From 2bcae6ec4471e90625e0da2d81ef7ad07a274c12 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 23 Oct 2025 13:05:20 +0200 Subject: [PATCH] port float MR --- apps/decoder.c | 2 +- apps/renderer.c | 30 +++---- lib_com/common_api_types.h | 13 ++- lib_com/ivas_cnst.h | 10 +-- lib_com/ivas_prot_fx.h | 6 +- lib_com/ivas_rom_com.h | 2 +- lib_com/ivas_rom_com_fx.c | 2 +- lib_com/ivas_stat_com.h | 6 +- lib_dec/ivas_dirac_output_synthesis_cov_fx.c | 28 +++--- lib_dec/ivas_jbm_dec_fx.c | 4 +- lib_dec/ivas_mc_param_dec_fx.c | 94 ++++++++++---------- lib_dec/ivas_mct_dec_fx.c | 6 +- lib_dec/ivas_out_setup_conversion_fx.c | 42 ++++----- lib_dec/lib_dec_fx.c | 2 +- lib_enc/ivas_mc_param_enc_fx.c | 76 ++++++++-------- lib_rend/ivas_rotation_fx.c | 14 +-- lib_rend/lib_rend.h | 14 +-- lib_rend/lib_rend_fx.c | 26 +++--- lib_util/ls_custom_file_reader.c | 22 ++--- 19 files changed, 200 insertions(+), 199 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index a8803b586..d0ad3f090 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -605,7 +605,7 @@ int main( fprintf( stderr, "\nError in reading Custom loudspeaker file %s: %s\n\n", arg.customLsSetupFilename, CustomLoudspeakerLayout_getError( lsCustomError ) ); goto cleanup; } - for ( int i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + for ( int16_t i = 0; i < IVAS_MAX_LS_CHANNELS; i++ ) { hLsCustomData.azimuth_fx[i] = (Word32) ( hLsCustomData.azimuth[i] * ( 1u << 22 ) ); hLsCustomData.elevation_fx[i] = (Word32) ( hLsCustomData.elevation[i] * ( 1u << 22 ) ); diff --git a/apps/renderer.c b/apps/renderer.c index 3613064ef..0bc511dc8 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -760,8 +760,8 @@ int main( RotFileReader *headRotReader = NULL; RotFileReader *externalOrientationFileReader = NULL; RotFileReader *referenceRotReader = NULL; - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS]; - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS]; + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[RENDERER_MAX_INPUT_CHANNELS]; + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[RENDERER_MAX_INPUT_CHANNELS]; int16_t cldfb_in_flag, CLDFBframeSize_smpls; SplitRendBFIFileReader *splitRendBFIReader = NULL; Vector3PairFileReader *referenceVectorReader = NULL; @@ -1242,8 +1242,8 @@ int main( /* Set up output custom layout configuration */ if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - floatToFixed_arrL_app( args.outConfig.outSetupCustom.azimuth, args.outConfig.outSetupCustom.azimuth_fx, Q22, IVAS_MAX_OUTPUT_CHANNELS ); - floatToFixed_arrL_app( args.outConfig.outSetupCustom.elevation, args.outConfig.outSetupCustom.elevation_fx, Q22, IVAS_MAX_OUTPUT_CHANNELS ); + floatToFixed_arrL_app( args.outConfig.outSetupCustom.azimuth, args.outConfig.outSetupCustom.azimuth_fx, Q22, RENDERER_MAX_OUTPUT_CHANNELS ); + floatToFixed_arrL_app( args.outConfig.outSetupCustom.elevation, args.outConfig.outSetupCustom.elevation_fx, Q22, RENDERER_MAX_OUTPUT_CHANNELS ); if ( ( error = IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( hIvasRend, args.outConfig.outSetupCustom ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_ConfigureCustomOutputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) ); @@ -1341,8 +1341,8 @@ int main( if ( args.inConfig.multiChannelBuses[i].audioConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { - floatToFixed_arrL_app( args.inConfig.inSetupCustom.azimuth, args.inConfig.inSetupCustom.azimuth_fx, Q22, IVAS_MAX_OUTPUT_CHANNELS ); - floatToFixed_arrL_app( args.inConfig.inSetupCustom.elevation, args.inConfig.inSetupCustom.elevation_fx, Q22, IVAS_MAX_OUTPUT_CHANNELS ); + floatToFixed_arrL_app( args.inConfig.inSetupCustom.azimuth, args.inConfig.inSetupCustom.azimuth_fx, Q22, RENDERER_MAX_OUTPUT_CHANNELS ); + floatToFixed_arrL_app( args.inConfig.inSetupCustom.elevation, args.inConfig.inSetupCustom.elevation_fx, Q22, RENDERER_MAX_OUTPUT_CHANNELS ); if ( ( error = IVAS_REND_ConfigureCustomInputLoudspeakerLayout( hIvasRend, mcIds[i], args.inConfig.inSetupCustom ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_ConfigureCustomInputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) ); @@ -1359,7 +1359,7 @@ int main( args.lfePanningEnabled = false; } - FOR( Word16 k = 0; k < IVAS_MAX_OUTPUT_CHANNELS; k++ ) + FOR( Word16 k = 0; k < RENDERER_MAX_OUTPUT_CHANNELS; k++ ) { ( *lfePanMatrix_fx )[k] = (Word32) ( ( *lfePanMatrix )[k] * ( 1u << 31 ) ); } @@ -1394,7 +1394,7 @@ int main( goto cleanup; } - FOR( Word16 k = 0; k < IVAS_MAX_OUTPUT_CHANNELS; k++ ) + FOR( Word16 k = 0; k < RENDERER_MAX_OUTPUT_CHANNELS; k++ ) { ( *lfePanMatrix_fx )[k] = (Word32) ( ( *lfePanMatrix )[k] * ( 1u << 31 ) ); } @@ -4058,7 +4058,7 @@ static ivas_error parseLfePanMtxFile( any subsequent issue in file reading will gracefully exit the function */ for ( lfe_in = 0; lfe_in < RENDERER_MAX_INPUT_LFE_CHANNELS; lfe_in++ ) { - for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + for ( i = 0; i < RENDERER_MAX_OUTPUT_CHANNELS; i++ ) { ( *lfePanMtx )[lfe_in][i] = 0.0f; } @@ -4086,7 +4086,7 @@ static ivas_error parseLfePanMtxFile( { continue; } - if ( ch_out > IVAS_MAX_OUTPUT_CHANNELS ) + if ( ch_out > RENDERER_MAX_OUTPUT_CHANNELS ) { break; } @@ -4128,13 +4128,13 @@ static void convertInputBuffer_fx( IF( cldfb_in_flag ) { Word16 slotIdx, numCldfbBands, numFloatPcmSamples; - Word32 fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; + Word32 fIn[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; numFloatPcmSamples = numFloatSamplesPerChannel >> 1; numCldfbBands = numFloatPcmSamples / IVAS_CLDFB_NO_COL_MAX; /* CLDFB Analysis*/ - assert( numIntSamplesPerChannel <= IVAS_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE ); + assert( numIntSamplesPerChannel <= RENDERER_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE ); FOR( smpl = 0; smpl < numFloatPcmSamples; ++smpl ) { FOR( chnl = 0; chnl < numChannels; ++chnl ) @@ -4212,9 +4212,9 @@ static void convertOutputBuffer_fx( IF( cldfb_in_flag ) { Word16 slotIdx, numCldfbBands, numPcmSamples, b, temp_out_q = 0; - Word32 fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; - Word32 re[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; - Word32 im[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; + Word32 fIn[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; + Word32 re[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; + Word32 im[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; numPcmSamples = numSamplesPerChannel >> 1; numCldfbBands = numPcmSamples / IVAS_CLDFB_NO_COL_MAX; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 76b3fb6d4..6259b5f8d 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -52,8 +52,7 @@ #define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) /* maximum bits per frame; corresponds to maximum bitrate of 512 kbps */ #define IVAS_MAX_NUM_OBJECTS 4 -#define IVAS_MAX_INPUT_CHANNELS 16 -#define IVAS_MAX_OUTPUT_CHANNELS 16 /* Note: there is an exception for OSBA and EXT otuput where it can be 20 (HOA3 + 4 ISM channels) */ +#define IVAS_MAX_LS_CHANNELS 16 #define IVAS_CLDFB_NO_COL_MAX 16 #define IVAS_CLDFB_NO_CHANNELS_MAX 60 @@ -206,12 +205,12 @@ typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; typedef struct _IVAS_LS_CUSTOM_LAYOUT { Word16 num_spk; - float azimuth[IVAS_MAX_OUTPUT_CHANNELS]; - float elevation[IVAS_MAX_OUTPUT_CHANNELS]; - Word32 azimuth_fx[IVAS_MAX_OUTPUT_CHANNELS]; // Q22 - Word32 elevation_fx[IVAS_MAX_OUTPUT_CHANNELS]; // Q22 + float azimuth[IVAS_MAX_LS_CHANNELS]; + float elevation[IVAS_MAX_LS_CHANNELS]; + Word32 azimuth_fx[IVAS_MAX_LS_CHANNELS]; // Q22 + Word32 elevation_fx[IVAS_MAX_LS_CHANNELS]; // Q22 Word16 num_lfe; - Word16 lfe_idx[IVAS_MAX_OUTPUT_CHANNELS]; + Word16 lfe_idx[IVAS_MAX_LS_CHANNELS]; } IVAS_CUSTOM_LS_DATA; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 66e8f6dfa..5185c5594 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -146,12 +146,12 @@ typedef enum * IVAS general constants *----------------------------------------------------------------------------------*/ -#define MAX_INPUT_CHANNELS 16 /* Maximum number of input channels (HOA 3rd order), == IVAS_MAX_INPUT_CHANNELS */ +#define MAX_INPUT_CHANNELS 16 /* Maximum number of input channels (HOA 3rd order or IVAS_MAX_LS_CHANNELS) without separate objects in combined formats */ #define MAX_TRANSPORT_CHANNELS 12 /* Maximum number of transport channels */ #define MAX_INTERN_CHANNELS 16 /* Maximum number of intern channels (HOA 3rd order) */ #define HEAD_ROTATION_HOA_ORDER 3 /* HOA 3rd order */ -#define MAX_CICP_CHANNELS 16 /* max channels for loudspeaker layouts (16 for custom layouts)*/ -#define MAX_OUTPUT_CHANNELS 16 /* Maximum number of output channels (HOA 3rd order) without separate objects in combined formats */ +#define MAX_LS_CHANNELS 16 /* max channels for loudspeaker layouts (16 for custom layouts), == IVAS_MAX_LS_CHANNELS */ +#define MAX_OUTPUT_CHANNELS 16 /* Maximum number of output channels (HOA 3rd order or IVAS_MAX_LS_CHANNELS) without separate objects in combined formats */ #define MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN 2 /* Maximum number of output channels with non diegetic panning */ #define BINAURAL_CHANNELS 2 /* number of channels for binaural output configuration */ @@ -1563,7 +1563,7 @@ typedef enum * TD Binaural Object renderer *----------------------------------------------------------------------------------*/ -#define MAX_NUM_TDREND_CHANNELS MAX_CICP_CHANNELS /* max. number of channels in TD renderer (objects or loudspeaker channels) */ +#define MAX_NUM_TDREND_CHANNELS MAX_LS_CHANNELS /* max. number of channels in TD renderer (objects or loudspeaker channels) */ #define SFX_SPAT_BIN_MAX_NO_OF_OUTPUT_SAMPLES 288 /* 288 = 6 msec @ 48 kHz. */ #define HRTF_MODEL_N_SECTIONS 3 /* No. sections used in approximate evaluation of model */ @@ -1672,7 +1672,7 @@ typedef enum #define IVAS_MAX_FB_MIXER_OUT_CH IVAS_SPAR_MAX_CH #define IVAS_MAX_SPAR_FB_MIXER_IN_CH IVAS_SPAR_MAX_CH -#define IVAS_MAX_FB_MIXER_IN_CH MAX_CICP_CHANNELS +#define IVAS_MAX_FB_MIXER_IN_CH MAX_LS_CHANNELS #define MAX_NUM_BANDS_DIFF_NON48K 3 diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index b24d34ce8..109ca1372 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1282,9 +1282,9 @@ void ivas_ls_setup_conversion_process_mdct_fx( void ivas_lssetupconversion_process_param_mc_fx( Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ const Word16 num_timeslots, - Word32 Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ - Word32 Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ - Word16 channel_active[MAX_CICP_CHANNELS] /* i : bitmap indicating which output channels are active */ + Word32 Cldfb_RealBuffer_InOut[MAX_LS_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ + Word32 Cldfb_ImagBuffer_InOut[MAX_LS_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ + Word16 channel_active[MAX_LS_CHANNELS] /* i : bitmap indicating which output channels are active */ ); void convert_coeffs_to_higher_res_fx( diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 5072e385f..44bc336d8 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -213,7 +213,7 @@ extern const Word16 param_mc_start_bin_per_band_14[14]; extern const Word16 param_mc_active_bins_per_band_14[14]; extern const Word16 param_mc_start_bin_per_band_10[10]; extern const Word16 param_mc_active_bins_per_band_10[10]; -extern const Word16 Param_MC_index[MAX_CICP_CHANNELS]; +extern const Word16 Param_MC_index[MAX_LS_CHANNELS]; extern const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS]; extern const UWord16 ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; extern const UWord16 ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index 4b14f6d5a..bd0dba245 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -1683,7 +1683,7 @@ const Word16 param_mc_coding_band_mapping_10[10] = 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; -const Word16 Param_MC_index[MAX_CICP_CHANNELS] = +const Word16 Param_MC_index[MAX_LS_CHANNELS] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 4678acd31..65a081c9c 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -561,9 +561,9 @@ typedef struct ivas_param_mc_ild_mapping_struct { Word16 ild_map_size_wo_lfe; Word16 ild_map_size_lfe; - Word16 ild_index[MAX_CICP_CHANNELS]; - Word16 num_ref_channels[MAX_CICP_CHANNELS]; - Word16 ref_channel_idx[MAX_CICP_CHANNELS][PARAM_MC_MAX_ILD_REF_CHANNELS]; + Word16 ild_index[MAX_LS_CHANNELS]; + Word16 num_ref_channels[MAX_LS_CHANNELS]; + Word16 ref_channel_idx[MAX_LS_CHANNELS][PARAM_MC_MAX_ILD_REF_CHANNELS]; } PARAM_MC_ILD_MAPPING, *HANDLE_PARAM_MC_ILD_MAPPING; diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c index 0ecd015ee..c53f66138 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c @@ -514,26 +514,26 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( Word16 have_residual; Word16 brange[2]; DIRAC_OUTPUT_SYNTHESIS_COV_STATE h_synthesis_state; - Word32 mixing_matrix_smooth_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; + Word32 mixing_matrix_smooth_fx[MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 mixing_matrix_smooth_e; - Word32 mixing_matrix_res_smooth_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; + Word32 mixing_matrix_res_smooth_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; Word16 mixing_matrix_res_smooth_e = 0; move16(); - Word32 mixing_matrix_buffer_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; + Word32 mixing_matrix_buffer_fx[MAX_LS_CHANNELS * MAX_LS_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 diff_f_real_fx[MAX_CICP_CHANNELS]; - Word32 diff_f_imag_fx[MAX_CICP_CHANNELS]; + Word32 diff_f_real_fx[MAX_LS_CHANNELS]; + Word32 diff_f_imag_fx[MAX_LS_CHANNELS]; h_synthesis_state = hParamMC->h_output_synthesis_cov_state; 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( diff_f_real_fx, MAX_CICP_CHANNELS ); - set_zero_fx( diff_f_imag_fx, MAX_CICP_CHANNELS ); + set_zero_fx( diff_f_real_fx, MAX_LS_CHANNELS ); + set_zero_fx( diff_f_imag_fx, MAX_LS_CHANNELS ); FOR( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) { @@ -708,7 +708,7 @@ Word16 computeMixingMatrices_fx( 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 Cy_fx[MAX_LS_CHANNELS * MAX_LS_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 Cx_fx_e; @@ -732,7 +732,7 @@ Word16 computeMixingMatrices_fx( Word32 Kx_reg_inv_fx[MAX_TRANSPORT_CHANNELS * MAX_TRANSPORT_CHANNELS]; Word16 Kx_reg_inv_e[MAX_TRANSPORT_CHANNELS * MAX_TRANSPORT_CHANNELS]; - Word32 Q_fx[PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS]; + Word32 Q_fx[PARAM_MC_MAX_TRANSPORT_CHANS * MAX_LS_CHANNELS]; Word16 Q_e; Word32 Q_Cx_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; @@ -1023,7 +1023,7 @@ Word16 computeMixingMatrices_fx( matrix_product_mant_exp_fx( Ky_fx, Ky_fx_e[0], lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, &mat_mult_buffer1_fx_e ); - Word16 mixing_matrix_fx_e[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; + Word16 mixing_matrix_fx_e[MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 mat_mult_buffer1_fx_e1[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; set16_fx( mat_mult_buffer1_fx_e1, mat_mult_buffer1_fx_e, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); @@ -1064,7 +1064,7 @@ Word16 computeMixingMatrices_fx( Cr_p_fx = Cr_fx; Cy_p_fx = Cy_fx; Cy_tilde_p_fx = mat_mult_buffer2_fx; - Word16 Cr_e_arr[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; + Word16 Cr_e_arr[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; FOR( i = 0; i < lengthCy; ++i ) { FOR( j = 0; j < lengthCy; ++j ) @@ -1517,7 +1517,7 @@ Word16 computeMixingMatricesResidual_fx( matrix_product_mant_exp_fx( Ky_fx, Ky_fx_e[0], lengthCy, lengthCy, 0, mat_mult_buffer3_fx, mat_mult_buffer3_e, lengthCy, lengthCx, 0, mat_mult_buffer1_fx, mat_mult_buffer1_buff_e ); set16_fx( mat_mult_buffer1_buff_e, mat_mult_buffer1_buff_e[0], MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); - Word16 mixing_matrix_fx_e[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; + Word16 mixing_matrix_fx_e[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; FOR( i = 0; i < num_outputs; i++ ) { @@ -1540,8 +1540,8 @@ Word16 computeMixingMatricesResidual_fx( /* Compute Cy_tilde = M*Cx*M' */ - Word16 Cx_e_arr[MAX_CICP_CHANNELS]; - set16_fx( Cx_e_arr, Cx_e, MAX_CICP_CHANNELS ); + Word16 Cx_e_arr[MAX_LS_CHANNELS]; + set16_fx( Cx_e_arr, Cx_e, MAX_LS_CHANNELS ); matrix_diag_product_fx_1( mixing_matrix_fx, mixing_matrix_fx_e, lengthCy, lengthCx, 0, Cx_fx, Cx_e_arr, lengthCx, mat_mult_buffer1_fx, mat_mult_buffer1_buff_e ); diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 9ce180ec5..3e171a8de 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2374,7 +2374,7 @@ ivas_error ivas_jbm_dec_render_fx( Word16 nchan_out_cldfb = 0; move16(); - set16_fx( channel_active_fx, 0, MAX_CICP_CHANNELS ); + set16_fx( channel_active_fx, 0, MAX_LS_CHANNELS ); Word16 nchan_transport_tmp = st_ivas->nchan_transport; move16(); output_Fs = st_ivas->hDecoderConfig->output_Fs; @@ -2630,7 +2630,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( Word16 n_slots_still_available; Word16 n_samples_to_render; DECODER_TC_BUFFER_HANDLE hTcBuffer; - Word32 *p_output_fx[MAX_CICP_CHANNELS + MAX_NUM_OBJECTS]; + Word32 *p_output_fx[MAX_LS_CHANNELS + MAX_NUM_OBJECTS]; Word16 nchan_in, nchan_out; IF( !st_ivas->hDecoderConfig->Opt_tsm ) diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index d95ffe998..2a5b0020e 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -72,7 +72,7 @@ typedef struct parameter_band_mapping_struct static void ivas_param_mc_dec_init_fx( PARAM_MC_DEC_HANDLE hParamMC, const Word16 nchan_in, const Word16 nchan_out ); -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 ); +static void ivas_param_mc_dec_copy_diffuse_proto( PARAM_MC_DEC_HANDLE hParamMC, Word32 Cldfb_buffer_real_fx[MAX_LS_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 Cldfb_buffer_imag_fx[MAX_LS_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 nY, const Word16 slot_idx ); static Word16 ivas_param_mc_range_decoder_LC_fx( 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 ); @@ -110,7 +110,7 @@ ivas_error ivas_param_mc_dec_open_fx( PARAM_MC_DEC_HANDLE hParamMC; Word16 nchan_out_transport; Word16 nchan_out_cov; - Word32 proto_matrix_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; + Word32 proto_matrix_fx[MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word32 proto_mtx_norm_fx, tmp32; Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; Word16 max_param_band_residual; @@ -638,7 +638,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( PARAM_MC_DEC_HANDLE hParamMC; Word16 nchan_out_transport; Word16 nchan_out_cov; - Word32 proto_matrix_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; + Word32 proto_matrix_fx[MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word32 proto_mtx_norm_fx; Word16 max_param_band_residual; UWord16 config_index; @@ -1020,9 +1020,9 @@ ivas_error ivas_param_mc_dec_reconfig_fx( DIRAC_OUTPUT_SYNTHESIS_COV_STATE cov_state_old = hParamMC->h_output_synthesis_cov_state; DIRAC_OUTPUT_SYNTHESIS_PARAMS params_old = hParamMC->h_output_synthesis_params; - Word32 tmp_buf_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; + Word32 tmp_buf_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; - set_zero_fx( tmp_buf_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); + set_zero_fx( tmp_buf_fx, MAX_LS_CHANNELS * MAX_LS_CHANNELS ); /* output synthesis */ IF( NE_32( ( 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, @@ -1639,7 +1639,7 @@ void ivas_param_mc_dec_prepare_renderer( hParamMC = st_ivas->hParamMC; assert( hParamMC ); - set16_fx( channel_active, 0, MAX_CICP_CHANNELS ); + set16_fx( channel_active, 0, MAX_LS_CHANNELS ); nchan_transport = st_ivas->nchan_transport; move16(); @@ -1933,7 +1933,7 @@ void ivas_param_mc_dec_render_fx( p_output_fx[i] = output_fx[i]; // Q11 } /*Decorrelator*/ - Word32 onset_filter_fx[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; // Q31 + Word32 onset_filter_fx[MAX_LS_CHANNELS * CLDFB_NO_CHANNELS_MAX]; // Q31 /* format converter */ Word16 channel_active[MAX_OUTPUT_CHANNELS]; UWord16 nband_synth; @@ -1946,7 +1946,7 @@ void ivas_param_mc_dec_render_fx( push_wmops( "param_mc_dec_render" ); - set16_fx( channel_active, 0, MAX_CICP_CHANNELS ); + set16_fx( channel_active, 0, MAX_LS_CHANNELS ); nchan_transport = st_ivas->nchan_transport; move16(); nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); @@ -2472,11 +2472,11 @@ static void param_mc_protoSignalComputation_fx( *------------------------------------------------------------------------*/ static void ivas_param_mc_dec_copy_diffuse_proto( - PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ - Word32 Cldfb_buffer_real_fx[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : CLDFB buffer used in the final synthesis (real part) */ - Word32 Cldfb_buffer_imag_fx[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : CLDFB buffer used in the final synthesis (imaginary part) */ - const Word16 nY, /* i : number of decorrelated channels */ - const Word16 slot_idx /* i : current time slot index */ + PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ + Word32 Cldfb_buffer_real_fx[MAX_LS_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : CLDFB buffer used in the final synthesis (real part) */ + Word32 Cldfb_buffer_imag_fx[MAX_LS_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : CLDFB buffer used in the final synthesis (imaginary part) */ + const Word16 nY, /* i : number of decorrelated channels */ + const Word16 slot_idx /* i : current time slot index */ ) { Word16 k, l; @@ -2741,32 +2741,32 @@ static void ivas_param_mc_get_mixing_matrices_fx( Word16 remove_lfe; Word16 lfe_indices[PARAM_MC_LOCAL_SZ_LFE_MAP]; Word32 Cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word32 Cy_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word32 Cy_full_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word32 Cr_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; // Q(31 - Cr_e) + Word32 Cy_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; + Word32 Cy_full_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; + Word32 Cr_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; // Q(31 - Cr_e) Word16 Cr_e; Word32 Cy_diag_fx[MAX_OUTPUT_CHANNELS]; // Q(31 - Cy_diag_buff_e) Word16 Cy_diag_buff_e[MAX_OUTPUT_CHANNELS]; - Word32 mixing_matrix_local_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - mixing_matrix_local_e) + Word32 mixing_matrix_local_fx[MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - mixing_matrix_local_e) Word16 Cy_diag_e = 0, mixing_matrix_local_e = 0; - Word32 Cproto_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; // Q(31 - Cproto_e) + Word32 Cproto_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; // Q(31 - Cproto_e) Word16 Cproto_e; Word32 *proto_matrix_ptr_fx; // Q(31 - proto_matrix_ptr_e) Word32 *Cx_state_fx; // Q(31 - Cx_state_e) Word32 *Cx_old_state_fx; - Word32 Cy_state_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; // Q(31 - Cy_state_e) + Word32 Cy_state_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; // Q(31 - Cy_state_e) Word32 *Cy_old_state_fx; Word16 Cx_state_e; Word16 Cy_state_e; - Word32 mixing_matrix_res_local_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; // Q(31 - mixing_matrix_res_local_e) + Word32 mixing_matrix_res_local_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; // Q(31 - mixing_matrix_res_local_e) Word16 mixing_matrix_res_local_e; Word32 L_tmp; Word16 tmp_e, tmp; Word16 proto_matrix_e = hParamMC->h_output_synthesis_params.proto_matrix_e; move16(); - Word32 proto_matrix_noLFE_fx[PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS]; // Q(31 - proto_matrix_noLFE_e) - Word32 mat_mult_buffer1_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; // Q(31 - mat_mult_buffer1_e) - Word32 Cproto_diag_fx[MAX_CICP_CHANNELS]; // Q(31 - Cproto_diag_e) + Word32 proto_matrix_noLFE_fx[PARAM_MC_MAX_TRANSPORT_CHANS * MAX_LS_CHANNELS]; // Q(31 - proto_matrix_noLFE_e) + Word32 mat_mult_buffer1_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; // Q(31 - mat_mult_buffer1_e) + Word32 Cproto_diag_fx[MAX_LS_CHANNELS]; // Q(31 - Cproto_diag_e) Word16 mat_mult_buffer1_e, proto_matrix_ptr_e, Cproto_diag_e; Word32 *ptrMM_fx; Word32 *ptrMM_out_fx; @@ -2775,11 +2775,11 @@ static void ivas_param_mc_get_mixing_matrices_fx( Word16 new_e = 0; move16(); - set_zero_fx( Cproto_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); - set_zero_fx( mat_mult_buffer1_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); - set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS ); - set_zero_fx( mixing_matrix_local_fx, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); - set_zero_fx( mixing_matrix_res_local_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); + set_zero_fx( Cproto_fx, MAX_LS_CHANNELS * MAX_LS_CHANNELS ); + set_zero_fx( mat_mult_buffer1_fx, MAX_LS_CHANNELS * MAX_LS_CHANNELS ); + set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_LS_CHANNELS ); + set_zero_fx( mixing_matrix_local_fx, MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); + set_zero_fx( mixing_matrix_res_local_fx, MAX_LS_CHANNELS * MAX_LS_CHANNELS ); Word16 proto_matrix_noLFE_e = 0; move16(); @@ -2810,7 +2810,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( proto_matrix_noLFE_e = proto_matrix_e; move16(); - set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS ); + set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_LS_CHANNELS ); FOR( ch_idx1 = 0; ch_idx1 < nX; ch_idx1++ ) { @@ -2988,16 +2988,16 @@ static void ivas_param_mc_get_mixing_matrices_fx( IF( NE_16( mixing_matrix_res_local_e, mixing_matrix_local_e ) ) { - tmp = getScaleFactor32( mixing_matrix_local_fx, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); - scale_sig32( mixing_matrix_local_fx, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS, tmp ); + tmp = getScaleFactor32( mixing_matrix_local_fx, MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); + scale_sig32( mixing_matrix_local_fx, MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS, tmp ); mixing_matrix_local_e = sub( mixing_matrix_local_e, tmp ); - tmp = getScaleFactor32( mixing_matrix_res_local_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); - scale_sig32( mixing_matrix_res_local_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS, tmp ); + tmp = getScaleFactor32( mixing_matrix_res_local_fx, MAX_LS_CHANNELS * MAX_LS_CHANNELS ); + scale_sig32( mixing_matrix_res_local_fx, MAX_LS_CHANNELS * MAX_LS_CHANNELS, tmp ); mixing_matrix_res_local_e = sub( mixing_matrix_res_local_e, tmp ); - scale_sig32( mixing_matrix_local_fx, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS, sub( mixing_matrix_local_e, s_max( mixing_matrix_local_e, mixing_matrix_res_local_e ) ) ); - scale_sig32( mixing_matrix_res_local_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS, sub( mixing_matrix_res_local_e, s_max( mixing_matrix_local_e, mixing_matrix_res_local_e ) ) ); + scale_sig32( mixing_matrix_local_fx, MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS, sub( mixing_matrix_local_e, s_max( mixing_matrix_local_e, mixing_matrix_res_local_e ) ) ); + scale_sig32( mixing_matrix_res_local_fx, MAX_LS_CHANNELS * MAX_LS_CHANNELS, sub( mixing_matrix_res_local_e, s_max( mixing_matrix_local_e, mixing_matrix_res_local_e ) ) ); mixing_matrix_res_local_e = mixing_matrix_local_e = s_max( mixing_matrix_local_e, mixing_matrix_res_local_e ); move16(); @@ -3359,16 +3359,16 @@ static void ivas_param_mc_dequantize_cov_fx( IF( EQ_32( synth_conf, PARAM_MC_SYNTH_LS_CONV_COV ) ) { /* Cy = dmx*Cy*dmx' */ - Word32 mat_mult_buffer1_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; // Q(31 - mat_mult_buffer1_e) - Word16 mat_mult_buffer1_e[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word32 target_ch_ener_fx[MAX_CICP_CHANNELS]; // Q(31 - target_ch_ener_e) - Word16 target_ch_ener_e[MAX_CICP_CHANNELS]; - Word32 dmx_ch_ener_fx[MAX_CICP_CHANNELS]; - Word16 ls_conv_dmx_matrix_e[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - - 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 ); + Word32 mat_mult_buffer1_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; // Q(31 - mat_mult_buffer1_e) + Word16 mat_mult_buffer1_e[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; + Word32 target_ch_ener_fx[MAX_LS_CHANNELS]; // Q(31 - target_ch_ener_e) + Word16 target_ch_ener_e[MAX_LS_CHANNELS]; + Word32 dmx_ch_ener_fx[MAX_LS_CHANNELS]; + Word16 ls_conv_dmx_matrix_e[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; + + set32_fx( target_ch_ener_fx, 0, MAX_LS_CHANNELS ); + set16_fx( target_ch_ener_e, 0, MAX_LS_CHANNELS ); + set32_fx( dmx_ch_ener_fx, 0, MAX_LS_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, @@ -3538,7 +3538,7 @@ static ivas_error param_mc_get_diff_proto_info_fx( PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info, /* o : generated diffuse prototype info */ Word16 Q_proto_mtx ) { - Word32 proto_fac_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; + Word32 proto_fac_fx[MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; UWord16 cur_out_ch; UWord16 cur_diff_proto; UWord16 cur_transport_ch; @@ -3548,7 +3548,7 @@ static ivas_error param_mc_get_diff_proto_info_fx( max_num_src_chan = 0; move16(); - set_zero_fx( proto_fac_fx, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); + set_zero_fx( proto_fac_fx, MAX_LS_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); IF( ( p_diff_proto_info->proto_index_diff = (Word16 *) malloc( nchan_out_cov * sizeof( Word16 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index aaffbee9a..027299b99 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -244,12 +244,12 @@ ivas_error ivas_mct_dec_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]; - FOR( i = 0; i < MAX_CICP_CHANNELS; i++ ) + Word16 x_all_e[MAX_LS_CHANNELS][NB_DIV]; + FOR( i = 0; i < MAX_LS_CHANNELS; i++ ) { set16_fx( x_all_e[i], 0, NB_DIV ); } - Word32 *x_all_fx[MAX_CICP_CHANNELS][NB_DIV]; //(Q(31 - x_all_e) + Word32 *x_all_fx[MAX_LS_CHANNELS][NB_DIV]; //(Q(31 - x_all_e) FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { FOR( n = 0; n < CPE_CHANNELS; n++ ) diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c index a3801bc06..339d6eb4b 100644 --- a/lib_dec/ivas_out_setup_conversion_fx.c +++ b/lib_dec/ivas_out_setup_conversion_fx.c @@ -431,7 +431,7 @@ ivas_error ivas_ls_setup_conversion_open_fx( hLsSetUpConversion->dmx_prev_exp[chIdx] = 0; move16(); } - FOR( ; chIdx < MAX_CICP_CHANNELS; chIdx++ ) + FOR( ; chIdx < MAX_LS_CHANNELS; chIdx++ ) { hLsSetUpConversion->targetEnergyPrev_fx[chIdx] = NULL; hLsSetUpConversion->dmxEnergyPrev_fx[chIdx] = NULL; @@ -468,7 +468,7 @@ 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" ) ); } - FOR( chIdx = 1; chIdx < MAX_CICP_CHANNELS; chIdx++ ) + FOR( chIdx = 1; chIdx < MAX_LS_CHANNELS; chIdx++ ) { hLsSetUpConversion->targetEnergyPrev_fx[chIdx] = NULL; hLsSetUpConversion->dmxEnergyPrev_fx[chIdx] = NULL; @@ -493,7 +493,7 @@ ivas_error ivas_ls_setup_conversion_open_fx( set32_fx( hLsSetUpConversion->dmxMtx_fx[chIdx], 0, outChannels ); } - FOR( ; chIdx < MAX_CICP_CHANNELS; chIdx++ ) + FOR( ; chIdx < MAX_LS_CHANNELS; chIdx++ ) { hLsSetUpConversion->dmxMtx_fx[chIdx] = NULL; } @@ -552,7 +552,7 @@ void ivas_ls_setup_conversion_close_fx( return; } - FOR( idx = 0; idx < MAX_CICP_CHANNELS; idx++ ) + FOR( idx = 0; idx < MAX_LS_CHANNELS; idx++ ) { IF( ( *hLsSetUpConversion )->dmxMtx_fx[idx] != NULL ) { @@ -660,18 +660,18 @@ void ivas_ls_setup_conversion_process_mdct_fx( /* Declaration of all required variables */ Word16 i, bandIdx, chInIdx, chOutIdx, cpe_idx, subFrameIdx, binIdx, idx, j; Word16 inChannels, outChannels, num_CPE; - Word16 transform_type[MAX_CICP_CHANNELS][2]; + Word16 transform_type[MAX_LS_CHANNELS][2]; Word16 frameSize; Word64 targetEnergy64[MAX_SFB + 2], dmxEnergy64[MAX_SFB + 2]; Word16 scf1, scf2; Word32 dmxCoeff; Word32 dmxSignalReal[L_FRAME48k], dmxSignalImag[L_FRAME48k]; Word32 eqGain; - Word32 *sig[NB_DIV], *pTmp[NB_DIV], *x[MAX_CICP_CHANNELS][NB_DIV]; + Word32 *sig[NB_DIV], *pTmp[NB_DIV], *x[MAX_LS_CHANNELS][NB_DIV]; Word32 mdst[L_FRAME48k]; Word32 convertRes[L_FRAME48k]; Word16 start, stop, start_tcx5, stop_tcx5; - Word16 mct_chan_mode[MAX_CICP_CHANNELS]; + Word16 mct_chan_mode[MAX_LS_CHANNELS]; /* Declare all handles */ LSSETUP_CONVERSION_HANDLE hLsSetUpConversion; @@ -1014,12 +1014,12 @@ void ivas_ls_setup_conversion_process_mdct_param_mc_fx( { Word32 targetEnergy_fx[MAX_SFB + 2], dmxEnergy_fx[MAX_SFB + 2]; Word32 eqGain_fx; - Word32 *sig_fx[MAX_CICP_CHANNELS][NB_DIV], *pTmp_fx[NB_DIV]; - Word32 mdst_fx[MAX_CICP_CHANNELS][L_FRAME48k]; - Word32 convertRes_fx[MAX_CICP_CHANNELS][L_FRAME48k]; + Word32 *sig_fx[MAX_LS_CHANNELS][NB_DIV], *pTmp_fx[NB_DIV]; + Word32 mdst_fx[MAX_LS_CHANNELS][L_FRAME48k]; + Word32 convertRes_fx[MAX_LS_CHANNELS][L_FRAME48k]; Word32 cx_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word32 cx_imag_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word32 cy_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; + Word32 cy_fx[MAX_LS_CHANNELS * MAX_LS_CHANNELS]; Word32 real_in_buffer_fx[PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND * PARAM_MC_BAND_TO_MDCT_BAND_RATIO * MAX_TRANSPORT_CHANNELS]; Word32 imag_in_buffer_fx[PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND * PARAM_MC_BAND_TO_MDCT_BAND_RATIO * MAX_TRANSPORT_CHANNELS]; Word32 real_buffer_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -1043,11 +1043,11 @@ void ivas_ls_setup_conversion_process_mdct_param_mc_fx( Word16 band, bandIdx, num_bands; Word16 num_CPE; - Word16 transform_type[MAX_CICP_CHANNELS][2]; + Word16 transform_type[MAX_LS_CHANNELS][2]; Word16 frameSize; Word16 start, stop, start_tcx5, stop_tcx5; - Word16 mct_chan_mode[MAX_CICP_CHANNELS]; + Word16 mct_chan_mode[MAX_LS_CHANNELS]; Word16 all_ch_ignored; // Flag for checking if all channels are ignored /* Declare all handles */ @@ -1227,7 +1227,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc_fx( { DMXEne_fx = 0; move16(); - set_zero_fx( cy_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); + set_zero_fx( cy_fx, MAX_LS_CHANNELS * MAX_LS_CHANNELS ); set_zero_fx( Nrqq_fx, MAX_OUTPUT_CHANNELS ); set_zero_fx( target_ch_ener_fx, MAX_OUTPUT_CHANNELS ); /* Step 1.2, get target channel energies for the transported format, Nrqq calculation */ @@ -1418,19 +1418,19 @@ void ivas_ls_setup_conversion_process_mdct_param_mc_fx( void ivas_lssetupconversion_process_param_mc_fx( Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ const Word16 num_timeslots, - Word32 Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals Q6*/ - Word32 Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals Q6*/ - Word16 channel_active[MAX_CICP_CHANNELS] /* i : bitmap indicating which output channels are active */ + Word32 Cldfb_RealBuffer_InOut[MAX_LS_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals Q6*/ + Word32 Cldfb_ImagBuffer_InOut[MAX_LS_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals Q6*/ + Word16 channel_active[MAX_LS_CHANNELS] /* i : bitmap indicating which output channels are active */ ) { Word16 slotIdx, chOutIdx, chInIdx, bandIdx; Word16 inChannels, outChannels; - Word32 targetEnergy[MAX_CICP_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - Word32 dmxEnergy[MAX_CICP_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 targetEnergy[MAX_LS_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 dmxEnergy[MAX_LS_CHANNELS][CLDFB_NO_CHANNELS_MAX]; Word32 tmpDMXSig, dmxCoeff, tmpReal, tmpImag; Word32 EQ; - Word32 Cldfb_RealBuffer_tmp[MAX_CICP_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - Word32 Cldfb_ImagBuffer_tmp[MAX_CICP_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_RealBuffer_tmp[MAX_LS_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_tmp[MAX_LS_CHANNELS][CLDFB_NO_CHANNELS_MAX]; LSSETUP_CONVERSION_HANDLE hLsSetUpConversion; Word16 i, k; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index b32a49e17..7ee9289a6 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -2142,7 +2142,7 @@ static Word16 getOutputBufferSize( IF( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { - return extract_l( Mult_32_16( imult3216( st_ivas->hDecoderConfig->output_Fs, ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) ), INV_FRAME_PER_SEC_Q15 ) ); + return extract_l( Mult_32_16( imult3216( st_ivas->hDecoderConfig->output_Fs, ( RENDERER_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) ), INV_FRAME_PER_SEC_Q15 ) ); } ELSE IF( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index cfd930dc7..67353a279 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -74,17 +74,17 @@ static void ivas_param_mc_range_encoder_fx( const Word16 *seq_in, const Word16 n #define ATTACKTHRESHOLD_E 4 -static void ivas_param_mc_quantize_ilds_fx( PARAM_MC_ENC_HANDLE hParamMC, Word32 Cy_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], Word16 Cy_e[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], Word32 Cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], Word16 Cx_e[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], const Word16 freq_idx, const Word16 nchan_input, const Word16 nchan_transport, Word16 *ILD_idx_out, Word16 ILD_q[PARAM_MC_SZ_ILD_MAP] ); +static void ivas_param_mc_quantize_ilds_fx( PARAM_MC_ENC_HANDLE hParamMC, Word32 Cy_fx[MAX_LS_CHANNELS][MAX_LS_CHANNELS], Word16 Cy_e[MAX_LS_CHANNELS][MAX_LS_CHANNELS], Word32 Cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], Word16 Cx_e[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], const Word16 freq_idx, const Word16 nchan_input, const Word16 nchan_transport, Word16 *ILD_idx_out, Word16 ILD_q[PARAM_MC_SZ_ILD_MAP] ); static void ivas_param_mc_parameter_quantizer_fx( const Word32 *x, const Word16 *x_e, const Word16 L, const Word16 sz_quantizer, const Word16 *quantizer_fx, const Word16 Q_quant, Word16 *quant_idx, Word16 *y ); -static void ivas_param_mc_quantize_iccs_fx( PARAM_MC_ENC_HANDLE hParamMC, Word32 Cy_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], Word16 Cy_e[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], const Word16 freq_idx, const Word16 nchan_input, Word16 *ICC_idx_out ); +static void ivas_param_mc_quantize_iccs_fx( PARAM_MC_ENC_HANDLE hParamMC, Word32 Cy_fx[MAX_LS_CHANNELS][MAX_LS_CHANNELS], Word16 Cy_e[MAX_LS_CHANNELS][MAX_LS_CHANNELS], const Word16 freq_idx, const Word16 nchan_input, Word16 *ICC_idx_out ); static void ivas_param_mc_dmx_fx( PARAM_MC_ENC_HANDLE hParamMC, Word32 *data_f_fx[], Word32 data_dmx_fx[][L_FRAME48k], const Word16 input_frame, const Word16 nchan_input, const Word16 nchan_transport ); static void ivas_param_mc_transient_detection_fx( PARAM_MC_ENC_HANDLE hParamMC, TRAN_DET_HANDLE hTranDet, Word16 *bAttackPresent, Word16 *attackIdx ); -static void ivas_param_mc_param_est_enc_fx( PARAM_MC_ENC_HANDLE hParamMC, Word32 *data_f[], Word32 Cy_sum_fx[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], Word16 Cy_sum_e[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], Word32 Cx_sum_fx[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], Word16 Cx_sum_e[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], const Word16 input_frame, const Word16 nchan_input, const Word16 nchan_transport ); +static void ivas_param_mc_param_est_enc_fx( PARAM_MC_ENC_HANDLE hParamMC, Word32 *data_f[], Word32 Cy_sum_fx[][MAX_LS_CHANNELS][MAX_LS_CHANNELS], Word16 Cy_sum_e[][MAX_LS_CHANNELS][MAX_LS_CHANNELS], Word32 Cx_sum_fx[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], Word16 Cx_sum_e[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], const Word16 input_frame, const Word16 nchan_input, const Word16 nchan_transport ); /*------------------------------------------------------------------------- @@ -415,8 +415,8 @@ void ivas_param_mc_enc_fx( Word16 data_f_fx16[L_FRAME48k]; Word32 data_dmx_fx[PARAM_MC_MAX_TRANSPORT_CHANS][L_FRAME48k]; Word16 data_dmx_fx16[PARAM_MC_MAX_TRANSPORT_CHANS][L_FRAME48k]; - Word32 Cy_sum_fx[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; - Word16 Cy_sum_e[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; + Word32 Cy_sum_fx[PARAM_MC_MAX_PARAMETER_BANDS][MAX_LS_CHANNELS][MAX_LS_CHANNELS]; + Word16 Cy_sum_e[PARAM_MC_MAX_PARAMETER_BANDS][MAX_LS_CHANNELS][MAX_LS_CHANNELS]; Word32 Cx_sum_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 Cx_sum_e[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 ILD_q_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_SZ_ILD_MAP]; @@ -438,10 +438,10 @@ void ivas_param_mc_enc_fx( FOR( band = 0; band < PARAM_MC_MAX_PARAMETER_BANDS; band++ ) { - FOR( ch = 0; ch < MAX_CICP_CHANNELS; ch++ ) + FOR( ch = 0; ch < MAX_LS_CHANNELS; ch++ ) { - set32_fx( Cy_sum_fx[band][ch], 0, MAX_CICP_CHANNELS ); - set16_fx( Cy_sum_e[band][ch], 0, MAX_CICP_CHANNELS ); + set32_fx( Cy_sum_fx[band][ch], 0, MAX_LS_CHANNELS ); + set16_fx( Cy_sum_e[band][ch], 0, MAX_LS_CHANNELS ); } FOR( ch = 0; ch < PARAM_MC_MAX_TRANSPORT_CHANS; ch++ ) { @@ -638,8 +638,8 @@ static void ivas_param_mc_dmx_fx( static void ivas_param_mc_param_est_enc_fx( PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ Word32 *data_f_fx[], /* i : Input frame in the time domain Q11 */ - Word32 Cy_sum_fx[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], /* o : Covariance matrix for the original frame Cy_sum_e*/ - Word16 Cy_sum_e[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], /* o : Covariance matrix for the original frame */ + Word32 Cy_sum_fx[][MAX_LS_CHANNELS][MAX_LS_CHANNELS], /* o : Covariance matrix for the original frame Cy_sum_e*/ + Word16 Cy_sum_e[][MAX_LS_CHANNELS][MAX_LS_CHANNELS], /* o : Covariance matrix for the original frame */ Word32 Cx_sum_fx[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], /* o : Covariance matrix for the downmixed frame Cx_sum_e*/ Word16 Cx_sum_e[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], /* o : Covariance matrix for the downmixed frame */ const Word16 input_frame, /* i : Input frame length */ @@ -658,18 +658,18 @@ static void ivas_param_mc_param_est_enc_fx( Word16 idx_ls; Word16 start_ts; - Word32 *pcm_in_fx[MAX_CICP_CHANNELS]; - Word32 slot_frame_f_real_fx[MAX_CICP_CHANNELS][DIRAC_NO_FB_BANDS_MAX]; /* Output of the MDFT FB - real part */ - Word32 slot_frame_f_imag_fx[MAX_CICP_CHANNELS][DIRAC_NO_FB_BANDS_MAX]; /* Output of the MDFT FB - imag part */ - Word32 *p_slot_frame_f_real_fx[MAX_CICP_CHANNELS]; /* Output of the MDFT FB - real part */ - Word32 *p_slot_frame_f_imag_fx[MAX_CICP_CHANNELS]; /* Output of the MDFT FB - imag part */ + Word32 *pcm_in_fx[MAX_LS_CHANNELS]; + Word32 slot_frame_f_real_fx[MAX_LS_CHANNELS][DIRAC_NO_FB_BANDS_MAX]; /* Output of the MDFT FB - real part */ + Word32 slot_frame_f_imag_fx[MAX_LS_CHANNELS][DIRAC_NO_FB_BANDS_MAX]; /* Output of the MDFT FB - imag part */ + Word32 *p_slot_frame_f_real_fx[MAX_LS_CHANNELS]; /* Output of the MDFT FB - real part */ + Word32 *p_slot_frame_f_imag_fx[MAX_LS_CHANNELS]; /* Output of the MDFT FB - imag part */ Word64 dmx_real_64[PARAM_MC_MAX_TRANSPORT_CHANS]; Word64 dmx_imag_64[PARAM_MC_MAX_TRANSPORT_CHANS]; Word32 a_fx, b_fx, c_fx, d_fx; /* Tmp complex values */ Word16 a_e, b_e, c_e, d_e; /* Tmp complex values */ - Word64 Cy_sum_real_64[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; - Word64 Cy_sum_imag_64[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; + Word64 Cy_sum_real_64[PARAM_MC_MAX_PARAMETER_BANDS][MAX_LS_CHANNELS][MAX_LS_CHANNELS]; + Word64 Cy_sum_imag_64[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][MAX_LS_CHANNELS][MAX_LS_CHANNELS]; Word16 sub62gb; Word16 sub35gb; Word32 Cx_sum_imag_fx[PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -702,17 +702,17 @@ static void ivas_param_mc_param_est_enc_fx( move16(); FOR( cur_param_band = 0; cur_param_band < PARAM_MC_MAX_PARAMETER_BANDS; cur_param_band++ ) { - FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) + FOR( ch_idx1 = 0; ch_idx1 < MAX_LS_CHANNELS; ch_idx1++ ) { - set64_fx( Cy_sum_real_64[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); + set64_fx( Cy_sum_real_64[cur_param_band][ch_idx1], 0, MAX_LS_CHANNELS ); } } FOR( cur_param_band = 0; cur_param_band < PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC; cur_param_band++ ) { - FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) + FOR( ch_idx1 = 0; ch_idx1 < MAX_LS_CHANNELS; ch_idx1++ ) { - set64_fx( Cy_sum_imag_64[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS ); + set64_fx( Cy_sum_imag_64[cur_param_band][ch_idx1], 0, MAX_LS_CHANNELS ); } FOR( ch_idx1 = 0; ch_idx1 < PARAM_MC_MAX_TRANSPORT_CHANS; ch_idx1++ ) @@ -969,8 +969,8 @@ static void ivas_param_mc_param_est_enc_fx( } IF( NE_16( hParamMC->hMetadataPMC.param_frame_idx, hParamMC->hMetadataPMC.coding_band_mapping[cur_param_band] ) ) { - Word32 Nrg_fx[MAX_CICP_CHANNELS]; - Word16 Nrg_e[MAX_CICP_CHANNELS]; + Word32 Nrg_fx[MAX_LS_CHANNELS]; + Word16 Nrg_e[MAX_LS_CHANNELS]; /* get ICLDs */ FOR( k = 0; k < nchan_input; ++k ) @@ -1084,9 +1084,9 @@ static void ivas_param_mc_param_est_enc_fx( // convert the 64 bit fixpoint back into the 48 bit float format FOR( cur_param_band = 0; cur_param_band < PARAM_MC_MAX_PARAMETER_BANDS; cur_param_band++ ) { - FOR( ch_idx1 = 0; ch_idx1 < MAX_CICP_CHANNELS; ch_idx1++ ) + FOR( ch_idx1 = 0; ch_idx1 < MAX_LS_CHANNELS; ch_idx1++ ) { - FOR( ch_idx2 = 0; ch_idx2 < MAX_CICP_CHANNELS; ch_idx2++ ) + FOR( ch_idx2 = 0; ch_idx2 < MAX_LS_CHANNELS; ch_idx2++ ) { CONVERT_CY( Cy_sum_real_64[cur_param_band][ch_idx1][ch_idx2], Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2] ); move32(); @@ -1176,8 +1176,8 @@ static void ivas_param_mc_param_est_enc_fx( static void ivas_param_mc_quantize_ilds_fx( PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ - Word32 Cy_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], /* i : Covariance matrix of the input */ - Word16 Cy_e[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], /* i : Covariance matrix of the input */ + Word32 Cy_fx[MAX_LS_CHANNELS][MAX_LS_CHANNELS], /* i : Covariance matrix of the input */ + Word16 Cy_e[MAX_LS_CHANNELS][MAX_LS_CHANNELS], /* i : Covariance matrix of the input */ Word32 Cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], /* i : Covariance matrix of the dmx */ Word16 Cx_e[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], /* i : Covariance matrix of the dmx */ const Word16 freq_idx, /* i : frequency index being processed */ @@ -1191,8 +1191,8 @@ static void ivas_param_mc_quantize_ilds_fx( Word16 Ny; Word16 num_ilds_to_code; Word16 ild_map_size; - Word32 Nrg_fx[MAX_CICP_CHANNELS]; - Word16 Nrg_e[MAX_CICP_CHANNELS]; + Word32 Nrg_fx[MAX_LS_CHANNELS]; + Word16 Nrg_e[MAX_LS_CHANNELS]; Word32 ILD_fx[PARAM_MC_SZ_ILD_MAP]; Word16 ILD_e[PARAM_MC_SZ_ILD_MAP]; const PARAM_MC_ILD_MAPPING *h_ild_mapping; @@ -1205,7 +1205,7 @@ static void ivas_param_mc_quantize_ilds_fx( push_wmops( "param_mc_prm_q" ); /* Initialization */ - set32_fx( Nrg_fx, 0, MAX_CICP_CHANNELS ); + set32_fx( Nrg_fx, 0, MAX_LS_CHANNELS ); set32_fx( ILD_fx, 0, PARAM_MC_SZ_ILD_MAP ); Ny = nchan_input; @@ -1442,12 +1442,12 @@ static void ivas_param_mc_quantize_ilds_fx( *------------------------------------------------------------------------*/ static void ivas_param_mc_quantize_iccs_fx( - PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ - Word32 Cy_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], /* i : Covariance matrix of the input */ - Word16 Cy_e[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], /* i : Covariance matrix of the input */ - const Word16 freq_idx, /* i : frequency index being processed */ - const Word16 nchan_input, /* i : number of input channels */ - Word16 *ICC_idx_out /* o : quantizer indices */ + PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ + Word32 Cy_fx[MAX_LS_CHANNELS][MAX_LS_CHANNELS], /* i : Covariance matrix of the input */ + Word16 Cy_e[MAX_LS_CHANNELS][MAX_LS_CHANNELS], /* i : Covariance matrix of the input */ + const Word16 freq_idx, /* i : frequency index being processed */ + const Word16 nchan_input, /* i : number of input channels */ + Word16 *ICC_idx_out /* o : quantizer indices */ ) { Word16 i, k; @@ -1459,13 +1459,13 @@ static void ivas_param_mc_quantize_iccs_fx( /* Initialization */ Word32 a_fx; - Word32 Nrg_fx[MAX_CICP_CHANNELS]; + Word32 Nrg_fx[MAX_LS_CHANNELS]; Word16 Nrg_e; Word32 ICC_vect_fx[PARAM_MC_SZ_ICC_MAP]; Word16 ICC_vect_e[PARAM_MC_SZ_ICC_MAP]; Word16 ICC_vect_q_fx[PARAM_MC_SZ_ICC_MAP]; - set32_fx( Nrg_fx, 0, MAX_CICP_CHANNELS ); + set32_fx( Nrg_fx, 0, MAX_LS_CHANNELS ); set32_fx( ICC_vect_fx, 0, PARAM_MC_SZ_ICC_MAP ); set16_fx( ICC_vect_q_fx, 0, PARAM_MC_SZ_ICC_MAP ); diff --git a/lib_rend/ivas_rotation_fx.c b/lib_rend/ivas_rotation_fx.c index ff7a6ac5c..7a7fac369 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -815,10 +815,10 @@ void rotateFrame_sd( Word32 azimuth_fx, elevation_fx; Word32 tmp = Q31_BY_SUB_FRAME_240; // Q31 Word32 out_temp; - Word32 tmp_gains_fx[MAX_CICP_CHANNELS - 1]; - Word32 gains_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; - Word32 gains_prev_fx[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS]; - Word32 output_tmp_fx[MAX_CICP_CHANNELS][L_FRAME48k]; + Word32 tmp_gains_fx[MAX_LS_CHANNELS - 1]; + Word32 gains_fx[MAX_LS_CHANNELS][MAX_LS_CHANNELS]; + Word32 gains_prev_fx[MAX_LS_CHANNELS][MAX_LS_CHANNELS]; + Word32 output_tmp_fx[MAX_LS_CHANNELS][L_FRAME48k]; Word32 cross_fade_fx[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; push_wmops( "rotateFrame_sd" ); @@ -1142,11 +1142,11 @@ void rotateFrame_sd_cldfb_fx( ) { Word16 iBlock, iBand, m, n; - Word32 gains_fx[MAX_CICP_CHANNELS - 1][MAX_CICP_CHANNELS - 1]; + Word32 gains_fx[MAX_LS_CHANNELS - 1][MAX_LS_CHANNELS - 1]; 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 realRot_fx[MAX_LS_CHANNELS - 1][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; + Word32 imagRot_fx[MAX_LS_CHANNELS - 1][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; Word32 *p_realRot_fx, *p_imagRot_fx; Word32 *p_real_fx, *p_imag_fx; Word16 nInChannels; diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 188919568..3709804b5 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -42,6 +42,8 @@ * Renderer constants *---------------------------------------------------------------------*/ +#define RENDERER_MAX_OUTPUT_CHANNELS IVAS_MAX_LS_CHANNELS +#define RENDERER_MAX_INPUT_CHANNELS IVAS_MAX_LS_CHANNELS #define RENDERER_MAX_ISM_INPUTS IVAS_MAX_NUM_OBJECTS #define RENDERER_MAX_MC_INPUTS 1 #define RENDERER_MAX_SBA_INPUTS 1 @@ -56,8 +58,8 @@ * Renderer structures *---------------------------------------------------------------------*/ -typedef float IVAS_REND_LfePanMtx[RENDERER_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -typedef Word32 IVAS_REND_LfePanMtx_fx[RENDERER_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; +typedef float IVAS_REND_LfePanMtx[RENDERER_MAX_INPUT_LFE_CHANNELS][RENDERER_MAX_OUTPUT_CHANNELS]; +typedef Word32 IVAS_REND_LfePanMtx_fx[RENDERER_MAX_INPUT_LFE_CHANNELS][RENDERER_MAX_OUTPUT_CHANNELS]; typedef struct { @@ -406,16 +408,16 @@ void IVAS_REND_Close( /* Split binaural rendering functions */ ivas_error IVAS_REND_openCldfb( - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_OUTPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[RENDERER_MAX_INPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[RENDERER_MAX_OUTPUT_CHANNELS], const Word16 num_in_chs, const Word16 num_out_chs, const Word32 output_Fs ); void IVAS_REND_closeCldfb( - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_OUTPUT_CHANNELS] + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[RENDERER_MAX_INPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[RENDERER_MAX_OUTPUT_CHANNELS] ); void IVAS_REND_cldfbAnalysis_ts_wrapper( diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 5140a9478..5827cc275 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -2130,7 +2130,7 @@ static ivas_error updateLfePanGainsForAmbiOut( ivas_dirac_dec_get_response_fx( inputMc->lfeRouting.lfeOutputAzimuth_fx, inputMc->lfeRouting.lfeOutputElevation_fx, inputMc->lfeRouting.lfePanMtx_fx[i], outAmbiOrder, Q29 ); /* linear input gain */ - v_multc_fx( inputMc->lfeRouting.lfePanMtx_fx[i], inputMc->lfeRouting.lfeInputGain_fx, inputMc->lfeRouting.lfePanMtx_fx[i], IVAS_MAX_OUTPUT_CHANNELS ); /* Q31 */ + v_multc_fx( inputMc->lfeRouting.lfePanMtx_fx[i], inputMc->lfeRouting.lfeInputGain_fx, inputMc->lfeRouting.lfePanMtx_fx[i], RENDERER_MAX_OUTPUT_CHANNELS ); /* Q31 */ } return error; @@ -2386,13 +2386,13 @@ static ivas_error updateMcPanGains( { FOR( i = 0; i < inputMc->customLsInput.num_lfe; ++i ) { - Copy32( 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]], RENDERER_MAX_OUTPUT_CHANNELS ); } } ELSE { /* For code simplicity, always copy LFE gains. If config has no LFE, gains will be zero anyway. */ - Copy32( 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], RENDERER_MAX_OUTPUT_CHANNELS ); } return IVAS_ERR_OK; @@ -2659,7 +2659,7 @@ static lfe_routing defaultLfeRouting( FOR( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; ++i ) { - set32_fx( routing.lfePanMtx_fx[i], 0, IVAS_MAX_OUTPUT_CHANNELS ); + set32_fx( routing.lfePanMtx_fx[i], 0, RENDERER_MAX_OUTPUT_CHANNELS ); } routing.pan_lfe = false; move16(); @@ -4214,7 +4214,7 @@ ivas_error IVAS_REND_SetInputLfeMtx_fx( /* 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 ); + Copy32( ( *lfePanMtx )[i], pInputMc->lfeRouting.lfePanMtx_fx[i], RENDERER_MAX_OUTPUT_CHANNELS ); } IF( NE_32( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ), IVAS_ERR_OK ) ) @@ -9174,8 +9174,8 @@ void IVAS_REND_Close( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_openCldfb( - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_OUTPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[RENDERER_MAX_INPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[RENDERER_MAX_OUTPUT_CHANNELS], const Word16 num_in_chs, const Word16 num_out_chs, const Word32 output_Fs ) @@ -9190,7 +9190,7 @@ ivas_error IVAS_REND_openCldfb( return error; } } - FOR( ; n < IVAS_MAX_INPUT_CHANNELS; n++ ) + FOR( ; n < RENDERER_MAX_INPUT_CHANNELS; n++ ) { cldfbAna[n] = NULL; } @@ -9202,7 +9202,7 @@ ivas_error IVAS_REND_openCldfb( return error; } } - FOR( ; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) + FOR( ; n < RENDERER_MAX_OUTPUT_CHANNELS; n++ ) { cldfbSyn[n] = NULL; } @@ -9218,12 +9218,12 @@ ivas_error IVAS_REND_openCldfb( *-------------------------------------------------------------------*/ void IVAS_REND_closeCldfb( - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], - IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_OUTPUT_CHANNELS] ) + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[RENDERER_MAX_INPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[RENDERER_MAX_OUTPUT_CHANNELS] ) { Word16 n; - FOR( n = 0; n < IVAS_MAX_INPUT_CHANNELS; n++ ) + FOR( n = 0; n < RENDERER_MAX_INPUT_CHANNELS; n++ ) { IF( cldfbAna[n] != NULL ) { @@ -9232,7 +9232,7 @@ void IVAS_REND_closeCldfb( } } - FOR( n = 0; n < IVAS_MAX_OUTPUT_CHANNELS; n++ ) + FOR( n = 0; n < RENDERER_MAX_OUTPUT_CHANNELS; n++ ) { IF( cldfbSyn[n] != NULL ) { diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 5f056250b..3be30c9f8 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -121,11 +121,11 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( { int16_t i, j; int16_t dup_count; - int16_t dup[IVAS_MAX_OUTPUT_CHANNELS]; - float azi_tmp[IVAS_MAX_OUTPUT_CHANNELS]; - float ele_tmp[IVAS_MAX_OUTPUT_CHANNELS]; + int16_t dup[IVAS_MAX_LS_CHANNELS]; + float azi_tmp[IVAS_MAX_LS_CHANNELS]; + float ele_tmp[IVAS_MAX_LS_CHANNELS]; - for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + for ( i = 0; i < IVAS_MAX_LS_CHANNELS; i++ ) { dup[i] = 0; azi_tmp[i] = 0.0f; @@ -143,7 +143,7 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( return LS_CUSTOM_FILEREADER_LFE_NUM_SPK_EXCEEDED_ERROR; } - if ( ( *num_azi + num_lfe ) > IVAS_MAX_OUTPUT_CHANNELS ) + if ( ( *num_azi + num_lfe ) > IVAS_MAX_LS_CHANNELS ) { return LS_CUSTOM_FILEREADER_OUTPUT_NCHAN_EXCEEDED_ERROR; } @@ -182,7 +182,7 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( ( *num_azi ) -= dup_count; - for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + for ( i = 0; i < IVAS_MAX_LS_CHANNELS; i++ ) { azi[i] = azi_tmp[i]; ele[i] = ele_tmp[i]; @@ -249,7 +249,7 @@ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( num_ele = 0; num_lfe = 0; - for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + for ( i = 0; i < IVAS_MAX_LS_CHANNELS; i++ ) { hLsCustomData->lfe_idx[i] = -1; hLsCustomData->azimuth[i] = 0.0f; @@ -281,7 +281,7 @@ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( continue; } - if ( num_azi >= IVAS_MAX_OUTPUT_CHANNELS ) + if ( num_azi >= IVAS_MAX_LS_CHANNELS ) { return LS_CUSTOM_FILEREADER_AZI_NUM_SPK_EXCEEDED_ERROR; } @@ -310,7 +310,7 @@ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( continue; } - if ( num_ele >= IVAS_MAX_OUTPUT_CHANNELS ) + if ( num_ele >= IVAS_MAX_LS_CHANNELS ) { return LS_CUSTOM_FILEREADER_ELE_NUM_SPK_EXCEEDED_ERROR; } @@ -336,14 +336,14 @@ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( continue; } - if ( num_lfe > IVAS_MAX_OUTPUT_CHANNELS ) + if ( num_lfe > IVAS_MAX_LS_CHANNELS ) { return LS_CUSTOM_FILEREADER_LFE_NUM_SPK_EXCEEDED_ERROR; } else { hLsCustomData->lfe_idx[num_lfe] = (int16_t) atoi( tok ); - if ( hLsCustomData->lfe_idx[num_lfe] < 0 || hLsCustomData->lfe_idx[num_lfe] > ( IVAS_MAX_OUTPUT_CHANNELS - 1 ) ) + if ( hLsCustomData->lfe_idx[num_lfe] < 0 || hLsCustomData->lfe_idx[num_lfe] > ( IVAS_MAX_LS_CHANNELS - 1 ) ) { return LS_CUSTOM_FILEREADER_LFE_INDEX_ERROR; } -- GitLab