diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 070a0ff5faf42c23c46d09360719d546789afc35..8a7e2d13b418d1a43f9483010e501882073c8437 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -474,9 +474,13 @@ void ivas_FB_mixer_close( void ivas_fb_mixer_pcm_ingest( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ - float pcm_in[][L_FRAME48k], /* i : input audio channels */ - float **ppOut_pcm, /* o : output audio channels */ - const int16_t frame_len, /* i : frame length */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *pcm_in[], /* i : input audio channels */ +#else + float pcm_in[][L_FRAME48k], /* i : input audio channels */ +#endif + float **ppOut_pcm, /* o : output audio channels */ + const int16_t frame_len, /* i : frame length */ const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] ) { int16_t i; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c299e999cf9749bebf70306124b6ad325c8e83e7..dea862c303c67a863d03aecc1458d34124c9a365 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -175,7 +175,11 @@ ivas_error ivas_cpe_enc( ivas_error ivas_mct_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data[MCT_MAX_CHANNELS], /* i : input signal buffers */ +#else float data[MCT_MAX_CHANNELS][L_FRAME48k], /* i : input signals */ +#endif const int16_t input_frame, /* i : input frame length per channel */ const int16_t nb_bits_metadata /* i : number of metadata bits */ ); @@ -389,7 +393,11 @@ ivas_error ivas_hp20_dec_reconfig( ivas_error ivas_sce_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t sce_id, /* i : SCE # identifier */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[1], /* o : output synthesis signal */ +#else float output[1][L_FRAME48k], /* o : output synthesis signal */ +#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t nb_bits_metadata /* i : number of metadata bits */ ); @@ -397,14 +405,22 @@ ivas_error ivas_sce_dec( ivas_error ivas_cpe_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t cpe_id, /* i : CPE # identifier */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* o : output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* o : output synthesis signal */ +#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t nb_bits_metadata /* i : number of metadata bits */ ); ivas_error ivas_mct_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* o : output synthesis signal */ +#else float output[][L_FRAME48k], /* o : output synthesis signal */ +#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t nb_bits_metadata /* i : number of metadata bits */ ); @@ -465,7 +481,11 @@ ivas_error ivas_core_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ const int16_t n_channels, /* i : number of channels to be decoded */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* o : output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* o : output synthesis signal */ +#endif float outputHB[CPE_CHANNELS][L_FRAME48k], /* o : output HB synthesis signal */ float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ @@ -504,7 +524,11 @@ void decod_gen_2sbfr( void synchro_synthesis( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ +#endif const int16_t output_frame, /* i : Number of samples */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ); @@ -658,7 +682,11 @@ void ivas_post_proc( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ const int16_t n, /* i : channel number */ float synth[], /* i/o: output synthesis signal */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ +#endif const int16_t output_frame, /* i : output frame length */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ); @@ -701,7 +729,11 @@ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( void smooth_dft2td_transition( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: synthesis @external Fs */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: synthesis @external Fs */ +#endif const int16_t output_frame /* i : output frame length */ ); @@ -984,7 +1016,11 @@ ivas_error ivas_ism_metadata_dec_create( ivas_error ivas_ism_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data[MAX_NUM_OBJECTS], /* i : input signal */ +#else float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i : input signal */ +#endif const int16_t input_frame, /* i : input frame length per channel */ int16_t *nb_bits_metadata /* i : number of metadata bits */ #ifdef MASA_AND_OBJECTS @@ -1056,7 +1092,11 @@ ivas_error ivas_param_ism_enc_open( void ivas_param_ism_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data[MAX_NUM_OBJECTS], /* i : input signal */ +#else float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i : input signal */ +#endif const int16_t input_frame /* i : input frame length per channel */ ); @@ -1075,7 +1115,11 @@ void ivas_ism_metadata_close( void ivas_param_ism_stereo_dmx( Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data[MAX_NUM_OBJECTS], /* i/o: input signal/stereo dmx */ +#else float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i/o: input signal/stereo dmx */ +#endif const int16_t input_frame /* i : Length of input frame */ ); @@ -1107,7 +1151,11 @@ void ivas_param_ism_dec_close( void ivas_param_ism_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +#else float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif ); void ivas_ism_dec_digest_tc( @@ -1850,13 +1898,21 @@ void stereo_tca_init_dec( void stereo_tca_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *synth[CPE_CHANNELS], /* i/o: output synth */ +#else float synth[CPE_CHANNELS][L_FRAME48k], /* i/o: output synth */ +#endif const int16_t output_frame /* i : length of a frame per channel */ ); void stereo_tca_scale_R_channel( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output, /* i/o: output synthesis, R channel */ +#else float output[L_FRAME48k], /* i/o: output synthesis, R channel */ +#endif const int16_t output_frame /* i : frame length */ ); @@ -1912,7 +1968,11 @@ void stereo_icBWE_dec( void stereo_icBWE_decproc( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: output symthesis */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output symthesis */ +#endif 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 */ @@ -2560,7 +2620,11 @@ void stereo_decoder_tcx( void stereo_mdct_core_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *signal_out[CPE_CHANNELS], /* o : synthesis @internal_FS */ +#else float signal_out[CPE_CHANNELS][L_FRAME48k], /* o : synthesis @internal_FS */ +#endif float signal_outFB[CPE_CHANNELS][L_FRAME48k] /* o : synthesis @output_FS */ ); @@ -2728,13 +2792,21 @@ void synchonize_channels_mdct_sid( void updateBuffersForDmxMdctStereo( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ const int16_t output_frame, /* i : output frame length */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: decoder output */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: decoder output */ +#endif float synth[CPE_CHANNELS][L_FRAME48k] /* i/o: decoder synthesis */ ); void applyDmxMdctStereo( const CPE_DEC_HANDLE hCPE, /* i : CPE handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* o : output from core decoder */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* o : output from core decoder */ +#endif const int16_t output_frame /* i : output frame length */ ); @@ -2801,7 +2873,11 @@ void stereo_cng_init_dec( ); void stereo_cng_compute_PScorr( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i : Output signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i : Output signal */ +#endif float *c_PS_LT, /* i/o: Correlation */ const int16_t L_frame_0, /* i : L_frame channel 0 */ const int16_t L_frame_1 /* i : L_frame channel 1 */ @@ -2814,7 +2890,11 @@ void stereo_cng_dec_update( void stereo_cna_update_params( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i : Output signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i : Output signal */ +#endif const int16_t output_frame, /* i : Output frame length */ const int16_t tdm_ratio_idx /* i : TDM ratio index */ ); @@ -3132,7 +3212,11 @@ void ivas_mct_core_dec( MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */ const int16_t nCPE, /* i : number of CPEs */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *signal_out[] /* o : synthesis @internal_FS */ +#else float signal_out[][L_FRAME48k] /* o : synthesis @internal_FS */ +#endif ); void ivas_mct_dec_mct( @@ -3447,13 +3531,17 @@ void ivas_dirac_param_est_enc( DIRAC_ENC_HANDLE hDirAC, IVAS_QDIRECTION *q_direction, const uint8_t useLowerRes, +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], +#else float data_f[][L_FRAME48k], +#endif float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame, const IVAS_FORMAT ivas_format , - const int16_t hodirac_flag, - const int16_t nchan_fb_in + const int16_t hodirac_flag, + const int16_t nchan_fb_in #ifdef FIX_527_SBA_MONO_INPUT , int16_t *mono_frame_count, @@ -3541,27 +3629,43 @@ void ivas_sba_get_spar_hoa_md_flag( ); void ivas_sba_zero_vert_comp( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *sba_data[], /* i : SBA signals */ +#else float sba_data[][L_FRAME48k], /* i/o: SBA data frame */ +#endif const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int16_t sba_planar, /* i : SBA planar flag */ const int16_t input_frame /* i : input frame length */ ); void ivas_sba_getTCs( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *sba_data[], /* i : SBA signals */ +#else float sba_data[][L_FRAME48k], /* i : SBA signals */ +#endif Encoder_Struct *st_ivas, /* i/o: Encoder struct */ const int16_t input_frame /* i : frame length */ ); int16_t ivas_sba_remapTCs( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *sba_data[], /* i/o: SBA signals */ +#else float sba_data[][L_FRAME48k], /* i/o: SBA signals */ +#endif Decoder_Struct *st_ivas, /* i/o: decoder struct */ const int16_t output_frame /* i : frame length */ ); void ivas_sba_dirac_stereo_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* o : output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* o : output synthesis signal */ +#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t mcmasa /* i : McMASA flag */ ); @@ -3620,7 +3724,11 @@ void ivas_dirac_enc( DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i/o: SBA channels */ +#else float data_f[][L_FRAME48k], /* i/o: SBA channels */ +#endif float **ppIn_FR_real, /* o : real freq domain values */ float **ppIn_FR_imag, /* o : imag freq domain values */ const int16_t input_frame, /* i : input frame length */ @@ -3628,6 +3736,7 @@ void ivas_dirac_enc( const IVAS_FORMAT ivas_format, /* i : ivas format */ int16_t hodirac_flag /* i : hodirac flag */ ); + ivas_error ivas_dirac_config( void *st_ivas, /* i/o: IVAS encoder/decoder state structure */ const int16_t enc_dec /* i : encoder or decoder flag */ @@ -3696,7 +3805,11 @@ void ivas_dirac_dec_set_md_map( void ivas_dirac_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif const int16_t nchan_transport /* i : number of transport channels */ ); @@ -3777,7 +3890,11 @@ void calculate_hodirac_sector_parameters( void ivas_mc_paramupmix_enc( Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i/o: input/transport MC data */ +#else float data_f[][L_FRAME48k], /* i/o: input: MC data */ +#endif const int16_t input_frame /* i : input frame length */ ); @@ -3792,7 +3909,11 @@ void ivas_mc_paramupmix_enc_close( void ivas_mc_paramupmix_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +#else float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif ); ivas_error ivas_mc_paramupmix_dec_open( @@ -3871,7 +3992,11 @@ void ivas_param_mc_enc_close( void ivas_param_mc_enc( Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i/o: input/transport MC data */ +#else float data_f[][L_FRAME48k], /* i/o: input: MC data */ +#endif const int16_t input_frame /* i : input frame length */ ); @@ -4124,7 +4249,11 @@ void ivas_spar_enc_close( ivas_error ivas_spar_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i/o: input/transport audio channels */ +#else float data_f[][L_FRAME48k], /* i/o: input/transport audio channels */ +#endif const int16_t input_frame, /* i : input frame length */ int16_t *nb_bits_metadata, /* i : number of MD bits written */ BSTR_ENC_HANDLE hMetaData /* o : MetaData handle */ @@ -4158,7 +4287,11 @@ void ivas_spar_config( void ivas_sba_upmixer_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: transport/output audio channels */ +#else float output[][L_FRAME48k], /* i/o: transport/output audio channels */ +#endif const int16_t output_frame /* i : output frame length */ ); @@ -4176,7 +4309,11 @@ ivas_error ivas_sba_linear_renderer( void ivas_sba_mix_matrix_determiner( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: transport/output audio channels */ +#else float output[][L_FRAME48k], /* i/o: transport/output audio channels */ +#endif 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 */ @@ -4225,8 +4362,13 @@ void ivas_spar_agc_dec_close( void ivas_agc_dec_process( ivas_agc_dec_state_t *hAgcDec, /* i/o: AGC decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *pcm_in[], /* i : input audio channels */ + float *pcm_out[], /* o : output audio channels */ +#else float pcm_in[][L_FRAME48k], /* i : input audio channels */ float pcm_out[][L_FRAME48k], /* o : output audio channels */ +#endif const int16_t n_channels, /* i : number of channels */ const int16_t output_Fs /* i : output sampling rate */ ); @@ -4348,7 +4490,11 @@ int16_t ivas_is_res_channel( void ivas_spar_dec_agc_pca( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: input/output audio channels */ +#else float output[][L_FRAME48k], /* i/o: input/output audio channels */ +#endif const int16_t output_frame /* i : output frame length */ ); @@ -4391,7 +4537,11 @@ void ivas_spar_dec_upmixer_sf( void ivas_spar_dec_upmixer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: input/output audio channels */ +#else float output[][L_FRAME48k], /* i/o: input/output audio channels */ +#endif const int16_t nchan_internal, /* i : number of internal channels */ const int16_t output_frame /* i : output frame length */ ); @@ -4569,7 +4719,7 @@ void ivas_spar_to_dirac( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t dtx_vad, /* i : DTX frame flag */ const int16_t num_bands_out, /* i : number of output bands */ - const int16_t bw /* i : band joining factor */ + const int16_t bw /* i : band joining factor */ #ifdef FIX_SBA_VANISHING_RESIDUAL , const int16_t dyn_active_w_flag /* i : dynamic active W flag */ @@ -4771,7 +4921,11 @@ void ivas_pca_dec( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ const int16_t bfi, /* i : bad frame indicator */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *pcm_out[] /* o : output audio channels */ +#else float pcm_out[][L_FRAME48k] /* o : output audio channels */ +#endif ); /* PCA utilities */ @@ -5072,7 +5226,11 @@ ivas_error ivas_masa_encode( void ivas_masa_estimate_energy( MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input audio channels */ +#else float data_f[][L_FRAME48k], /* i : Input audio channels */ +#endif const int16_t input_frame, /* i : frame length */ const int16_t nchan_transport /* i : number of MASA input/transport channels */ ); @@ -5244,7 +5402,11 @@ void update_bits_next_block( void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: synthesized core-coder transport channels */ +#else float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels */ +#endif const int16_t output_frame /* i : output frame length per channel */ #ifdef CR_FIX_585_MASA_2TC_DTX_EXT , @@ -5470,7 +5632,11 @@ void ivas_ls_setup_conversion( void ivas_ls_setup_conversion_process_mdct( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[] /* i/o: output synthesis signal */ +#else float output[][L_FRAME48k] /* i/o: output synthesis signal */ +#endif ); void ivas_ls_setup_conversion_process_mdct_param_mc( @@ -5551,7 +5717,11 @@ void ivas_mcmasa_enc( MCMASA_ENC_HANDLE hMcMasa, /* i/o: Encoder McMASA handle */ IVAS_QMETADATA_HANDLE hQMeta, /* o : Qmetadata handle */ MASA_ENCODER_HANDLE hMasa, /* i/o: Encoder MASA handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input frame of audio */ +#else float data_f[][L_FRAME48k], /* i : Input frame of audio */ +#endif 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 */ @@ -5560,7 +5730,11 @@ void ivas_mcmasa_enc( void ivas_mcmasa_param_est_enc( MCMASA_ENC_HANDLE hMcMasa, /* i/o: Encoder McMASA handle */ MASA_ENCODER_HANDLE hMasa, /* i/o: Encoder MASA handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input frame of audio */ +#else float data_f[][L_FRAME48k], /* i : Input frame of audio */ +#endif float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated elevation */ float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated azimuth */ float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated direct-to-total ratio*/ @@ -5615,19 +5789,31 @@ ivas_error ivas_mono_dmx_renderer_open( void ivas_mono_downmix_render_passive( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: synthesized core-coder transport channels/mono output */ +#else float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/mono output */ +#endif const int16_t output_frame /* i : output frame length */ ); void ivas_mono_stereo_downmix_mcmasa( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: synthesized core-coder transport channels/mono or stereo output */ +#else float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/mono or stereo output */ +#endif int16_t output_frame /* i : output frame length per channel */ ); void ivas_lfe_synth_with_filters( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* o : output signals */ +#else float data_f[][L_FRAME48k], /* o : output signals */ +#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t separateChannelIndex, /* i : separate channel index */ const int16_t lfeChannelIndex /* i : LFE channel index */ @@ -5723,6 +5909,11 @@ void ivas_filter_process( const int16_t length /* i : filter order */ ); + +/*----------------------------------------------------------------------------------* + * OSBA prototypes + *----------------------------------------------------------------------------------*/ + #ifdef SBA_AND_OBJECTS ivas_error ivas_osba_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ @@ -5739,15 +5930,20 @@ ivas_error ivas_osba_enc_reconfig( void ivas_osba_enc( OSBA_ENC_HANDLE hOSba, /* i/o: OSBA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_in_f[], /* i/o: Input / transport audio signals */ +#else float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + #endif const int16_t input_frame, /* i : Input frame size */ const int16_t nchan_ism, /* i : Number of objects for parameter analysis */ const ISM_MODE ism_mode, /* i : ISM mode */ const int16_t sba_analysis_order /* i : SBA order evaluated in DirAC/SPAR encoder */ #ifdef SBA_AND_OBJECTS - , const int32_t input_Fs /* i : input sampling rate*/ + , const int32_t input_Fs /* i : input sampling rate */ #endif ); + #ifdef SBA_AND_OBJECTS ivas_error ivas_masa_ism_data_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ @@ -5758,7 +5954,11 @@ ivas_error ivas_sba_ism_separate_object_renderer_open( ivas_error ivas_osba_dirac_td_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* o : output synthesis signal */ +#else float output[][L_FRAME48k], /* o : output synthesis signal */ +#endif const int16_t output_frame /* i : output frame length per channel */ ); @@ -5769,15 +5969,13 @@ ivas_error ivas_osba_ism_metadata_dec( int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ ); -/*-------------------------------------------------------------------------* - * ivas_osba_render() - * - * Object + SBA rendering process. - *-------------------------------------------------------------------------*/ - void ivas_osba_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: core-coder transport channels/object output */ +#else float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ +#endif const int16_t output_frame /* i : output frame length per channel */ ); @@ -5826,12 +6024,20 @@ void ivas_omasa_enc( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_in_f[], /* i/o: Input / transport audio signals */ +#else float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ +#endif const int16_t input_frame, /* i : Input frame size */ const int16_t nchan_transport, /* i : Number of transport channels */ const int16_t nchan_ism, /* i : Number of objects for parameter analysis*/ const ISM_MODE ism_mode, /* i : ISM mode */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_separated_object, /* o : Separated object audio signal */ +#else float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ +#endif int16_t* idx_separated_object /* o : Index of the separated object */ ); @@ -5861,7 +6067,11 @@ void ivas_set_ism_importance_interformat( int16_t ivas_omasa_ener_brate( const int16_t nchan_ism, /* i : number of ISMs */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input / transport audio signals */ +#else float data_f[][L_FRAME48k], /* i : Input / transport audio signals */ +#endif const int16_t input_frame /* i : Input frame size */ ); @@ -5895,8 +6105,13 @@ void ivas_set_omasa_TC( void ivas_merge_masa_transports( float data_in_f1[][L_FRAME48k], /* i : Transport audio signals 1 */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_in_f2[], /* i : Transport audio signals 2 */ + float *data_out_f[], /* o : Merged transport audio signals */ +#else float data_in_f2[][L_FRAME48k], /* i : Transport audio signals 2 */ float data_out_f[][L_FRAME48k], /* o : Merged transport audio signals */ +#endif const int16_t input_frame, /* i : Input frame size */ const int16_t num_transport_channels /* i : Number of transport audio signals */ ); @@ -5920,7 +6135,11 @@ ivas_error ivas_omasa_ism_metadata_dec( ivas_error ivas_omasa_dirac_td_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* o : output synthesis signal */ +#else float output[][L_FRAME48k], /* o : output synthesis signal */ +#endif const int16_t output_frame /* i : output frame length per channel */ ); @@ -5937,9 +6156,21 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( void ivas_omasa_dirac_rend( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* o : output synthesis signal */ +#else float output[][L_FRAME48k], /* o : output synthesis signal */ +#endif + const int16_t output_frame /* i : output frame length per channel */ +); + +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +void ivas_omasa_rearrange_channels( + float *output[], /* o : output synthesis signal */ + const int16_t nchan_transport_ism, /* i : number of ISM TCs */ const int16_t output_frame /* i : output frame length per channel */ ); +#endif #ifdef MASA_AND_OBJECTS void ivas_omasa_dirac_rend_jbm( @@ -5971,7 +6202,11 @@ void ivas_omasa_separate_object_renderer_close( void ivas_omasa_separate_object_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float input_f[][L_FRAME48k], /* i : separated object signal */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: output signals */ +#else float output_f[][L_FRAME48k], /* i/o: output signals */ +#endif const int16_t output_frame /* i : output frame length per channel */ ); @@ -6069,7 +6304,11 @@ void ivas_FB_mixer_close( void ivas_fb_mixer_pcm_ingest( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *pcm_in[], /* i : input audio channels */ +#else float pcm_in[][L_FRAME48k], /* i : input audio channels */ +#endif float **ppOut_pcm, /* o : output audio channels */ const int16_t frame_length, /* i : frame length */ const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index 9ae98584131c63d94fa0949f7a20dc2815bf2d1b..90d36a09174d5ef06aab361185c9840f23c62c1d 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -316,10 +316,14 @@ void ivas_sba_get_spar_hoa_md_flag( *-------------------------------------------------------------------*/ void ivas_sba_zero_vert_comp( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *sba_data[], /* i : SBA signals */ +#else float sba_data[][L_FRAME48k], /* i : SBA signals */ - const int16_t sba_order, /* i : SBA order */ - const int16_t sba_planar, /* i : SBA planar flag */ - const int16_t input_frame /* i : frame length */ +#endif + const int16_t sba_order, /* i : SBA order */ + const int16_t sba_planar, /* i : SBA planar flag */ + const int16_t input_frame /* i : frame length */ ) { int16_t i, j; diff --git a/lib_com/options.h b/lib_com/options.h index b644c2f4db3191a39274b223d7967f43e2ff20ac..9c2089633c8cf11a64666214a4c2cf5385e4022d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -248,6 +248,9 @@ #define FIX_674_MISSING_TABLES_FOR_TDREND_REVERB /* Eri: add tables for 32kHz, 16kHz (and update 48kHz) for left/right energies and coherence for late reverb in TD renderer path. Also read tables from binary when hrtf binaries are used. */ +#define FIX_264_AUDIO_CHANNELS_TO_HEAP /* VA: issue 243: Move audio channels memory from stack to heap */ + + /* ################## End BE DEVELOPMENT switches ######################### */ /* #################### Start NON-BE CR switches ########################## */ diff --git a/lib_dec/ivas_agc_dec.c b/lib_dec/ivas_agc_dec.c index 72ae68a57b34d61132eee2944adf4b6f27e52a4f..476ff0be1c08afaa55dc7880752242cbc021008a 100644 --- a/lib_dec/ivas_agc_dec.c +++ b/lib_dec/ivas_agc_dec.c @@ -173,10 +173,15 @@ void ivas_spar_agc_dec_close( void ivas_agc_dec_process( ivas_agc_dec_state_t *hAgcDec, /* i/o: AGC decoder handle */ - float pcm_in[][L_FRAME48k], /* i : input audio channels */ - float pcm_out[][L_FRAME48k], /* o : output audio channels */ - const int16_t n_channels, /* i : number of channels */ - const int16_t output_frame /* i : output frame length */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *pcm_in[], /* i : input audio channels */ + float *pcm_out[], /* o : output audio channels */ +#else + float pcm_in[][L_FRAME48k], /* i : input audio channels */ + float pcm_out[][L_FRAME48k], /* o : output audio channels */ +#endif + const int16_t n_channels, /* i : number of channels */ + const int16_t output_frame /* i : output frame length */ ) { int16_t i, idx; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index bb0268e98010658765660826e3786b61fbc94331..938d75b1035e957ee8842698473ff6a3f4c12b1f 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -55,12 +55,16 @@ *-------------------------------------------------------------------*/ ivas_error ivas_core_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ - const int16_t n_channels, /* i : number of channels to be decoded */ - float output[CPE_CHANNELS][L_FRAME48k], /* o : output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ + const int16_t n_channels, /* i : number of channels to be decoded */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[L_FRAME48k], /* o : output synthesis signal */ +#else + float output[CPE_CHANNELS][L_FRAME48k], /* o : output synthesis signal */ +#endif float hb_synth[CPE_CHANNELS][L_FRAME48k], /* o : output HB synthesis signal */ float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 96542eb1043b487197e4b0c624105670bdf97ac0..c85dfd334441718b7c43aa3cce28e48f223ff4fe 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -64,11 +64,15 @@ static void stereo_mode_combined_format_dec( const Decoder_Struct *st_ivas, CPE_ *--------------------------------------------------------------------------*/ ivas_error ivas_cpe_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t cpe_id, /* i : CPE # identifier */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t cpe_id, /* i : CPE # identifier */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* o : output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* 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 */ +#endif + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t nb_bits_metadata /* i : number of metadata bits */ ) { int16_t i, n, n_channels; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c old mode 100755 new mode 100644 index bce8d4e3ded800eeedc4c0ea90d6cd6fc7aeb963..97a2f69b832eaee32cb4a47238abcfd07717d45f --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -62,13 +62,23 @@ ivas_error ivas_dec( { int16_t n, output_frame, nchan_out; Decoder_State *st; /* used for bitstream handling */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +#ifdef SBA_AND_OBJECTS + float *output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* 'float' buffer for output synthesis */ +#else + float *output[MAX_OUTPUT_CHANNELS]; /* 'float' buffer for output synthesis */ +#endif +#else #ifdef SBA_AND_OBJECTS float output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; /* 'float' buffer for output synthesis, MAX_OUTPUT_CHANNELS channels */ #else float output[MAX_OUTPUT_CHANNELS][L_FRAME48k]; /* 'float' buffer for output synthesis, MAX_OUTPUT_CHANNELS channels */ +#endif #endif int16_t nchan_remapped; +#ifndef FIX_264_AUDIO_CHANNELS_TO_HEAP float output_lfe_ch[L_FRAME48k]; +#endif #if defined MASA_AND_OBJECTS || defined SBA_AND_OBJECTS int16_t nb_bits_metadata[MAX_SCE + 1]; #else @@ -127,7 +137,12 @@ ivas_error ivas_dec( for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) #endif { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + output[n] = st_ivas->p_output_f[n]; + p_output[n] = output[n]; +#else p_output[n] = &output[n][0]; +#endif } @@ -665,6 +680,9 @@ ivas_error ivas_dec( return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" ); } +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + ivas_omasa_rearrange_channels( output, nchan_transport_ism, output_frame ); +#else /* in case of external rendering, rearrange the channels order */ mvr2r( output[0], output[MAX_OUTPUT_CHANNELS - 2], output_frame ); mvr2r( output[1], output[MAX_OUTPUT_CHANNELS - 1], output_frame ); @@ -675,6 +693,7 @@ ivas_error ivas_dec( } mvr2r( output[MAX_OUTPUT_CHANNELS - 2], output[n], output_frame ); mvr2r( output[MAX_OUTPUT_CHANNELS - 1], output[++n], output_frame ); +#endif } } #endif @@ -900,7 +919,11 @@ ivas_error ivas_dec( /* LFE channel decoder */ if ( st_ivas->mc_mode == MC_MODE_MCT ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output[LFE_CHANNEL] ); +#else ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); +#endif } if ( st_ivas->mc_mode == MC_MODE_MCT ) @@ -910,8 +933,9 @@ ivas_error ivas_dec( return error; } +#ifndef FIX_264_AUDIO_CHANNELS_TO_HEAP mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); - +#endif /* HP filtering */ for ( n = 0; n < st_ivas->nchan_transport; n++ ) { @@ -997,7 +1021,11 @@ ivas_error ivas_dec( } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output[LFE_CHANNEL] ); +#else ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); +#endif ivas_mc_paramupmix_dec_read_BS( st_ivas, st, st_ivas->hMCParamUpmix, &nb_bits_metadata[0] ); @@ -1006,8 +1034,9 @@ ivas_error ivas_dec( return error; } +#ifndef FIX_264_AUDIO_CHANNELS_TO_HEAP mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); - +#endif ivas_mc_paramupmix_dec( st_ivas, output ); /* HP filtering */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 4e84f63edb9b212a92845d43cd423448fcde3aa5..73185359fa977d53815bf037fe0eb5abfe6fb3eb 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1654,8 +1654,12 @@ void ivas_dirac_dec_set_md_map( *------------------------------------------------------------------------*/ void ivas_dirac_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif const int16_t nchan_transport /* i : number of transport channels */ ) { @@ -1672,7 +1676,11 @@ void ivas_dirac_dec( for ( n = 0; n < nchan_out; n++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + output_f_local[n] = output_f[n]; +#else output_f_local[n] = &output_f[n][0]; +#endif } for ( n = 0; n < nchan_transport; n++ ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 58cbb3424e30449e31f3f8aa34bd13f94c53d988..3919b7de70dda58de2ba0a90eca6f34fe92dc4c3 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2236,6 +2236,33 @@ ivas_error ivas_init_decoder( } #endif +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + /*-----------------------------------------------------------------* + * Allocate floating-point output audio buffers + *-----------------------------------------------------------------*/ + + if ( !st_ivas->hDecoderConfig->voip_active ) + { + for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas ); n++ ) + { + /* note: these are intra-frame heap memories */ + if ( ( st_ivas->p_output_f[n] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); + } + } + } + else + { + n = 0; + } + + for ( ; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) + { + st_ivas->p_output_f[n] = NULL; + } +#endif + return error; } @@ -2482,6 +2509,14 @@ void ivas_initialize_handles_dec( st_ivas->hJbmMetadata = NULL; #endif +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + /* floating-point output audio buffers */ + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + st_ivas->p_output_f[i] = NULL; + } +#endif + return; } @@ -2724,6 +2759,18 @@ void ivas_destroy_dec( } #endif +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + /* floating-point output audio buffers */ + for ( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) + { + if ( st_ivas->p_output_f[i] != NULL ) + { + free( st_ivas->p_output_f[i] ); + st_ivas->p_output_f[i] = NULL; + } + } +#endif + /* main IVAS handle */ free( st_ivas ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index d776026664522aa54a5d14bb98e54c639c00cc75..0375bd07e7ae2166dfa68eba8281e91282af6fee 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -62,6 +62,9 @@ static ivas_error ivas_ism_bitrate_switching( int16_t tc_nchan_tc_new; int16_t tc_nchan_allocate_new; int16_t tc_granularity_new; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + int16_t ch, nchan_out_buff, nchan_out_buff_old; +#endif AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; RENDERER_TYPE renderer_type_old; @@ -75,6 +78,9 @@ static ivas_error ivas_ism_bitrate_switching( st_ivas->ism_mode = last_ism_mode; ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); st_ivas->ism_mode = ism_mode; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas ); +#endif if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL #ifdef MASA_AND_OBJECTS @@ -340,6 +346,37 @@ static ivas_error ivas_ism_bitrate_switching( return error; } +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + /*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ + + if ( !st_ivas->hDecoderConfig->voip_active ) + { + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas ); + + if ( nchan_out_buff > nchan_out_buff_old ) + { + for ( ch = nchan_out_buff_old; ch < nchan_out_buff; ch++ ) + { + /* note: these are intra-frame heap memories */ + if ( ( st_ivas->p_output_f[ch] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) /* note: 32000 == max internal sampling rate */ + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); + } + } + } + else + { + for ( ch = nchan_out_buff; ch < nchan_out_buff_old; ch++ ) + { + free( st_ivas->p_output_f[ch] ); + st_ivas->p_output_f[ch] = NULL; + } + } + } +#endif + /*-----------------------------------------------------------------* * Reconfigure TC buffer *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 06283748dcf0735532f007ec4e86daf222629dcc..dceb0eb08d420e4f343ccb25b6d92e36ad146e88 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -732,8 +732,12 @@ void ivas_param_ism_dec_close( *-------------------------------------------------------------------------*/ void ivas_param_ism_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output*/ +#else float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output*/ +#endif ) { int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i; diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 0a40ab325b7e7b893973cb68cdfdb2bcb9be72f4..e8a7ac5808c74b53b4ec21d81c834095dc44b73e 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -471,10 +471,14 @@ void ivas_omasa_separate_object_renderer_close( *-------------------------------------------------------------------------*/ void ivas_omasa_separate_object_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float input_f[][L_FRAME48k], /* i : separated object signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float input_f[][L_FRAME48k], /* i : separated object signal */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: output signals */ +#else float output_f[][L_FRAME48k], /* i/o: output signals */ - const int16_t output_frame /* i : output frame length per channel */ +#endif + const int16_t output_frame /* i : output frame length per channel */ ) { VBAP_HANDLE hVBAPdata; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 5cbd1852e790765e0d995fed503727b39da0af28..12fd1ba693463c6fb6f19a811ba3a525728b0842 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -73,10 +73,17 @@ ivas_error ivas_jbm_dec_tc( ) { int16_t n, output_frame, nchan_out; - Decoder_State *st; /* used for bitstream handling */ + Decoder_State *st; /* used for bitstream handling */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[MAX_OUTPUT_CHANNELS]; /* 'float' buffer for output synthesis */ /* TODO: can be allocated dynamically using st_ivas->p_output_f */ + float p_output_f[MAX_TRANSPORT_CHANNELS][L_FRAME48k]; +#else float output[MAX_TRANSPORT_CHANNELS][L_FRAME48k]; /* 'float' buffer for transport channels, MAX_TRANSPORT_CHANNELS channels */ +#endif int16_t nchan_remapped; +#ifndef FIX_264_AUDIO_CHANNELS_TO_HEAP float output_lfe_ch[L_FRAME48k]; +#endif #ifdef MASA_AND_OBJECTS int16_t nb_bits_metadata[MAX_SCE + 1]; #else @@ -110,6 +117,9 @@ ivas_error ivas_jbm_dec_tc( for ( n = 0; n < MAX_TRANSPORT_CHANNELS; n++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + output[n] = p_output_f[n]; +#endif p_output[n] = &output[n][0]; } @@ -457,7 +467,11 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg = st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg; } +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output[LFE_CHANNEL] ); +#else ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); +#endif } if ( st_ivas->mc_mode == MC_MODE_MCT ) @@ -467,8 +481,9 @@ ivas_error ivas_jbm_dec_tc( return error; } +#ifndef FIX_264_AUDIO_CHANNELS_TO_HEAP mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); - +#endif /* HP filtering */ for ( n = 0; n < st_ivas->nchan_transport; n++ ) { @@ -501,7 +516,11 @@ ivas_error ivas_jbm_dec_tc( #ifdef JBM_PARAMUPMIX else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output[LFE_CHANNEL] ); +#else ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); +#endif ivas_mc_paramupmix_dec_read_BS( st_ivas, st, st_ivas->hMCParamUpmix, &nb_bits_metadata[0] ); @@ -510,8 +529,9 @@ ivas_error ivas_jbm_dec_tc( return error; } +#ifndef FIX_264_AUDIO_CHANNELS_TO_HEAP mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); - +#endif /* Rendering */ if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -820,7 +840,11 @@ ivas_error ivas_jbm_dec_render( { int16_t n, nchan_out; int16_t nchan_transport; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAPaa + float *output[MAX_OUTPUT_CHANNELS]; /* 'float' buffer for output synthesis */ +#else float output[MAX_OUTPUT_CHANNELS][L_FRAME48k]; /* 'float' buffer for output synthesis, MAX_OUTPUT_CHANNELS channels */ +#endif int16_t nchan_remapped; int32_t output_Fs; AUDIO_CONFIG output_config; @@ -848,6 +872,9 @@ ivas_error ivas_jbm_dec_render( for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAPaa + output[n] = st_ivas->p_output_f[n]; +#endif p_output[n] = &output[n][0]; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 442b1336116ea8ff87c6b112c546e65fb1c33edc..1b1c65e0e471cfc4582d99edc2974e917fd1f77a 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -917,9 +917,13 @@ static ivas_error ivas_masa_dec_config( *-------------------------------------------------------------------*/ void ivas_masa_prerender( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: synthesized core-coder transport channels */ +#else float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels */ - const int16_t output_frame /* i : output frame length per channel */ +#endif + const int16_t output_frame /* i : output frame length per channel */ #ifdef CR_FIX_585_MASA_2TC_DTX_EXT , const int16_t nchan_remapped /* i : number of transports used in core */ diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 217d67d69358794394375112e9901dfefc54255a..d9d348c167dd795554db04c0c8c7d4547c820dea 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -36,6 +36,9 @@ #include "cnst.h" #include "prot.h" #include "ivas_prot.h" +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +#include "ivas_prot_rend.h" +#endif #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" @@ -67,7 +70,11 @@ static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[ static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering ); #endif +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], float *pcm_in[], float **pp_out_pcm, const int16_t output_frame ); +#else static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], float pcm_in[][L_FRAME48k], float **pp_out_pcm, const int16_t output_frame ); +#endif static int huff_read( Decoder_State *st, const int16_t ( *ht )[2] ); @@ -166,8 +173,12 @@ void ivas_mc_paramupmix_dec_read_BS( *------------------------------------------------------------------------*/ void ivas_mc_paramupmix_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[] /* i/o: synthesized core-coder transport channels */ +#else float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels */ +#endif ) { MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; @@ -482,10 +493,18 @@ void ivas_mc_paramupmix_dec( #endif } +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + for ( ch = first_empty_channel; ch < ivas_get_nchan_buffers_dec( st_ivas ); ch++ ) + { + set_f( output_f[ch], 0.0f, output_frame ); + } +#else for ( ch = first_empty_channel; ch < MAX_OUTPUT_CHANNELS; ch++ ) { set_f( output_f[ch], 0.0, L_FRAME48k ); } +#endif + pop_wmops(); return; @@ -1277,9 +1296,13 @@ static void ivas_mc_paramupmix_dec_sf( static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], /* i/o: SPAR Covar. decoder handle */ - float pcm_in[][L_FRAME48k], /* i : input audio channels */ - float **pp_out_pcm, /* o : output audio channels */ - const int16_t output_frame /* i : output frame length */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *pcm_in[], /* i : input audio channels */ +#else + float pcm_in[][L_FRAME48k], /* i : input audio channels */ +#endif + float **pp_out_pcm, /* o : output audio channels */ + const int16_t output_frame /* i : output frame length */ ) { int16_t j, k; diff --git a/lib_dec/ivas_mct_core_dec.c b/lib_dec/ivas_mct_core_dec.c index 8309c9874dea415cf4288a06c88f2bafd2903eac..57ed6c7d1c31fed413f6e9615a3794565865122d 100644 --- a/lib_dec/ivas_mct_core_dec.c +++ b/lib_dec/ivas_mct_core_dec.c @@ -165,7 +165,11 @@ void ivas_mct_core_dec( MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */ const int16_t nCPE, /* i : number of CPEs */ - float signal_out[][L_FRAME48k] /* o : synthesis @internal_FS */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *signal_out[] /* o : synthesis @internal_FS */ +#else + float signal_out[][L_FRAME48k] /* o : synthesis @internal_FS */ +#endif ) { int16_t i, k, ch, cpe_id, nChannels; @@ -217,8 +221,13 @@ void ivas_mct_core_dec( { /* Initialization or re-configuration of Stereo TCX */ sts[ch]->enablePlcWaveadjust = 0; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + x[ch][0] = signal_out[ch]; + x[ch][1] = signal_out[ch] + ( L_FRAME48k / 2 ); +#else x[ch][0] = &signal_out[ch][0]; x[ch][1] = &signal_out[ch][0] + L_FRAME48k / 2; +#endif } /*--------------------------------------------------------------------------------* diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 31ae09fd3bbc15ee9f0437a148203164dc18e1e4..9513ff9db2028a2cf1cbf943747cc315e30047ba 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -63,8 +63,12 @@ static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamp *--------------------------------------------------------------------------*/ ivas_error ivas_mct_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output[][L_FRAME48k], /* o : output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* o : output synthesis signal */ +#else + float output[][L_FRAME48k], /* o : output synthesis signal */ +#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t nb_bits_metadata /* i : number of metadata bits */ ) @@ -82,6 +86,9 @@ ivas_error ivas_mct_dec( STnsData tnsData[MCT_MAX_BLOCKS][CPE_CHANNELS][2]; Decoder_State **sts; float synth[CPE_CHANNELS][L_FRAME_PLUS]; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float output_lfe_ch[L_FRAME48k]; +#endif int32_t ivas_total_brate; ivas_error error; @@ -93,6 +100,14 @@ ivas_error ivas_mct_dec( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + 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 ); + } +#endif + 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 */ @@ -143,8 +158,13 @@ ivas_error ivas_mct_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + x[n][0] = output[n + cpe_id * CPE_CHANNELS]; + x[n][1] = output[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); +#else x[n][0] = &output[n + cpe_id * CPE_CHANNELS][0]; x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; +#endif set_zero( x[n][0], L_FRAME48k / 2 ); set_zero( x[n][1], L_FRAME48k / 2 ); } @@ -182,8 +202,13 @@ ivas_error ivas_mct_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + x[n][0] = output[n + cpe_id * CPE_CHANNELS]; + x[n][1] = output[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); +#else x[n][0] = &output[n + cpe_id * CPE_CHANNELS][0]; x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; +#endif } ivas_mdct_core_tns_ns( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 ); @@ -203,8 +228,13 @@ ivas_error ivas_mct_dec( { for ( n = 0; n < CPE_CHANNELS; n++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + 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 ); +#else x_all[n + cpe_id * CPE_CHANNELS][0] = &output[n + cpe_id * CPE_CHANNELS][0]; x_all[n + cpe_id * CPE_CHANNELS][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; +#endif } } @@ -218,8 +248,13 @@ ivas_error ivas_mct_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + x[n][0] = output[n + cpe_id * CPE_CHANNELS]; + x[n][1] = output[n + cpe_id * CPE_CHANNELS] + ( L_FRAME48k / 2 ); +#else x[n][0] = &output[n + cpe_id * CPE_CHANNELS][0]; x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; +#endif } ivas_mdct_core_reconstruct( hCPE, x, synth, fUseTns[cpe_id], 1 ); @@ -282,6 +317,7 @@ ivas_error ivas_mct_dec( } #endif } + /* 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 ) ) { @@ -295,7 +331,13 @@ ivas_error ivas_mct_dec( mvr2r( output[n - 1], output[n + 1], output_frame ); } mvr2r( tmp, output[LFE_CHANNEL - 1], output_frame ); +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + + /* save LFE channel */ + mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); +#else set_zero( output[LFE_CHANNEL], output_frame ); +#endif } #ifdef DEBUG_MODE_INFO diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index 9937c9b8553d52bba2ca012cfeedfcdb5ef8e8fa..f823f2563e2053d5ec3de251a175e24c1c821f5e 100755 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -84,9 +84,13 @@ ivas_error ivas_mono_dmx_renderer_open( *------------------------------------------------------------------------*/ void ivas_mono_downmix_render_passive( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: synthesized core-coder transport channels/mono output */ +#else float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/mono output */ - const int16_t output_frame /* i : output frame length */ +#endif + const int16_t output_frame /* i : output frame length */ ) { int16_t i, j, numInputChannels; @@ -152,9 +156,13 @@ void ivas_mono_downmix_render_passive( *------------------------------------------------------------------------*/ void ivas_mono_stereo_downmix_mcmasa( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: synthesized core-coder transport channels/mono or stereo output */ +#else float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/mono or stereo output */ - int16_t output_frame /* i : output frame length per channel */ +#endif + int16_t output_frame /* i : output frame length per channel */ ) { int16_t i; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index acbde108f128a5b6359150742a4e4d28ef3c1424..9ae1ff1cb3edcd566643c01e1cfe32cf9e097f54 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -170,6 +170,9 @@ ivas_error ivas_omasa_dec_config( int32_t ivas_total_brate, ism_total_brate, cpe_brate; ISM_MODE ism_mode_old; IVAS_FORMAT ivas_format_orig; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + int16_t nchan_out_buff, nchan_out_buff_old; +#endif ivas_error error; RENDERER_TYPE old_renderer_type; @@ -184,6 +187,9 @@ ivas_error ivas_omasa_dec_config( ivas_format_orig = st_ivas->ivas_format; st_ivas->ivas_format = st_ivas->last_ivas_format; ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas ); +#endif st_ivas->ivas_format = ivas_format_orig; nSCE_old = st_ivas->nSCE; @@ -405,6 +411,37 @@ ivas_error ivas_omasa_dec_config( { return error; } + +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + /*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ + + if ( !st_ivas->hDecoderConfig->voip_active ) + { + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas ); + + if ( nchan_out_buff > nchan_out_buff_old ) + { + for ( k = nchan_out_buff_old; k < nchan_out_buff; k++ ) + { + /* note: these are intra-frame heap memories */ + if ( ( st_ivas->p_output_f[k] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) /* note: 32000 == max internal sampling rate */ + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); + } + } + } + else + { + for ( k = nchan_out_buff; k < nchan_out_buff_old; k++ ) + { + free( st_ivas->p_output_f[k] ); + st_ivas->p_output_f[k] = NULL; + } + } + } +#endif } return IVAS_ERR_OK; @@ -584,9 +621,13 @@ ivas_error ivas_omasa_ism_metadata_dec( *--------------------------------------------------------------------------*/ void ivas_omasa_dirac_rend( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* o : output synthesis signal */ +#else float output[][L_FRAME48k], /* o : output synthesis signal */ - const int16_t output_frame /* i : output frame length per channel */ +#endif + const int16_t output_frame /* i : output frame length per channel */ ) { int16_t n, dirac_read_idx; @@ -652,9 +693,13 @@ void ivas_omasa_dirac_rend_jbm( *--------------------------------------------------------------------------*/ ivas_error ivas_omasa_dirac_td_binaural( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* o : output synthesis signal */ +#else float output[][L_FRAME48k], /* o : output synthesis signal */ - const int16_t output_frame /* i : output frame length per channel */ +#endif + const int16_t output_frame /* i : output frame length per channel */ ) { int16_t n; @@ -751,4 +796,35 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( return IVAS_ERR_OK; } + + +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +/*--------------------------------------------------------------------------* + * ivas_omasa_rearrange_channels() + * + * in case of external rendering, rearrange the channels order + *--------------------------------------------------------------------------*/ + +void ivas_omasa_rearrange_channels( + float *output[], /* o : output synthesis signal */ + const int16_t nchan_transport_ism, /* o : number of ISM TCs */ + const int16_t output_frame /* i : output frame length per channel */ +) +{ + int16_t n; + float tmp_buff[CPE_CHANNELS][L_FRAME48k]; + + mvr2r( output[0], tmp_buff[0], output_frame ); + mvr2r( output[1], tmp_buff[1], output_frame ); + + for ( n = 0; n < nchan_transport_ism; n++ ) + { + mvr2r( output[CPE_CHANNELS + n], output[n], output_frame ); + } + mvr2r( tmp_buff[0], output[n], output_frame ); + mvr2r( tmp_buff[1], output[++n], output_frame ); + + return; +} +#endif #endif diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 09a6bd27c87116e16d1b417738d66ca0afc57132..c324de82568aba44b7c766c0a922532f9e58b80e 100755 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -140,9 +140,13 @@ ivas_error ivas_sba_ism_separate_object_renderer_open( *--------------------------------------------------------------------------*/ ivas_error ivas_osba_dirac_td_binaural( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output[][L_FRAME48k], /* o : output synthesis signal */ - const int16_t output_frame /* i : output frame length per channel */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* o : output synthesis signal */ +#else + float output[][L_FRAME48k], /* o : output synthesis signal */ +#endif + const int16_t output_frame /* i : output frame length per channel */ ) { int16_t n; @@ -297,9 +301,13 @@ ivas_error ivas_osba_ism_metadata_dec( *-------------------------------------------------------------------------*/ void ivas_osba_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: core-coder transport channels/object output */ +#else float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ - const int16_t output_frame /* i : output frame length per channel */ +#endif + const int16_t output_frame /* i : output frame length per channel */ ) { float tmp_ism_out[MAX_OUTPUT_CHANNELS][L_FRAME48k]; diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index 153764c98a97457fc5c600c42e30e26d82b04991..f93f6fb2f55eaf9a09a1dcb2b241a003eb69b96a 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -559,8 +559,12 @@ void ivas_ls_setup_conversion( *-------------------------------------------------------------------------*/ void ivas_ls_setup_conversion_process_mdct( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[] /* i/o: output synthesis signal */ +#else float output[][L_FRAME48k] /* i/o: output synthesis signal */ +#endif ) { /* Declaration of all required variables */ @@ -592,8 +596,13 @@ void ivas_ls_setup_conversion_process_mdct( /* Assign output pointer to variable x */ for ( chInIdx = 0; chInIdx < inChannels; chInIdx++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + x[chInIdx][0] = output[chInIdx]; + x[chInIdx][1] = output[chInIdx] + ( L_FRAME48k / 2 ); +#else x[chInIdx][0] = &output[chInIdx][0]; x[chInIdx][1] = &output[chInIdx][0] + L_FRAME48k / 2; +#endif } /* Assign all the declared handles*/ diff --git a/lib_dec/ivas_pca_dec.c b/lib_dec/ivas_pca_dec.c index e73b3aa1d61f6025322a0913b7b8ea964680ab23..9e5cb019916f0dfd1ee815a0da53f2ed3b0790e1 100644 --- a/lib_dec/ivas_pca_dec.c +++ b/lib_dec/ivas_pca_dec.c @@ -92,7 +92,11 @@ static void pca_dec_reset_mem_eigvec( static void pca_inv_transform_sub( float *eigVec, +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *transformed_data[], /* i : input/transformed audio channels */ +#else float transformed_data[][L_FRAME48k], /* i : input/transformed audio channels */ +#endif const int16_t start, const int16_t len, const int16_t n_channels ) @@ -129,7 +133,11 @@ static void pca_dec_inv_transform( float *qr, const int16_t n_samples, const int16_t n_channels, +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *decoded_data[] ) +#else float decoded_data[][L_FRAME48k] ) +#endif { int16_t j; int16_t slot_len; @@ -224,7 +232,11 @@ void ivas_pca_dec( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int32_t last_ivas_total_brate, /* i : last IVAS total bitrate */ const int16_t bfi, /* i : bad frame indicator */ - float pcm_out[][L_FRAME48k] /* o : output audio channels */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *pcm_out[] /* o : output audio channels */ +#else + float pcm_out[][L_FRAME48k] /* o : output audio channels */ +#endif ) { float ql[IVAS_PCA_INTERP], qr[IVAS_PCA_INTERP]; diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index b63bc6af9d028e5dd506946e053b4ab05cccabac..23c8a5a09ed98c26ffc21ecaca09aa0ab9bbf090 100755 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -53,13 +53,17 @@ *-------------------------------------------------------------------------*/ void ivas_post_proc( - SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const int16_t n, /* i : channel number */ - float synth[], /* i/o: output synthesis signal */ + SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const int16_t n, /* i : channel number */ + float synth[], /* i/o: output synthesis signal */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ - const int16_t output_frame, /* i : output frame length */ - const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ +#endif + const int16_t output_frame, /* i : output frame length */ + const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ) { #ifndef DEBUG_STEREO_DFT_NOCORE diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 7334ea49791768b027ecaaed5dd342190f128bf7..52135acfb55b76f85764a9aa0163b0ea2418b9a1 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -113,7 +113,9 @@ ivas_error ivas_sba_dec_reconfigure( #ifdef VLBR_20MS_MD int16_t num_channels, num_md_sub_frames; #endif - +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + int16_t ch, nchan_out_buff, nchan_out_buff_old; +#endif DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; #ifdef OSBA_BR_SWITCHING @@ -156,11 +158,14 @@ ivas_error ivas_sba_dec_reconfigure( nCPE_old = st_ivas->nCPE; nchan_transport_old = st_ivas->nchan_transport; sba_dirac_stereo_flag_old = st_ivas->sba_dirac_stereo_flag; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas ); +#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); /* save old */ - if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) + if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) // ToDo; this never happens { st_ivas->hTcBuffer->num_slots = st_ivas->hSpar->num_slots; st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpar->nb_subframes; @@ -522,6 +527,37 @@ ivas_error ivas_sba_dec_reconfigure( } } +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + /*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ + + if ( !st_ivas->hDecoderConfig->voip_active ) + { + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas ); + + if ( nchan_out_buff > nchan_out_buff_old ) + { + for ( ch = nchan_out_buff_old; ch < nchan_out_buff; ch++ ) + { + /* note: these are intra-frame heap memories */ + if ( ( st_ivas->p_output_f[ch] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) /* note: 32000 == max internal sampling rate */ + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); + } + } + } + else + { + for ( ch = nchan_out_buff; ch < nchan_out_buff_old; ch++ ) + { + free( st_ivas->p_output_f[ch] ); + st_ivas->p_output_f[ch] = NULL; + } + } + } +#endif + return error; } diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 1b12db0e6d2511b30709fa1cebc8df6ce84426ae..5a6875ecf753325630987ac861fccf09fd93a170 100755 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -609,10 +609,14 @@ static void ivas_sba_dirac_stereo_upmix_hb( *-------------------------------------------------------------------*/ static void ivas_sba_dirac_stereo_apply_td_stefi( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t spar_flag /* i : SPAR flag */ +#endif + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t spar_flag /* i : SPAR flag */ ) { int16_t i; @@ -821,10 +825,14 @@ void ivas_sba_dirac_stereo_smooth_parameters( *-------------------------------------------------------------------*/ void ivas_sba_dirac_stereo_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t mcmasa /* i : McMASA flag */ +#endif + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t mcmasa /* i : McMASA flag */ ) { int16_t dtx_flag, fd_cng_flag; diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index c0d40f88230c3f082001ca8b9ab45a7daf47b863..84f5df812e105a1276bb912f54ccb7cf6da72041 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -220,9 +220,13 @@ void ivas_mc2sba( *-------------------------------------------------------------------*/ int16_t ivas_sba_remapTCs( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *sba_data[], /* i/o: SBA signals */ +#else float sba_data[][L_FRAME48k], /* i/o: SBA signals */ - Decoder_Struct *st_ivas, /* i/o: decoder struct */ - const int16_t output_frame /* i : frame length */ +#endif + Decoder_Struct *st_ivas, /* i/o: decoder struct */ + const int16_t output_frame /* i : frame length */ ) { int16_t nchan_remapped; @@ -388,12 +392,19 @@ void ivas_ism2sba_sf( *-------------------------------------------------------------------*/ void ivas_sba_upmixer_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ - float output[][L_FRAME48k], /* i/o: transport/output audio channels */ - const int16_t output_frame /* i : output frame length */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: transport/output audio channels */ +#else + float output[][L_FRAME48k], /* i/o: transport/output audio channels */ +#endif + const int16_t output_frame /* i : output frame length */ ) { int16_t nchan_internal; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + int16_t sba_ch_idx; +#endif push_wmops( "ivas_sba_upmixer_renderer" ); @@ -416,13 +427,24 @@ void ivas_sba_upmixer_renderer( output_config = ( st_ivas->ivas_format == SBA_ISM_FORMAT ? st_ivas->hOutSetup.output_config : st_ivas->hDecoderConfig->output_config ); #endif #ifdef SBA_AND_OBJECTS +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + sba_ch_idx = 0; + if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + sba_ch_idx = st_ivas->nchan_ism; + } + + for ( ch = 0; ch < ivas_get_nchan_buffers_dec( st_ivas ) - sba_ch_idx; ch++ ) +#else for ( ch = 0; ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; ch++ ) +#endif #else for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) #endif { output_f[ch] = output[ch]; } + #ifdef SBA_AND_OBJECTS ivas_sba_linear_renderer( output_f, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, #ifdef SBA_AND_OBJECTS @@ -607,8 +629,12 @@ ivas_error ivas_sba_linear_renderer( *-------------------------------------------------------------------*/ void ivas_sba_mix_matrix_determiner( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - float output[][L_FRAME48k], /* i/o: transport/output audio channels */ + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: transport/output audio channels */ +#else + float output[][L_FRAME48k], /* i/o: transport/output audio channels */ +#endif 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 */ diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 57b3c3c5afabc19e7a5c6e36b51a626e8d7c5816..2a78d742b309297e64917418e9e9e80a866d0328 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -52,9 +52,13 @@ *--------------------------------------------------------------------------*/ ivas_error ivas_sce_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t sce_id, /* i : SCE # identifier */ - float output[1][L_FRAME48k], /* o : output synthesis signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t sce_id, /* i : SCE # identifier */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[1], /* o : output synthesis signal */ +#else + float output[1][L_FRAME48k], /* o : output synthesis signal */ +#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t nb_bits_metadata /* i : number of metadata bits */ ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 3695bf7bd08b1989bf406e137333e3e4da119c49..00dfe6730dc5d53f0a359e5cec1da37f92081dbc 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1148,9 +1148,13 @@ static void ivas_spar_calc_smooth_facs( *-------------------------------------------------------------------*/ void ivas_spar_dec_agc_pca( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: input/output audio channels */ +#else float output[][L_FRAME48k], /* i/o: input/output audio channels */ - const int16_t output_frame /* i : output frame length */ +#endif + const int16_t output_frame /* i : output frame length */ ) { int16_t nchan_transport; @@ -1360,8 +1364,12 @@ void ivas_spar_dec_digest_tc( *-------------------------------------------------------------------*/ void ivas_spar_dec_upmixer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output[][L_FRAME48k], /* i/o: input/output audio channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: input/output audio channels */ +#else + float output[][L_FRAME48k], /* i/o: input/output audio channels */ +#endif const int16_t nchan_internal, /* i : number of internal channels */ const int16_t output_frame /* i : output frame length */ ) @@ -1382,7 +1390,11 @@ void ivas_spar_dec_upmixer( for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + output_f_local[n] = output[n]; +#else output_f_local[n] = &output[n][0]; +#endif } for ( n = 0; n < nchan_internal; n++ ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index c785ecff98a2c8d149e9de5682b261249061bbaa..891f49d812609f74f5604e239d9b7d9602e0c9f9 100755 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1023,6 +1023,10 @@ typedef struct Decoder_Struct float **mem_hp20_out; /* output signals HP filter memories */ IVAS_LIMITER_HANDLE hLimiter; /* Limiter handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *p_output_f[MAX_OUTPUT_CHANNELS+MAX_NUM_OBJECTS]; /* floating-point output audio buffers */ +#endif + /* core-decoder modules */ int16_t nSCE; /* number of total SCEs */ int16_t nCPE; /* number of total CPEs */ diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index c674f8bec9115d8a517b44433c9e1cce4f43e750..c823c7e28ba7b2ccc9950e215d0ed44a6d0ddf4a 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -759,10 +759,14 @@ void stereo_cng_dec_update( *-------------------------------------------------------------------*/ void stereo_cng_compute_PScorr( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i : Output signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i : Output signal */ - float *c_PS_LT, /* i/o: Correlation */ - const int16_t L_frame_0, /* i : L_frame channel 0 */ - const int16_t L_frame_1 /* i : L_frame channel 1 */ +#endif + float *c_PS_LT, /* i/o: Correlation */ + const int16_t L_frame_0, /* i : L_frame channel 0 */ + const int16_t L_frame_1 /* i : L_frame channel 1 */ ) { int16_t i; @@ -815,10 +819,14 @@ void stereo_cng_compute_PScorr( *-------------------------------------------------------------------*/ static void stereo_cng_compute_LRcorr( - CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i : Output signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i : Output signal */ - const int16_t output_frame, /* i : Output frame length */ - const int16_t tdm_ratio_idx /* i : TDM ratio index */ +#endif + const int16_t output_frame, /* i : Output frame length */ + const int16_t tdm_ratio_idx /* i : TDM ratio index */ ) { int16_t i; @@ -904,10 +912,14 @@ static void FindEmEs( *-------------------------------------------------------------------*/ void stereo_cna_update_params( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i : Output signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i : Output signal */ - const int16_t output_frame, /* i : Output frame length */ - const int16_t tdm_ratio_idx /* i : TDM ratio index */ +#endif + const int16_t output_frame, /* i : Output frame length */ + const int16_t tdm_ratio_idx /* i : TDM ratio index */ ) { int16_t i; diff --git a/lib_dec/ivas_stereo_ica_dec.c b/lib_dec/ivas_stereo_ica_dec.c index 02b81a8c264420ac72e93ddd4d63b0123dc64395..461611c87c2e97158dc5e61a65bbfb729a0d01bb 100644 --- a/lib_dec/ivas_stereo_ica_dec.c +++ b/lib_dec/ivas_stereo_ica_dec.c @@ -54,9 +54,13 @@ * ---------------------------------------------------------------*/ void stereo_tca_dec( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *synth[CPE_CHANNELS], /* i/o: output synth */ +#else float synth[CPE_CHANNELS][L_FRAME48k], /* i/o: output synth */ - const int16_t output_frame /* i : length of a frame per channel */ +#endif + const int16_t output_frame /* i : length of a frame per channel */ ) { /* Buffers, input Left and right channels @ input_Fs*/ @@ -266,8 +270,12 @@ void stereo_tca_dec( *-------------------------------------------------------------------*/ void stereo_tca_scale_R_channel( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - float output[L_FRAME48k], /* i/o: output synthesis, R channel */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output, /* i/o: output synthesis, R channel */ +#else + float output[L_FRAME48k], /* i/o: output synthesis, R channel */ +#endif const int16_t output_frame /* i : frame length */ ) { diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index ae952d237e8cc69f825e75927eff1289f056c788..d60dcef17caecf9e55775d8021a55c1dd5413173 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -515,8 +515,12 @@ void stereo_icBWE_dec( *-------------------------------------------------------------------*/ void stereo_icBWE_decproc( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: output synthesis */ +#else + float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis */ +#endif 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 */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 325ec91b0b4ce1b31c69fbdb3170cb0fa106be9f..2c541768e98470aca41642cf3a439a1c94e3ce00 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -139,9 +139,13 @@ static void stereo_mdct_dec_stereo( *--------------------------------------------------------------------*/ void stereo_mdct_core_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - float signal_out[CPE_CHANNELS][L_FRAME48k], /* o : synthesis @internal_FS */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *signal_out[CPE_CHANNELS], /* o : synthesis @internal_FS */ +#else + float signal_out[CPE_CHANNELS][L_FRAME48k], /* o : synthesis @internal_FS */ +#endif float signal_outFB[CPE_CHANNELS][L_FRAME48k] /* o : synthesis @output_FS */ ) { diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index 76f740d6c6f4cf24bbdc1dded6b083f345eba3d4..650cb827ce155b1cfc2e96b6db5dd4ce8a1438d1 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -552,10 +552,14 @@ void synchonize_channels_mdct_sid( *-------------------------------------------------------------------*/ void updateBuffersForDmxMdctStereo( - CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ - const int16_t output_frame, /* i : output frame length */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ + const int16_t output_frame, /* i : output frame length */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: decoder output */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: decoder output */ - float synth[CPE_CHANNELS][L_FRAME48k] /* i/o: decoder synthesis */ +#endif + float synth[CPE_CHANNELS][L_FRAME48k] /* i/o: decoder synthesis */ ) { int16_t delay_buf_out_len, tcxltp_mem_in_len, delta, i; @@ -634,9 +638,13 @@ void updateBuffersForDmxMdctStereo( *-------------------------------------------------------------------*/ void applyDmxMdctStereo( - const CPE_DEC_HANDLE hCPE, /* i : CPE handle */ + const CPE_DEC_HANDLE hCPE, /* i : CPE handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: core decoder output */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: core decoder output */ - const int16_t output_frame /* i : output frame length */ +#endif + const int16_t output_frame /* i : output frame length */ ) { int16_t crossfade_len, i; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 4a4bb5ad14f8628091fe246ba98c932b0571c5ee..8b8a9b89de9f876261bb5c72941fbde9e887eb10 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -1016,11 +1016,15 @@ ivas_error stereo_memory_dec( *-------------------------------------------------------------------*/ void synchro_synthesis( - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: output synthesis signal */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ - const int16_t output_frame, /* i : Number of samples */ - const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ +#endif + const int16_t output_frame, /* i : Number of samples */ + const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ) { int16_t n, delay_comp_TD, delay_comp_DFT; @@ -1794,9 +1798,13 @@ static float ncross_corr_self( #define DFT2TD_CORR_THRESH 0.9f void smooth_dft2td_transition( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[CPE_CHANNELS], /* i/o: synthesis @external Fs */ +#else float output[CPE_CHANNELS][L_FRAME48k], /* i/o: synthesis @external Fs */ - const int16_t output_frame /* i : output frame lenght */ +#endif + const int16_t output_frame /* i : output frame lenght */ ) { Decoder_State **sts; diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 9f4b3b76943aa7487a95eb3cff2fb1052fa425f7..35e5926ecca444e4a33d6348c55866c00847cb6d 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -286,13 +286,17 @@ void ivas_dirac_enc( DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: SBA channels */ - float **ppIn_FR_real, /* o : real freq domain values */ - float **ppIn_FR_imag, /* o : imag freq domain values */ - const int16_t input_frame, /* i : input frame length */ - const int16_t dtx_vad, /* i : DTX vad flag */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - int16_t hodirac_flag ) /* i : hodirac flag */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i/o: SBA channels */ +#else + float data_f[][L_FRAME48k], /* i/o: SBA channels */ +#endif + float **ppIn_FR_real, /* o : real freq domain values */ + float **ppIn_FR_imag, /* o : imag freq domain values */ + const int16_t input_frame, /* i : input frame length */ + const int16_t dtx_vad, /* i : DTX vad flag */ + const IVAS_FORMAT ivas_format, /* i : ivas format */ + int16_t hodirac_flag ) /* i : hodirac flag */ { int16_t orig_dirac_bands; float dir[3], avg_dir[3]; @@ -604,7 +608,11 @@ void ivas_dirac_param_est_enc( DIRAC_ENC_HANDLE hDirAC, IVAS_QDIRECTION *q_direction, const uint8_t useLowerRes, +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], +#else float data_f[][L_FRAME48k], +#endif float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame, @@ -669,7 +677,11 @@ void ivas_dirac_param_est_enc( /* Copy current frame to memory for delay compensation */ for ( i = 0; i < nchan_fb_in; i++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + pcm_in[i] = data_f[i]; +#else pcm_in[i] = &data_f[i][0]; +#endif p_Cldfb_RealBuffer[i] = &Cldfb_RealBuffer[i][0]; p_Cldfb_ImagBuffer[i] = &Cldfb_ImagBuffer[i][0]; } diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c old mode 100755 new mode 100644 index 85738e1e003bf4ab99cd542e1e044a2b16d16dc8..0fbc02585cc90dbf432c2e154624ccb9c52a1331 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -67,9 +67,17 @@ ivas_error ivas_enc( int16_t nb_bits_metadata[MAX_SCE]; #endif #ifdef SBA_AND_OBJECTS +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS]; +#else float data_f[MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; +#endif +#else +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[MAX_INPUT_CHANNELS]; #else float data_f[MAX_INPUT_CHANNELS][L_FRAME48k]; +#endif #endif int32_t ivas_total_brate; ivas_error error; @@ -101,6 +109,13 @@ ivas_error ivas_enc( * convert 'short' input data to 'float' *----------------------------------------------------------------*/ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + for ( n = 0; n < MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) + { + data_f[n] = st_ivas->p_data_f[n]; + } +#endif + n = 0; while ( n < nchan_inp ) { @@ -242,6 +257,7 @@ ivas_error ivas_enc( if ( st_ivas->hQMetaData != NULL && ivas_format != SBA_FORMAT ) { ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ + if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -296,7 +312,11 @@ ivas_error ivas_enc( #ifdef MASA_AND_OBJECTS else if ( ivas_format == MASA_ISM_FORMAT ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_separated_object; +#else float data_separated_object[L_FRAME48k]; +#endif int16_t idx_separated_object; int16_t flag_omasa_ener_brate; @@ -309,7 +329,6 @@ ivas_error ivas_enc( mvr2r( data_f[hEncoderConfig->nchan_ism], data_f[hEncoderConfig->nchan_ism + 1], input_frame ); } - /* Estimate TF-tile energy for the input MASA stream */ ivas_masa_estimate_energy( st_ivas->hMasa, &( data_f[hEncoderConfig->nchan_ism] ), input_frame, st_ivas->nchan_transport ); @@ -320,7 +339,9 @@ ivas_error ivas_enc( set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); idx_separated_object = 0; - +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + data_separated_object = data_f[hEncoderConfig->nchan_ism + CPE_CHANNELS]; +#endif /* put audio object data in SCE's */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 93dc83e83cc493fdf2553cd4fb404694df55c8f7..8e03a40bccd055bfa2cdba230b3545aabbe2e6d4 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -383,6 +383,9 @@ ivas_error ivas_init_encoder( ) { int16_t i, n; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + int16_t nchan_inp_buff; +#endif int16_t sce_id, cpe_id; IVAS_FORMAT ivas_format; int32_t input_Fs, ivas_total_brate; @@ -408,6 +411,36 @@ ivas_error ivas_init_encoder( st_ivas->nchan_transport = -1; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + /*-----------------------------------------------------------------* + * Allocate floating-point input audio buffers + *-----------------------------------------------------------------*/ + + nchan_inp_buff = hEncoderConfig->nchan_inp; + if ( ivas_format == MASA_ISM_FORMAT ) + { + if ( hEncoderConfig->nchan_inp - hEncoderConfig->nchan_ism == 1 ) /* mono is duplicated in monoMASA */ + { + nchan_inp_buff++; + } + + nchan_inp_buff++; /* for *data_separated_object */ + } + + for ( n = 0; n < nchan_inp_buff; n++ ) + { + /* note: these are intra-frame heap memories */ + if ( ( st_ivas->p_data_f[n] = (float *) malloc( ( input_Fs / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point input audio buffer!\n" ) ); + } + } + for ( ; n < MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) + { + st_ivas->p_data_f[n] = NULL; + } +#endif + /*-----------------------------------------------------------------* * Allocate and initialize buffer of indices *-----------------------------------------------------------------*/ @@ -753,8 +786,9 @@ ivas_error ivas_init_encoder( { st_ivas->mc_mode = ivas_mc_mode_select( hEncoderConfig->mc_input_setup, ivas_total_brate ); +#ifndef FIX_264_AUDIO_CHANNELS_TO_HEAP hEncoderConfig->nchan_inp = ivas_mc_ls_setup_get_num_channels( hEncoderConfig->mc_input_setup ); - +#endif if ( ( error = ivas_create_lfe_lpf_enc( &st_ivas->hLfeLpf, hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) { return error; @@ -1208,6 +1242,18 @@ void ivas_destroy_enc( free( st_ivas->ind_list_metadata ); } +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + /* floating-point input audio buffers */ + for ( n = 0; n < MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) + { + if ( st_ivas->p_data_f[n] != NULL ) + { + free( st_ivas->p_data_f[n] ); + st_ivas->p_data_f[n] = NULL; + } + } +#endif + /* main IVAS handle */ free( st_ivas ); diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 5b95543061e2947c7793d566c2214e5b9a5be312..e2268ecc617bcaac89241ac75583af80faa9c521 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -49,10 +49,14 @@ *-------------------------------------------------------------------*/ ivas_error ivas_ism_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data[MAX_NUM_OBJECTS], /* i : input signal */ +#else float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i : input signal */ - const int16_t input_frame, /* i : input frame length per channel */ - int16_t *nb_bits_metadata /* i : number of metadata bits */ +#endif + const int16_t input_frame, /* i : input frame length per channel */ + int16_t *nb_bits_metadata /* i : number of metadata bits */ #ifdef MASA_AND_OBJECTS , const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 7c99c491844d1622f27d41f07c057abe9167bfa8..b6d0d4b3fe4debf93491b0b655459db52a02cfea 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -213,9 +213,13 @@ static void ivas_param_ism_enc_quantize_DOA( *-------------------------------------------------------------------------*/ void ivas_param_ism_stereo_dmx( - Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ + Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data[MAX_NUM_OBJECTS], /* i/o: input signal/stereo dmx */ +#else float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i/o: input signal/stereo dmx */ - const int16_t input_frame /* i : Length of input frame */ +#endif + const int16_t input_frame /* i : Length of input frame */ ) { int16_t i, j; @@ -440,9 +444,13 @@ void ivas_param_ism_enc_close( *-------------------------------------------------------------------------*/ void ivas_param_ism_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data[MAX_NUM_OBJECTS], /* i : input signal */ +#else float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i : input signal */ - const int16_t input_frame /* i : input frame length per channel */ +#endif + const int16_t input_frame /* i : input frame length per channel */ ) { int16_t i, j, ts, l_ts; @@ -468,7 +476,11 @@ void ivas_param_ism_enc( for ( i = 0; i < nchan_ism; i++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + pcm_in[i] = data[i]; +#else pcm_in[i] = &data[i][0]; +#endif set_zero( fb_RealBuffer[i], DIRAC_NO_FB_BANDS_MAX ); set_zero( fb_ImagBuffer[i], DIRAC_NO_FB_BANDS_MAX ); diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index cbc5b145728e9ac00d57e2486a5d140be9826e04..1b4d8ee4011ba1379eae10d55a490662e117cf47 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -717,8 +717,12 @@ ivas_error ivas_masa_encode( *-----------------------------------------------------------------------*/ void ivas_masa_estimate_energy( - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ - float data_f[][L_FRAME48k], /* i : Input audio channels */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input audio channels */ +#else + float data_f[][L_FRAME48k], /* i : Input audio channels */ +#endif const int16_t input_frame, /* i : frame length */ const int16_t nchan_transport /* i : number of MASA input/transport channels */ ) @@ -3957,8 +3961,13 @@ static void ivas_encode_masaism_metadata( void ivas_merge_masa_transports( float data_in_f1[][L_FRAME48k], +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_in_f2[], + float *data_out_f[], +#else float data_in_f2[][L_FRAME48k], float data_out_f[][L_FRAME48k], +#endif const int16_t input_frame, const int16_t num_transport_channels ) { diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 2979a9bdb5621ab83df96f06ec98553b9d99269d..8722b67ab36f7e9700572fa0507324ff3c6d56f1 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -54,9 +54,15 @@ * Local function prototypes *------------------------------------------------------------------------*/ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +static void ivas_param_mc_dmx( PARAM_MC_ENC_HANDLE hParamMC, float *data_f[], float data_dmx[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_input, const int16_t nchan_transport ); + +static void ivas_param_mc_param_est_enc( PARAM_MC_ENC_HANDLE hParamMC, float *data_f[], float Cy_sum[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], float Cx_sum[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], const int16_t input_frame, const int16_t nchan_input, const int16_t nchan_transport ); +#else static void ivas_param_mc_dmx( PARAM_MC_ENC_HANDLE hParamMC, float data_f[][L_FRAME48k], float data_dmx[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_input, const int16_t nchan_transport ); static void ivas_param_mc_param_est_enc( PARAM_MC_ENC_HANDLE hParamMC, float input_frame_t[][L_FRAME48k], float Cy_sum[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], float Cx_sum[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], const int16_t input_frame, const int16_t nchan_input, const int16_t nchan_transport ); +#endif static void ivas_param_mc_parameter_quantizer( const float *x, const int16_t L, const int16_t sz_quantizer, const float *quantizer, int16_t *quant_idx, float *y ); @@ -393,10 +399,14 @@ void ivas_param_mc_enc_close( *------------------------------------------------------------------------*/ void ivas_param_mc_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i/o: input/transport MC data */ +#else float data_f[][L_FRAME48k], /* i/o: input: MC data */ - const int16_t input_frame /* i : input frame length */ +#endif + const int16_t input_frame /* i : input frame length */ ) { int16_t k; @@ -574,7 +584,11 @@ void ivas_param_mc_enc( static void ivas_param_mc_dmx( PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ - float data_f[][L_FRAME48k], /* i : Input frame */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input frame */ +#else + float data_f[][L_FRAME48k], /* i : Input frame */ +#endif float data_dmx[][L_FRAME48k], /* o : Down mixed frame */ const int16_t input_frame, /* i : Input frame length */ const int16_t nchan_input, /* i : number of input channels */ @@ -614,8 +628,12 @@ static void ivas_param_mc_dmx( *------------------------------------------------------------------------*/ static void ivas_param_mc_param_est_enc( - PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ - float input_frame_t[][L_FRAME48k], /* i : Input frame in the time domain */ + PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input frame in the time domain */ +#else + float data_f[][L_FRAME48k], /* i : Input frame in the time domain */ +#endif float Cy_sum[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], /* o : Covariance matrix for the original frame */ float Cx_sum[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], /* o : Covariance matrix for the downmixed frame */ const int16_t input_frame, /* i : Input frame length */ @@ -673,7 +691,11 @@ static void ivas_param_mc_param_est_enc( for ( i = 0; i < nchan_input; i++ ) { idx_ls = map_ls[i]; - pcm_in[i] = &input_frame_t[idx_ls][0]; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + pcm_in[i] = data_f[idx_ls]; +#else + pcm_in[i] = &data_f[idx_ls][0]; +#endif p_slot_frame_f_real[i] = &slot_frame_f_real[i][0]; p_slot_frame_f_imag[i] = &slot_frame_f_imag[i][0]; } diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index 8c442a51c6d357c9d6dc597992901dc90da299aa..f572134ea37e5bb59011495b83e5e18712209992 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -53,9 +53,15 @@ * Local function prototypes *------------------------------------------------------------------------*/ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +static void ivas_mc_paramupmix_dmx( MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, float *data_f[], const int16_t input_frame ); + +static void ivas_mc_paramupmix_param_est_enc( MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, float *input_frame_t[], const int16_t input_frame, float alphas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS], float betas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS] ); +#else static void ivas_mc_paramupmix_dmx( MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, float data_f[][L_FRAME48k], const int16_t input_frame ); static void ivas_mc_paramupmix_param_est_enc( MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, float input_frame_t[][L_FRAME48k], const int16_t input_frame, float alphas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS], float betas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS] ); +#endif static void get_huff_table( const PAR_TYPE par_type, const QUANT_TYPE quant_type, HUFF_TAB *df0, HUFF_TAB *df, HUFF_TAB *dt ); @@ -79,10 +85,14 @@ static void quantize_pars( const int16_t nv, const float *v, const int16_t nq, c *------------------------------------------------------------------------*/ void ivas_mc_paramupmix_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hBStr, /* i/o: IVAS Metadata bitstream handle */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hBStr, /* i/o: IVAS Metadata bitstream handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i/o: input/transport MC data */ +#else float data_f[][L_FRAME48k], /* i/o: input: MC data */ - const int16_t input_frame /* i : input frame length */ +#endif + const int16_t input_frame /* i : input frame length */ ) { MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix; @@ -680,8 +690,12 @@ static void put_ec_data( static void ivas_mc_paramupmix_dmx( MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, /* i/o: MC ParamUpmix encoder handle */ - float data_f[][L_FRAME48k], /* i/o: Input, downmix out */ - const int16_t input_frame /* i : Input frame length */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i/o: Input, downmix out */ +#else + float data_f[][L_FRAME48k], /* i/o: Input, downmix out */ +#endif + const int16_t input_frame /* i : Input frame length */ ) { int16_t i, l; @@ -725,8 +739,12 @@ static void ivas_mc_paramupmix_dmx( static void ivas_mc_paramupmix_param_est_enc( MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ - float input_frame_t[][L_FRAME48k], /* i : Input frame in the time domain */ - const int16_t input_frame, /* i : Input frame length */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input frame in the time domain */ +#else + float data_f[][L_FRAME48k], /* i : Input frame in the time domain */ +#endif + const int16_t input_frame, /* i : Input frame length */ float alphas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS], float betas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS] ) { @@ -753,8 +771,8 @@ static void ivas_mc_paramupmix_param_est_enc( for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { - pcm_in[2 * i] = input_frame_t[chan1s[i]]; - pcm_in[2 * i + 1] = input_frame_t[chan2s[i]]; + pcm_in[2 * i] = data_f[chan1s[i]]; + pcm_in[2 * i + 1] = data_f[chan2s[i]]; } /*-----------------------------------------------------------------------------------------* diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 2088fa7dced6d935dc4c09eede50c3caa9c6ddcc..7e7e816d7c3c9bfc4372f18eb2ad46d457689bbe 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -65,7 +65,11 @@ typedef struct float xi[MCMASA_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; } CovarianceMatrix; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +static void ivas_mcmasa_dmx( MCMASA_ENC_HANDLE hMcMasa, float *data_f[], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_inp ); +#else static void ivas_mcmasa_dmx( MCMASA_ENC_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][DIRAC_NO_FB_BANDS_MAX], float si[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], const int16_t freq, const int16_t N, CovarianceMatrix *COVls ); @@ -75,7 +79,11 @@ static void computeVerticalDiffuseness( float **buffer_intensity, const float *b static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, const int16_t numChannels ); +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +static void computeLfeEnergy( MCMASA_ENC_HANDLE hMcMasa, float *data_f[], const int16_t input_frame ); +#else static void computeLfeEnergy( MCMASA_ENC_HANDLE hMcMasa, float data_f[][L_FRAME48k], const int16_t input_frame ); +#endif /*--------------------------------------------------------------------------* @@ -555,13 +563,18 @@ void ivas_mcmasa_enc_close( *--------------------------------------------------------------------------*/ void ivas_mcmasa_enc( - MCMASA_ENC_HANDLE hMcMasa, - IVAS_QMETADATA_HANDLE hQMeta, - MASA_ENCODER_HANDLE hMasa, - float data_f[][L_FRAME48k], - const int16_t input_frame, - const int16_t nchan_transport, - const int16_t nchan_inp ) + MCMASA_ENC_HANDLE hMcMasa, /* i/o: Encoder McMASA handle */ + IVAS_QMETADATA_HANDLE hQMeta, /* o : Qmetadata handle */ + MASA_ENCODER_HANDLE hMasa, /* i/o: Encoder MASA handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input frame of audio */ +#else + float data_f[][L_FRAME48k], /* i : Input frame of audio */ +#endif + 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, j, k; int16_t nBands = hMcMasa->nbands; @@ -723,9 +736,13 @@ void ivas_mcmasa_enc( *--------------------------------------------------------------------------*/ void ivas_mcmasa_param_est_enc( - MCMASA_ENC_HANDLE hMcMasa, /* i : McMASA encoder structure */ - MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder structure */ - float data_f[][L_FRAME48k], /* i : Audio frame in MC-format */ + MCMASA_ENC_HANDLE hMcMasa, /* i : McMASA encoder structure */ + MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Audio frame in MC-format */ +#else + float data_f[][L_FRAME48k], /* i : Audio frame in MC-format */ +#endif float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated elevation */ float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated azimuth */ float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated direct-to-total ratio */ @@ -801,7 +818,11 @@ void ivas_mcmasa_param_est_enc( /* Copy current frame to memory for delay compensation */ for ( i = 0; i < numAnalysisChannels; i++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + pcm_in[i] = data_f[i]; +#else pcm_in[i] = &data_f[i][0]; +#endif p_Chnl_RealBuffer[i] = &Chnl_RealBuffer[i][0]; p_Chnl_ImagBuffer[i] = &Chnl_ImagBuffer[i][0]; } @@ -1327,7 +1348,11 @@ void ivas_mcmasa_dmx_modify( /* Compute downmix */ static void ivas_mcmasa_dmx( MCMASA_ENC_HANDLE hMcMasa, +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], +#else float data_f[][L_FRAME48k], +#endif const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_inp ) @@ -1621,7 +1646,11 @@ static void computeEvenLayout( static void computeLfeEnergy( MCMASA_ENC_HANDLE hMcMasa, +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], +#else float data_f[][L_FRAME48k], +#endif const int16_t input_frame ) { int16_t l_ts; @@ -1638,13 +1667,19 @@ static void computeLfeEnergy( if ( hMcMasa->separateChannelEnabled ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + mvr2r( data_f[lfeChannelIndex], &( hMcMasa->delay_buffer_lfe[0][hMcMasa->num_samples_delay_comp - hMcMasa->offset_comp] ), hMcMasa->offset_comp ); + mvr2r( data_f[separateChannelIndex], &( hMcMasa->delay_buffer_lfe[1][hMcMasa->num_samples_delay_comp - hMcMasa->offset_comp] ), hMcMasa->offset_comp ); +#else mvr2r( &data_f[lfeChannelIndex][0], &( hMcMasa->delay_buffer_lfe[0][hMcMasa->num_samples_delay_comp - hMcMasa->offset_comp] ), hMcMasa->offset_comp ); mvr2r( &data_f[separateChannelIndex][0], &( hMcMasa->delay_buffer_lfe[1][hMcMasa->num_samples_delay_comp - hMcMasa->offset_comp] ), hMcMasa->offset_comp ); +#endif } else { pcm_in[0] = &data_f[lfeChannelIndex][0]; } + /* Reset variables */ set_zero( hMcMasa->lfeLfEne, MAX_PARAM_SPATIAL_SUBFRAMES ); set_zero( hMcMasa->totalLfEne, MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -1657,10 +1692,17 @@ static void computeLfeEnergy( float delayedInputSignal[2][L_FRAME48k]; float lowPassSignal[2][L_FRAME48k]; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + mvr2r( &( hMcMasa->delay_buffer_lfe[0][0] ), &( delayedInputSignal[0][0] ), hMcMasa->num_slots_delay_comp * l_ts ); + mvr2r( data_f[lfeChannelIndex] + hMcMasa->offset_comp, &( delayedInputSignal[0][hMcMasa->num_slots_delay_comp * l_ts] ), ( MDFT_NO_COL_MAX - hMcMasa->num_slots_delay_comp ) * l_ts ); + mvr2r( &( hMcMasa->delay_buffer_lfe[1][0] ), &( delayedInputSignal[1][0] ), hMcMasa->num_slots_delay_comp * l_ts ); + mvr2r( data_f[separateChannelIndex] + hMcMasa->offset_comp, &( delayedInputSignal[1][hMcMasa->num_slots_delay_comp * l_ts] ), ( MDFT_NO_COL_MAX - hMcMasa->num_slots_delay_comp ) * l_ts ); +#else mvr2r( &( hMcMasa->delay_buffer_lfe[0][0] ), &( delayedInputSignal[0][0] ), hMcMasa->num_slots_delay_comp * l_ts ); mvr2r( &( data_f[lfeChannelIndex][hMcMasa->offset_comp] ), &( delayedInputSignal[0][hMcMasa->num_slots_delay_comp * l_ts] ), ( MDFT_NO_COL_MAX - hMcMasa->num_slots_delay_comp ) * l_ts ); mvr2r( &( hMcMasa->delay_buffer_lfe[1][0] ), &( delayedInputSignal[1][0] ), hMcMasa->num_slots_delay_comp * l_ts ); mvr2r( &( data_f[separateChannelIndex][hMcMasa->offset_comp] ), &( delayedInputSignal[1][hMcMasa->num_slots_delay_comp * l_ts] ), ( MDFT_NO_COL_MAX - hMcMasa->num_slots_delay_comp ) * l_ts ); +#endif lowpassCoef = 1.0f / ( (float) hMcMasa->ringBufferSize ); @@ -1731,8 +1773,13 @@ static void computeLfeEnergy( if ( hMcMasa->separateChannelEnabled ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + mvr2r( data_f[lfeChannelIndex] + ( input_frame - hMcMasa->num_samples_delay_comp + hMcMasa->offset_comp ), &( hMcMasa->delay_buffer_lfe[0][0] ), ( hMcMasa->num_samples_delay_comp - hMcMasa->offset_comp ) ); + mvr2r( data_f[separateChannelIndex] + ( input_frame - hMcMasa->num_samples_delay_comp + hMcMasa->offset_comp ), &( hMcMasa->delay_buffer_lfe[1][0] ), ( hMcMasa->num_samples_delay_comp - hMcMasa->offset_comp ) ); +#else mvr2r( &data_f[lfeChannelIndex][input_frame - hMcMasa->num_samples_delay_comp + hMcMasa->offset_comp], &( hMcMasa->delay_buffer_lfe[0][0] ), ( hMcMasa->num_samples_delay_comp - hMcMasa->offset_comp ) ); mvr2r( &data_f[separateChannelIndex][input_frame - hMcMasa->num_samples_delay_comp + hMcMasa->offset_comp], &( hMcMasa->delay_buffer_lfe[1][0] ), ( hMcMasa->num_samples_delay_comp - hMcMasa->offset_comp ) ); +#endif } return; diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index e392da6aed4c8f6aea177270dd0d673e122b82de..6e86ecdd14cda414b0003449227549473ef98670 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -103,9 +103,13 @@ static void set_mct_enc_params( *-------------------------------------------------------------------*/ static void map_input_to_cpe_channels( - const Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - float *pdata[MAX_INPUT_CHANNELS], /* o : mapped input pointers */ + const Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + float *pdata[MAX_INPUT_CHANNELS], /* o : mapped input pointers */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data[MCT_MAX_CHANNELS] /* i : input channel data */ +#else float data[MCT_MAX_CHANNELS][L_FRAME48k] /* i : input channel data */ +#endif ) { int16_t i, n; @@ -173,10 +177,14 @@ static void map_input_to_cpe_channels( *-------------------------------------------------------------------*/ ivas_error ivas_mct_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data[MCT_MAX_CHANNELS], /* i : input signal buffers */ +#else float data[MCT_MAX_CHANNELS][L_FRAME48k], /* i : input signal */ - const int16_t input_frame, /* i : input frame length per channel */ - const int16_t nb_bits_metadata /* i : number of metadata bits */ +#endif + const int16_t input_frame, /* i : input frame length per channel */ + const int16_t nb_bits_metadata /* i : number of metadata bits */ ) { int16_t n, cpe_id; diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 3006a0d6eb7a14f967ef191230a322607e031d19..349ae992bd2980b7be47f7e245c6bf7b349847c5 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -50,11 +50,19 @@ * Local function prototypes *------------------------------------------------------------------------*/ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, OMASA_ENCODER_DATA_HANDLE hOmasaData, ISM_METADATA_HANDLE hIsmMeta[], float *data_f[], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], float diffuseness_m[MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); + +static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, OMASA_ENCODER_DATA_HANDLE hOmasaData, float *data_f[], const int16_t input_frame, const int16_t nchan_inp ); + +static void ivas_omasa_dmx( float *data_in_f[], float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_ism, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); +#else static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, OMASA_ENCODER_DATA_HANDLE hOmasaData, ISM_METADATA_HANDLE hIsmMeta[], 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[MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MASA_FREQUENCY_BANDS], float diffuseness_m[MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_inp ); static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, OMASA_ENCODER_DATA_HANDLE hOmasaData, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_inp ); static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_ism, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); +#endif static void computeIntensityVector_enc( const int16_t *band_grouping, float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], const int16_t num_frequency_bands, float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS] ); @@ -381,16 +389,24 @@ void ivas_omasa_set_config( *--------------------------------------------------------------------------*/ void ivas_omasa_enc( - OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ + OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ + MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_in_f[], /* i/o: Input / transport audio signals */ +#else float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t nchan_transport, /* i : Number of transport channels */ - const int16_t nchan_ism, /* i : Number of objects for parameter analysis */ - const ISM_MODE ism_mode, /* i : ISM mode */ +#endif + const int16_t input_frame, /* i : Input frame size */ + const int16_t nchan_transport, /* i : Number of transport channels */ + const int16_t nchan_ism, /* i : Number of objects for parameter analysis */ + const ISM_MODE ism_mode, /* i : ISM mode */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_separated_object, /* o : Separated object audio signal */ +#else float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ - int16_t *idx_separated_object /* o : Index of the separated object */ +#endif + int16_t *idx_separated_object /* o : Index of the separated object */ ) { int16_t i, j; @@ -727,8 +743,12 @@ void ivas_set_surplus_brate_enc( int16_t ivas_omasa_ener_brate( const int16_t nchan_ism, /* i : number of ISMs */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - float data_f[][L_FRAME48k], /* i : Input / transport audio signals */ - const int16_t input_frame /* i : Input frame size */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i : Input / transport audio signals */ +#else + float data_f[][L_FRAME48k], /* i : Input / transport audio signals */ +#endif + const int16_t input_frame /* i : Input frame size */ ) { int16_t i, flag_omasa_ener_brate; @@ -771,7 +791,11 @@ static void ivas_omasa_param_est_enc( OMASA_ENC_HANDLE hOMasa, OMASA_ENCODER_DATA_HANDLE hOmasaData, ISM_METADATA_HANDLE hIsmMeta[], +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], +#else float data_f[][L_FRAME48k], +#endif float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MASA_FREQUENCY_BANDS], @@ -961,7 +985,11 @@ static void ivas_omasa_param_est_enc( static void ivas_omasa_energy_and_ratio_est( OMASA_ENC_HANDLE hOMasa, OMASA_ENCODER_DATA_HANDLE hOmasaData, +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], +#else float data_f[][L_FRAME48k], +#endif const int16_t input_frame, const int16_t nchan_ism ) { @@ -1043,7 +1071,11 @@ static void ivas_omasa_energy_and_ratio_est( /* Compute downmix */ static void ivas_omasa_dmx( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_in_f[], +#else float data_in_f[][L_FRAME48k], +#endif float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index d66126fe267938a98db0321e2fd8f87392a2c382..497b43c628c56073f29b3d5f9efcab7c53bb9b6a 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -50,7 +50,11 @@ * Local function prototypes *------------------------------------------------------------------------*/ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +static void ivas_osba_render_ism_to_sba( float *data_in_f[], float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_sba, const int16_t nchan_ism, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MAX_INPUT_CHANNELS], const float interpolator[L_FRAME48k] ); +#else static void ivas_osba_render_ism_to_sba( float data_in_f[][L_FRAME48k], float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_sba, const int16_t nchan_ism, ISM_METADATA_HANDLE hIsmMeta[], float prev_gains[][MAX_INPUT_CHANNELS], const float interpolator[L_FRAME48k] ); +#endif /*-------------------------------------------------------------------* * ivas_merge_sba_transports() @@ -60,8 +64,13 @@ static void ivas_osba_render_ism_to_sba( float data_in_f[][L_FRAME48k], float da static void ivas_merge_sba_transports( float data_in_f1[][L_FRAME48k], +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_in_f2[], + float *data_out_f[], +#else float data_in_f2[][L_FRAME48k], float data_out_f[][L_FRAME48k], +#endif const int16_t input_frame, const int16_t sba_analysis_order ) { @@ -375,9 +384,13 @@ ivas_error ivas_osba_enc_reconfig( *--------------------------------------------------------------------------*/ void ivas_osba_enc( - OSBA_ENC_HANDLE hOSba, /* i/o: OSBA encoder handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ - float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ + OSBA_ENC_HANDLE hOSba, /* i/o: OSBA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_in_f[], /* i/o: Input / transport audio signals */ +#else + float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ +#endif const int16_t input_frame, /* i : Input frame size */ const int16_t nchan_ism, /* i : Number of objects for parameter analysis */ const ISM_MODE ism_mode, /* i : ISM mode */ @@ -396,6 +409,7 @@ void ivas_osba_enc( { mvr2r( &data_in_f[n][input_frame - delay_s], hOSba->input_data_mem[n], delay_s ); } + /* Convert ISM to SBA */ ivas_osba_render_ism_to_sba( data_in_f, data_out_f, input_frame, sba_analysis_order, nchan_ism, hIsmMeta, hOSba->prev_object_dm_gains, hOSba->interpolator ); @@ -431,7 +445,11 @@ void ivas_osba_enc( /* Render ISMs to SBA */ static void ivas_osba_render_ism_to_sba( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_in_f[], +#else float data_in_f[][L_FRAME48k], +#endif float data_out_f[][L_FRAME48k], const int16_t input_frame, const int16_t sba_analysis_order, diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 53e2a62a14efbebdd8b2c8a86b3d6c21826a41db..3d5be7e13e615483517d4c52ec4bd08d0d41f8b2 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -53,9 +53,13 @@ *-------------------------------------------------------------------*/ void ivas_sba_getTCs( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *sba_data[], /* i : SBA signals */ +#else float sba_data[][L_FRAME48k], /* i : SBA signals */ - Encoder_Struct *st_ivas, /* i/o: Encoder struct */ - const int16_t input_frame /* i : frame length */ +#endif + Encoder_Struct *st_ivas, /* i/o: Encoder struct */ + const int16_t input_frame /* i : frame length */ ) { if ( st_ivas->hEncoderConfig->sba_planar ) diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 0e82d0856642a0ccc2f4eed978da8db1b9f87dbb..33abd13cf2ac325a6c737e7f6713fb0dcb78b86f 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -48,7 +48,11 @@ * Local function prototypes *--------------------------------------------------------------------*/ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +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[] ); +#else 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[][L_FRAME48k] ); +#endif /*------------------------------------------------------------------------- @@ -324,11 +328,15 @@ void ivas_spar_enc_close( *-------------------------------------------------------------------*/ ivas_error ivas_spar_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* i/o: input/transport audio channels */ +#else float data_f[][L_FRAME48k], /* i/o: input/transport audio channels */ - const int16_t input_frame, /* i : input frame length */ - int16_t *nb_bits_metadata, /* i : number of MD bits written */ - BSTR_ENC_HANDLE hMetaData /* o : MetaData handle */ +#endif + const int16_t input_frame, /* i : input frame length */ + int16_t *nb_bits_metadata, /* i : number of MD bits written */ + BSTR_ENC_HANDLE hMetaData /* o : MetaData handle */ ) { ENCODER_CONFIG_HANDLE hEncoderConfig; @@ -570,7 +578,11 @@ static ivas_error ivas_spar_enc_process( const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ const int16_t front_vad_flag, /* i : front-VAD decision */ - float data_f[][L_FRAME48k] /* i/o: input/transport audio channels */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[] /* i/o: input/transport audio channels */ +#else + float data_f[][L_FRAME48k] /* i/o: input/transport audio channels */ +#endif ) { float pcm_tmp[DIRAC_MAX_ANA_CHANS][L_FRAME48k * 2]; @@ -676,7 +688,11 @@ static ivas_error ivas_spar_enc_process( { ppIn_FR_real[i] = p_pcm_tmp[i]; ppIn_FR_imag[i] = p_pcm_tmp[i] + input_frame; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + p_pcm_tmp[i] = data_f[i]; +#else p_pcm_tmp[i] = &data_f[i][0]; +#endif } l_ts = input_frame / MAX_PARAM_SPATIAL_SUBFRAMES; diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 91bed51e3ed08d67fd3c29811e929a974cc1f6b0..1f63f129c82f348d9779e08ddde5eb7a0aac315a 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1220,6 +1220,10 @@ typedef struct { ENCODER_CONFIG_HANDLE hEncoderConfig; /* Encoder configuration structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *p_data_f[MAX_INPUT_CHANNELS+MAX_NUM_OBJECTS]; /* floating-point input audio buffers */ +#endif + Indice *ind_list; /* List of indices */ int16_t ivas_max_num_indices; /* Maximum allowed number of indices in the list */ Indice *ind_list_metadata; /* List of indices for metadata */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 12a80a034fbd4ac5fde00de2befd963abfadff14..3bb6d623fb8026193e44b82682dd5d03896ed604 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -735,6 +735,10 @@ ivas_error IVAS_ENC_ConfigureForMultichannel( break; } +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + hEncoderConfig->nchan_inp = ivas_mc_ls_setup_get_num_channels( hEncoderConfig->mc_input_setup ); +#endif + hIvasEnc->maxBandwidthUser = max_bwidth_user; error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index c93296e289e13d7ee838e53c6411ea5c72f87632..00cd2e73c7857351b6dbe10a548cd8c6dc97b2f4 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -554,7 +554,11 @@ void ivas_dirac_dec_binaural_render( *------------------------------------------------------------------------*/ void ivas_dirac_dec_binaural_sba_gain( - float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else + float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ ) @@ -590,8 +594,12 @@ void ivas_dirac_dec_binaural_sba_gain( void ivas_dirac_dec_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t nchan_transport /* i : number of transport channels */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif + const int16_t nchan_transport /* i : number of transport channels */ ) { int16_t subframe; @@ -601,13 +609,25 @@ void ivas_dirac_dec_binaural( int16_t ch; int16_t slot_size; int16_t numInChannels; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *decorr_signal[BINAURAL_CHANNELS], decorr_signal_buff[BINAURAL_CHANNELS][L_FRAME48k]; +#endif + hSpatParamRendCom = st_ivas->hSpatParamRendCom; slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + p_output[ch] = output_f[ch]; + p_output[ch + BINAURAL_CHANNELS] = decorr_signal_buff[ch]; + } +#else for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) { p_output[ch] = &output_f[ch][0]; } +#endif numInChannels = nchan_transport; #ifdef MASA_AND_OBJECTS if ( st_ivas->hOutSetup.separateChannelEnabled || ( 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 ) ) ) @@ -645,12 +665,18 @@ void ivas_dirac_dec_binaural( if ( st_ivas->hDiracDecBin->useTdDecorr ) #endif { +#ifndef FIX_264_AUDIO_CHANNELS_TO_HEAP float *decorr_signal[BINAURAL_CHANNELS]; +#endif int16_t output_frame; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + decorr_signal[ch] = decorr_signal_buff[ch]; +#else decorr_signal[ch] = (float *) &( output_f[ch + BINAURAL_CHANNELS][0] ); +#endif st_ivas->hTcBuffer->tc[ch + BINAURAL_CHANNELS] = decorr_signal[ch]; } output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 0a662c38a861267ad95abe57cfe790c47b8ea1c1..b10273ff5ed4953bee07ea55b7290bb5037fe412 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -2157,10 +2157,14 @@ void ivas_dirac_dec_compute_power_factors( void ivas_lfe_synth_with_filters( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ - float data_f[][L_FRAME48k], /* o : output signals */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t separateChannelIndex, /* i : separate channel index */ - const int16_t lfeChannelIndex /* i : LFE channel index */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *data_f[], /* o : output signals */ +#else + float data_f[][L_FRAME48k], /* o : output signals */ +#endif + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t separateChannelIndex, /* i : separate channel index */ + const int16_t lfeChannelIndex /* i : LFE channel index */ ) { float lowpassCoef; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index ccfbca98fcd3669857413e3942603954a0758d9b..09c45076aafc51d9dccf4436104ce36d93dc52df 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -816,9 +816,13 @@ ivas_error ivas_td_binaural_renderer_ext( * Render to multiple binaural pairs based on relative head positions for split rendering. *---------------------------------------------------------------------*/ void ObjRenderIvasFrame_splitBinaural( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: SCE channels / Binaural synthesis */ +#else float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame /* i : output frame length */ +#endif + const int16_t output_frame /* i : output frame length */ ) { int32_t i; diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 9459023565f2af49304bf23b01a0f5ec5764c5f0..990d36c8f04ac1a729f65848c72d612fc47a6bc9 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -253,3 +253,141 @@ void ivas_output_init( return; } + + +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +/*-----------------------------------------------------------------* + * ivas_get_nchan_buffers_dec() + * + * Return number of decoder audio buffers + *-----------------------------------------------------------------*/ + +/*! r: number of decoder buffers */ +int16_t ivas_get_nchan_buffers_dec( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t nchan_out_buff; + AUDIO_CONFIG output_config; + + output_config = st_ivas->hDecoderConfig->output_config; + + nchan_out_buff = MAX_OUTPUT_CHANNELS; + + if ( st_ivas->ivas_format == STEREO_FORMAT ) + { + nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, CPE_CHANNELS ); + } + else if ( st_ivas->ivas_format == ISM_FORMAT ) + { + nchan_out_buff = st_ivas->nchan_ism; + + if ( output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); + } + else if ( output_config != AUDIO_CONFIG_EXTERNAL ) + { + nchan_out_buff = max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) ); + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT ) + { + nchan_out_buff = st_ivas->hDecoderConfig->nchan_out; + + if ( output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); + } + else + { + nchan_out_buff = max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) ); + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); + } + } + else if ( st_ivas->ivas_format == MASA_FORMAT ) + { + nchan_out_buff = CPE_CHANNELS; + + if ( output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); + } + else if ( output_config != AUDIO_CONFIG_EXTERNAL ) + { + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); + } + } + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + nchan_out_buff = st_ivas->nchan_ism + CPE_CHANNELS; + + if ( output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); + } + else if ( output_config != AUDIO_CONFIG_EXTERNAL ) + { + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); + } + } + else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + nchan_out_buff = st_ivas->nchan_ism + st_ivas->nchan_transport; + + if ( st_ivas->hMCT != NULL ) + { + nchan_out_buff = ( ( nchan_out_buff + 1 ) >> 1 ) << 1; /* ensure odd number of channels in MCT */ + } + + if ( output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); + } + else if ( output_config != AUDIO_CONFIG_EXTERNAL ) + { + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) ); + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); + + if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS ) + { + nchan_out_buff = max( nchan_out_buff + st_ivas->nchan_ism, audioCfg2channels( output_config ) ); /* needed for ivas_sba_upmixer_renderer() */ + } + else + { + nchan_out_buff = max( nchan_out_buff + st_ivas->nchan_ism, audioCfg2channels( output_config ) ); /* needed for iivas_spar_dec_upmixer_sf() which is based on 'nchan_out' */ + } + } + else if ( output_config == AUDIO_CONFIG_EXTERNAL ) + { + nchan_out_buff = st_ivas->hDecoderConfig->nchan_out + st_ivas->nchan_ism; /*take into account sba_ch_idx' in ivas_dec() */ + } + + nchan_out_buff = min( nchan_out_buff, MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS ); + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + nchan_out_buff = st_ivas->hDecoderConfig->nchan_out; + + if ( output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); + } + else + { + nchan_out_buff = max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) ); + nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); + } + } + + if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + nchan_out_buff = max( nchan_out_buff, st_ivas->splitBinRend.splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS ); + } + + return nchan_out_buff; +} +#endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 482aa8632621a152e996b4279c2d8c17ce5f225d..b2a3a8cdf5210d41d4423635dc4d478585308d26 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -76,6 +76,14 @@ void ivas_output_init( const AUDIO_CONFIG output_config /* i : output audio configuration */ ); +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP +/*! r: number of decoder buffers */ +int16_t ivas_get_nchan_buffers_dec( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#endif + + /*----------------------------------------------------------------------------------* * Limiter prototypes *----------------------------------------------------------------------------------*/ @@ -153,7 +161,11 @@ ivas_error ivas_sba_get_hoa_dec_matrix( #ifdef FIX_564 void ivas_dirac_dec_binaural_sba_gain( +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else float output[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame /* i : output frame length */ ); @@ -162,7 +174,11 @@ void ivas_dirac_dec_binaural_sba_gain( void ivas_dirac_dec_binaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif const int16_t nchan_transport /* i : number of transport channels */ ); @@ -554,7 +570,11 @@ void ivas_HRTF_CRend_binary_close( /* TODO(sgi): Rework interface */ void ObjRenderIvasFrame_splitBinaural( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], /* i/o: SCE channels / Binaural synthesis */ +#else float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ +#endif const int16_t output_frame /* i : output frame length */ ); #endif @@ -1563,7 +1583,11 @@ ivas_error ivas_renderMultiBinToSplitBinaural( float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_bands, - float out[][L_FRAME48k], +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], +#else + float output[][L_FRAME48k], +#endif const int16_t low_res_pre_rend_rot, int16_t td_input, const int16_t pcm_out diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 40734c6ede38dba3bc78d6006a5d822cea25fa8e..a087efee6ff79cbe400d1b1275b32ef34859cb63 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -2098,7 +2098,11 @@ static ivas_error splitRendLc3plusEncodeAndWrite( SPLIT_REND_WRAPPER *hSplitBin, ivas_split_rend_bits_t *pBits, const int32_t SplitRendBitRate, +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *in[] ) +#else float in[][L_FRAME48k] ) +#endif { ivas_error error; int16_t i; @@ -2141,7 +2145,11 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( const int32_t SplitRendBitRate, ivas_split_rend_bits_t *pBits, const int16_t max_bands, +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *in[], +#else float in[][L_FRAME48k], +#endif const int16_t low_res_pre_rend_rot, const int16_t pcm_out ) { @@ -2342,7 +2350,11 @@ ivas_error ivas_renderMultiBinToSplitBinaural( float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_bands, - float out[][L_FRAME48k], +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + float *output[], +#else + float output[][L_FRAME48k], +#endif const int16_t low_res_pre_rend_rot, int16_t td_input, const int16_t pcm_out ) @@ -2367,8 +2379,8 @@ ivas_error ivas_renderMultiBinToSplitBinaural( if ( td_input ) { /*TD input*/ - /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/ - error = ivas_renderMultiTDBinToSplitBinaural( hSplitBin, headPositions, SplitRendBitRate, pBits, max_bands, out, + /*if CLDFB handles have been allocated then assume valid multi binaural input in output[][] buffer and perform CLDFB analysis*/ + error = ivas_renderMultiTDBinToSplitBinaural( hSplitBin, headPositions, SplitRendBitRate, pBits, max_bands, output, low_res_pre_rend_rot, pcm_out ); pop_wmops(); return error; @@ -2429,13 +2441,13 @@ ivas_error ivas_renderMultiBinToSplitBinaural( Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; } #ifndef OSBA_SPLIT_RENDERING - cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, out[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); + cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); #else - cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, out[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); + cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); #endif } - if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, out ) ) != IVAS_ERR_OK ) + if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, output ) ) != IVAS_ERR_OK ) { return error; } @@ -2456,9 +2468,9 @@ ivas_error ivas_renderMultiBinToSplitBinaural( Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; } #ifndef OSBA_SPLIT_RENDERING - cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, out[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); + cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); #else - cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, out[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); + cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); #endif } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 899500a5f8d3b70cee30fae7034d84013e5d2036..fe8fd63f0539b3e61c4b30e1831862de0c6efa73 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8069,9 +8069,21 @@ static void renderMasaToMc( input_masa *masaInput, IVAS_REND_AudioBuffer outAudio ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + int16_t ch; + float *tmpBuffer[MAX_OUTPUT_CHANNELS], tmpBuffer_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + tmpBuffer[ch] = tmpBuffer_buff[ch]; + } + + copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer_buff ); +#else float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); +#endif copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); if ( masaInput->decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) @@ -8083,7 +8095,11 @@ static void renderMasaToMc( ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); } +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); +#else accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); +#endif return; } @@ -8092,14 +8108,30 @@ static void renderMasaToSba( input_masa *masaInput, IVAS_REND_AudioBuffer outAudio ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + int16_t ch; + float *tmpBuffer[MAX_OUTPUT_CHANNELS], tmpBuffer_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + tmpBuffer[ch] = tmpBuffer_buff[ch]; + } + + copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer_buff ); +#else float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); +#endif copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); +#else accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); +#endif return; } @@ -8113,9 +8145,21 @@ static void renderMasaToBinaural( #endif ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + int16_t ch; + float *tmpBuffer[MAX_OUTPUT_CHANNELS], tmpBuffer_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + tmpBuffer[ch] = tmpBuffer_buff[ch]; + } + + copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer_buff ); +#else float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); +#endif copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); @@ -8128,7 +8172,11 @@ static void renderMasaToBinaural( } else { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); +#else accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); +#endif } return; @@ -8728,7 +8776,17 @@ ivas_error IVAS_REND_GetSamples( int16_t td_input; float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + int16_t ch; + float *tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS], tmpBinaural_buff[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; + + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + tmpBinaural[ch] = tmpBinaural_buff[ch]; + } +#else float tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; +#endif if ( outAudio.config.is_cldfb == 1 ) { @@ -8738,7 +8796,11 @@ ivas_error IVAS_REND_GetSamples( else { td_input = 1; +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + copyBufferTo2dArray( outAudio, tmpBinaural_buff ); +#else copyBufferTo2dArray( outAudio, tmpBinaural ); +#endif } /* Encode split rendering bitstream */ @@ -8759,11 +8821,17 @@ ivas_error IVAS_REND_GetSamples( { return error; } + convertInternalBitsBuffToBitsBuffer( hBits, bits ); outAudio = outAudioOrig; + if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { +#ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP + accumulate2dArrayToBuffer( tmpBinaural_buff, &outAudio ); +#else accumulate2dArrayToBuffer( tmpBinaural, &outAudio ); +#endif } } #endif /* SPLIT_REND_WITH_HEAD_ROT */