From 108ac73c2c29dd91a9ae4454ab79cf1069d88159 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Aug 2023 22:40:44 +0200 Subject: [PATCH 1/9] [cleanup] accept FIX_718_JBM_MD_UDPATE --- lib_com/options.h | 1 - lib_dec/ivas_objectRenderer_internal.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index be3261f808..8aa8e8a097 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,7 +165,6 @@ #define APLIT_5MS_FIX_TODO #endif -#define FIX_718_JBM_MD_UDPATE /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */ #define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 342cb86539..f1e93bfe2e 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -238,13 +238,9 @@ ivas_error ivas_td_binaural_renderer_sf( } /* Render subframe */ -#ifdef FIX_718_JBM_MD_UDPATE /* ism_md_subframe_update_jbm != subframe_idx: trigger update only for ism_md_subframe_update_jbm == subframe_idx, where then the two TDREND_GetMix()-arguments subframe_idx and ism_md_subframe_update are equal, and we want to enforce the update inside TDREND_GetMix to use subframe_idx == 0 */ if ( ( error = TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0, ism_md_subframe_update_jbm != subframe_idx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0, ism_md_subframe_update_jbm ) ) != IVAS_ERR_OK ) -#endif { return error; } -- GitLab From 3373a52df89575dbdda9b1e1b86f5073f1914237 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Aug 2023 22:41:48 +0200 Subject: [PATCH 2/9] [cleanup] accept FIX_719_CRASH_IN_CLEANUP --- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8aa8e8a097..a0f7394307 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,7 +165,6 @@ #define APLIT_5MS_FIX_TODO #endif -#define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7c5642a5e9..25a1ec172d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2522,11 +2522,7 @@ void ivas_initialize_handles_dec( st_ivas->hJbmMetadata = NULL; /* floating-point output audio buffers */ -#ifdef FIX_719_CRASH_IN_CLEANUP for ( i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++ ) -#else - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) -#endif { st_ivas->p_output_f[i] = NULL; } -- GitLab From 8bef346d7f127af3c00f9be075b422202109356c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Aug 2023 22:42:47 +0200 Subject: [PATCH 3/9] [cleanup] accept CR_FIX_585_MASA_2TC_DTX_EXT --- lib_com/ivas_prot.h | 2 -- lib_com/options.h | 1 - lib_dec/ivas_dec.c | 4 ---- lib_dec/ivas_jbm_dec.c | 4 ---- lib_dec/ivas_masa_dec.c | 6 ------ 5 files changed, 17 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index a9fba371ab..b7a476163a 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5193,10 +5193,8 @@ void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output[], /* i/o: synthesized core-coder transport channels */ 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 */ -#endif ); void ivas_spar_param_to_masa_param_mapping( diff --git a/lib_com/options.h b/lib_com/options.h index a0f7394307..6d0ac516af 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,6 @@ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ -#define CR_FIX_585_MASA_2TC_DTX_EXT /* Nokia: issue 585: fixes transition artifacts in MASA 2TC DTX by applying correct condition */ #define CR_FIX_639_HQ_ACELP_TRANSITION /* Ericsson: Issue 639: Wrong sampling rate of SWB TBE excitation memory in 16 kHz core for DFT Stereo@32 kbps */ #define CR_FIX_586_BPF_DFT_MEM /* FhG: issue 586: set input memory of DFT analysis of BPF signal to zero for HQ core to fix issue with PLC and bitrate switching */ #define CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* FhG: fix for cng in ISM DTX on sudden silence periods */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index eff9a11c06..e68839490b 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -509,11 +509,7 @@ ivas_error ivas_dec( if ( st_ivas->ivas_format == MASA_FORMAT ) { -#ifdef CR_FIX_585_MASA_2TC_DTX_EXT ivas_masa_prerender( st_ivas, output, output_frame, nchan_remapped ); -#else - ivas_masa_prerender( st_ivas, output, output_frame ); -#endif } else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index b0a0754c0a..ce475deaab 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -297,11 +297,7 @@ ivas_error ivas_jbm_dec_tc( if ( st_ivas->ivas_format == MASA_FORMAT ) { -#ifdef CR_FIX_585_MASA_2TC_DTX_EXT ivas_masa_prerender( st_ivas, output, output_frame, nchan_remapped ); -#else - ivas_masa_prerender( st_ivas, output, output_frame ); -#endif } else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 37fe367ef6..e7b498f28f 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -843,17 +843,11 @@ void ivas_masa_prerender( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output[], /* i/o: synthesized core-coder transport channels */ 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 */ -#endif ) { -#ifdef CR_FIX_585_MASA_2TC_DTX_EXT if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && nchan_remapped == 1 ) -#else - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) -#endif { if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { -- GitLab From 5633fecf32ea6d37a2e4b67d8e62c33f033b7ef9 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Aug 2023 22:43:28 +0200 Subject: [PATCH 4/9] [cleanup] accept CR_FIX_639_HQ_ACELP_TRANSITION --- lib_com/options.h | 1 - lib_dec/acelp_core_dec.c | 4 ---- lib_enc/acelp_core_enc.c | 4 ---- 3 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6d0ac516af..05d3d997cf 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,6 @@ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ -#define CR_FIX_639_HQ_ACELP_TRANSITION /* Ericsson: Issue 639: Wrong sampling rate of SWB TBE excitation memory in 16 kHz core for DFT Stereo@32 kbps */ #define CR_FIX_586_BPF_DFT_MEM /* FhG: issue 586: set input memory of DFT analysis of BPF signal to zero for HQ core to fix issue with PLC and bitrate switching */ #define CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* FhG: fix for cng in ISM DTX on sudden silence periods */ #define CR_FIX_698_SBA_MSAN /* Dlb: issue 698: Uninitialized memory read in SBA init */ diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 1a909ac037..f686381d54 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -707,7 +707,6 @@ ivas_error acelp_core_dec( if ( st->last_core != ACELP_CORE && st->element_mode > EVS_MONO ) { /* Prepare ACB memory of old_bwe_exc */ -#ifdef CR_FIX_639_HQ_ACELP_TRANSITION if ( st->L_frame == L_FRAME ) { lerp( old_exc, old_bwe_exc, L_EXC_MEM_DEC * HIBND_ACB_L_FAC, L_EXC_MEM_DEC ); @@ -716,9 +715,6 @@ ivas_error acelp_core_dec( { lerp( old_exc, old_bwe_exc, L_EXC_MEM_DEC * 2, L_EXC_MEM_DEC ); } -#else - lerp( old_exc, old_bwe_exc, L_EXC_MEM_DEC * HIBND_ACB_L_FAC, L_EXC_MEM_DEC ); -#endif } /*-----------------------------------------------------------------* diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index ac6c820fa1..42c5907229 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -461,7 +461,6 @@ ivas_error acelp_core_enc( if ( st->last_core != ACELP_CORE && st->element_mode > EVS_MONO ) { /* Prepare ACB memory of old_bwe_exc */ -#ifdef CR_FIX_639_HQ_ACELP_TRANSITION if ( st->L_frame == L_FRAME ) { lerp( old_exc, old_bwe_exc, L_EXC_MEM_DEC * HIBND_ACB_L_FAC, L_EXC_MEM_DEC ); @@ -470,9 +469,6 @@ ivas_error acelp_core_enc( { lerp( old_exc, old_bwe_exc, L_EXC_MEM_DEC * 2, L_EXC_MEM_DEC ); } -#else - lerp( old_exc, old_bwe_exc, L_EXC_MEM_DEC * HIBND_ACB_L_FAC, L_EXC_MEM_DEC ); -#endif } -- GitLab From 66a31adc248b52a9e8aacf738f7e3eb4c58a73d0 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Aug 2023 22:44:55 +0200 Subject: [PATCH 5/9] [cleanup] accept CR_FIX_586_BPF_DFT_MEM --- lib_com/options.h | 1 - lib_dec/ivas_post_proc.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 05d3d997cf..4ba241ac4b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,6 @@ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ -#define CR_FIX_586_BPF_DFT_MEM /* FhG: issue 586: set input memory of DFT analysis of BPF signal to zero for HQ core to fix issue with PLC and bitrate switching */ #define CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* FhG: fix for cng in ISM DTX on sudden silence periods */ #define CR_FIX_698_SBA_MSAN /* Dlb: issue 698: Uninitialized memory read in SBA init */ diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index a8089c7e23..f9ea70702b 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -226,21 +226,15 @@ void stereo_dft_dec_core_switching( mvr2r( &output[st->L_frame - NS2SA( st->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS )], hCPE->hStereoDft->buff_LBTCX_mem, NS2SA( st->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_OVL_NS ) ); /* BPF */ -#ifdef CR_FIX_586_BPF_DFT_MEM if ( st->p_bpf_noise_buf && st->core != HQ_CORE ) -#else - if ( st->p_bpf_noise_buf ) -#endif { stereo_dft_dec_analyze( hCPE, st->p_bpf_noise_buf, DFT, 0, st->L_frame, output_frame, DFT_STEREO_DEC_ANA_BPF, 2, 0 ); } -#ifdef CR_FIX_586_BPF_DFT_MEM /* st->p_bpf_noise_buf not updated for HQ core -> skip analysis and set input memory to zero */ else if ( st->p_bpf_noise_buf && st->core == HQ_CORE ) { set_zero( hCPE->input_mem_BPF[0], STEREO_DFT32MS_OVL_16k ); } -#endif /* TCX */ stereo_dft_dec_analyze( hCPE, synth, DFT, 0, L_frameTCX, output_frame, DFT_STEREO_DEC_ANA_FB, 0, 0 ); -- GitLab From 12de3d7c6a058dab2a21a7262fd8107db662cb9d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Aug 2023 22:45:57 +0200 Subject: [PATCH 6/9] [cleanup] accept CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE --- lib_com/ivas_prot.h | 2 -- lib_com/options.h | 1 - lib_dec/ivas_dec.c | 9 --------- lib_dec/ivas_ism_dtx_dec.c | 2 -- 4 files changed, 14 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b7a476163a..ebb4ae1d4a 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1212,13 +1212,11 @@ void ivas_get_ism_sid_quan_bitbudget( int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); -#ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE void ivas_ism_dtx_limit_noise_energy_for_near_silence( SCE_DEC_HANDLE hSCE[], /* i/o: SCE encoder structures */ const int16_t sce_id_dtx, /* i : SCE DTX ID */ const int16_t nchan_transport /* i : number of transport channels */ ); -#endif /*----------------------------------------------------------------------------------* * DFT Stereo prototypes diff --git a/lib_com/options.h b/lib_com/options.h index 4ba241ac4b..09599a21b4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,6 @@ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ -#define CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* FhG: fix for cng in ISM DTX on sudden silence periods */ #define CR_FIX_698_SBA_MSAN /* Dlb: issue 698: Uninitialized memory read in SBA init */ /* ##################### End NON-BE CR switches ########################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index e68839490b..0f06149eff 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -225,7 +225,6 @@ ivas_error ivas_dec( { return error; } -#ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* decode dominant object first so the noise energy of the other objects can be limited */ if ( ( error = ivas_sce_dec( st_ivas, st_ivas->hISMDTX.sce_id_dtx, &output[st_ivas->hISMDTX.sce_id_dtx], output_frame, nb_bits_metadata[st_ivas->hISMDTX.sce_id_dtx] ) ) != IVAS_ERR_OK ) @@ -234,7 +233,6 @@ ivas_error ivas_dec( } ivas_ism_dtx_limit_noise_energy_for_near_silence( st_ivas->hSCE, st_ivas->hISMDTX.sce_id_dtx, st_ivas->nchan_transport ); -#endif } else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { @@ -255,7 +253,6 @@ ivas_error ivas_dec( for ( n = 0; n < st_ivas->nchan_transport; n++ ) { -#ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* for DTX frames, dominant object has already been decoded before */ if ( !( ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) && n == st_ivas->hISMDTX.sce_id_dtx ) ) { @@ -264,12 +261,6 @@ ivas_error ivas_dec( return error; } } -#else - if ( ( error = ivas_sce_dec( st_ivas, n, &output[n], output_frame, nb_bits_metadata[n] ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif /* HP filtering */ hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 682ba615fa..fdc5a205aa 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -163,7 +163,6 @@ ivas_error ivas_ism_dtx_dec( } -#ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /*-------------------------------------------------------------------* * ivs_ism_dtx_limit_noise_energy_for_near_silence() * @@ -208,4 +207,3 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence( return; } -#endif -- GitLab From 14342effd0c1fff8db8dfb71a4fa1275624eb886 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Aug 2023 22:46:45 +0200 Subject: [PATCH 7/9] [cleanup] accept CR_FIX_698_SBA_MSAN --- lib_com/ivas_prot.h | 4 ---- lib_com/ivas_spar_com_quant_util.c | 23 ----------------------- lib_com/options.h | 1 - lib_dec/ivas_spar_md_dec.c | 8 -------- lib_enc/ivas_spar_md_enc.c | 4 ---- 5 files changed, 40 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ebb4ae1d4a..c9b736edba 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4941,12 +4941,8 @@ void ivas_copy_band_coeffs_idx_to_arr( void ivas_clear_band_coeffs( ivas_band_coeffs_t *pband_coeffs, -#ifdef CR_FIX_698_SBA_MSAN const uint16_t num_bands, const uint16_t num_ts -#else - const uint16_t num_bands -#endif ); diff --git a/lib_com/ivas_spar_com_quant_util.c b/lib_com/ivas_spar_com_quant_util.c index 863177130b..7e7aa4c084 100644 --- a/lib_com/ivas_spar_com_quant_util.c +++ b/lib_com/ivas_spar_com_quant_util.c @@ -293,33 +293,13 @@ void ivas_copy_band_coeffs_idx_to_arr( void ivas_clear_band_coeffs( ivas_band_coeffs_t *pband_coeffs, -#ifdef CR_FIX_698_SBA_MSAN const uint16_t num_bands, const uint16_t num_ts ) -#else - const uint16_t num_bands ) -#endif { -#ifdef CR_FIX_698_SBA_MSAN uint16_t i, j; -#else - uint16_t i; -#endif -#ifdef CR_FIX_698_SBA_MSAN for ( j = 0; j < num_ts; j++ ) -#else - for ( i = 0; i < num_bands; i++ ) -#endif { -#ifndef CR_FIX_698_SBA_MSAN - set_zero( (float *) pband_coeffs[i].C_re, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); - set_zero( (float *) pband_coeffs[i].P_re, ( IVAS_SPAR_MAX_CH - 1 ) ); - set_zero( (float *) pband_coeffs[i].C_quant_re, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); - set_zero( (float *) pband_coeffs[i].P_quant_re, ( IVAS_SPAR_MAX_CH - 1 ) ); - set_zero( pband_coeffs[i].pred_re, ( IVAS_SPAR_MAX_CH - 1 ) ); -#endif -#ifdef CR_FIX_698_SBA_MSAN for ( i = 0; i < num_bands; i++ ) { set_zero( (float *) pband_coeffs[i + j * num_bands].C_re, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) ); @@ -330,9 +310,6 @@ void ivas_clear_band_coeffs( set_zero( pband_coeffs[i + j * num_bands].pred_quant_re, ( IVAS_SPAR_MAX_CH - 1 ) ); } -#else - set_zero( pband_coeffs[i].pred_quant_re, ( IVAS_SPAR_MAX_CH - 1 ) ); -#endif } return; diff --git a/lib_com/options.h b/lib_com/options.h index 09599a21b4..93ab1d5d1b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,6 @@ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ -#define CR_FIX_698_SBA_MSAN /* Dlb: issue 698: Uninitialized memory read in SBA init */ /* ##################### End NON-BE CR switches ########################### */ diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 909284d810..5796b48596 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -498,11 +498,7 @@ ivas_error ivas_spar_md_dec_init( ) { int16_t i, j; -#ifdef CR_FIX_698_SBA_MSAN int16_t nchan_transport, num_md_sub_frames; -#else - int16_t nchan_transport; -#endif float pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate, &hMdDec->spar_hoa_md_flag, &hMdDec->spar_hoa_dirac2spar_md_flag ); @@ -545,13 +541,9 @@ ivas_error ivas_spar_md_dec_init( hMdDec->spar_plc_enable_fadeout_flag = 1; hMdDec->dtx_md_smoothing_cntr = 1; -#ifdef CR_FIX_698_SBA_MSAN num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate, hDecoderConfig->ivas_total_brate ); ivas_clear_band_coeffs( hMdDec->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS, num_md_sub_frames ); -#else - ivas_clear_band_coeffs( hMdDec->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS ); -#endif ivas_clear_band_coeff_idx( hMdDec->spar_md.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx_mapped, IVAS_MAX_NUM_BANDS ); diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 3aa05843ad..93dc7daf0a 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -303,11 +303,7 @@ ivas_error ivas_spar_md_enc_init( } } -#ifdef CR_FIX_698_SBA_MSAN ivas_clear_band_coeffs( hMdEnc->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS, 1 ); -#else - ivas_clear_band_coeffs( hMdEnc->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS ); -#endif ivas_clear_band_coeff_idx( hMdEnc->spar_md.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); ivas_clear_band_coeff_idx( hMdEnc->spar_md_prior.band_coeffs_idx, IVAS_MAX_NUM_BANDS ); ivas_clear_band_coeff_idx( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, IVAS_MAX_NUM_BANDS ); -- GitLab From 3b4d6b0f246236297ff5e618dcfcb807ac9258b6 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Aug 2023 22:49:47 +0200 Subject: [PATCH 8/9] [cleanup] accept API_5MS, API_5MS_BASELINE, APLIT_5MS_FIX_TODO --- apps/decoder.c | 1952 ++++-------------- apps/renderer.c | 105 +- lib_com/common_api_types.h | 7 - lib_com/ivas_cnst.h | 2 +- lib_com/ivas_error.h | 2 - lib_com/ivas_prot.h | 28 +- lib_com/options.h | 7 - lib_dec/ivas_binRenderer_internal.c | 2 - lib_dec/ivas_dec.c | 118 +- lib_dec/ivas_dirac_dec.c | 14 - lib_dec/ivas_init_dec.c | 73 +- lib_dec/ivas_ism_dec.c | 26 +- lib_dec/ivas_ism_dtx_dec.c | 2 +- lib_dec/ivas_ism_param_dec.c | 131 -- lib_dec/ivas_ism_renderer.c | 17 - lib_dec/ivas_jbm_dec.c | 72 +- lib_dec/ivas_masa_dec.c | 20 +- lib_dec/ivas_mc_param_dec.c | 28 - lib_dec/ivas_mc_paramupmix_dec.c | 6 - lib_dec/ivas_mct_dec.c | 22 +- lib_dec/ivas_objectRenderer_internal.c | 2 - lib_dec/ivas_omasa_dec.c | 12 +- lib_dec/ivas_osba_dec.c | 2 - lib_dec/ivas_sba_dec.c | 10 - lib_dec/ivas_spar_decoder.c | 8 - lib_dec/ivas_stat_dec.h | 8 - lib_dec/jbm_jb4sb.h | 7 - lib_dec/jbm_pcmdsp_fifo.c | 231 --- lib_dec/jbm_pcmdsp_fifo.h | 41 - lib_dec/lib_dec.c | 980 +-------- lib_dec/lib_dec.h | 73 +- lib_rend/ivas_crend.c | 48 - lib_rend/ivas_dirac_dec_binaural_functions.c | 12 - lib_rend/ivas_objectRenderer.c | 26 - lib_rend/ivas_prot_rend.h | 60 - lib_rend/ivas_render_config.c | 2 - lib_rend/ivas_rotation.c | 182 -- lib_rend/ivas_splitRendererPost.c | 82 - lib_rend/ivas_splitRendererPre.c | 85 - lib_rend/ivas_splitRenderer_utils.c | 43 - lib_rend/ivas_stat_rend.h | 13 - lib_rend/lib_rend.c | 526 +---- lib_rend/lib_rend.h | 28 +- lib_util/render_config_reader.c | 4 - lib_util/split_render_file_read_write.c | 8 - lib_util/split_render_file_read_write.h | 4 - 46 files changed, 499 insertions(+), 4632 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index a63d8e9f4b..ff058bb484 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -82,10 +82,8 @@ static #define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20 #endif #define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20 -#ifdef API_5MS #define HEADROTATION_FETCH_FRAMESIZE_MS 5 #define DEFAULT_FETCH_FRAMESIZE_MS 20 -#endif /*------------------------------------------------------------------------------------------* @@ -130,12 +128,8 @@ typedef struct char *outputMdFilename; #endif IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; -#ifdef API_5MS bool tsmEnabled; -#ifdef API_5MS_BASELINE bool enable5ms; -#endif -#endif #ifdef DEBUGGING IVAS_DEC_FORCED_REND_MODE forcedRendMode; #ifdef DEBUG_FOA_AGC @@ -146,9 +140,6 @@ typedef struct uint16_t frontendFetchSizeMs; #endif #ifdef VARIABLE_SPEED_DECODING -#ifndef API_5MS - bool variableSpeedMode; -#endif bool tsmScaleFileEnabled; char *tsmScaleFileName; uint16_t tsmScale; @@ -439,7 +430,6 @@ int main( } } -#ifdef API_5MS /*-------------------------------------------------------------------* * Load renderer configuration from file *--------------------------------------------------------------------*/ @@ -478,7 +468,6 @@ int main( goto cleanup; } } -#endif /*------------------------------------------------------------------------------------------* * Configure the decoder @@ -491,7 +480,6 @@ int main( if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { arg.enableHeadRotation = true; -#ifdef API_5MS_BASELINE if ( arg.enable5ms && ( renderConfigSplit.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE || renderConfigSplit.split_rend_config.dof == 0 ) ) @@ -503,14 +491,11 @@ int main( { arg.enable5ms = false; } -#endif } #endif if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, -#ifdef API_5MS_BASELINE arg.tsmEnabled, arg.enable5ms, -#endif arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -522,7 +507,6 @@ int main( * Configure VoIP mode *------------------------------------------------------------------------------------------*/ -#ifdef API_5MS #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { @@ -532,7 +516,6 @@ int main( goto cleanup; } } -#endif #endif /*------------------------------------------------------------------------------------------* @@ -541,32 +524,12 @@ int main( if ( arg.voipMode ) { -#ifdef API_5MS if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) -#else -#ifndef VARIABLE_SPEED_DECODING - if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VOIP, 100, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) -#endif -#endif { fprintf( stderr, "\nCould not enable VOIP: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING - else if ( arg.variableSpeedMode ) - { - if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VARIABLE_SPEED, arg.tsmScale, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nCould not enable Variable Play Speed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } -#endif -#endif #ifdef DEBUGGING /*-----------------------------------------------------------------* @@ -600,11 +563,7 @@ int main( IVAS_DEC_PrintConfigWithBitstream( hIvasDec, arg.quietModeEnabled, bit_stream, num_bits ); #ifdef VARIABLE_SPEED_DECODING -#ifdef API_5MS if ( arg.tsmEnabled ) -#else - if ( arg.variableSpeedMode ) -#endif { if ( arg.tsmScaleFileEnabled ) { @@ -834,14 +793,6 @@ int main( { error = decodeVoIP( arg, hBsReader, hIvasDec ); } -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING - else if ( arg.variableSpeedMode ) - { - error = decodeVariableSpeed( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); - } -#endif -#endif else { error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, @@ -1092,17 +1043,10 @@ static bool parseCmdlIVAS_dec( arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; arg->Opt_non_diegetic_pan = 0; arg->non_diegetic_pan_gain = 0.f; -#ifdef API_5MS arg->tsmEnabled = false; -#ifdef API_5MS_BASELINE arg->enable5ms = false; -#endif -#endif #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING -#ifndef API_5MS - arg->variableSpeedMode = false; -#endif arg->tsmScale = 100; arg->tsmScaleFileEnabled = false; arg->tsmScaleFileName = NULL; @@ -1256,14 +1200,8 @@ static bool parseCmdlIVAS_dec( { i++; int32_t tmp = 100; -#ifdef API_5MS arg->tsmEnabled = true; -#ifdef API_5MS_BASELINE arg->enable5ms = true; -#endif -#else - arg->variableSpeedMode = true; -#endif if ( i < argc - 3 ) { if ( !is_digits_only( argv[i] ) ) @@ -1332,13 +1270,11 @@ static bool parseCmdlIVAS_dec( arg->headrotTrajFileName = argv[i]; i++; } -#ifdef API_5MS_BASELINE else if ( strcmp( argv_to_upper, "-FR5" ) == 0 ) { arg->enable5ms = true; i++; } -#endif else if ( strcmp( argv_to_upper, "-OTR" ) == 0 ) { @@ -1603,12 +1539,10 @@ static bool parseCmdlIVAS_dec( return false; } -#ifdef API_5MS_BASELINE if ( ( !arg->enableHeadRotation ) && ( !arg->enableExternalOrientation ) ) { arg->enable5ms = false; } -#endif return true; } @@ -1741,7 +1675,7 @@ static ivas_error initOnFirstGoodFrame( IVAS_DEC_HANDLE hIvasDec, /* i/o: */ const DecArguments arg, /* i : */ const int16_t numInitialBadFrames, /* i : */ -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) uint16_t *numOutSamples, /* i/o: */ int16_t *vec_pos_len, /* i/o: */ #else @@ -1857,15 +1791,11 @@ static ivas_error initOnFirstGoodFrame( splitRendBitsZero.buf_len = 0; splitRendBitsZero.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; splitRendBitsZero.pose_correction = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; -#ifdef API_5MS splitRendBitsZero.codec_frame_size_ms = 20; -#endif if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written, -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE -#ifdef API_5MS , splitRendBitsZero.codec_frame_size_ms -#endif ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); @@ -1876,7 +1806,7 @@ static ivas_error initOnFirstGoodFrame( { #endif if ( *pRemainingDelayNumSamples < -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) *numOutSamples #else numOutSamples @@ -1884,7 +1814,7 @@ static ivas_error initOnFirstGoodFrame( ) { if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) *numOutSamples #else numOutSamples @@ -1900,7 +1830,7 @@ static ivas_error initOnFirstGoodFrame( else { *pRemainingDelayNumSamples -= -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) *numOutSamples #else numOutSamples @@ -1995,7 +1925,7 @@ static ivas_error initOnFirstGoodFrame( } } -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) if ( *hSplitRendFileReadWrite != NULL ) { @@ -2030,7 +1960,6 @@ static ivas_error initOnFirstGoodFrame( * * Read G.192 bitstream and decode in regular decoder *---------------------------------------------------------------------*/ -#ifdef API_5MS static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, @@ -2059,7 +1988,7 @@ static ivas_error decodeG192( int16_t nOutChannels = 0; int16_t delayNumSamples = -1; int16_t delayNumSamples_orig[3]; -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) uint16_t nOutSamples = 0; #else int16_t nOutSamples = 0; @@ -2138,9 +2067,7 @@ static ivas_error decodeG192( vec_pos_update = 0; if ( arg.enableHeadRotation -#ifdef API_5MS_BASELINE && arg.enable5ms -#endif ) { nOutSamples = (int16_t) ( arg.output_Fs / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS ); @@ -2207,14 +2134,10 @@ static ivas_error decodeG192( goto cleanup; } } -#ifdef API_5MS int16_t enable5ms, num_subframes; IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms ); arg.enable5ms = enable5ms; num_subframes = ( arg.enable5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; -#else - num_subframes = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; -#endif /* Head-tracking input simulation */ /* Head-tracking input simulation */ @@ -2252,7 +2175,6 @@ static ivas_error decodeG192( } #endif -#ifdef API_5MS for ( i = 0; i < num_subframes; i++ ) { if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i @@ -2266,18 +2188,6 @@ static ivas_error decodeG192( goto cleanup; } } -#else - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - DEFAULT_AXIS -#endif - ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } -#endif } if ( arg.enableExternalOrientation ) @@ -2298,7 +2208,6 @@ static ivas_error decodeG192( goto cleanup; } } -#ifdef API_5MS for ( i = 0; i < num_subframes; i++ ) { if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions[i], enableHeadRotation[i], enableExternalOrientation[i], enableRotationInterpolation[i], numFramesToTargetOrientation[i], i ) ) != IVAS_ERR_OK ) @@ -2307,13 +2216,6 @@ static ivas_error decodeG192( goto cleanup; } } -#else - if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedExternalOrientationData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } -#endif } /* decode and get samples */ @@ -2391,7 +2293,7 @@ static ivas_error decodeG192( { #endif error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT IVAS_DEC_PCM_INT16, (void *) #endif @@ -2433,7 +2335,7 @@ static ivas_error decodeG192( hIvasDec, arg, numInitialBadFrames, -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) &nOutSamples, &vec_pos_len, #else @@ -2472,10 +2374,8 @@ static ivas_error decodeG192( { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction -#ifdef API_5MS , splitRendBits.codec_frame_size_ms -#endif ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); @@ -2488,10 +2388,8 @@ static ivas_error decodeG192( { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction -#ifdef API_5MS , splitRendBits.codec_frame_size_ms -#endif ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); @@ -2562,10 +2460,8 @@ static ivas_error decodeG192( } } vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; -#ifdef API_5MS if ( needNewFrame ) { -#endif frame++; if ( !arg.quietModeEnabled ) { @@ -2577,9 +2473,7 @@ static ivas_error decodeG192( } #endif } -#ifdef API_5MS } -#endif #ifdef WMOPS if ( vec_pos_update == 0 ) { @@ -2661,7 +2555,7 @@ static ivas_error decodeG192( /* decode and get samples */ if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT IVAS_DEC_PCM_INT16, (void *) #endif @@ -2814,1575 +2708,519 @@ cleanup: return error; } -#else -static ivas_error decodeG192( + +#ifdef DEBUGGING +/*---------------------------------------------------------------------* + * printBitstreamInfoVoip() + * + * Print bitstream info of a VoIP G.192 or RTPDUMP bitstream. + *---------------------------------------------------------------------*/ + +static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, - RotFileReader *headRotReader, - RotFileReader *externalOrientationFileReader, - RotFileReader *refRotReader, - Vector3PairFileReader *referenceVectorReader, -#ifdef SPLIT_REND_WITH_HEAD_ROT - uint8_t *splitRendBitsBuf, -#endif - IVAS_DEC_HANDLE hIvasDec, - int16_t *pcmBuf ) - + IVAS_DEC_HANDLE hIvasDec ) { - bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ - uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8]; - int16_t i, num_bits; - int16_t bfi = 0; -#ifdef DEBUGGING - int16_t fec_seed = 12558; /* FEC_SEED */ -#endif - AudioFileWriter *afWriter = NULL; - MasaFileWriter *masaWriter = NULL; - bool decodedGoodFrame = false; - int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */ - int16_t nOutChannels = 0; - int16_t delayNumSamples = -1; - int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */ - int16_t nOutSamples = 0; - int32_t delayTimeScale = 0; - ivas_error error = IVAS_ERR_UNKNOWN; - uint16_t numObj = 0; - IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; - IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef SPLIT_REND_WITH_HEAD_ROT - SplitFileReadWrite *splitRendWriter = NULL; -#endif - IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; - for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) - { - ismWriters[i] = NULL; - } + bool previewFailed = true; + ivas_error error = IVAS_ERR_OK; + FILE *f_rtpstream = NULL; + EVS_RTPDUMP_DEPACKER rtpdumpDepacker; + EVS_RTPDUMP_DEPACKER_ERROR rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_NO_ERROR; + uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3]; + int16_t auSizeBits; + uint8_t *auPtr = NULL; + bool isAMRWB_IOmode; + uint16_t frameTypeIndex; + bool qBit; + uint32_t nextPacketRcvTime_ms = 0; + uint16_t rtpSequenceNumber; + uint32_t rtpTimeStamp; - if ( !arg.quietModeEnabled ) - { - fprintf( stdout, "\n------ Running the decoder ------\n\n" ); - fprintf( stdout, "Frames processed: " ); - } - else + rtpdumpDepacker.rtpdump = NULL; + switch ( arg.inputFormat ) { - fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" ); - } - - delayNumSamples_orig[0] = -1; - -#ifdef WMOPS - reset_stack(); - reset_wmops(); -#endif + case IVAS_DEC_INPUT_FORMAT_RTPDUMP: + case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF: + f_rtpstream = fopen( arg.inputBitstreamFilename, "r" ); - /*------------------------------------------------------------------------------------------* - * Loop for every packet (frame) of bitstream data - * - Read the bitstream packet - * - Run the decoder - * - Write the synthesized signal into output file - *------------------------------------------------------------------------------------------*/ + if ( f_rtpstream == NULL ) + { + fprintf( stderr, "could not open: %s\n", arg.inputBitstreamFilename ); + goto cleanup; + } - while ( 1 ) - { - /* Read next frame */ - if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK ) - { - if ( error == IVAS_ERR_END_OF_FILE ) + rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_open( &rtpdumpDepacker, f_rtpstream, arg.inputFormat == IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF ); + if ( rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) { - break; + fprintf( stderr, "error in EVS_RTPDUMP_DEPACKER_open(): %d\n", rtpdumpDepackerError ); + goto cleanup; } - fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); + break; + case IVAS_DEC_INPUT_FORMAT_G192: + auPtr = au; + break; + default: + fprintf( stderr, "Unsupported format of input bitstream" ); goto cleanup; - } + } -#ifdef DEBUGGING - /* Random FEC simulation */ - if ( arg.FER > 0.0f ) + /* Keep reading until full frame is found */ + do + { + if ( arg.inputFormat == IVAS_DEC_INPUT_FORMAT_G192 ) { - float ftmp = (float) app_own_random( &fec_seed ) + 32768.0f; - if ( ftmp <= arg.FER / 100.0f * 65535.0f ) - { - bfi = 1; - } - else - { - bfi = 0; - } + error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSizeBits, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); + qBit = 1; /* good q_bit for INPUT_FORMAT_G192 */ } -#endif - - /* Feed into decoder */ - if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi ) ) != IVAS_ERR_OK ) + else + { + auPtr = au; /* might have been set to RTP packet in prev call */ + rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, + &nextPacketRcvTime_ms, + &isAMRWB_IOmode, &frameTypeIndex, &qBit, + &auPtr, (uint16_t *) &auSizeBits ); + /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ + rtpTimeStamp = rtpTimeStamp / 16; + } + if ( error != IVAS_ERR_OK || rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) { - fprintf( stderr, "\nError: could not feed frame to decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + fprintf( stderr, "failed to read first RTP packet\n" ); goto cleanup; } + } while ( !qBit || auSizeBits < MIN_NUM_BITS_ACTIVE_FRAME || auSizeBits == NUM_BITS_SID_IVAS_5K2 ); - /* reference vector */ - if ( arg.enableReferenceVectorTracking ) - { - IVAS_VECTOR3 listenerPosition, referencePosition; - if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) ); - goto cleanup; - } + BS_Reader_Rewind( hBsReader ); - if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } + IVAS_DEC_PrintConfigWithVoipBitstream( hIvasDec, arg.quietModeEnabled, au, auSizeBits ); - /* Reference rotation */ - if ( arg.enableReferenceRotation ) - { - IVAS_QUATERNION quaternion; - if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( refRotReader ) ); - goto cleanup; - } + /*------------------------------------------------------------------------------------------* + * Close fhandles and deallocate resources + *------------------------------------------------------------------------------------------*/ - if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - /* Head-tracking input simulation */ - if ( arg.enableHeadRotation ) - { - IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; + previewFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( headRotReader == NULL ) - { - for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - Quaternions[i].w = -3.0f; - Quaternions[i].x = 0.0f; - Quaternions[i].y = 0.0f; - Quaternions[i].z = 0.0f; - Pos[i].x = 0.0f; - Pos[i].y = 0.0f; - Pos[i].z = 0.0f; - } - } - else - { -#endif - for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( headRotReader ) ); - goto cleanup; - } - } -#ifdef SPLIT_REND_WITH_HEAD_ROT - } -#endif +cleanup: - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - DEFAULT_AXIS -#endif - ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } + EVS_RTPDUMP_DEPACKER_close( &rtpdumpDepacker ); - if ( arg.enableExternalOrientation ) - { - IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int8_t enableHeadRotation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; + if ( previewFailed && error == IVAS_ERR_OK ) + { + return IVAS_ERR_UNKNOWN; + } - for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { + return IVAS_ERR_OK; +} +#endif - if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( externalOrientationFileReader ) ); - goto cleanup; - } - } +#ifdef SUPPORT_JBM_TRACEFILE +static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer ) +{ + return JbmTraceFileWriter_writeFrame( data, writer ); +} +#endif - if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedExternalOrientationData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - /* Run decoder for one frame (get rendered output) */ - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - splitRendBitsBuf -#endif - ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError: could not get samples from decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } +/*---------------------------------------------------------------------* + * decodeVoIP() + * + * Read G.192 or RTPDUMP bitstream and decode in VOIP + *---------------------------------------------------------------------*/ - /* Continue checking for first good frame until it is found */ - if ( !decodedGoodFrame ) - { - if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error ); - goto cleanup; - } +static ivas_error decodeVoIP( + DecArguments arg, + BS_READER_HANDLE hBsReader, + IVAS_DEC_HANDLE hIvasDec ) +{ + bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ + ivas_error error = IVAS_ERR_OK; - /* Once good frame decoded, catch up */ - if ( decodedGoodFrame ) - { - if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, nOutSamples, delayNumSamples_orig, - &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - &splitRendWriter -#endif - ) ) != IVAS_ERR_OK ) - { - goto cleanup; - } - } - else - { - ++numInitialBadFrames; - } - } + uint32_t nextPacketRcvTime_ms = 0; + uint32_t systemTime_ms = 0; + uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS; + int32_t nFramesFed = 0; - /* Write current frame */ - if ( decodedGoodFrame ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - IVAS_SPLIT_REND_BITS_DATA splitRendBits; - if ( ( error = IVAS_DEC_GetSplitRendBits( hIvasDec, &splitRendBits ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_SplitRendBits: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } + uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3]; + int16_t auSize; + uint16_t rtpSequenceNumber; + uint32_t rtpTimeStamp; - if ( split_rend_write_bitstream_to_file( splitRendWriter, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing split rendering bitstream to file!\n" ); - goto cleanup; - } - } + bool decodedGoodFrame = false; + int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */ + int16_t nOutChannels = 0; + MasaFileWriter *masaWriter = NULL; + uint16_t numObj = 0; - if ( arg.outputConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) - { -#endif - if ( delayNumSamples < nOutSamples ) - { - if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nOutput audio file writer error\n" ); - goto cleanup; - } - delayNumSamples = 0; - } - else - { - delayNumSamples -= nOutSamples; - } -#ifdef SPLIT_REND_WITH_HEAD_ROT - } + int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; + AudioFileWriter *afWriter = NULL; +#ifdef SUPPORT_JBM_TRACEFILE + JbmTraceFileWriter *jbmTraceWriter = NULL; #endif - } + JbmOffsetFileWriter *jbmOffsetWriter = NULL; - /* Write MASA/ISM metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) - { - if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM || bsFormat == IVAS_DEC_BS_SBA_ISM ) - { - if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } + int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */ + int16_t delayNumSamples = -1; + int32_t delayTimeScale = -1; - for ( i = 0; i < numObj; ++i ) - { - IVAS_ISM_METADATA IsmMetadata; + FILE *f_rtpstream = NULL; + EVS_RTPDUMP_DEPACKER rtpdumpDepacker; + EVS_RTPDUMP_DEPACKER_ERROR rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_NO_ERROR; + uint8_t *auPtr = NULL; + bool isAMRWB_IOmode; + uint16_t frameTypeIndex; + bool qBit; - if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } + IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; + IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; - if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); - goto cleanup; - } - } - } + for ( int16_t i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) + { + ismWriters[i] = NULL; + } - if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) - { - MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } + delayNumSamples_orig[0] = -1; - if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); - goto cleanup; - } + rtpdumpDepacker.rtpdump = NULL; + switch ( arg.inputFormat ) + { + case IVAS_DEC_INPUT_FORMAT_RTPDUMP: + case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF: + f_rtpstream = fopen( arg.inputBitstreamFilename, "r" ); + + if ( f_rtpstream == NULL ) + { + fprintf( stderr, "could not open: %s\n", arg.inputBitstreamFilename ); + goto cleanup; } - } - frame++; - if ( !arg.quietModeEnabled ) - { - fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); -#ifdef DEBUGGING - if ( IVAS_DEC_GetBerDetectFlag( hIvasDec ) ) + rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_open( &rtpdumpDepacker, f_rtpstream, arg.inputFormat == IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF ); + if ( rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) { - fprintf( stdout, "\n Decoding error: BER detected in frame %d !!!!!\n", frame - 1 ); + fprintf( stderr, "error in EVS_RTPDUMP_DEPACKER_open(): %d\n", rtpdumpDepackerError ); + goto cleanup; } -#endif - } -#ifdef WMOPS - update_mem(); - update_wmops(); -#endif + break; + case IVAS_DEC_INPUT_FORMAT_G192: + auPtr = au; + break; + default: + fprintf( stderr, "Unsupported format of input bitstream" ); + goto cleanup; } - /*------------------------------------------------------------------------------------------* - * Add zeros at the end to have equal length of synthesized signals - *------------------------------------------------------------------------------------------*/ - - memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( afWriter != NULL ) +#ifdef SUPPORT_JBM_TRACEFILE + if ( arg.jbmTraceFilename != NULL ) { -#endif - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) + if ( ( error = JbmTraceFileWriter_open( arg.jbmTraceFilename, &jbmTraceWriter ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); + fprintf( stderr, "Could not open: %s\n", arg.jbmTraceFilename ); goto cleanup; } -#ifdef SPLIT_REND_WITH_HEAD_ROT + fprintf( stdout, "JBM trace file: %s\n", arg.jbmTraceFilename ); } #endif - /*------------------------------------------------------------------------------------------* - * Printouts after decoding has finished - *------------------------------------------------------------------------------------------*/ - - if ( !arg.quietModeEnabled ) + if ( arg.jbmOffsetFilename != NULL ) { - printf( "\n\nDecoder+renderer delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale ); - - if ( delayNumSamples_orig[2] > 0 ) + if ( ( error = JbmOffsetFileWriter_open( arg.jbmOffsetFilename, &jbmOffsetWriter ) ) != IVAS_ERR_OK ) { - printf( "HRIR/BRIR delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale ); - printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale ); + fprintf( stderr, "Could not open CA offset file: %s\n", arg.jbmOffsetFilename ); + goto cleanup; } + fprintf( stdout, "JBM CA offset file: %s\n", arg.jbmOffsetFilename ); } - /* Print output metadata file name(s) */ - if ( arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) + /* read first packet */ + if ( arg.inputFormat == IVAS_DEC_INPUT_FORMAT_G192 ) { - if ( bsFormat == IVAS_DEC_BS_OBJ ) - { - for ( i = 0; i < numObj; i++ ) - { - fprintf( stdout, "\nOutput metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); - } - fprintf( stdout, "\n" ); - } - else if ( bsFormat == IVAS_DEC_BS_MASA ) - { - fprintf( stdout, "\nOutput metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); - } - else if ( bsFormat == IVAS_DEC_BS_MASA_ISM ) - { - for ( i = 0; i < numObj; i++ ) - { - fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); - } - fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); - } + error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSize, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); + qBit = 1; /* good q_bit for INPUT_FORMAT_G192 */ } - - /*------------------------------------------------------------------------------------------* - * Close files and deallocate resources - *------------------------------------------------------------------------------------------*/ - - decodingFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ - -cleanup: -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( splitRendWriter != NULL ) + else { - split_rend_reader_writer_close( &splitRendWriter ); + auPtr = au; /* might have been set to RTP packet in prev call */ + rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, + &nextPacketRcvTime_ms, + &isAMRWB_IOmode, &frameTypeIndex, &qBit, + &auPtr, (uint16_t *) &auSize ); + /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ + rtpTimeStamp = rtpTimeStamp / 16; } - - if ( afWriter != NULL ) + if ( error != IVAS_ERR_OK || rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) { -#endif - AudioFileWriter_close( &afWriter ); -#ifdef SPLIT_REND_WITH_HEAD_ROT + fprintf( stderr, "failed to read first RTP packet\n" ); + goto cleanup; } -#endif - MasaFileWriter_close( &masaWriter ); - for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) + if ( !arg.quietModeEnabled ) { - IsmFileWriter_close( &ismWriters[i] ); + fprintf( stdout, "\n------ Running the decoder ------\n\n" ); + fprintf( stdout, "Frames processed: " ); } - - if ( decodingFailed && error == IVAS_ERR_OK ) + else { - return IVAS_ERR_UNKNOWN; + fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" ); } - return error; -} +#ifdef WMOPS + reset_stack(); + reset_wmops(); #endif -#ifdef DEBUGGING -/*---------------------------------------------------------------------* - * printBitstreamInfoVoip() - * - * Print bitstream info of a VoIP G.192 or RTPDUMP bitstream. - *---------------------------------------------------------------------*/ + /*------------------------------------------------------------------------------------------* + * Main receiving/decoding loop + *------------------------------------------------------------------------------------------*/ -static ivas_error printBitstreamInfoVoip( - DecArguments arg, - BS_READER_HANDLE hBsReader, - IVAS_DEC_HANDLE hIvasDec ) -{ - bool previewFailed = true; - ivas_error error = IVAS_ERR_OK; - FILE *f_rtpstream = NULL; - EVS_RTPDUMP_DEPACKER rtpdumpDepacker; - EVS_RTPDUMP_DEPACKER_ERROR rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_NO_ERROR; - uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3]; - int16_t auSizeBits; - uint8_t *auPtr = NULL; - bool isAMRWB_IOmode; - uint16_t frameTypeIndex; - bool qBit; - uint32_t nextPacketRcvTime_ms = 0; - uint16_t rtpSequenceNumber; - uint32_t rtpTimeStamp; +#ifdef DEBUG_JBM_CMD_OPTION + systemTimeInc_ms = arg.frontendFetchSizeMs; +#endif - rtpdumpDepacker.rtpdump = NULL; - switch ( arg.inputFormat ) + while ( 1 ) { - case IVAS_DEC_INPUT_FORMAT_RTPDUMP: - case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF: - f_rtpstream = fopen( arg.inputBitstreamFilename, "r" ); - - if ( f_rtpstream == NULL ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) + uint16_t nOutSamples = 0; +#else + int16_t nOutSamples = 0; +#endif +#ifdef DEBUG_JBM_CMD_OPTION + nOutSamples = (int16_t) ( arg.output_Fs / 1000 * arg.frontendFetchSizeMs ); +#else + nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS ); +#endif + /* read all packets with a receive time smaller than the system time */ + while ( nextPacketRcvTime_ms <= systemTime_ms ) + { + /* feed the previous read packet into the receiver now */ + error = IVAS_DEC_VoIP_FeedFrame( hIvasDec, auPtr, auSize, rtpSequenceNumber, rtpTimeStamp, nextPacketRcvTime_ms, qBit ); + if ( error != IVAS_ERR_OK ) { - fprintf( stderr, "could not open: %s\n", arg.inputBitstreamFilename ); + fprintf( stderr, "\nError in IVAS_DEC_VoIP_FeedFrame: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } + ++nFramesFed; - rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_open( &rtpdumpDepacker, f_rtpstream, arg.inputFormat == IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF ); - if ( rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) + /* read the next packet */ + if ( arg.inputFormat == IVAS_DEC_INPUT_FORMAT_G192 ) { - fprintf( stderr, "error in EVS_RTPDUMP_DEPACKER_open(): %d\n", rtpdumpDepackerError ); + error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSize, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); + + qBit = 1; /* good q_bit for VOIP_G192_RTP */ + } + else + { + auPtr = au; /* might have been set to RTP packet in prev call */ + rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, + &nextPacketRcvTime_ms, + &isAMRWB_IOmode, &frameTypeIndex, &qBit, + &auPtr, (uint16_t *) &auSize ); + /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ + rtpTimeStamp = rtpTimeStamp / 16; + } + if ( error == IVAS_ERR_END_OF_FILE || rtpdumpDepackerError == EVS_RTPDUMP_DEPACKER_EOF ) + { + /* finished reading */ + nextPacketRcvTime_ms = (uint32_t) -1; + } + else if ( error != IVAS_ERR_OK || rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) + { + fprintf( stderr, "\nError in BS_Reader_ReadVoipFrame_compact, error code: %d\n", error ); goto cleanup; } - break; - case IVAS_DEC_INPUT_FORMAT_G192: - auPtr = au; - break; - default: - fprintf( stderr, "Unsupported format of input bitstream" ); - goto cleanup; - } - - /* Keep reading until full frame is found */ - do - { - if ( arg.inputFormat == IVAS_DEC_INPUT_FORMAT_G192 ) - { - error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSizeBits, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); - qBit = 1; /* good q_bit for INPUT_FORMAT_G192 */ - } - else - { - auPtr = au; /* might have been set to RTP packet in prev call */ - rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, - &nextPacketRcvTime_ms, - &isAMRWB_IOmode, &frameTypeIndex, &qBit, - &auPtr, (uint16_t *) &auSizeBits ); - /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ - rtpTimeStamp = rtpTimeStamp / 16; } - if ( error != IVAS_ERR_OK || rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) + + /* we are finished when all packets have been received and jitter buffer is empty */ + /* also stop when the input file contains less than two frames, because JBM cannot calculate a delay value and won't start decoding */ + /* last clause should make sure that for BE tests we end up with the same number of samples...*/ + if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples ) || nFramesFed < 2 ) ) { - fprintf( stderr, "failed to read first RTP packet\n" ); - goto cleanup; + break; } - } while ( !qBit || auSizeBits < MIN_NUM_BITS_ACTIVE_FRAME || auSizeBits == NUM_BITS_SID_IVAS_5K2 ); - - BS_Reader_Rewind( hBsReader ); - - IVAS_DEC_PrintConfigWithVoipBitstream( hIvasDec, arg.quietModeEnabled, au, auSizeBits ); - - /*------------------------------------------------------------------------------------------* - * Close fhandles and deallocate resources - *------------------------------------------------------------------------------------------*/ - - previewFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ - -cleanup: - - EVS_RTPDUMP_DEPACKER_close( &rtpdumpDepacker ); - - if ( previewFailed && error == IVAS_ERR_OK ) - { - return IVAS_ERR_UNKNOWN; - } - return IVAS_ERR_OK; -} -#endif -#ifdef SUPPORT_JBM_TRACEFILE -static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer ) -{ - return JbmTraceFileWriter_writeFrame( data, writer ); -} -#endif - - -/*---------------------------------------------------------------------* - * decodeVoIP() - * - * Read G.192 or RTPDUMP bitstream and decode in VOIP - *---------------------------------------------------------------------*/ - -static ivas_error decodeVoIP( - DecArguments arg, - BS_READER_HANDLE hBsReader, - IVAS_DEC_HANDLE hIvasDec ) -{ - bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ - ivas_error error = IVAS_ERR_OK; - - uint32_t nextPacketRcvTime_ms = 0; - uint32_t systemTime_ms = 0; - uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS; - int32_t nFramesFed = 0; - - - uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3]; - int16_t auSize; - uint16_t rtpSequenceNumber; - uint32_t rtpTimeStamp; - - bool decodedGoodFrame = false; - int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */ - int16_t nOutChannels = 0; - MasaFileWriter *masaWriter = NULL; - uint16_t numObj = 0; - - int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; - AudioFileWriter *afWriter = NULL; -#ifdef SUPPORT_JBM_TRACEFILE - JbmTraceFileWriter *jbmTraceWriter = NULL; -#endif - JbmOffsetFileWriter *jbmOffsetWriter = NULL; - - int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */ - int16_t delayNumSamples = -1; - int32_t delayTimeScale = -1; - - FILE *f_rtpstream = NULL; - EVS_RTPDUMP_DEPACKER rtpdumpDepacker; - EVS_RTPDUMP_DEPACKER_ERROR rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_NO_ERROR; - uint8_t *auPtr = NULL; - bool isAMRWB_IOmode; - uint16_t frameTypeIndex; - bool qBit; - - IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; - IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; - - for ( int16_t i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) - { - ismWriters[i] = NULL; - } - - delayNumSamples_orig[0] = -1; - - rtpdumpDepacker.rtpdump = NULL; - switch ( arg.inputFormat ) - { - case IVAS_DEC_INPUT_FORMAT_RTPDUMP: - case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF: - f_rtpstream = fopen( arg.inputBitstreamFilename, "r" ); - - if ( f_rtpstream == NULL ) - { - fprintf( stderr, "could not open: %s\n", arg.inputBitstreamFilename ); - goto cleanup; - } - - rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_open( &rtpdumpDepacker, f_rtpstream, arg.inputFormat == IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF ); - if ( rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) - { - fprintf( stderr, "error in EVS_RTPDUMP_DEPACKER_open(): %d\n", rtpdumpDepackerError ); - goto cleanup; - } - break; - case IVAS_DEC_INPUT_FORMAT_G192: - auPtr = au; - break; - default: - fprintf( stderr, "Unsupported format of input bitstream" ); - goto cleanup; - } - - -#ifdef SUPPORT_JBM_TRACEFILE - if ( arg.jbmTraceFilename != NULL ) - { - if ( ( error = JbmTraceFileWriter_open( arg.jbmTraceFilename, &jbmTraceWriter ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Could not open: %s\n", arg.jbmTraceFilename ); - goto cleanup; - } - fprintf( stdout, "JBM trace file: %s\n", arg.jbmTraceFilename ); - } -#endif - - if ( arg.jbmOffsetFilename != NULL ) - { - if ( ( error = JbmOffsetFileWriter_open( arg.jbmOffsetFilename, &jbmOffsetWriter ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Could not open CA offset file: %s\n", arg.jbmOffsetFilename ); - goto cleanup; - } - fprintf( stdout, "JBM CA offset file: %s\n", arg.jbmOffsetFilename ); - } - - /* read first packet */ - if ( arg.inputFormat == IVAS_DEC_INPUT_FORMAT_G192 ) - { - error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSize, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); - qBit = 1; /* good q_bit for INPUT_FORMAT_G192 */ - } - else - { - auPtr = au; /* might have been set to RTP packet in prev call */ - rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, - &nextPacketRcvTime_ms, - &isAMRWB_IOmode, &frameTypeIndex, &qBit, - &auPtr, (uint16_t *) &auSize ); - /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ - rtpTimeStamp = rtpTimeStamp / 16; - } - if ( error != IVAS_ERR_OK || rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) - { - fprintf( stderr, "failed to read first RTP packet\n" ); - goto cleanup; - } - - if ( !arg.quietModeEnabled ) - { - fprintf( stdout, "\n------ Running the decoder ------\n\n" ); - fprintf( stdout, "Frames processed: " ); - } - else - { - fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" ); - } - -#ifdef WMOPS - reset_stack(); - reset_wmops(); -#endif - - /*------------------------------------------------------------------------------------------* - * Main receiving/decoding loop - *------------------------------------------------------------------------------------------*/ - -#ifdef DEBUG_JBM_CMD_OPTION - systemTimeInc_ms = arg.frontendFetchSizeMs; -#endif - - while ( 1 ) - { -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) - uint16_t nOutSamples = 0; -#else - int16_t nOutSamples = 0; -#endif -#ifndef API_5MS - uint16_t nSamplesAvailableNext = 0; -#endif -#ifdef DEBUG_JBM_CMD_OPTION - nOutSamples = (int16_t) ( arg.output_Fs / 1000 * arg.frontendFetchSizeMs ); -#else - nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS ); -#endif - /* read all packets with a receive time smaller than the system time */ - while ( nextPacketRcvTime_ms <= systemTime_ms ) - { - /* feed the previous read packet into the receiver now */ - error = IVAS_DEC_VoIP_FeedFrame( hIvasDec, auPtr, auSize, rtpSequenceNumber, rtpTimeStamp, nextPacketRcvTime_ms, qBit ); - if ( error != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_VoIP_FeedFrame: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - ++nFramesFed; - - /* read the next packet */ - if ( arg.inputFormat == IVAS_DEC_INPUT_FORMAT_G192 ) - { - error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSize, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); - - qBit = 1; /* good q_bit for VOIP_G192_RTP */ - } - else - { - auPtr = au; /* might have been set to RTP packet in prev call */ - rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, - &nextPacketRcvTime_ms, - &isAMRWB_IOmode, &frameTypeIndex, &qBit, - &auPtr, (uint16_t *) &auSize ); - /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ - rtpTimeStamp = rtpTimeStamp / 16; - } - if ( error == IVAS_ERR_END_OF_FILE || rtpdumpDepackerError == EVS_RTPDUMP_DEPACKER_EOF ) - { - /* finished reading */ - nextPacketRcvTime_ms = (uint32_t) -1; - } - else if ( error != IVAS_ERR_OK || rtpdumpDepackerError != EVS_RTPDUMP_DEPACKER_NO_ERROR ) - { - fprintf( stderr, "\nError in BS_Reader_ReadVoipFrame_compact, error code: %d\n", error ); - goto cleanup; - } - } - - /* we are finished when all packets have been received and jitter buffer is empty */ - /* also stop when the input file contains less than two frames, because JBM cannot calculate a delay value and won't start decoding */ - /* last clause should make sure that for BE tests we end up with the same number of samples...*/ - if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples ) || nFramesFed < 2 ) ) - { - break; - } - - - /* decode and get samples */ - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT - IVAS_DEC_PCM_INT16, - (void *) -#endif - pcmBuf, - systemTime_ms -#ifndef API_5MS - , - &nSamplesAvailableNext + /* decode and get samples */ + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, +#if defined SPLIT_REND_WITH_HEAD_ROT + IVAS_DEC_PCM_INT16, + (void *) #endif + pcmBuf, + systemTime_ms #ifdef SUPPORT_JBM_TRACEFILE , writeJbmTraceFileFrameWrapper, - jbmTraceWriter -#endif - ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - - /* write JBM Offset file entry */ - if ( jbmOffsetWriter != NULL ) - { - int16_t optimum_offset, FEC_hi; - - if ( ( error = IVAS_DEC_VoIP_Get_CA_offset( hIvasDec, &optimum_offset, &FEC_hi ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_VoIP_Get_CA_offset: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - if ( ( JbmOffsetFileWriter_writeFrame( FEC_hi, optimum_offset, jbmOffsetWriter ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing JBM Offset data to file %s\n", arg.jbmOffsetFilename ); - goto cleanup; - } - } - - /* Continue checking for first good frame until it is found */ - if ( !decodedGoodFrame ) - { - if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error ); - goto cleanup; - } - - /* Once good frame decoded, catch up */ - if ( decodedGoodFrame ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT - - SplitFileReadWrite *hSplitRendFileReadWrite = NULL; -#endif - error = initOnFirstGoodFrame( - hIvasDec, - arg, - numInitialBadFrames, -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) - &nOutSamples, - NULL, -#else - nOutSamples, -#endif - delayNumSamples_orig, - &delayNumSamples, - &delayTimeScale, - &bsFormat, - &afWriter, - &masaWriter, - ismWriters, - &nOutChannels, - &numObj -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - &hSplitRendFileReadWrite -#endif - ); - if ( error != IVAS_ERR_OK ) - { - goto cleanup; - } - } -#ifdef DEBUG_JBM_CMD_OPTION - else if ( arg.noBadFrameDelay == false ) -#else - else -#endif - { - ++numInitialBadFrames; - } - } - - - /* Write current frame */ - if ( decodedGoodFrame ) - { - if ( delayNumSamples < nOutSamples ) - { - if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nOutput audio file writer error\n" ); - goto cleanup; - } - delayNumSamples = 0; - } - else - { - delayNumSamples -= nOutSamples; - } - - /* Write ISM metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) - { - int16_t i; - - if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) - { - if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - for ( i = 0; i < numObj; ++i ) - { - IVAS_ISM_METADATA IsmMetadata; - - if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); - goto cleanup; - } - } - } - - if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) - { - MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); - goto cleanup; - } - } - } - } - - if ( !arg.quietModeEnabled ) - { - fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); - } - - frame++; - systemTime_ms += systemTimeInc_ms; - -#ifdef WMOPS - update_mem(); - update_wmops(); -#endif - } - - /*------------------------------------------------------------------------------------------* - * Add zeros at the end to have equal length of synthesized signals - *------------------------------------------------------------------------------------------*/ - - memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); - goto cleanup; - } - - /*------------------------------------------------------------------------------------------* - * Printouts after decoding has finished - *------------------------------------------------------------------------------------------*/ - - if ( !arg.quietModeEnabled ) - { - printf( "\n\nDecoder+renderer delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale ); - - if ( delayNumSamples_orig[2] > 0 ) - { - printf( "HRIR/BRIR delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale ); - printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale ); - } - } - - /*------------------------------------------------------------------------------------------* - * Close files and deallocate resources - *------------------------------------------------------------------------------------------*/ - - decodingFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ - -cleanup: - - EVS_RTPDUMP_DEPACKER_close( &rtpdumpDepacker ); - AudioFileWriter_close( &afWriter ); - JbmOffsetFileWriter_close( &jbmOffsetWriter ); -#ifdef SUPPORT_JBM_TRACEFILE - JbmTraceFileWriter_close( &jbmTraceWriter ); -#endif - MasaFileWriter_close( &masaWriter ); - for ( int16_t i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) - { - IsmFileWriter_close( &ismWriters[i] ); - } - - if ( decodingFailed && error == IVAS_ERR_OK ) - { - return IVAS_ERR_UNKNOWN; - } - - return error; -} - - -#ifdef DEBUGGING -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING -/*---------------------------------------------------------------------* - * decodeVariableSpeed() - * - * Read G.192 or decode with variable Speed - *---------------------------------------------------------------------*/ - -static ivas_error decodeVariableSpeed( - DecArguments arg, - BS_READER_HANDLE hBsReader, - RotFileReader *headRotReader, - RotFileReader *externalOrientationFileReader, - RotFileReader *refRotReader, - Vector3PairFileReader *referenceVectorReader, - IVAS_DEC_HANDLE hIvasDec ) - -{ - bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ - uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8]; - int16_t i, num_bits; - int16_t bfi = 0; -#ifdef DEBUGGING - int16_t fec_seed = 12558; /* FEC_SEED */ -#endif - AudioFileWriter *afWriter = NULL; - MasaFileWriter *masaWriter = NULL; - bool decodedGoodFrame = false; - int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */ - int16_t nOutChannels = 0; - int16_t delayNumSamples = -1; - int16_t delayNumSamples_orig[3]; - int16_t nOutSamples = 0; - int32_t delayTimeScale = 0; - ivas_error error = IVAS_ERR_UNKNOWN; - uint16_t numObj = 0; - IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; - uint16_t nSamplesAvailableNext; - int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; -#ifdef SUPPORT_JBM_TRACEFILE - JbmTraceFileWriter *jbmTraceWriter = NULL; -#endif - TsmScaleFileReader *tsmScaleFileReader = NULL; - IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; - IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t scale; - for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) - { - ismWriters[i] = NULL; - } - - /*------------------------------------------------------------------------------------------* - * Open TSM scale file - *------------------------------------------------------------------------------------------*/ - - if ( arg.tsmScaleFileEnabled ) - { - if ( ( tsmScaleFileReader = TsmScaleFileReader_open( arg.tsmScaleFileName ) ) == NULL ) - { - fprintf( stderr, "\nError: Can't open TSM scale file %s \n\n", arg.tsmScaleFileName ); - goto cleanup; - } - } - - if ( !arg.quietModeEnabled ) - { - fprintf( stdout, "\n------ Running the decoder ------\n\n" ); - fprintf( stdout, "Frames processed: " ); - } - else - { - fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" ); - } - - delayNumSamples_orig[0] = -1; - -#ifdef WMOPS - reset_stack(); - reset_wmops(); -#endif - nSamplesAvailableNext = 0; - nOutSamples = (int16_t) ( arg.output_Fs / 1000 * VARIABLE_SPEED_FETCH_FRAMESIZE_MS ); - - /*------------------------------------------------------------------------------------------* - * Loop for every packet (frame) of bitstream data - * - Read the bitstream packet - * - Run the decoder - * - Write the synthesized signal into output file - *------------------------------------------------------------------------------------------*/ - - while ( 1 ) - { - /* Read next frame if not enough samples availble */ - - /* reference vector */ - if ( arg.enableReferenceVectorTracking ) - { - IVAS_VECTOR3 listenerPosition, referencePosition; - if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) ); - goto cleanup; - } - - if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - - /* Reference rotation */ - if ( arg.enableReferenceRotation ) - { - IVAS_QUATERNION quaternion; - if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( refRotReader ) ); - goto cleanup; - } - - if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - - /* Head-tracking input simulation */ - if ( arg.enableHeadRotation ) - { - IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - - for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( headRotReader ) ); - goto cleanup; - } - } - - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - DEFAULT_AXIS -#endif - ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - - if ( arg.enableExternalOrientation ) - { - IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int8_t enableHeadRotation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - - for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - - if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( externalOrientationFileReader ) ); - goto cleanup; - } - } - - if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nIVAS_DEC_FeedExternalOrientationData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - - /* decode and get samples */ - do - { - error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, 0, &nSamplesAvailableNext -#ifdef SUPPORT_JBM_TRACEFILE - , - writeJbmTraceFileFrameWrapper, jbmTraceWriter -#endif - ); - - if ( error != IVAS_ERR_OK && error != IVAS_ERR_VS_FRAME_NEEDED ) - { - fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - if ( error == IVAS_ERR_VS_FRAME_NEEDED ) - { - if ( arg.tsmScaleFileEnabled ) - { - if ( ( error = TsmScaleFileReader_readScale( tsmScaleFileReader, &scale ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); - goto cleanup; - } -#ifdef API_5MS - IVAS_DEC_VoIP_SetScale( hIvasDec, scale, scale ); -#else - IVAS_DEC_VoIP_SetScale( hIvasDec, scale ); -#endif - } - - if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK ) - { - if ( error == IVAS_ERR_END_OF_FILE ) - { - break; - } - fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); - goto cleanup; - } - -#ifdef DEBUGGING - /* Random FEC simulation */ - if ( arg.FER > 0.0f ) - { - float ftmp = (float) app_own_random( &fec_seed ) + 32768.0f; - if ( ftmp <= arg.FER / 100.0f * 65535.0f ) - { - bfi = 1; - } - else - { - bfi = 0; - } - } -#endif - - /* Feed into decoder */ - if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError: could not feed frame to decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - error = IVAS_ERR_VS_FRAME_NEEDED; - } - } while ( error != IVAS_ERR_OK ); - - if ( error == IVAS_ERR_END_OF_FILE ) - { - break; - } - - /* Continue checking for first good frame until it is found */ - if ( !decodedGoodFrame ) - { - if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error ); - goto cleanup; - } - - /* Once good frame decoded, catch up */ - if ( decodedGoodFrame ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT - SplitFileReadWrite *hSplitRendFileReadWrite = NULL; -#endif - error = initOnFirstGoodFrame( - hIvasDec, - arg, - numInitialBadFrames, - nOutSamples, - delayNumSamples_orig, - &delayNumSamples, - &delayTimeScale, - &bsFormat, - &afWriter, - &masaWriter, - ismWriters, - &nOutChannels, - &numObj -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - &hSplitRendFileReadWrite -#endif - ); - if ( error != IVAS_ERR_OK ) - { - goto cleanup; - } - } - else - { - ++numInitialBadFrames; - } - } - - /* Write current frame */ - if ( decodedGoodFrame ) - { - if ( delayNumSamples < nOutSamples ) - { - if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nOutput audio file writer error\n" ); - goto cleanup; - } - delayNumSamples = 0; - } - else - { - delayNumSamples -= nOutSamples; - } - } - - /* Write ISm metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) - { - if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) - { - if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - for ( i = 0; i < numObj; ++i ) - { - IVAS_ISM_METADATA IsmMetadata; - - if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); - goto cleanup; - } - } - } - - if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) - { - MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); - goto cleanup; - } - } - } - - frame++; - if ( !arg.quietModeEnabled ) - { - fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); -#ifdef DEBUGGING - if ( IVAS_DEC_GetBerDetectFlag( hIvasDec ) ) - { - fprintf( stdout, "\n Decoding error: BER detected in frame %d !!!!!\n", frame - 1 ); - } -#endif - } -#ifdef WMOPS - update_wmops(); -#ifdef MEM_COUNT_DETAILS - export_mem( "mem_analysis.csv" ); -#endif + jbmTraceWriter #endif - } - - - /*------------------------------------------------------------------------------------------* - * Flush what is still left in the VoIP Buffers.... - *------------------------------------------------------------------------------------------*/ - - while ( nSamplesAvailableNext > 0 ) - { - int16_t nSamplesFlushed; + ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } - /* Feed into decoder */ - /* reference vector */ - if ( arg.enableReferenceVectorTracking ) + /* write JBM Offset file entry */ + if ( jbmOffsetWriter != NULL ) { - IVAS_VECTOR3 listenerPosition, referencePosition; - if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK ) + int16_t optimum_offset, FEC_hi; + + if ( ( error = IVAS_DEC_VoIP_Get_CA_offset( hIvasDec, &optimum_offset, &FEC_hi ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) ); + fprintf( stderr, "\nError in IVAS_DEC_VoIP_Get_CA_offset: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } - if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK ) + if ( ( JbmOffsetFileWriter_writeFrame( FEC_hi, optimum_offset, jbmOffsetWriter ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + fprintf( stderr, "\nError writing JBM Offset data to file %s\n", arg.jbmOffsetFilename ); goto cleanup; } } - /* Reference rotation */ - if ( arg.enableReferenceRotation ) + + /* Continue checking for first good frame until it is found */ + if ( !decodedGoodFrame ) { - IVAS_QUATERNION quaternion; - if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( refRotReader ) ); + fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error ); goto cleanup; } - if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) + /* Once good frame decoded, catch up */ + if ( decodedGoodFrame ) { - fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - } - /* Head-tracking input simulation */ - if ( arg.enableHeadRotation ) - { - IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; +#ifdef SPLIT_REND_WITH_HEAD_ROT - for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) + SplitFileReadWrite *hSplitRendFileReadWrite = NULL; +#endif + error = initOnFirstGoodFrame( + hIvasDec, + arg, + numInitialBadFrames, +#if defined( SPLIT_REND_WITH_HEAD_ROT ) + &nOutSamples, + NULL, +#else + nOutSamples, +#endif + delayNumSamples_orig, + &delayNumSamples, + &delayTimeScale, + &bsFormat, + &afWriter, + &masaWriter, + ismWriters, + &nOutChannels, + &numObj +#ifdef SPLIT_REND_WITH_HEAD_ROT + , + &hSplitRendFileReadWrite +#endif + ); + if ( error != IVAS_ERR_OK ) { - fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( headRotReader ) ); goto cleanup; } } - - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - DEFAULT_AXIS +#ifdef DEBUG_JBM_CMD_OPTION + else if ( arg.noBadFrameDelay == false ) +#else + else #endif - ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; + ++numInitialBadFrames; } } - if ( arg.enableExternalOrientation ) - { - IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int8_t enableHeadRotation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + /* Write current frame */ + if ( decodedGoodFrame ) + { + if ( delayNumSamples < nOutSamples ) { - - if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK ) + if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( externalOrientationFileReader ) ); + fprintf( stderr, "\nOutput audio file writer error\n" ); goto cleanup; } + delayNumSamples = 0; } - - if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) + else { - fprintf( stderr, "\nIVAS_DEC_FeedExternalOrientationData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; + delayNumSamples -= nOutSamples; } - } - - /* decode and get samples */ - if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesAvailableNext, &nSamplesFlushed ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - /* Write current frame */ - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, nSamplesFlushed * nOutChannels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nOutput audio file writer error\n" ); - goto cleanup; - } - /* Write ISm metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) - { - if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) + /* Write ISM metadata to external file(s) */ + if ( decodedGoodFrame && arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) { - if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } + int16_t i; - for ( i = 0; i < numObj; ++i ) + if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) { - IVAS_ISM_METADATA IsmMetadata; - - if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } - if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) + for ( i = 0; i < numObj; ++i ) { - fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); - goto cleanup; + IVAS_ISM_METADATA IsmMetadata; + + if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); + goto cleanup; + } } } - } - if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) - { - MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) + if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { - fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } - if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); - goto cleanup; + if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); + goto cleanup; + } } } } - frame++; if ( !arg.quietModeEnabled ) { fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); -#ifdef DEBUGGING - if ( IVAS_DEC_GetBerDetectFlag( hIvasDec ) ) - { - fprintf( stdout, "\n Decoding error: BER detected in frame %d !!!!!\n", frame - 1 ); - } -#endif } + + frame++; + systemTime_ms += systemTimeInc_ms; + +#ifdef WMOPS + update_mem(); + update_wmops(); +#endif + } + + /*------------------------------------------------------------------------------------------* + * Add zeros at the end to have equal length of synthesized signals + *------------------------------------------------------------------------------------------*/ + + memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); + if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } /*------------------------------------------------------------------------------------------* @@ -4400,39 +3238,6 @@ static ivas_error decodeVariableSpeed( } } - /* Print output metadata file name(s) */ - if ( arg.outputConfig == AUDIO_CONFIG_EXTERNAL ) - { - if ( bsFormat == IVAS_DEC_BS_OBJ ) - { - for ( i = 0; i < numObj; i++ ) - { - fprintf( stdout, "\nOutput metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); - } - fprintf( stdout, "\n" ); - } - else if ( bsFormat == IVAS_DEC_BS_MASA ) - { - fprintf( stdout, "\nOutput metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); - } - else if ( bsFormat == IVAS_DEC_BS_MASA_ISM ) - { - for ( i = 0; i < numObj; i++ ) - { - fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); - } - fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); - } - } - - /* add zeros at the end to have equal length of synthesized signals */ - memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); - goto cleanup; - } - /*------------------------------------------------------------------------------------------* * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ @@ -4441,10 +3246,14 @@ static ivas_error decodeVariableSpeed( cleanup: + EVS_RTPDUMP_DEPACKER_close( &rtpdumpDepacker ); AudioFileWriter_close( &afWriter ); + JbmOffsetFileWriter_close( &jbmOffsetWriter ); +#ifdef SUPPORT_JBM_TRACEFILE + JbmTraceFileWriter_close( &jbmTraceWriter ); +#endif MasaFileWriter_close( &masaWriter ); - TsmScaleFileReader_close( &tsmScaleFileReader ); - for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) + for ( int16_t i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) { IsmFileWriter_close( &ismWriters[i] ); } @@ -4456,8 +3265,9 @@ cleanup: return error; } -#endif -#endif + + +#ifdef DEBUGGING /*---------------------------------------------------------------------* * parseForcedRendModeDec() diff --git a/apps/renderer.c b/apps/renderer.c index 858a9d4150..100d8e3e73 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -777,12 +777,7 @@ int main( int32_t delayTimeScale = 0; int16_t i, numChannels; ivas_error error = IVAS_ERR_OK; -#ifndef API_5MS - IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; -#endif -#ifdef API_5MS bool splitBinNeedsNewFrame = true; -#endif #ifdef WMOPS reset_wmops(); @@ -1002,11 +997,7 @@ int main( } #endif const int16_t frameSize_smpls = (int16_t) ( -#ifdef API_5MS ( args.framing_5ms ? 5 : 20 ) -#else - 20 -#endif * args.sampleRate / 1000 ); IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; @@ -1018,10 +1009,8 @@ int main( #endif if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain -#ifdef API_5MS , ( args.framing_5ms ) ? 1 : 4 -#endif ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); @@ -1426,9 +1415,7 @@ int main( bitsBuffer.config.bufLenInBytes = bitsBufferSize; bitsBuffer.config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; bitsBuffer.config.poseCorrection = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; -#ifdef API_5MS bitsBuffer.config.codec_frame_size_ms = 20; -#endif #else inFloatBuffer = malloc( inBufferSize * sizeof( float ) ); outInt16Buffer = malloc( outBufferSize * sizeof( int16_t ) ); @@ -1458,34 +1445,26 @@ int main( fprintf( stdout, "\n\n-- Start the renderer (quiet mode) --\n\n" ); } -#ifdef API_5MS ObjectPositionBuffer mtdBuffer; -#endif while ( 1 ) { int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; -#ifdef API_5MS const bool isCurrentFrameMultipleOf20ms = !args.framing_5ms || frame % 4 == 0; -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT numSamplesRead = 0; if ( ( hSplitRendFileReadWrite != NULL ) && is_split_post_rend_mode( &args ) -#ifdef API_5MS && splitBinNeedsNewFrame -#endif ) { ivas_error error_tmp; numSamplesRead = (int16_t) inBufferSize; error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection -#ifdef API_5MS , &bitsBuffer.config.codec_frame_size_ms -#endif ); if ( error_tmp != IVAS_ERR_OK ) { @@ -1515,9 +1494,7 @@ int main( #endif if ( numSamplesRead == 0 -#ifdef API_5MS && splitBinNeedsNewFrame -#endif ) { /* end of input data */ @@ -1533,18 +1510,10 @@ int main( ); int16_t num_subframes, sf_idx; -#ifdef API_5MS num_subframes = ( args.framing_5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; -#else - num_subframes = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; -#endif -#ifdef API_5MS if ( isCurrentFrameMultipleOf20ms ) { -#else - ObjectPositionBuffer mtdBuffer; -#endif IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); if ( referenceVectorReader != NULL ) @@ -1580,14 +1549,11 @@ int main( } } } -#ifdef API_5MS } -#endif /* Read from head rotation trajectory file if specified */ if ( headRotReader != NULL ) { -#ifdef API_5MS for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { IVAS_QUATERNION headRot; @@ -1603,69 +1569,28 @@ int main( , DEFAULT_AXIS #endif -#ifdef API_5MS , sf_idx -#endif ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } -#else - IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; - - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) - { - if ( ( error = HeadRotationFileReading( headRotReader, &quatBuffer[i], &Pos[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } - } - - if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, Pos -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - DEFAULT_AXIS -#endif - ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } -#endif } else { -#ifdef API_5MS if ( ( error = IVAS_REND_DisableHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error disabling head rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } -#else /* API_5MS */ - error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - DEFAULT_AXIS -#endif - ); - if ( error != IVAS_ERR_OK && error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) - { - fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } -#endif /* API_5MS */ } #ifdef SPLIT_REND_WITH_HEAD_ROT /* Read from split renderer bfi file if specified */ if ( splitRendBFIReader != NULL -#ifdef API_5MS && splitBinNeedsNewFrame -#endif ) { int16_t bfi; @@ -1682,11 +1607,7 @@ int main( int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef API_5MS for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) -#else - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) -#endif { if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quatBuffer[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK ) { @@ -1694,27 +1615,17 @@ int main( exit( -1 ); } } -#ifdef API_5MS for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { if ( ( error = IVAS_REND_SetExternalOrientation( hIvasRend, &quatBuffer[sf_idx], enableHeadRotation[sf_idx], enableExternalOrientation[sf_idx], enableRotationInterpolation[sf_idx], numFramesToTargetOrientation[sf_idx] -#ifdef API_5MS , sf_idx -#endif ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error setting External Orientation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } -#else - if ( ( error = IVAS_REND_SetExternalOrientation( hIvasRend, quatBuffer, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error setting External Orientation: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } -#endif } /* Combine external orientations and head rotation */ @@ -1828,10 +1739,8 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < args.inConfig.numBinBuses; ++i ) { -#ifdef API_5MS if ( splitBinNeedsNewFrame ) { -#endif if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, splitBinIds[i], &numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); @@ -1850,13 +1759,11 @@ int main( fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } -#ifdef API_5MS } -#endif } #endif -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT if ( args.inConfig.numBinBuses != 0 ) { if ( ( error = IVAS_REND_GetSplitBinauralSamples( hIvasRend, outBuffer, &splitBinNeedsNewFrame ) ) != IVAS_ERR_OK ) @@ -1878,12 +1785,6 @@ int main( { #endif if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer -#ifndef API_5MS -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - &bitsBuffer -#endif -#endif ) ) != IVAS_ERR_OK ) { #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1893,7 +1794,7 @@ int main( #endif exit( -1 ); } -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT } #endif @@ -1945,10 +1846,8 @@ int main( { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection -#ifdef API_5MS , bitsBuffer.config.codec_frame_size_ms -#endif ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 9360ffb757..440892803d 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -57,9 +57,6 @@ #define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 -#ifndef API_5MS -#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // ToDo: should it be harmonized with IVAS_MAX_PARAM_SPATIAL_SUBFRAMES? -#endif #define QC_ABS_COEFF 6 #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -181,9 +178,7 @@ typedef struct ivas_split_rend_bits_t int32_t buf_len; /*size of bits_buf in bytes. This field should be set by allocator of bits_buf*/ int32_t bits_written; int32_t bits_read; -#ifdef API_5MS int16_t codec_frame_size_ms; -#endif IVAS_SPLIT_REND_CODEC codec; IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction; } ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS_DATA, *IVAS_SPLIT_REND_BITS_HANDLE; @@ -266,9 +261,7 @@ typedef struct _IVAS_SPLIT_REND_CONFIG 3 - (3dof correction. By default YAW, PITCH and ROLL correction) */ int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ -#ifdef API_5MS int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */ -#endif IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; IVAS_SPLIT_REND_CODEC codec; IVAS_SPLIT_REND_RENDERER_SELECTION rendererSelection; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 29473c091c..91bf07a9ff 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -130,7 +130,7 @@ typedef enum } ivas_renderTypeOverride; #endif -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT typedef enum { PCM_INT16, diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 813b1d570f..92339c1f81 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -86,10 +86,8 @@ typedef enum IVAS_ERR_ISM_INVALID_METADATA_VALUE, IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE, IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, -#ifdef API_5MS IVAS_ERR_TSM_NOT_ENABLED, IVAS_ERR_FETCH_SIZE_NO_MULTIPLE_OF_5MS, -#endif #ifdef DEBUGGING IVAS_ERR_INVALID_FORCE_MODE, #ifdef DEBUG_AGC_ENCODER_CMD_OPTION diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c9b736edba..6893be758d 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -299,26 +299,20 @@ void stereo_dmx_evs_close_encoder( STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ ); -#if !defined(API_5MS) || defined (API_5MS_BASELINE) ivas_error ivas_dec( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else int16_t *data /* o : output synthesis signal */ #endif -#if defined SPLIT_REND_WITH_HEAD_ROT && !defined(API_5MS) - , - uint8_t *splitRendBitsBuf /* o : output split rendering bits */ -#endif ); -#endif ivas_error ivas_dec_setup( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -663,7 +657,7 @@ ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx, /* i : LS config. index */ uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -783,7 +777,7 @@ ivas_error ivas_jbm_dec_render( const uint16_t nSamplesAsked, /* i : number of samples wanted */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -800,7 +794,7 @@ ivas_error ivas_jbm_dec_flush_renderer( const MC_MODE mc_mode_old, /* i : old MC mode */ const ISM_MODE ism_mode_old, /* i : old ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -844,12 +838,10 @@ int16_t ivas_jbm_dec_get_num_tc_channels( Decoder_Struct *st_ivas /* i : IVAS decoder handle */ ); -#ifdef API_5MS void ivas_jbm_dec_copy_tc_no_tsm( Decoder_Struct *st_ivas, float *tc[], const int16_t output_frame ); -#endif void ivas_jbm_dec_get_md_map_even_spacing( const int16_t len, /* i : length of the modfied frames in metadata slots */ @@ -1071,7 +1063,7 @@ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -1104,14 +1096,12 @@ void ivas_param_ism_dec_digest_tc( float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ); -#ifdef API_5MS void ivas_ism_param_dec_tc_gain_ajust( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamples, /* i : number of samples to be compensate */ const uint16_t nFadeLength, /* i : length of the crossfade in samples */ float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ); -#endif void ivas_param_ism_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -3678,9 +3668,7 @@ void ivas_dirac_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport /* i : number of transport channels */ -#ifdef API_5MS ,const int16_t num_subframes /* i : number of subframes to render */ -#endif ); void ivas_dirac_dec_render( @@ -4989,7 +4977,7 @@ void ivas_masa_enc_reconfigure( ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -5716,7 +5704,7 @@ ivas_error ivas_omasa_enc_config( ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else diff --git a/lib_com/options.h b/lib_com/options.h index 93ab1d5d1b..e3e04a1c7a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,13 +158,6 @@ #define OSBA_SPLIT_RENDERING #endif -/* ### API_5MS switches start ### */ -#define API_5MS /* FhG: 5ms rendering capability */ -#ifdef API_5MS -#define API_5MS_BASELINE /* FhG: baseline with 20ms rendering and split rendering through 20ms branch */ -#define APLIT_5MS_FIX_TODO -#endif - /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index cb2f7f5702..5f71f79088 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -2111,10 +2111,8 @@ void ivas_rend_CldfbMultiBinRendProcess( float Cldfb_Out_Real[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_Out_Imag[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t low_res_pre_rend_rot -#ifdef API_5MS , int16_t num_subframes -#endif ) { int16_t slot_idx, ch_idx, idx, pose_idx, i, j; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 0f06149eff..4dcec5509d 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -53,16 +53,12 @@ ivas_error ivas_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else int16_t *data /* o : output synthesis signal */ #endif -#if defined SPLIT_REND_WITH_HEAD_ROT && !defined( API_5MS ) - , - uint8_t *splitRendBitsBuf /* o : output split rendering bits */ -#endif ) { int16_t n, output_frame, nchan_out; @@ -77,7 +73,7 @@ ivas_error ivas_dec( float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; int16_t num_md_sub_frames; int32_t ism_total_brate; -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT int16_t nchan_out_syn_output; #endif @@ -85,27 +81,6 @@ ivas_error ivas_dec( push_wmops( "ivas_dec" ); -#ifndef API_5MS_BASELINE - /*----------------------------------------------------------------* - * IVAS decoder setup - * - read IVAS format signaling - * - read IVAS format specific signaling - * - initialize decoder in the first frame based on IVAS format and number of transport channels - * - reconfigure the decoder when the number of TC or IVAS total bitrate change - *----------------------------------------------------------------*/ - - if ( st_ivas->bfi == 0 ) - { - if ( ( error = ivas_dec_setup( st_ivas, NULL, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT - PCM_NOT_KNOW, -#endif - NULL ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif /*----------------------------------------------------------------* * Initialization of local vars after struct has been set @@ -134,30 +109,7 @@ ivas_error ivas_dec( return error; } -#if defined SPLIT_REND_WITH_HEAD_ROT && !defined( API_5MS ) - if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - assert( ( st_ivas->ivas_format != UNDEFINED_FORMAT && - st_ivas->ivas_format != MONO_FORMAT && - st_ivas->ivas_format != STEREO_FORMAT ) && - ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, MASA, ISM, or MC formats and 48 kHz sampling rate only" ); -#else - assert( ( st_ivas->ivas_format == SBA_FORMAT || - st_ivas->ivas_format == MASA_FORMAT || - st_ivas->ivas_format == ISM_FORMAT || - ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_PARAM ) || - ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCMASA ) ) && - ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" ); -#endif - if ( ( error = ivas_set_split_rend_setup( &st_ivas->hSplitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, splitRendBitsBuf ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif -#if defined SPLIT_REND_WITH_HEAD_ROT && defined( API_5MS ) +#if defined SPLIT_REND_WITH_HEAD_ROT if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { @@ -277,10 +229,8 @@ ivas_error ivas_dec( ivas_param_ism_params_to_masa_param_mapping( st_ivas ); ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) @@ -360,10 +310,8 @@ ivas_error ivas_dec( { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, p_output, output_Fs -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -512,10 +460,8 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, nchan_remapped -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); } else if ( st_ivas->ivas_format == MASA_FORMAT ) @@ -532,10 +478,8 @@ ivas_error ivas_dec( else if ( st_ivas->renderer_type == RENDERER_DIRAC ) { ivas_dirac_dec( st_ivas, output, nchan_remapped -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); } } @@ -624,10 +568,8 @@ ivas_error ivas_dec( else { ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); } } @@ -769,10 +711,8 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[sba_ch_idx], nchan_remapped -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) @@ -901,10 +841,8 @@ ivas_error ivas_dec( #endif if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -1143,19 +1081,15 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); } else if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) /* rendering to CICPxx and Ambisonics */ { ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) @@ -1177,40 +1111,6 @@ ivas_error ivas_dec( } } -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && !defined( API_5MS ) - /*split rendering process calls*/ - if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend; - int16_t max_band; - int16_t pcm_out; -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - int16_t td_input; - - td_input = st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC; -#endif - hSplitBinRend = &st_ivas->hSplitBinRend; - max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); - pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; - - if ( ( error = ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, st_ivas->hRenderConfig->split_rend_config.codec, hSplitBinRend->hSplitRendBits, - hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, - max_band, output, 1, -#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - td_input, -#else - st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV, -#endif - pcm_out ) ) != IVAS_ERR_OK ) - { - return error; - } - - free( st_ivas->hSplitBinRend.hMultiBinCldfbData ); - st_ivas->hSplitBinRend.hMultiBinCldfbData = NULL; - } -#endif /*----------------------------------------------------------------* * Write IVAS output channels @@ -1218,7 +1118,7 @@ ivas_error ivas_dec( * - float to integer conversion *----------------------------------------------------------------*/ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { nchan_out_syn_output = BINAURAL_CHANNELS * st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses; @@ -1233,7 +1133,7 @@ ivas_error ivas_dec( { #ifndef DISABLE_LIMITER ivas_limiter_dec( st_ivas->hLimiter, p_output, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT nchan_out_syn_output, #else nchan_out, @@ -1242,7 +1142,7 @@ ivas_error ivas_dec( #endif } -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT switch ( pcm_resolution ) { case PCM_INT16: @@ -1251,17 +1151,17 @@ ivas_error ivas_dec( st_ivas->noClipping += #endif ivas_syn_output( p_output, output_frame, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT nchan_out_syn_output, #else nchan_out, #endif -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT (int16_t *) #endif data ); -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT break; case PCM_FLOAT32: ivas_syn_output_f( p_output, output_frame, nchan_out_syn_output, (float *) data ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 853e51631c..fd94409a02 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -975,13 +975,7 @@ ivas_error ivas_dirac_dec_config( if ( dec_config_flag == DIRAC_OPEN ) { if ( -#ifdef API_5MS -#ifdef API_5MS_BASELINE st_ivas->hDecoderConfig->Opt_5ms && -#endif -#else - st_ivas->hDecoderConfig->voip_active == 1 && -#endif st_ivas->hTcBuffer == NULL ) { if ( st_ivas->ivas_format == SBA_FORMAT ) @@ -1556,7 +1550,6 @@ void ivas_dirac_dec_set_md_map( hSpatParamRendCom->subframes_rendered = 0; ivas_jbm_dec_get_adapted_subframes( nCldfbTs, hSpatParamRendCom->subframe_nbslots, &hSpatParamRendCom->nb_subframes ); -#ifdef API_5MS /* copy also to tc buffer */ /* only for non-combined formats and combinded formats w/o discrete objects */ if ( st_ivas->ivas_format != MASA_ISM_FORMAT || st_ivas->ism_mode != ISM_MASA_MODE_DISC ) @@ -1564,7 +1557,6 @@ void ivas_dirac_dec_set_md_map( st_ivas->hTcBuffer->nb_subframes = hSpatParamRendCom->nb_subframes; mvs2s( hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hSpatParamRendCom->nb_subframes ); } -#endif /* set mapping according to dirac_read_idx */ @@ -1617,10 +1609,8 @@ void ivas_dirac_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport /* i : number of transport channels */ -#ifdef API_5MS , const int16_t num_subframes /* i : number of subframes to render */ -#endif ) { int16_t subframe_idx; @@ -1653,11 +1643,7 @@ void ivas_dirac_dec( ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); for ( n = 0; n < nchan_out; n++ ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 25a1ec172d..0be2bb49e6 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -247,7 +247,6 @@ static ivas_error ivas_dec_init_split_rend( } } -#ifdef API_5MS if ( ( error = ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, &st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, ( cldfb_in == 0 ), @@ -255,9 +254,6 @@ static ivas_error ivas_dec_init_split_rend( { return error; } -#else - ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, ( cldfb_in == 0 ), pcm_out ); -#endif #ifdef OSBA_SPLIT_RENDERING if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) { @@ -269,25 +265,9 @@ static ivas_error ivas_dec_init_split_rend( &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in, pcm_out -#ifdef API_5MS , st_ivas->hDecoderConfig->Opt_5ms -#endif ); -#ifndef API_5MS - IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits; - if ( ( hSplitRendBits = (IVAS_SPLIT_REND_BITS_HANDLE) malloc( sizeof( IVAS_SPLIT_REND_BITS_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for split renderer Bits buffer\n" ) ); - } - - hSplitRendBits->bits_buf = NULL; - hSplitRendBits->bits_read = 0; - hSplitRendBits->bits_written = 0; - hSplitRendBits->buf_len = IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES; - - st_ivas->hSplitBinRend.hSplitRendBits = hSplitRendBits; -#endif return error; } #endif @@ -302,7 +282,7 @@ static ivas_error ivas_dec_init_split_rend( ivas_error ivas_dec_setup( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -359,7 +339,7 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = nchan_ism; if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) @@ -420,7 +400,7 @@ ivas_error ivas_dec_setup( else { if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) @@ -432,7 +412,7 @@ ivas_error ivas_dec_setup( else { if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) @@ -457,7 +437,7 @@ ivas_error ivas_dec_setup( if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) { if ( ( error = ivas_omasa_dec_config( st_ivas, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) @@ -533,7 +513,7 @@ ivas_error ivas_dec_setup( /* select MC format mode; reconfigure the MC format decoder */ ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif @@ -653,7 +633,7 @@ ivas_error ivas_dec_setup( } if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) @@ -1016,10 +996,8 @@ ivas_error ivas_init_decoder_front( if ( st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ) -#ifdef API_5MS , ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -1033,10 +1011,8 @@ ivas_error ivas_init_decoder_front( if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { if ( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ) -#ifdef API_5MS , ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -1968,13 +1944,7 @@ ivas_error ivas_init_decoder( } -#ifdef API_5MS_BASELINE -#ifndef API_5MS - if ( st_ivas->hDecoderConfig->voip_active ) -#else if ( st_ivas->hDecoderConfig->Opt_5ms ) -#endif -#endif { granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); @@ -2022,13 +1992,7 @@ ivas_error ivas_init_decoder( st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#ifdef API_5MS_BASELINE -#ifndef API_5MS - if ( st_ivas->hDecoderConfig->voip_active ) -#else if ( st_ivas->hDecoderConfig->Opt_5ms ) -#endif -#endif { if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) { @@ -2203,13 +2167,7 @@ ivas_error ivas_init_decoder( * Allocate and initialize JBM struct + buffer *-----------------------------------------------------------------*/ if ( -#ifdef API_5MS -#ifdef API_5MS_BASELINE st_ivas->hDecoderConfig->Opt_5ms && -#endif -#else - st_ivas->hDecoderConfig->voip_active == 1 && -#endif st_ivas->hTcBuffer == NULL ) { @@ -2222,7 +2180,6 @@ ivas_error ivas_init_decoder( } } -#if !defined( API_5MS ) || defined( API_5MS_BASELINE ) if ( st_ivas->hTcBuffer == NULL ) { /* we need the handle anyway, but without the buffer*/ @@ -2231,7 +2188,6 @@ ivas_error ivas_init_decoder( return error; } } -#endif if ( st_ivas->hJbmMetadata == NULL ) { @@ -2248,11 +2204,7 @@ ivas_error ivas_init_decoder( * Allocate floating-point output audio buffers *-----------------------------------------------------------------*/ -#ifdef API_5MS if ( !st_ivas->hDecoderConfig->Opt_5ms ) -#else - if ( !st_ivas->hDecoderConfig->voip_active ) -#endif { for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas ); n++ ) { @@ -2510,10 +2462,8 @@ void ivas_initialize_handles_dec( st_ivas->hSplitBinRend.hMultiBinCldfbData = NULL; st_ivas->hSplitBinRend.hSplitRendBits = NULL; st_ivas->hSplitBinRend.hCldfbDataOut = NULL; -#ifdef API_5MS st_ivas->hSplitBinRend.tdDataOut = NULL; st_ivas->hSplitBinRend.numTdSamplesPerChannelCached = 0; -#endif ivas_init_split_rend_handles( &st_ivas->hSplitBinRend.splitrend ); #endif @@ -2668,19 +2618,10 @@ void ivas_destroy_dec( st_ivas->hSplitBinRend.hCldfbDataOut = NULL; } -#ifndef API_5MS - if ( st_ivas->hSplitBinRend.hSplitRendBits != NULL ) - { - free( st_ivas->hSplitBinRend.hSplitRendBits ); - st_ivas->hSplitBinRend.hSplitRendBits = NULL; - } -#endif -#ifdef API_5MS if ( st_ivas->hSplitBinRend.tdDataOut != NULL ) { free( st_ivas->hSplitBinRend.tdDataOut ); } -#endif #endif /* Parametric binaural renderer handle */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 1e90079203..d83fd7ff07 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -51,7 +51,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( const int16_t nchan_transport_old, /* i : last number of transport channels */ const ISM_MODE last_ism_mode, /* i : last ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -127,13 +127,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config ); } -#ifdef API_5MS_BASELINE -#ifndef API_5MS - if ( st_ivas->hDecoderConfig->voip_active ) -#else if ( st_ivas->hDecoderConfig->Opt_5ms ) -#endif -#endif { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) @@ -151,7 +145,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) @@ -345,11 +339,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( * floating-point output audio buffers *-----------------------------------------------------------------*/ -#ifdef API_5MS if ( !st_ivas->hDecoderConfig->Opt_5ms ) -#else - if ( !st_ivas->hDecoderConfig->voip_active ) -#endif { nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas ); @@ -377,13 +367,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( /*-----------------------------------------------------------------* * Reconfigure TC buffer *-----------------------------------------------------------------*/ -#ifdef API_5MS -#ifdef API_5MS_BASELINE if ( st_ivas->hDecoderConfig->Opt_5ms ) -#endif -#else - if ( st_ivas->hDecoderConfig->voip_active == 1 ) -#endif { int16_t tc_nchan_full_new; DECODER_TC_BUFFER_HANDLE hTcBuffer; @@ -442,7 +426,7 @@ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -487,7 +471,7 @@ ivas_error ivas_ism_dec_config( if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) @@ -514,7 +498,7 @@ ivas_error ivas_ism_dec_config( if ( st_ivas->ism_mode != last_ism_mode ) { if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index fdc5a205aa..cf5d6311b9 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -97,7 +97,7 @@ ivas_error ivas_ism_dtx_dec( } if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, NULL, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT PCM_NOT_KNOW, #endif NULL ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 1d76765193..23740664fa 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -528,11 +528,7 @@ ivas_error ivas_param_ism_dec_open( if ( !( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) { /* Initialize Param ISM Rendering handle */ -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_tsm ) -#else - if ( st_ivas->hDecoderConfig->voip_active ) -#endif { if ( ( error = ivas_param_ism_rendering_init( hDirAC->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, MAX_JBM_CLDFB_TIMESLOTS, output_config ) ) != IVAS_ERR_OK ) { @@ -594,13 +590,7 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hDirAC = hDirAC; st_ivas->hSpatParamRendCom = hSpatParamRendCom; -#ifndef API_5MS - if ( st_ivas->hDecoderConfig->voip_active ) -#else -#ifdef API_5MS_BASELINE if ( st_ivas->hDecoderConfig->Opt_5ms ) -#endif -#endif { if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) { @@ -614,7 +604,6 @@ ivas_error ivas_param_ism_dec_open( } else { -#ifdef API_5MS int16_t n_slots_to_alloc; if ( st_ivas->hDecoderConfig->Opt_tsm == 1 ) { @@ -636,20 +625,6 @@ ivas_error ivas_param_ism_dec_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } set_zero( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); -#else - if ( ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); - } - set_zero( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands ); - - if ( ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); - } - set_zero( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hSpatParamRendCom->num_freq_bands ); -#endif } if ( st_ivas->hTcBuffer == NULL ) { @@ -673,13 +648,11 @@ ivas_error ivas_param_ism_dec_open( } } } -#if !defined( API_5MS ) || defined API_5MS_BASELINE else { hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; } -#endif pop_wmops(); return error; @@ -777,12 +750,7 @@ void ivas_param_ism_dec( int16_t subframe_idx, slot_idx, index_slot, bin_idx; int32_t ivas_total_brate; int16_t output_frame; -#ifndef API_5MS - float gain, ene_tc, ene_sum, grad; - float last_gain; -#else float *p_tc[PARAM_ISM_MAX_DMX]; -#endif float ref_power[CLDFB_NO_CHANNELS_MAX]; float cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; /* CLDFB Input Buffers */ @@ -809,17 +777,10 @@ void ivas_param_ism_dec( assert( hDirAC ); hSpatParamRendCom = st_ivas->hSpatParamRendCom; assert( hSpatParamRendCom ); -#ifdef API_5MS for ( i = 0; i < PARAM_ISM_MAX_DMX; i++ ) { p_tc[i] = output_f[i]; } -#else - - ene_tc = 0.0f; - ene_sum = 0.0f; - last_gain = st_ivas->hDirAC->hParamIsm->last_dmx_gain; -#endif output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); nchan_transport = st_ivas->nchan_transport; @@ -910,43 +871,7 @@ void ivas_param_ism_dec( } } } -#ifdef API_5MS ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, output_frame / 2, p_tc ); -#else - /* Energy Compensation */ - for ( i = 0; i < output_frame; i++ ) - { - ene_tc += output_f[0][i] * output_f[0][i] + output_f[1][i] * output_f[1][i]; // L*L + R*R - ene_sum += ( output_f[0][i] + output_f[1][i] ) * ( output_f[0][i] + output_f[1][i] ); // (L+R)*(L+R) - } - gain = sqrtf( ene_tc / ( ene_sum + EPSILON ) ); - if ( st_ivas->hSCE[0]->hCoreCoder[0]->ini_frame > 1 ) - { - /* Smoothing */ - gain = 0.75f * gain + 0.25f * last_gain; - /* 10ms ramp */ - grad = ( gain - last_gain ) * 2.0f / (float) output_frame; /* slope between two consecutive gains, 480 samples length */ - for ( i = 0; i < ( output_frame / 2 ); i++ ) - { - output_f[0][i] *= ( last_gain + i * grad ); - output_f[1][i] *= ( last_gain + i * grad ); - } - for ( ; i < output_frame; i++ ) - { - output_f[0][i] *= gain; - output_f[1][i] *= gain; - } - } - else - { - for ( i = 0; i < output_frame; i++ ) - { - output_f[0][i] *= gain; - output_f[1][i] *= gain; - } - } - st_ivas->hDirAC->hParamIsm->last_dmx_gain = gain; -#endif /* API_5MS */ for ( ch = 0; ch < nchan_transport; ch++ ) { /*-----------------------------------------------------------------* @@ -1163,10 +1088,6 @@ void ivas_param_ism_dec_digest_tc( int16_t slot_idx, bin_idx; int32_t ivas_total_brate; int16_t output_frame; -#ifndef API_5MS - float gain, ene_tc, ene_sum, grad; - float last_gain; -#endif float ref_power[CLDFB_NO_CHANNELS_MAX]; float cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; /* Direct Response/EFAP Gains */ @@ -1180,11 +1101,6 @@ void ivas_param_ism_dec_digest_tc( assert( hDirAC ); hSpatParamRendCom = st_ivas->hSpatParamRendCom; assert( hSpatParamRendCom ); -#ifndef API_5MS - ene_tc = 0.0f; - ene_sum = 0.0f; - last_gain = st_ivas->hDirAC->hParamIsm->last_dmx_gain; -#endif output_frame = nCldfbSlots * hSpatParamRendCom->num_freq_bands; fade_len = output_frame / 2; @@ -1279,50 +1195,13 @@ void ivas_param_ism_dec_digest_tc( } } } -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_tsm -#ifdef API_5MS_BASELINE || !st_ivas->hDecoderConfig->Opt_5ms -#endif ) { /*TODO : FhG to check*/ ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, fade_len, transport_channels_f ); } -#else - /* Energy Compensation */ - for ( i = 0; i < output_frame; i++ ) - { - ene_tc += transport_channels_f[0][i] * transport_channels_f[0][i] + transport_channels_f[1][i] * transport_channels_f[1][i]; // L*L + R*R - ene_sum += ( transport_channels_f[0][i] + transport_channels_f[1][i] ) * ( transport_channels_f[0][i] + transport_channels_f[1][i] ); // (L+R)*(L+R) - } - gain = sqrtf( ene_tc / ( ene_sum + EPSILON ) ); - if ( st_ivas->hSCE[0]->hCoreCoder[0]->ini_frame > 1 ) - { - /* Smoothing */ - gain = 0.75f * gain + 0.25f * last_gain; - grad = ( gain - last_gain ) / (float) fade_len; /* slope between two consecutive gains, 480 samples length */ - for ( i = 0; i < fade_len; i++ ) - { - transport_channels_f[0][i] *= ( last_gain + i * grad ); - transport_channels_f[1][i] *= ( last_gain + i * grad ); - } - for ( ; i < output_frame; i++ ) - { - transport_channels_f[0][i] *= gain; - transport_channels_f[1][i] *= gain; - } - } - else - { - for ( i = 0; i < output_frame; i++ ) - { - transport_channels_f[0][i] *= gain; - transport_channels_f[1][i] *= gain; - } - } - st_ivas->hDirAC->hParamIsm->last_dmx_gain = gain; -#endif /* API_5MS */ for ( ch = 0; ch < nchan_transport; ch++ ) { @@ -1331,14 +1210,10 @@ void ivas_param_ism_dec_digest_tc( *-----------------------------------------------------------------*/ for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) { -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_tsm -#ifdef API_5MS_BASELINE || !st_ivas->hDecoderConfig->Opt_5ms -#endif ) { -#endif float RealBuffer[CLDFB_NO_CHANNELS_MAX]; float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; @@ -1346,12 +1221,8 @@ void ivas_param_ism_dec_digest_tc( cldfbAnalysis_ts( &( transport_channels_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); mvr2r( RealBuffer, &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); mvr2r( ImagBuffer, &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); -#ifdef API_5MS } ivas_param_ism_collect_slot( hDirAC, &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], ch, ref_power, cx_diag ); -#else - ivas_param_ism_collect_slot( hDirAC, RealBuffer, ImagBuffer, ch, ref_power, cx_diag ); -#endif } } @@ -1370,7 +1241,6 @@ void ivas_param_ism_dec_digest_tc( } -#ifdef API_5MS /*-------------------------------------------------------------------------* * ivas_ism_param_dec_tc_gain_ajust() * @@ -1429,7 +1299,6 @@ void ivas_ism_param_dec_tc_gain_ajust( return; } -#endif /*-------------------------------------------------------------------------* * ivas_ism_param_dec_render_sf() diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index b8b7fa0a0d..ead528fb3f 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -82,11 +82,7 @@ ivas_error ivas_ism_renderer_open( set_f( st_ivas->hIsmRendererData->gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); } -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_tsm ) -#else - if ( st_ivas->hDecoderConfig->voip_active ) -#endif { init_interpolator_length = NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_CLDFB_TIMESLOTS * CLDFB_SLOT_NS ); interpolator_length = (uint16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); @@ -375,21 +371,8 @@ ivas_error ivas_omasa_separate_object_renderer_open( set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); } -#ifndef API_5MS - // Todo OMASA JBM: This needs touches for VOIP path at least. Current version is mostly an adapted copy from ivas_ism_renderer_open() - if ( st_ivas->hDecoderConfig->voip_active ) - { - init_interpolator_length = NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_CLDFB_TIMESLOTS * CLDFB_SLOT_NS ); - interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); - } - else - { -#endif init_interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); interpolator_length = init_interpolator_length; -#ifndef API_5MS - } -#endif st_ivas->hIsmRendererData->interpolator = (float *) malloc( sizeof( float ) * init_interpolator_length ); for ( i = 0; i < interpolator_length; i++ ) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index ce475deaab..6cb0588b53 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -584,7 +584,6 @@ ivas_error ivas_jbm_dec_tc( ivas_mono_stereo_downmix_mcmasa( st_ivas, output, output_frame ); } } -#ifdef API_5MS else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { @@ -598,30 +597,23 @@ ivas_error ivas_jbm_dec_tc( return error; } } -#endif } /*----------------------------------------------------------------* * Write IVAS transport channels *----------------------------------------------------------------*/ -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_tsm == 1 -#ifdef API_5MS_BASELINE || !st_ivas->hDecoderConfig->Opt_5ms -#endif ) { -#endif ivas_syn_output_f( p_output, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data ); -#ifdef API_5MS } else { /* directly copy to tc buffers */ ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, output_frame ); } -#endif /*----------------------------------------------------------------* * Common updates @@ -687,22 +679,16 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer( { p_data_f[n] = &data_f[n][0]; } -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_tsm -#ifdef API_5MS_BASELINE || !st_ivas->hDecoderConfig->Opt_5ms -#endif ) { -#endif ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data, p_data_f ); -#ifdef API_5MS } else { *nSamplesResidual = 0; } -#endif n_render_timeslots = st_ivas->hTcBuffer->n_samples_available / st_ivas->hTcBuffer->n_samples_granularity; if ( st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_BUFFER ) @@ -791,7 +777,7 @@ ivas_error ivas_jbm_dec_render( const uint16_t nSamplesAsked, /* i : number of samples wanted */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -1184,23 +1170,19 @@ ivas_error ivas_jbm_dec_render( st_ivas->hTcBuffer->n_samples_discard = 0; } -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->Opt_Limiter ) #endif { -#ifdef API_5MS if ( !( st_ivas->ivas_format == MONO_FORMAT ) ) { -#endif #ifndef DISABLE_LIMITER ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, *nSamplesRendered, st_ivas->BER_detect ); #endif -#ifdef API_5MS } -#endif } -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT switch ( pcm_resolution ) { case PCM_INT16: @@ -1209,12 +1191,12 @@ ivas_error ivas_jbm_dec_render( st_ivas->noClipping += #endif ivas_syn_output( p_output, *nSamplesRendered, nchan_out, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT (int16_t *) #endif data ); -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT break; case PCM_FLOAT32: ivas_syn_output_f( p_output, *nSamplesRendered, nchan_out, (float *) data ); @@ -1245,7 +1227,7 @@ ivas_error ivas_jbm_dec_flush_renderer( const MC_MODE mc_mode_old, /* i : old MC mode */ const ISM_MODE ism_mode_old, /* i : old ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -1402,23 +1384,19 @@ ivas_error ivas_jbm_dec_flush_renderer( } /* Only write out the valid data*/ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT if ( st_ivas->hDecoderConfig->Opt_Limiter ) #endif { -#ifdef API_5MS if ( !( st_ivas->ivas_format == MONO_FORMAT ) ) { -#endif #ifndef DISABLE_LIMITER ivas_limiter_dec( st_ivas->hLimiter, p_output, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, st_ivas->BER_detect ); #endif -#ifdef API_5MS } -#endif } -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT switch ( pcm_resolution ) { case PCM_INT16: @@ -1427,12 +1405,12 @@ ivas_error ivas_jbm_dec_flush_renderer( st_ivas->noClipping += #endif ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT (int16_t *) #endif data ); -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT break; case PCM_FLOAT32: ivas_syn_output_f( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (float *) data ); @@ -1804,12 +1782,10 @@ int16_t ivas_jbm_dec_get_num_tc_channels( } } } -#ifdef API_5MS else if ( st_ivas->ivas_format == MONO_FORMAT && st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { num_tc = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; } -#endif return num_tc; } @@ -1868,9 +1844,7 @@ static void ivas_jbm_dec_copy_tc( } hTcBuffer->n_samples_rendered = 0; -#ifdef API_5MS hTcBuffer->subframes_rendered = 0; -#endif return; } @@ -1973,14 +1947,8 @@ ivas_error ivas_jbm_dec_tc_buffer_open( } else { -#ifdef API_5MS int16_t n_samp_full, n_samp_residual; -#else - int16_t n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); - int16_t n_samp_residual = hTcBuffer->n_samples_granularity - 1; -#endif int32_t offset; -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_tsm ) { n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); @@ -1991,13 +1959,11 @@ ivas_error ivas_jbm_dec_tc_buffer_open( n_samp_full = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); n_samp_residual = 0; } -#endif nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; -#ifdef API_5MS if ( nsamp_to_allocate == 0 ) { hTcBuffer->tc_buffer = NULL; @@ -2008,7 +1974,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open( } else { -#endif if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); @@ -2030,9 +1995,7 @@ ivas_error ivas_jbm_dec_tc_buffer_open( { hTcBuffer->tc[ch_idx] = NULL; } -#ifdef API_5MS } -#endif } st_ivas->hTcBuffer = hTcBuffer; @@ -2111,7 +2074,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( /* realloc buffers */ free( hTcBuffer->tc_buffer ); -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_tsm ) { n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); @@ -2122,10 +2084,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( n_samp_full = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); n_samp_residual = 0; } -#else - n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); - n_samp_residual = hTcBuffer->n_samples_granularity - 1; -#endif nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; @@ -2308,7 +2266,6 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( case RENDERER_PARAM_ISM: case RENDERER_BINAURAL_MIXER_CONV: case RENDERER_BINAURAL_MIXER_CONV_ROOM: -#ifdef API_5MS case RENDERER_OSBA_AMBI: case RENDERER_OSBA_LS: buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -2323,13 +2280,6 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( buffer_mode = TC_BUFFER_MODE_RENDERER; } break; -#else - case RENDERER_NON_DIEGETIC_DOWNMIX: - case RENDERER_OSBA_AMBI: - case RENDERER_OSBA_LS: - buffer_mode = TC_BUFFER_MODE_RENDERER; - break; -#endif case RENDERER_MC_PARAMMC: if ( st_ivas->hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { @@ -2375,7 +2325,6 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( return buffer_mode; } -#ifdef API_5MS void ivas_jbm_dec_copy_tc_no_tsm( Decoder_Struct *st_ivas, float *tc[], @@ -2443,7 +2392,6 @@ void ivas_jbm_dec_copy_tc_no_tsm( hTcBuffer->n_samples_rendered = 0; hTcBuffer->subframes_rendered = 0; } -#endif /*--------------------------------------------------------------------------* diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index e7b498f28f..c5a7c881be 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -623,13 +623,7 @@ ivas_error ivas_masa_dec_open( /* allocate transport channels*/ if ( -#ifdef API_5MS -#ifdef API_5MS_BASELINE st_ivas->hDecoderConfig->Opt_5ms && -#endif -#else - st_ivas->hDecoderConfig->voip_active == 1 && -#endif st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { int16_t nchan_to_allocate; @@ -1233,7 +1227,7 @@ static int16_t decode_lfe_to_total_energy_ratio( ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -1258,11 +1252,7 @@ ivas_error ivas_masa_dec_reconfigure( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_5ms == 1 ) -#else - if ( st_ivas->hDecoderConfig->voip_active == 1 ) -#endif { if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity ) { @@ -1455,13 +1445,7 @@ ivas_error ivas_masa_dec_reconfigure( st_ivas->ism_mode = ISM_MODE_NONE; } -#ifdef API_5MS -#ifdef API_5MS_BASELINE if ( st_ivas->hDecoderConfig->Opt_5ms == 1 ) -#endif -#else - if ( st_ivas->hDecoderConfig->voip_active == 1 ) -#endif { int16_t tc_nchan_to_allocate; int16_t tc_nchan_transport; @@ -1501,7 +1485,7 @@ ivas_error ivas_masa_dec_reconfigure( if ( n_samples_granularity < st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index a85a35b3a5..3c33c986c3 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -460,16 +460,9 @@ ivas_error ivas_param_mc_dec_open( ivas_param_mc_dec_init( hParamMC, nchan_transport, nchan_out_cov ); if ( -#ifdef API_5MS -#ifdef API_5MS_BASELINE st_ivas->hDecoderConfig->Opt_5ms && -#endif -#else - st_ivas->hDecoderConfig->voip_active && -#endif hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) { -#ifdef API_5MS int16_t n_cldfb_slots; n_cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; @@ -488,19 +481,6 @@ ivas_error ivas_param_mc_dec_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); } set_zero( hParamMC->Cldfb_ImagBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); -#else - if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set_zero( hParamMC->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands ); - - if ( ( hParamMC->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set_zero( hParamMC->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands ); -#endif if ( st_ivas->hTcBuffer == NULL ) { if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) @@ -1479,10 +1459,8 @@ void ivas_param_mc_dec_digest_tc( hParamMC->slots_rendered = 0; hParamMC->subframes_rendered = 0; ivas_jbm_dec_get_adapted_subframes( nCldfbSlots, hParamMC->subframe_nbslots, &hParamMC->nb_subframes ); -#ifdef API_5MS st_ivas->hTcBuffer->nb_subframes = hParamMC->nb_subframes; mvs2s( hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hParamMC->nb_subframes ); -#endif ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator ); @@ -1495,14 +1473,10 @@ void ivas_param_mc_dec_digest_tc( /* slot loop for gathering the input data */ for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) { -#ifdef API_5MS if ( st_ivas->hDecoderConfig->Opt_tsm -#ifdef API_5MS_BASELINE || !st_ivas->hDecoderConfig->Opt_5ms -#endif ) { -#endif float RealBuffer[CLDFB_NO_CHANNELS_MAX]; float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; @@ -1514,9 +1488,7 @@ void ivas_param_mc_dec_digest_tc( mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); } -#ifdef API_5MS } -#endif if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex ) { ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], cx, cx_imag, hParamMC, nchan_transport ); diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 673d24018f..ecccd9b6e1 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -663,13 +663,7 @@ ivas_error ivas_mc_paramupmix_dec_open( hMCParamUpmix->free_param_interpolator = 0; hMCParamUpmix->param_interpolator = NULL; if ( -#ifdef API_5MS -#ifdef API_5MS_BASELINE st_ivas->hDecoderConfig->Opt_5ms == 1 && -#endif -#else - st_ivas->hDecoderConfig->voip_active == 1 && -#endif st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 0271035526..9072d8a1b7 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -55,7 +55,7 @@ *-----------------------------------------------------------------------*/ static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -634,7 +634,7 @@ ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx, /* i : LS config. index */ uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -670,7 +670,7 @@ ivas_error ivas_mc_dec_config( if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) { ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ); @@ -693,7 +693,7 @@ ivas_error ivas_mc_dec_config( static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -755,13 +755,7 @@ static ivas_error ivas_mc_dec_reconfig( /* side effect of the renderer selection can be a changed internal config */ ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); -#ifdef API_5MS_BASELINE -#ifndef API_5MS - if ( st_ivas->hDecoderConfig->voip_active ) -#else if ( st_ivas->hDecoderConfig->Opt_5ms ) -#endif -#endif { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ if ( last_mc_mode == MC_MODE_PARAMMC ) @@ -787,7 +781,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) @@ -1308,13 +1302,7 @@ static ivas_error ivas_mc_dec_reconfig( /*-----------------------------------------------------------------* * Reconfigure TC buffer *-----------------------------------------------------------------*/ -#ifdef API_5MS -#ifdef API_5MS_BASELINE if ( st_ivas->hDecoderConfig->Opt_5ms == 1 ) -#endif -#else - if ( st_ivas->hDecoderConfig->voip_active == 1 ) -#endif { int16_t tc_nchan_full_new; DECODER_TC_BUFFER_HANDLE hTcBuffer; diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index f1e93bfe2e..c041e8e702 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -111,10 +111,8 @@ ivas_error ivas_td_binaural_renderer( ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL, ism_md_subframe_update, output, output_frame -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 06a7e8ead3..761fe88390 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -154,7 +154,7 @@ void ivas_omasa_data_close( ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -203,7 +203,7 @@ ivas_error ivas_omasa_dec_config( st_ivas->hCPE[0]->nchan_out = 1; } else if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif data ) ) != IVAS_ERR_OK ) @@ -412,11 +412,7 @@ ivas_error ivas_omasa_dec_config( * floating-point output audio buffers *-----------------------------------------------------------------*/ -#ifdef API_5MS if ( !st_ivas->hDecoderConfig->Opt_5ms ) -#else - if ( !st_ivas->hDecoderConfig->voip_active ) -#endif { nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas ); @@ -638,10 +634,8 @@ void ivas_omasa_dirac_rend( dirac_read_idx = st_ivas->hSpatParamRendCom->dirac_read_idx; ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); st_ivas->hSpatParamRendCom->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ @@ -716,10 +710,8 @@ ivas_error ivas_omasa_dirac_td_binaural( } ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); if ( ( error = ivas_td_binaural_renderer( st_ivas, p_sepobj, output_frame ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index d162ad6c63..27fe7a144d 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -184,10 +184,8 @@ ivas_error ivas_osba_dirac_td_binaural( else { ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[channel_offset], st_ivas->nchan_transport -#ifdef API_5MS , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 500b95f5e8..1189fb7cd1 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -465,13 +465,7 @@ ivas_error ivas_sba_dec_reconfigure( /*-----------------------------------------------------------------* * JBM TC buffer *-----------------------------------------------------------------*/ -#ifdef API_5MS -#ifdef API_5MS_BASELINE if ( st_ivas->hDecoderConfig->Opt_5ms == 1 ) -#endif -#else - if ( st_ivas->hDecoderConfig->voip_active == 1 ) -#endif { int16_t tc_nchan_to_allocate; int16_t tc_nchan_tc; @@ -515,11 +509,7 @@ ivas_error ivas_sba_dec_reconfigure( * floating-point output audio buffers *-----------------------------------------------------------------*/ -#ifdef API_5MS if ( !st_ivas->hDecoderConfig->Opt_5ms ) -#else - if ( !st_ivas->hDecoderConfig->voip_active ) -#endif { nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index d38953212b..7f014c0a46 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -217,13 +217,7 @@ ivas_error ivas_spar_dec_open( /* allocate transport channels*/ if ( -#ifdef API_5MS -#ifdef API_5MS_BASELINE st_ivas->hDecoderConfig->Opt_5ms && -#endif -#else - st_ivas->hDecoderConfig->voip_active == 1 && -#endif st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate; @@ -1201,10 +1195,8 @@ void ivas_spar_dec_set_render_map( hSpar->subframes_rendered = 0; set_s( hSpar->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); ivas_jbm_dec_get_adapted_subframes( nCldfbTs, hSpar->subframe_nbslots, &hSpar->nb_subframes ); -#ifdef API_5MS st_ivas->hTcBuffer->nb_subframes = hSpar->nb_subframes; mvs2s( hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hSpar->nb_subframes ); -#endif ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, 1, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hSpar->render_to_md_map ); return; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 5b799c29e1..b63994d7bf 100755 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -908,17 +908,11 @@ typedef struct decoder_config_structure #ifdef DEBUGGING int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ #endif -#ifdef API_5MS int16_t Opt_tsm; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t Opt_Limiter; #endif -#ifdef API_5MS_BASELINE int16_t Opt_5ms; -#endif -#else - int16_t voip_active; -#endif int16_t Opt_delay_comp; /* flag indicating delay compensation active */ } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; @@ -945,10 +939,8 @@ typedef struct IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits; /*scratch buffer for frame by frame processing*/ SPLIT_REND_WRAPPER splitrend; IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE hCldfbDataOut; /*buffer to store cldfb data before binauralization*/ -#ifdef API_5MS float *tdDataOut; /*buffer to store TD data before binauralization*/ int16_t numTdSamplesPerChannelCached; -#endif } IVAS_DEC_SPLIT_REND_WRAPPER; #endif diff --git a/lib_dec/jbm_jb4sb.h b/lib_dec/jbm_jb4sb.h index 599730975d..b64805f342 100644 --- a/lib_dec/jbm_jb4sb.h +++ b/lib_dec/jbm_jb4sb.h @@ -77,13 +77,6 @@ struct JB4_DATAUNIT int16_t partialCopyOffset; int16_t nextCoderType; }; -#ifndef API_5MS -typedef enum -{ - JBM_RENDERER_NONE, - JBM_RENDERER_IVAS, -} JBM_RENDERER_TYPE; -#endif typedef struct JB4_DATAUNIT *JB4_DATAUNIT_HANDLE; diff --git a/lib_dec/jbm_pcmdsp_fifo.c b/lib_dec/jbm_pcmdsp_fifo.c index ad0a860944..7fa6a9f953 100644 --- a/lib_dec/jbm_pcmdsp_fifo.c +++ b/lib_dec/jbm_pcmdsp_fifo.c @@ -38,234 +38,3 @@ #include #include "options.h" -#ifndef API_5MS -#include "prot.h" -#include "ivas_prot.h" -#ifdef DEBUGGING -#include "debug.h" -#endif -#include "wmc_auto.h" -#include "jbm_pcmdsp_fifo.h" - - -/* Creates a FIFO. */ -ivas_error pcmdsp_fifo_create( - PCMDSP_FIFO_HANDLE *ph ) -{ - PCMDSP_FIFO_HANDLE h; - - if ( ( h = malloc( sizeof( struct PCMDSP_FIFO ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); - } - - h->size = 0; - h->capacity = 0; - h->nBytesPerSampleSet = 0; - h->dataBegin = NULL; - h->dataEnd = NULL; - h->dataWriteIterator = NULL; - h->dataReadIterator = NULL; - - *ph = h; - - return IVAS_ERR_OK; -} - - -/* Destroys the FIFO. */ -void pcmdsp_fifo_destroy( - PCMDSP_FIFO_HANDLE *ph ) -{ - PCMDSP_FIFO_HANDLE h; - - if ( !ph ) - { - return; - } - h = *ph; - if ( !h ) - { - return; - } - - if ( h->dataBegin ) - { - free( h->dataBegin ); - } - - free( h ); - *ph = NULL; - - return; -} - -/* Initializes the FIFO with a fixed maximum allowed number audio samples. */ -ivas_error pcmdsp_fifo_init( - PCMDSP_FIFO_HANDLE h, - uint16_t nSamplesPerChannel, - uint16_t nChannels, - uint16_t nBytesPerSample ) -{ - uint32_t nDataBytes; /* Must be 32-bit, otherwise overflows for multichannel */ - - h->capacity = nSamplesPerChannel; - h->nBytesPerSampleSet = nChannels * nBytesPerSample; - nDataBytes = nSamplesPerChannel * h->nBytesPerSampleSet; - if ( ( h->dataBegin = malloc( nDataBytes ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); - } - -#ifdef DEBUGGING - { - uint32_t i; - for ( i = 0; i < nDataBytes; i++ ) - { - h->dataBegin[i] = 0; - } - } -#endif - h->dataEnd = h->dataBegin + nDataBytes; - h->dataWriteIterator = h->dataBegin; - h->dataReadIterator = h->dataBegin; - - return IVAS_ERR_OK; -} - - -/* Writes the given audio data to the FIFO. */ -int16_t pcmdsp_fifo_write( - PCMDSP_FIFO_HANDLE h, - const uint8_t *samples, - uint16_t nSamplesPerChannel ) -{ - uint16_t nBytesToWrite; - - /* check for empty input buffer */ - if ( nSamplesPerChannel == 0U ) - { - return 0; - } - - /* check, if enough space left */ - if ( nSamplesPerChannel > h->capacity - h->size ) - { - return -1; - } - - nBytesToWrite = nSamplesPerChannel * h->nBytesPerSampleSet; - if ( h->dataWriteIterator + nBytesToWrite > h->dataEnd ) - { - /* wrap around: writing two parts */ - uint16_t bytesOfFirstPart, secondSize; - bytesOfFirstPart = (uint16_t) ( h->dataEnd - h->dataWriteIterator ); - secondSize = nBytesToWrite - bytesOfFirstPart; - mvc2c( samples, h->dataWriteIterator, bytesOfFirstPart ); - mvc2c( samples + bytesOfFirstPart, h->dataBegin, secondSize ); - h->dataWriteIterator = h->dataBegin + secondSize; - } - else - { - /* no wrap around: simple write */ - mvc2c( samples, h->dataWriteIterator, nBytesToWrite ); - h->dataWriteIterator += nBytesToWrite; - } - h->size += nSamplesPerChannel; - - return 0; -} - -#ifdef DEBUGGING -/* Writes the given audio data to the FIFO. */ -int16_t pcmdsp_fifo_write_zero( - PCMDSP_FIFO_HANDLE h, - uint16_t nSamplesPerChannel ) -{ - uint16_t nBytesToWrite; - - /* check for empty input buffer */ - if ( nSamplesPerChannel == 0U ) - { - return 0; - } - - /* check, if enough space left */ - if ( nSamplesPerChannel > h->capacity - h->size ) - { - return -1; - } - - nBytesToWrite = nSamplesPerChannel * h->nBytesPerSampleSet; - if ( h->dataWriteIterator + nBytesToWrite > h->dataEnd ) - { - /* wrap around: writing two parts */ - uint16_t bytesOfFirstPart, secondSize; - bytesOfFirstPart = (uint16_t) ( h->dataEnd - h->dataWriteIterator ); - secondSize = nBytesToWrite - bytesOfFirstPart; - set_c( (int8_t *) h->dataWriteIterator, 0, bytesOfFirstPart ); - set_c( (int8_t *) h->dataBegin, 0, secondSize ); - h->dataWriteIterator = h->dataBegin + secondSize; - } - else - { - /* no wrap around: simple write */ - set_c( (int8_t *) h->dataWriteIterator, 0, nBytesToWrite ); - h->dataWriteIterator += nBytesToWrite; - } - h->size += nSamplesPerChannel; - - return 0; -} -#endif - -/* Reads the given number of audio samples from the FIFO. */ -int16_t pcmdsp_fifo_read( - PCMDSP_FIFO_HANDLE h, - uint16_t nSamplesPerChannel, - uint8_t *samples ) -{ - uint16_t nBytesToRead; - - /* check for empty output buffer */ - if ( nSamplesPerChannel == 0U ) - { - return 0; - } - - /* check, if enough bytes readable */ - if ( nSamplesPerChannel > h->size ) - { - return -1; - } - - nBytesToRead = nSamplesPerChannel * h->nBytesPerSampleSet; - if ( h->dataReadIterator + nBytesToRead > h->dataEnd ) - { - /* wrap around: reading two parts */ - uint16_t bytesOfFirstPart, nBytesOfSecondPart; - bytesOfFirstPart = (uint16_t) ( h->dataEnd - h->dataReadIterator ); - nBytesOfSecondPart = nBytesToRead - bytesOfFirstPart; - mvc2c( h->dataReadIterator, samples, bytesOfFirstPart ); - mvc2c( h->dataBegin, samples + bytesOfFirstPart, nBytesOfSecondPart ); - h->dataReadIterator = h->dataBegin + nBytesOfSecondPart; - } - else - { - /* no wrap around: simple read */ - mvc2c( h->dataReadIterator, samples, nBytesToRead ); - h->dataReadIterator += nBytesToRead; - } - h->size -= nSamplesPerChannel; - - return 0; -} - - -/* Returns the number of samples per channel that can be read (number of currently stored samples). */ -uint16_t pcmdsp_fifo_nReadableSamplesPerChannel( - const PCMDSP_FIFO_HANDLE h ) -{ - return h->size; -} -#endif diff --git a/lib_dec/jbm_pcmdsp_fifo.h b/lib_dec/jbm_pcmdsp_fifo.h index 62ebc15d08..25591ac83e 100644 --- a/lib_dec/jbm_pcmdsp_fifo.h +++ b/lib_dec/jbm_pcmdsp_fifo.h @@ -41,45 +41,4 @@ #include #include "options.h" -#ifndef API_5MS - -/** Ringbuffer (FIFO) with fixed capacity for audio samples. */ -struct PCMDSP_FIFO -{ - /** size of currently stored samples per channel */ - uint16_t size; - /** maximum allowed number of samples per channel */ - uint16_t capacity; - /** sample size in bytes per channel */ - uint16_t nBytesPerSampleSet; - - /** begin of the FIFO data (pointer to bytes) */ - uint8_t *dataBegin; - /** end of the FIFO data (pointer to bytes) */ - uint8_t *dataEnd; - /** position of next write operation (pointer to bytes) */ - uint8_t *dataWriteIterator; - /** position of next read operation (pointer to bytes) */ - uint8_t *dataReadIterator; -}; - -typedef struct PCMDSP_FIFO *PCMDSP_FIFO_HANDLE; - - -ivas_error pcmdsp_fifo_create( PCMDSP_FIFO_HANDLE *ph ); - -void pcmdsp_fifo_destroy( PCMDSP_FIFO_HANDLE *ph ); - -ivas_error pcmdsp_fifo_init( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint16_t nChannels, uint16_t nBytesPerSample ); - -int16_t pcmdsp_fifo_write( PCMDSP_FIFO_HANDLE h, const uint8_t *samples, uint16_t nSamplesPerChannel ); - -#ifdef DEBUGGING -int16_t pcmdsp_fifo_write_zero( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel ); -#endif - -int16_t pcmdsp_fifo_read( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint8_t *samples ); - -uint16_t pcmdsp_fifo_nReadableSamplesPerChannel( const PCMDSP_FIFO_HANDLE h ); -#endif #endif /* JBM_PCMDSP_FIFO_H */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b0d224b9c4..71c9432882 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -54,26 +54,9 @@ struct IVAS_DEC_VOIP { uint16_t nSamplesFrame; /* Total number of samples in a frame (includes number of channels) */ JB4_HANDLE hJBM; -#ifndef API_5MS - PCMDSP_APA_HANDLE hTimeScaler; -#endif uint16_t lastDecodedWasActive; -#ifndef API_5MS - float *apaExecBuffer; /* Buffer for APA scaling */ -#endif JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */ uint16_t *bs_conversion_buf; /* Buffer for bitstream conversion from packed to serial */ -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING - IVAS_DEC_VOIP_MODE voipMode; - uint16_t speedFac; - bool needNewFrame; -#endif - JBM_RENDERER_TYPE rendererType; - PCMDSP_FIFO_HANDLE hFifoOut; - uint8_t nTransportChannelsOld; - uint16_t nSamplesAvailableNext; -#endif #ifdef SUPPORT_JBM_TRACEFILE IVAS_JBM_TRACE_DATA JbmTraceData; #endif @@ -93,7 +76,6 @@ struct IVAS_DEC int16_t bitstreamformat; /* Bitstream format flag (G.192/MIME/VOIP_G192_RTP/VOIP_RTPDUMP) */ bool Opt_VOIP; /* flag indicating VOIP mode with JBM */ -#ifdef API_5MS int16_t tsm_scale; /* scale for TSM operation */ int16_t tsm_max_scaling; float *apaExecBuffer; /* Buffer for APA scaling */ @@ -103,7 +85,6 @@ struct IVAS_DEC uint16_t nSamplesAvailableNext; int16_t nSamplesRendered; int16_t nTransportChannelsOld; -#endif int16_t amrwb_rfc4867_flag; /* MIME from rfc4867 is used */ int16_t sdp_hf_only; /* RTP payload format parameter: only Header-Full format without zero padding for size collision avoidance */ int16_t prev_ft_speech; /* RXDTX handler: previous frametype flag for G.192 format AMRWB SID_FIRST detection */ @@ -123,12 +104,9 @@ static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSampl static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas ); -#ifndef API_5MS -static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasDec ); -#endif static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, void *data #else @@ -138,7 +116,7 @@ static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferG static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf, int16_t *nOutSamples ); static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *pcmBuf ); static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const uint16_t nSamplesForRendering, uint16_t *nSamplesRendered, uint16_t *nSamplesAvailableNext, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf #else @@ -147,7 +125,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const u #endif ); static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, int16_t *nSamplesBuffered ); -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT static PCM_RESOLUTION pcm_type_API_to_internal( const IVAS_DEC_PCM_TYPE pcmType ); static void *pcm_buffer_offset( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, int32_t offset ); static ivas_error set_pcm_buffer_to_zero( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, int16_t nZeroSamples ); @@ -182,7 +160,6 @@ ivas_error IVAS_DEC_Open( } hIvasDec = *phIvasDec; hIvasDec->hVoIP = NULL; -#ifdef API_5MS hIvasDec->apaExecBuffer = NULL; hIvasDec->hTimeScaler = NULL; hIvasDec->tsm_scale = 100; @@ -192,7 +169,6 @@ ivas_error IVAS_DEC_Open( hIvasDec->nSamplesRendered = 0; hIvasDec->nSamplesFrame = 0; hIvasDec->hasBeenFedFrame = false; -#endif hIvasDec->hasBeenFedFirstGoodFrame = false; hIvasDec->hasDecodedFirstGoodFrame = false; hIvasDec->isInitialized = false; @@ -290,17 +266,11 @@ static void init_decoder_config( hDecoderConfig->orientation_tracking = HEAD_ORIENT_TRK_NONE; hDecoderConfig->Opt_non_diegetic_pan = 0; hDecoderConfig->non_diegetic_pan_gain = 0; -#ifdef API_5MS hDecoderConfig->Opt_tsm = 0; #ifdef SPLIT_REND_WITH_HEAD_ROT hDecoderConfig->Opt_Limiter = 1; #endif -#ifdef API_5MS_BASELINE hDecoderConfig->Opt_5ms = 0; -#endif -#else - hDecoderConfig->voip_active = 0; -#endif hDecoderConfig->Opt_delay_comp = 0; @@ -338,14 +308,12 @@ void IVAS_DEC_Close( ( *phIvasDec )->st_ivas = NULL; } -#ifdef API_5MS apa_exit( &( *phIvasDec )->hTimeScaler ); if ( ( *phIvasDec )->apaExecBuffer != NULL ) { free( ( *phIvasDec )->apaExecBuffer ); } -#endif free( *phIvasDec ); *phIvasDec = NULL; phIvasDec = NULL; @@ -400,10 +368,8 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ const AUDIO_CONFIG outputConfig, /* i : output configuration */ -#ifdef API_5MS const int16_t tsmEnabled, /* i : enable TSM */ const int16_t enable5ms, -#endif const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -480,22 +446,18 @@ ivas_error IVAS_DEC_Configure( hIvasDec->st_ivas->ivas_format = MONO_FORMAT; } -#ifdef API_5MS hDecoderConfig->Opt_tsm = tsmEnabled; -#ifdef API_5MS_BASELINE hDecoderConfig->Opt_5ms = enable5ms; -#endif hIvasDec->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); hIvasDec->nSamplesAvailableNext = 0; hIvasDec->nSamplesRendered = 0; hIvasDec->tsm_scale = 100; hIvasDec->tsm_max_scaling = 100; -#endif return error; } -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) /*---------------------------------------------------------------------* * IVAS_DEC_EnableSplitRendering( ) * @@ -520,9 +482,7 @@ ivas_error IVAS_DEC_EnableSplitRendering( hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; hDecoderConfig->Opt_Headrotation = 1; -#ifdef API_5MS_BASELINE hDecoderConfig->Opt_5ms = false; -#endif hDecoderConfig->Opt_Limiter = 0; @@ -531,7 +491,6 @@ ivas_error IVAS_DEC_EnableSplitRendering( } #endif -#ifdef API_5MS /*---------------------------------------------------------------------* * IVAS_DEC_Get5msFlag( ) * @@ -552,7 +511,6 @@ ivas_error IVAS_DEC_Get5msFlag( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_EnableVoIP( ) @@ -564,12 +522,6 @@ ivas_error IVAS_DEC_Get5msFlag( ivas_error IVAS_DEC_EnableVoIP( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING - const IVAS_DEC_VOIP_MODE voipMode, /* i : VoIP or variable speed */ - const uint16_t speedFac, /* i : speed factor for variable speed */ -#endif -#endif const int16_t jbmSafetyMargin, /* i : allowed delay reserve for JBM, in milliseconds */ const IVAS_DEC_INPUT_FORMAT inputFormat /* i : format of the input bitstream */ ) @@ -588,14 +540,8 @@ ivas_error IVAS_DEC_EnableVoIP( hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; hIvasDec->Opt_VOIP = 1; -#ifdef API_5MS hDecoderConfig->Opt_tsm = 1; -#ifdef API_5MS_BASELINE hDecoderConfig->Opt_5ms = 1; -#endif -#else - hDecoderConfig->voip_active = 1; -#endif if ( hDecoderConfig->output_config != AUDIO_CONFIG_EXTERNAL ) { @@ -621,23 +567,7 @@ ivas_error IVAS_DEC_EnableVoIP( hIvasDec->hVoIP->lastDecodedWasActive = 0; hIvasDec->hVoIP->hCurrentDataUnit = NULL; -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING - hIvasDec->hVoIP->voipMode = voipMode; - hIvasDec->hVoIP->speedFac = speedFac; - hIvasDec->hVoIP->needNewFrame = false; -#endif -#endif hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#ifndef API_5MS - hIvasDec->hVoIP->nSamplesAvailableNext = 0; - hIvasDec->hVoIP->rendererType = JBM_RENDERER_NONE; - hIvasDec->hVoIP->hFifoOut = NULL; - - /* postpone init of the buffers until we know the real number of TCs*/ - hIvasDec->hVoIP->apaExecBuffer = NULL; - hIvasDec->hVoIP->nTransportChannelsOld = 0; -#endif #define WMC_TOOL_SKIP /* Bitstream conversion is not counted towards complexity and memory usage */ @@ -650,13 +580,6 @@ ivas_error IVAS_DEC_EnableVoIP( } /* initialize JBM */ -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING - hIvasDec->hVoIP->hJBM = NULL; - if ( hIvasDec->hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VOIP ) - { -#endif -#endif if ( ( error = JB4_Create( &hIvasDec->hVoIP->hJBM ) != IVAS_ERR_OK ) != IVAS_ERR_OK ) { return error; @@ -665,22 +588,7 @@ ivas_error IVAS_DEC_EnableVoIP( { return IVAS_ERR_FAILED_ALLOC; } -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING - } -#endif -#endif -#ifndef API_5MS - /* postpone init of time scaler and output FIFO until we know the real number of TCs */ - hIvasDec->hVoIP->hTimeScaler = NULL; -#ifdef VARIABLE_SPEED_DECODING - if ( hIvasDec->hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) - { - hIvasDec->hVoIP->needNewFrame = true; - } -#endif -#endif return error; } @@ -724,13 +632,8 @@ ivas_error IVAS_DEC_FeedFrame_Serial( { hIvasDec->st_ivas->hDecoderConfig->ivas_total_brate = ACELP_8k00; } -#ifdef API_5MS hIvasDec->isInitialized = true; -#endif } -#ifndef API_5MS - hIvasDec->isInitialized = true; -#endif } if ( !bfi ) /* TODO(mcjbm): Is this ok for bfi == 2 (partial frame)? Is there enough info to fully configure decoder? */ @@ -772,19 +675,10 @@ ivas_error IVAS_DEC_FeedFrame_Serial( st->use_partial_copy = 1; } -#ifdef API_5MS hIvasDec->needNewFrame = false; hIvasDec->hasBeenFedFrame = true; hIvasDec->nSamplesRendered = 0; hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; -#else -#ifdef VARIABLE_SPEED_DECODING - if ( hIvasDec->hVoIP != NULL && hIvasDec->hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) - { - hIvasDec->hVoIP->needNewFrame = false; - } -#endif -#endif return error; } @@ -796,24 +690,15 @@ ivas_error IVAS_DEC_FeedFrame_Serial( * Main function to decode to PCM data *---------------------------------------------------------------------*/ -#if !defined API_5MS || defined( API_5MS_BASELINE ) -#ifdef API_5MS_BASELINE static ivas_error _GetSamples( -#else -ivas_error IVAS_DEC_GetSamples( -#endif IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const PCM_RESOLUTION pcm_resolution, void *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ #else int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ #endif int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && !defined( API_5MS ) - , - uint8_t *splitRendBitsBuf /* o : output split rendering bits */ -#endif ) { Decoder_Struct *st_ivas; @@ -832,12 +717,12 @@ ivas_error IVAS_DEC_GetSamples( if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { -#if defined DEBUGGING && defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined DEBUGGING && defined SPLIT_REND_WITH_HEAD_ROT assert( pcm_resolution == PCM_INT16 ); #endif if ( ( error = evs_dec_main( st_ivas, *nOutSamples, NULL, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT (int16_t *) #endif pcmBuf ) ) != IVAS_ERR_OK ) @@ -850,14 +735,10 @@ ivas_error IVAS_DEC_GetSamples( /* run the main IVAS decoding routine */ if ( ( error = ivas_dec( st_ivas, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif pcmBuf -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && !defined( API_5MS ) - , - splitRendBitsBuf -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -873,12 +754,10 @@ ivas_error IVAS_DEC_GetSamples( return error; } -#endif -#ifdef API_5MS ivas_error IVAS_DEC_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked, /* i: number of samples wanted by the caller */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *pcmBuf, /* o : output synthesis signal */ #else @@ -886,10 +765,6 @@ ivas_error IVAS_DEC_GetSamples( #endif int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ bool *needNewFrame /* indication that the decoder needs a new frame */ -#if defined SPLIT_REND_WITH_HEAD_ROT && !defined API_5MS - , - IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits /* o : bitstream output for split rendering mode*/ -#endif ) { ivas_error error; @@ -900,11 +775,9 @@ ivas_error IVAS_DEC_GetSamples( nSamplesRendered = 0; nOutChannels = 0; -#ifdef API_5MS_BASELINE nSamplesRendered_loop = 0; l_ts = 0; nTransportChannels = 0; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) @@ -935,7 +808,6 @@ ivas_error IVAS_DEC_GetSamples( *needNewFrame = true; } } -#ifdef API_5MS_BASELINE /* only for 1st step 5ms API, split rendering still needs to go through the old decoding function */ else @@ -945,7 +817,7 @@ ivas_error IVAS_DEC_GetSamples( { /* setup */ if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) #else @@ -956,14 +828,14 @@ ivas_error IVAS_DEC_GetSamples( { return error; } -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT /* :TODO: change nSamplesAsked also if we are in 5ms 0dof split rendering... */ #endif } if ( !hIvasDec->st_ivas->hDecoderConfig->Opt_5ms ) { if ( ( error = _GetSamples( hIvasDec, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_type_API_to_internal( pcmType ), #endif pcmBuf, nOutSamples ) ) != IVAS_ERR_OK ) @@ -980,28 +852,12 @@ ivas_error IVAS_DEC_GetSamples( hIvasDec->hasBeenFedFrame = false; *needNewFrame = true; } -#endif else { /* check if we need to run the setup function, tc decoding and feeding the renderer */ if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) { int16_t nResidualSamples, nSamplesTcsScaled; -#ifndef API_5MS_BASELINE - /* setup */ - if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT - pcmType, - pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) -#else - pcmBuf + nSamplesRendered * nOutChannels -#endif - - ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif nSamplesRendered += nSamplesRendered_loop; if ( nTransportChannels != hIvasDec->nTransportChannelsOld ) { @@ -1053,7 +909,7 @@ ivas_error IVAS_DEC_GetSamples( /* render IVAS frames directly to the output buffer */ nSamplesToRender = nSamplesAsked - nSamplesRendered; if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) #else @@ -1076,17 +932,14 @@ ivas_error IVAS_DEC_GetSamples( *needNewFrame = false; } } -#ifdef API_5MS_BASELINE } -#endif *nOutSamples = nSamplesRendered; return error; } -#endif -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT ivas_error IVAS_DEC_GetSplitBinauralBitstream( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ void *pcmBuf_out, /* o : output synthesis signal for BINAURAL_SPLIT_PCM */ @@ -1222,9 +1075,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( st_ivas->hHeadTrackData->Quaternions[0], st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, st_ivas->hRenderConfig->split_rend_config.codec, -#ifdef API_5MS st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, -#endif hSplitBinRend->hSplitRendBits, hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural, hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural, @@ -1285,7 +1136,7 @@ static ivas_error IVAS_DEC_Setup( uint8_t *nTransportChannels, /* o : number of decoded transport PCM channels */ uint8_t *nOutChannels, /* o : number of decoded out channels (PCM or CLDFB) */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *data /* o : output synthesis signal */ #else @@ -1329,7 +1180,7 @@ static ivas_error IVAS_DEC_Setup( if ( st_ivas->bfi == 0 ) { if ( ( error = ivas_dec_setup( st_ivas, nSamplesRendered, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_type_API_to_internal( pcmType ), #endif data ) ) != IVAS_ERR_OK ) @@ -1445,7 +1296,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples( const uint16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the renerer pipeline */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf #else @@ -1467,7 +1318,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples( /* run the main IVAS decoding routine */ if ( ( error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering, nSamplesRendered, nSamplesAvailableNext, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcm_type_API_to_internal( pcmType ), #endif pcmBuf ) ) != IVAS_ERR_OK ) @@ -1688,14 +1539,9 @@ ivas_error IVAS_DEC_GetMasaMetadata( ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef API_5MS IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ IVAS_VECTOR3 Pos, /* i : listener position */ const int16_t subframe_idx /*subframe index*/ -#else - IVAS_QUATERNION *orientation, /* i : head-tracking data, listener orientation */ - IVAS_VECTOR3 *Pos /* i : listener position */ -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , const IVAS_SPLIT_REND_ROT_AXIS rot_axis @@ -1703,15 +1549,8 @@ ivas_error IVAS_DEC_FeedHeadTrackData( ) { HEAD_TRACK_DATA_HANDLE hHeadTrackData; -#ifndef API_5MS - int16_t i; -#endif -#ifdef API_5MS if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) -#else - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || orientation == NULL ) -#endif { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -1724,7 +1563,6 @@ ivas_error IVAS_DEC_FeedHeadTrackData( } /* Move head-tracking data to the decoder handle */ -#ifdef API_5MS /* check for Euler angle signaling */ if ( orientation.w == -3.0f ) { @@ -1735,30 +1573,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( hHeadTrackData->Pos[subframe_idx].x = Pos.x; hHeadTrackData->Pos[subframe_idx].y = Pos.y; hHeadTrackData->Pos[subframe_idx].z = Pos.z; -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - /* check for Euler angle signaling */ - if ( orientation[i].w == -3.0f ) - { - Euler2Quat( deg2rad( orientation[i].x ), deg2rad( orientation[i].y ), deg2rad( orientation[i].z ), &orientation[i] ); - } - - ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[i] ); - - hHeadTrackData->Pos[i].x = Pos[i].x; - hHeadTrackData->Pos[i].y = Pos[i].y; - hHeadTrackData->Pos[i].z = Pos[i].z; - } -#endif -#ifndef API_5MS -#ifdef SPLIT_REND_WITH_HEAD_ROT - hHeadTrackData->num_quaternions = 0; -#else - hIvasDec->st_ivas->hHeadTrackData->num_quaternions = 0; -#endif -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT hHeadTrackData->sr_pose_pred_axis = rot_axis; @@ -1832,32 +1647,17 @@ ivas_error IVAS_DEC_FeedRefVectorData( ivas_error IVAS_DEC_FeedExternalOrientationData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef API_5MS IVAS_QUATERNION orientation, /* i : external orientation data */ int8_t enableHeadRotation, /* i : flag to enable head rotation for this frame */ int8_t enableExternalOrientation, /* i : flag to enable external orientation for this frame */ int8_t enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ int16_t numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */ const int16_t subframe_idx /*i : subframe index*/ -#else - IVAS_QUATERNION *orientation, /* i : external orientation data */ - int8_t *enableHeadRotation, /* i : flag to enable head rotation for this frame */ - int8_t *enableExternalOrientation, /* i : flag to enable external orientation for this frame */ - int8_t *enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ - int16_t *numFramesToTargetOrientation /* i : number of frames until target orientation is reached */ -#endif ) { EXTERNAL_ORIENTATION_HANDLE hExternalOrientationData; -#ifndef API_5MS - int16_t i; -#endif -#ifdef API_5MS if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) -#else - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || orientation == NULL ) -#endif { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -1870,24 +1670,12 @@ ivas_error IVAS_DEC_FeedExternalOrientationData( } /* Move external orientation data to the decoder handle (invert orientations) */ -#ifdef API_5MS QuaternionInverse( orientation, &hExternalOrientationData->Quaternions[subframe_idx] ); hExternalOrientationData->enableHeadRotation[subframe_idx] = enableHeadRotation; hExternalOrientationData->enableExternalOrientation[subframe_idx] = enableExternalOrientation; hExternalOrientationData->enableRotationInterpolation[subframe_idx] = enableRotationInterpolation; hExternalOrientationData->numFramesToTargetOrientation[subframe_idx] = numFramesToTargetOrientation; -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - QuaternionInverse( orientation[i], &hExternalOrientationData->Quaternions[i] ); - - hExternalOrientationData->enableHeadRotation[i] = enableHeadRotation[i]; - hExternalOrientationData->enableExternalOrientation[i] = enableExternalOrientation[i]; - hExternalOrientationData->enableRotationInterpolation[i] = enableRotationInterpolation[i]; - hExternalOrientationData->numFramesToTargetOrientation[i] = numFramesToTargetOrientation[i]; - } -#endif return IVAS_ERR_OK; } @@ -2034,7 +1822,6 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( return IVAS_ERR_OK; } -#ifdef API_5MS static ivas_error copyRendererConfigStruct( RENDER_CONFIG_HANDLE hRCin, IVAS_RENDER_CONFIG_HANDLE hRCout ) { if ( hRCin == NULL || hRCout == NULL ) @@ -2080,7 +1867,6 @@ static ivas_error copyRendererConfigStruct( RENDER_CONFIG_HANDLE hRCin, IVAS_REN return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_GetRenderConfig( ) @@ -2093,61 +1879,15 @@ ivas_error IVAS_DEC_GetRenderConfig( const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ) { -#ifndef API_5MS - RENDER_CONFIG_HANDLE hRCin; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hRenderConfig == NULL || hRCout == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef API_5MS return copyRendererConfigStruct( hIvasDec->st_ivas->hRenderConfig, hRCout ); -#else - hRCin = hIvasDec->st_ivas->hRenderConfig; -#ifdef DEBUGGING - switch ( hRCin->renderer_type_override ) - { - case RENDER_TYPE_OVERRIDE_CREND: - hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; - break; - case RENDER_TYPE_OVERRIDE_FASTCONV: - hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; - break; - default: - hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; - break; - } -#endif - hRCout->room_acoustics.override = hRCin->roomAcoustics.override; - hRCout->room_acoustics.nBands = hRCin->roomAcoustics.nBands; - hRCout->room_acoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; - hRCout->room_acoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; - - mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->room_acoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->room_acoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->directivity, hRCout->directivity, 3 * MAX_NUM_OBJECTS ); - -#ifdef SPLIT_REND_WITH_HEAD_ROT - hRCout->split_rend_config.splitRendBitRate = SPLIT_REND_768k; - hRCout->split_rend_config.dof = 3; - hRCout->split_rend_config.hq_mode = 0; - hRCout->split_rend_config.codec_delay_ms = 0; - hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; - hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; - hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; -#endif - - hRCout->room_acoustics.use_er = hRCin->roomAcoustics.use_er; - hRCout->room_acoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; - - return IVAS_ERR_OK; -#endif } -#ifdef API_5MS /*! r: error code*/ ivas_error IVAS_DEC_GetDefaultRenderConfig( IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ @@ -2164,7 +1904,6 @@ ivas_error IVAS_DEC_GetDefaultRenderConfig( return copyRendererConfigStruct( hRCin, hRCout ); } -#endif /*---------------------------------------------------------------------* @@ -2475,7 +2214,6 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( return IVAS_ERR_OK; } -#if defined( VARIABLE_SPEED_DECODING ) || defined( API_5MS ) /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_SetScale( ) * @@ -2484,9 +2222,7 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( ivas_error IVAS_DEC_VoIP_SetScale( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef API_5MS const int16_t maxScaling, -#endif const int16_t scale /* i : TSM scale to set */ ) { @@ -2494,7 +2230,6 @@ ivas_error IVAS_DEC_VoIP_SetScale( error = IVAS_ERR_OK; -#ifdef API_5MS if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == false ) { return IVAS_ERR_TSM_NOT_ENABLED; @@ -2504,16 +2239,11 @@ ivas_error IVAS_DEC_VoIP_SetScale( hIvasDec->tsm_scale = scale; hIvasDec->tsm_max_scaling = maxScaling; } -#else - hIvasDec->hVoIP->speedFac = scale; -#endif return error; } -#endif -#ifdef API_5MS /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_GetSamples( ) * @@ -2523,7 +2253,7 @@ ivas_error IVAS_DEC_VoIP_SetScale( ivas_error IVAS_DEC_VoIP_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, #else @@ -2669,7 +2399,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( /* codec mode to use not known yet - simply output silence */ /* directly set output zero */ int16_t nSamplesToZero = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT set_pcm_buffer_to_zero( pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ), pcmType, nSamplesToZero * nOutChannels ); #else set_s( pcmBuf + nSamplesRendered * nOutChannels, 0, nSamplesToZero * nOutChannels ); @@ -2686,7 +2416,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( /* render IVAS frames directly to the output buffer */ if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ), #else @@ -2701,501 +2431,60 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } return error; } -#else + /*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_GetSamples( ) + * IVAS_DEC_VoIP_Flush( ) * - * Main function to decode one frame in VoIP + * Function to flush remaining audio in VoIP *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_VoIP_GetSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - const uint32_t systemTimestamp_ms, /* i : current system timestamp */ - uint16_t *sampleAvailableNext /* o : samples available for the next call */ -#ifdef SUPPORT_JBM_TRACEFILE - , - JbmTraceFileWriterFn jbmWriterFn, - void *jbmWriter +ivas_error IVAS_DEC_Flush( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ +#if defined SPLIT_REND_WITH_HEAD_ROT + const IVAS_DEC_PCM_TYPE pcmType, + void *pcmBuf, +#else + int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ #endif - + int16_t *nSamplesFlushed /* o : number of samples flushed */ ) { - Decoder_Struct *st_ivas; - DECODER_CONFIG_HANDLE hDecoderConfig; - IVAS_DEC_VOIP *hVoIP; - uint32_t extBufferedTime_ms, scale, maxScaling; - uint16_t nTimeScalerOutSamples; - JB4_DATAUNIT_HANDLE dataUnit; - int16_t nOutSamplesElse; - uint16_t extBufferedSamples; - int16_t timeScalingDone; - int16_t result; ivas_error error; - int16_t nSamplesRendered; - uint16_t nSamplesTcsScaled; - uint8_t nTransportChannels; - uint8_t nOutChannels; + uint16_t nSamplesToRender; + uint16_t nSamplesFlushedLocal; error = IVAS_ERR_OK; - st_ivas = hIvasDec->st_ivas; - hDecoderConfig = st_ivas->hDecoderConfig; - hVoIP = hIvasDec->hVoIP; - timeScalingDone = 0; + *nSamplesFlushed = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); - nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; - nTransportChannels = 0; - nSamplesTcsScaled = hVoIP->nSamplesFrame; - nSamplesRendered = 0; -#ifdef VARIABLE_SPEED_DECODING - scale = hVoIP->speedFac; - maxScaling = hVoIP->speedFac; + nSamplesToRender = (uint16_t) *nSamplesFlushed; + /* render IVAS frames */ + if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, +#if defined SPLIT_REND_WITH_HEAD_ROT + pcmType, #endif - - if ( ( hVoIP->hFifoOut != NULL && nSamplesPerChannel > hVoIP->hFifoOut->capacity ) || nSamplesPerChannel == 0 ) + pcmBuf ) ) != IVAS_ERR_OK ) { - return IVAS_ERR_WRONG_PARAMS; + return error; } - /* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */ - while ( ( hVoIP->hFifoOut != NULL && pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ) < nSamplesPerChannel ) || ( hVoIP->hFifoOut == NULL && nSamplesRendered < nSamplesPerChannel ) ) - { -#ifdef DEBUGGING -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED && hVoIP->needNewFrame ) - { - /* we need another bs frame fed into the decoder...*/ - *sampleAvailableNext = 0; - return IVAS_ERR_VS_FRAME_NEEDED; - } -#endif -#endif + return error; +} - if ( hVoIP->nSamplesAvailableNext == 0 ) - { - if ( hVoIP->hFifoOut ) - { - extBufferedSamples = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ); - nSamplesRendered = extBufferedSamples; - } - else - { - int16_t nSamplesBuffered; - nSamplesBuffered = 0; - if ( hIvasDec->hasDecodedFirstGoodFrame ) - { - IVAS_DEC_GetBufferedNumberOfSamples( hIvasDec, &nSamplesBuffered ); - } - extBufferedSamples = nSamplesRendered + nSamplesBuffered; - } - extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs; - dataUnit = NULL; +/*---------------------------------------------------------------------* + * IVAS_DEC_VoIP_IsEmpty( ) + * + * + *---------------------------------------------------------------------*/ -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VOIP ) - { -#endif - /* pop one access unit from the jitter buffer */ - result = JB4_PopDataUnit( hVoIP->hJBM, systemTimestamp_ms, extBufferedTime_ms, &dataUnit, &scale, &maxScaling ); - if ( result != 0 ) - { - return IVAS_ERR_UNKNOWN; - } -#ifdef VARIABLE_SPEED_DECODING - } - else if ( hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) - { - scale = hVoIP->speedFac; - maxScaling = hVoIP->speedFac; - } -#ifdef DEBUGGING - else - { - assert( "Wrong VoIP mode!\n" && 0 ); - } -#endif -#endif - - maxScaling = maxScaling * hDecoderConfig->output_Fs / 1000; - /* avoid time scaling multiple times in one sound card slot */ - if ( scale != 100U ) - { - if ( timeScalingDone ) - { - scale = 100; - } - else - { - timeScalingDone = 1; - } - } - -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VOIP ) - { -#endif - /* copy bitstream into decoder state */ - if ( dataUnit ) - { - hIvasDec->hVoIP->hCurrentDataUnit = dataUnit; - - bsCompactToSerial( dataUnit->data, hIvasDec->hVoIP->bs_conversion_buf, dataUnit->dataSize ); - IVAS_DEC_FeedFrame_Serial( hIvasDec, hIvasDec->hVoIP->bs_conversion_buf, dataUnit->dataSize, 0 ); - } - else if ( hIvasDec->hasDecodedFirstGoodFrame ) - { - /* Decoder has been initialized with first good frame - do PLC */ - IVAS_DEC_FeedFrame_Serial( hIvasDec, hIvasDec->hVoIP->bs_conversion_buf, 0, 1 ); - } -#ifdef VARIABLE_SPEED_DECODING - } -#endif - - /* decode */ - if ( !hIvasDec->hasBeenFedFirstGoodFrame ) - { - /* codec mode to use not known yet - simply output silence */ - nSamplesTcsScaled = hVoIP->nSamplesFrame; - if ( hVoIP->hFifoOut != NULL ) - { -#ifdef DEBUGGING - /* feed zeros to FIFO */ - if ( pcmdsp_fifo_write_zero( hVoIP->hFifoOut, nSamplesTcsScaled ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } -#endif - } - else - { - /* directly set output zero */ - set_s( pcmBuf, 0, nSamplesPerChannel * nOutChannels ); - } - nSamplesRendered = nSamplesTcsScaled; - } - else - { - - uint16_t l_ts = 1; - uint16_t nSamplesRendered_loop; - - /* setup ivas decoder and get the number of TCs */ - /* might render some remaining samples from the previous frame too if the renderer granularity changed */ - if ( hVoIP->hFifoOut ) - { - int16_t rendererPcmBuf[( MAX_OUTPUT_CHANNELS * L_FRAME_MAX * APA_MAX_SCALE ) / 100]; - if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, rendererPcmBuf ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( pcmdsp_fifo_write( hVoIP->hFifoOut, (uint8_t *) rendererPcmBuf, nSamplesRendered_loop ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - } - else - { - if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - nSamplesRendered += nSamplesRendered_loop; - if ( nTransportChannels != hVoIP->nTransportChannelsOld ) - { - IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ); - } - - /* decode TCs only */ - if ( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hVoIP->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) - { - return error; - } - } - -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VOIP ) - { -#endif - if ( dataUnit ) - { - if ( dataUnit->partial_frame != 0 ) - { - hVoIP->lastDecodedWasActive = 1; - } - else - { - hVoIP->lastDecodedWasActive = !dataUnit->silenceIndicator; - } - /* data unit memory is no longer used */ - JB4_FreeDataUnit( hVoIP->hJBM, dataUnit ); - } -#ifdef VARIABLE_SPEED_DECODING - } - else - { - hVoIP->lastDecodedWasActive = 1; - } -#endif - - /* limit scale to range supported by time scaler */ - if ( scale < APA_MIN_SCALE ) - { - scale = APA_MIN_SCALE; - } - else if ( scale > APA_MAX_SCALE ) - { - scale = APA_MAX_SCALE; - } - - /* apply time scaling on decoded/concealed samples */ - if ( hIvasDec->hasBeenFedFirstGoodFrame ) - { - if ( apa_set_scale( hVoIP->hTimeScaler, (uint16_t) scale ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - result = apa_exec( hVoIP->hTimeScaler, hVoIP->apaExecBuffer, hVoIP->nSamplesFrame * nTransportChannels, (uint16_t) maxScaling, hVoIP->apaExecBuffer, &nTimeScalerOutSamples ); - if ( result != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - assert( nTimeScalerOutSamples <= APA_BUF ); - - nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels; - - if ( hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->rendererType != JBM_RENDERER_NONE ) - { - /* render IVAS frames */ - int16_t nResidualSamples; - - if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hVoIP->apaExecBuffer ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* feed residual samples to TSM for the next call */ - if ( apa_set_renderer_residual_samples( hVoIP->hTimeScaler, (uint16_t) nResidualSamples ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - } - else - { - /* inplace float->int16_t conversion*/ -#ifdef DEBUGGING - st_ivas->noClipping += -#endif - syn_output( hVoIP->apaExecBuffer, nTimeScalerOutSamples, (int16_t *) hVoIP->apaExecBuffer ); - - if ( pcmdsp_fifo_write( hVoIP->hFifoOut, (uint8_t *) hVoIP->apaExecBuffer, nSamplesTcsScaled ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - nSamplesRendered = nSamplesTcsScaled; - } - } -#ifdef SUPPORT_JBM_TRACEFILE - /* jbmWriterFn and jbmWriter may be NULL if tracefile writing was not requested on CLI */ - if ( jbmWriterFn != NULL && jbmWriter != NULL ) - { - /* write JBM trace data entry */ - store_JbmData( hVoIP, dataUnit, systemTimestamp_ms, extBufferedSamples, hDecoderConfig->output_Fs ); - if ( ( jbmWriterFn( &hVoIP->JbmTraceData, jbmWriter ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing JBM Trace data to file\n" ); - return IVAS_ERR_UNKNOWN; - } - } -#endif - } - - if ( hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->rendererType != JBM_RENDERER_NONE ) - { - uint16_t nSamplesRendered_loop; - int16_t nSamplesToRender; - if ( hVoIP->hFifoOut ) - { - int16_t rendererPcmBuf[( MAX_OUTPUT_CHANNELS * L_FRAME_MAX * APA_MAX_SCALE ) / 100]; - - nSamplesToRender = nSamplesPerChannel - pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ); - - /* render IVAS frames */ - if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hVoIP->nSamplesAvailableNext, rendererPcmBuf ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( pcmdsp_fifo_write( hVoIP->hFifoOut, (uint8_t *) rendererPcmBuf, nSamplesRendered_loop ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - } - else - { - nSamplesToRender = nSamplesPerChannel - nSamplesRendered; - - /* render IVAS frames directly to the output buffer */ - if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hVoIP->nSamplesAvailableNext, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - nSamplesRendered += nSamplesRendered_loop; - -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED && hVoIP->nSamplesAvailableNext == 0 ) - { - hVoIP->needNewFrame = true; - } -#endif - } - else if ( !hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->hFifoOut == NULL ) - { - hVoIP->nSamplesAvailableNext = 0; - } - else - { - hVoIP->nSamplesAvailableNext = max( 0, pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ) - nSamplesPerChannel ); - -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED && hVoIP->nSamplesAvailableNext < nSamplesPerChannel ) - { - hVoIP->needNewFrame = true; - } -#endif - - hVoIP->nSamplesAvailableNext = 0; - } - } - - /* fetch a user-specified number of samples from FIFO */ - if ( hVoIP->hFifoOut ) - { - if ( pcmdsp_fifo_read( hVoIP->hFifoOut, nSamplesPerChannel, (uint8_t *) pcmBuf ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - } - - *sampleAvailableNext = hVoIP->nSamplesAvailableNext; - - return error; -} -#endif - -/*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_Flush( ) - * - * Function to flush remaining audio in VoIP - *---------------------------------------------------------------------*/ - -ivas_error IVAS_DEC_Flush( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT - const IVAS_DEC_PCM_TYPE pcmType, - void *pcmBuf, -#else - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ -#endif -#ifndef API_5MS - uint16_t *nSamplesAvailableNext, /* o : number of samples still available */ -#endif - int16_t *nSamplesFlushed /* o : number of samples flushed */ -) -{ - ivas_error error; -#ifndef API_5MS - IVAS_DEC_VOIP *hVoIP; - int16_t rendererPcmBuf[( MAX_OUTPUT_CHANNELS * L_FRAME_MAX * APA_MAX_SCALE ) / 100]; -#endif - uint16_t nSamplesToRender; - uint16_t nSamplesFlushedLocal; - - error = IVAS_ERR_OK; - -#ifndef API_5MS - hVoIP = hIvasDec->hVoIP; -#endif -#ifdef API_5MS - *nSamplesFlushed = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); -#else - *nSamplesFlushed = min( nSamplesPerChannel, hVoIP->nSamplesAvailableNext ); -#endif - -#ifndef API_5MS - if ( hVoIP->rendererType == JBM_RENDERER_NONE ) - { - /* fetch a user-specified number of samples from FIFO */ - if ( pcmdsp_fifo_read( hVoIP->hFifoOut, *nSamplesFlushed, (uint8_t *) pcmBuf ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - hVoIP->nSamplesAvailableNext -= *nSamplesFlushed; - *nSamplesAvailableNext = hVoIP->nSamplesAvailableNext; - } - else - { - - nSamplesToRender = (uint16_t) *nSamplesFlushed; - /* render IVAS frames */ - if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hVoIP->nSamplesAvailableNext, rendererPcmBuf ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( pcmdsp_fifo_write( hVoIP->hFifoOut, (uint8_t *) rendererPcmBuf, nSamplesFlushedLocal ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - - if ( pcmdsp_fifo_read( hVoIP->hFifoOut, nSamplesFlushedLocal, (uint8_t *) pcmBuf ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } - - *nSamplesAvailableNext = hVoIP->nSamplesAvailableNext; - *nSamplesFlushed = (int16_t) nSamplesFlushedLocal; - } -#else - nSamplesToRender = (uint16_t) *nSamplesFlushed; - /* render IVAS frames */ - if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT - pcmType, -#endif - pcmBuf ) ) != IVAS_ERR_OK ) - { - return error; - } - -#endif - return error; -} - - -/*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_IsEmpty( ) - * - * - *---------------------------------------------------------------------*/ - -bool IVAS_DEC_VoIP_IsEmpty( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const int16_t nSamplesAsked ) -{ -#ifdef API_5MS - return ( ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 ) && ( hIvasDec->nSamplesAvailableNext < nSamplesAsked ) ); -#else - return ( ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 ) && ( hIvasDec->hVoIP->nSamplesAvailableNext < nSamplesAsked ) ); -#endif -} +bool IVAS_DEC_VoIP_IsEmpty( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const int16_t nSamplesAsked ) +{ + return ( ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 ) && ( hIvasDec->nSamplesAvailableNext < nSamplesAsked ) ); +} /*---------------------------------------------------------------------* @@ -3233,16 +2522,6 @@ static void IVAS_DEC_Close_VoIP( { JB4_Destroy( &hVoIP->hJBM ); -#ifndef API_5MS - apa_exit( &hVoIP->hTimeScaler ); - - pcmdsp_fifo_destroy( &hVoIP->hFifoOut ); - - if ( hVoIP->apaExecBuffer != NULL ) - { - free( hVoIP->apaExecBuffer ); - } -#endif if ( hVoIP->bs_conversion_buf != NULL ) { #define WMC_TOOL_SKIP @@ -3588,7 +2867,6 @@ static ivas_error printConfigInfo_dec( } } -#ifdef API_5MS /*-----------------------------------------------------------------* * Print TSM mode info *-----------------------------------------------------------------*/ @@ -3596,7 +2874,6 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "TSM mode: ON\n" ); } -#ifdef API_5MS_BASELINE /*-----------------------------------------------------------------* * Print 5ms API mode info *-----------------------------------------------------------------*/ @@ -3604,16 +2881,6 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "API 5ms mode: ON\n" ); } -#endif -#else - /*-----------------------------------------------------------------* - * Print VoIP mode info - *-----------------------------------------------------------------*/ - if ( st_ivas->hDecoderConfig->voip_active ) - { - fprintf( stdout, "VoIP mode: ON\n" ); - } -#endif return IVAS_ERR_OK; } @@ -3788,18 +3055,14 @@ static ivas_error evs_dec_main( } -#ifdef API_5MS if ( !st_ivas->hDecoderConfig->Opt_tsm -#ifdef API_5MS_BASELINE && st_ivas->hDecoderConfig->Opt_5ms -#endif ) { ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); } else -#endif if ( floatBuf != NULL ) { /* BE workaround */ @@ -4032,31 +3295,6 @@ static int16_t IVAS_DEC_VoIP_GetRenderGranularity( } -#ifndef API_5MS -/*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_GetRendererConfig() - * - * - *---------------------------------------------------------------------*/ - -static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( - IVAS_DEC_HANDLE hIvasDec ) -{ - JBM_RENDERER_TYPE rendererType; - rendererType = JBM_RENDERER_NONE; - - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) - { - rendererType = JBM_RENDERER_NONE; - } - else - { - rendererType = JBM_RENDERER_IVAS; - } - - return rendererType; -} -#endif /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_reconfigure() @@ -4069,35 +3307,16 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( const uint16_t l_ts ) { -#ifndef API_5MS - IVAS_DEC_VOIP *hVoIP; -#endif -#ifdef API_5MS int16_t apa_buffer_size; -#endif ivas_error error; -#ifndef API_5MS - hVoIP = hIvasDec->hVoIP; -#endif -#ifdef API_5MS apa_buffer_size = hIvasDec->nSamplesFrame; -#endif -#ifdef API_5MS if ( hIvasDec->apaExecBuffer == NULL ) -#else - if ( hIvasDec->hVoIP->hTimeScaler == NULL ) -#endif { -#ifndef API_5MS - uint16_t wss, css; - float startQuality; -#endif DECODER_CONFIG_HANDLE hDecoderConfig; -#ifdef API_5MS if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { uint16_t wss, css; @@ -4105,18 +3324,8 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( startQuality = 1.0f; apa_buffer_size = APA_BUF_PER_CHANNEL; -#else -#ifdef VARIABLE_SPEED_DECODING - startQuality = hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ? -2.0f : 1.0f; -#else - startQuality = 1.0f; -#endif -#endif /* get current renderer type*/ -#ifndef API_5MS - hVoIP->rendererType = IVAS_DEC_VoIP_GetRendererConfig( hIvasDec ); -#endif hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; if ( hDecoderConfig->output_Fs == 8000 ) @@ -4143,16 +3352,6 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( { return IVAS_ERR_INIT_ERROR; } -#ifndef API_5MS - if ( ( hIvasDec->hVoIP->apaExecBuffer = malloc( sizeof( float ) * APA_BUF_PER_CHANNEL * nTransportChannels ) ) == NULL ) - - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } - - set_zero( hIvasDec->hVoIP->apaExecBuffer, APA_BUF_PER_CHANNEL * nTransportChannels ); -#endif -#ifdef API_5MS if ( apa_init( &hIvasDec->hTimeScaler, nTransportChannels ) != IVAS_ERR_OK || apa_set_rate( hIvasDec->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || @@ -4162,52 +3361,15 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( { return IVAS_ERR_INIT_ERROR; } -#else - if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, - nTransportChannels ) != IVAS_ERR_OK || - apa_set_rate( hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || - apa_set_complexity_options( hIvasDec->hVoIP->hTimeScaler, wss, css ) != 0 || - apa_set_quality( hIvasDec->hVoIP->hTimeScaler, startQuality, 4, 4 ) != 0 || - apa_set_renderer_granularity( hIvasDec->hVoIP->hTimeScaler, l_ts ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } -#endif -#ifndef API_5MS - if ( hVoIP->hFifoOut == NULL && hVoIP->rendererType == JBM_RENDERER_NONE ) - { - /* we still need the FIFO out buffer */ - if ( pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoOut ) != 0 || - pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoOut, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } - } -#ifdef VARIABLE_SPEED_DECODING - else if ( hIvasDec->hVoIP->voipMode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) - { - if ( pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoOut ) != 0 || - pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoOut, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } - } -#endif -#endif if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { -#ifdef API_5MS if ( apa_set_evs_compat_mode( hIvasDec->hTimeScaler, true ) != 0 ) -#else - if ( apa_set_evs_compat_mode( hIvasDec->hVoIP->hTimeScaler, true ) != 0 ) -#endif { return IVAS_ERR_INIT_ERROR; } } -#ifdef API_5MS if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) { @@ -4216,30 +3378,15 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } -#endif -#ifndef API_5MS - if ( ( hVoIP->apaExecBuffer = malloc( sizeof( float ) * APA_BUF_PER_CHANNEL * nTransportChannels ) ) == NULL ) - - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } - - set_zero( hVoIP->apaExecBuffer, APA_BUF_PER_CHANNEL * nTransportChannels ); -#endif } else { -#ifdef API_5MS if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { if ( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ) -#else - if ( apa_reconfigure( hVoIP->hTimeScaler, nTransportChannels, l_ts ) != 0 ) -#endif { return IVAS_ERR_INIT_ERROR; } -#ifdef API_5MS apa_buffer_size = APA_BUF_PER_CHANNEL; free( hIvasDec->apaExecBuffer ); if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) @@ -4248,23 +3395,10 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( } set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } -#endif /* realloc apa_exe_buffer */ -#ifndef API_5MS - free( hIvasDec->hVoIP->apaExecBuffer ); - if ( ( hIvasDec->hVoIP->apaExecBuffer = malloc( sizeof( float ) * APA_BUF_PER_CHANNEL * nTransportChannels ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } - set_zero( hIvasDec->hVoIP->apaExecBuffer, APA_BUF_PER_CHANNEL * nTransportChannels ); -#endif } -#ifdef API_5MS hIvasDec->nTransportChannelsOld = nTransportChannels; -#else - hIvasDec->hVoIP->nTransportChannelsOld = (uint8_t) nTransportChannels; -#endif error = IVAS_ERR_OK; @@ -4363,7 +3497,7 @@ ivas_error IVAS_DEC_GetCldfbSamples( } #endif -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT void *pcm_buffer_offset( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, int32_t offset ) { switch ( pcmType ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index fa76331d7d..3ab0a77670 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -63,15 +63,6 @@ typedef enum _IVAS_DEC_COMPLEXITY_LEVEL IVAS_DEC_COMPLEXITY_LEVEL_THREE = 3 } IVAS_DEC_COMPLEXITY_LEVEL; -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING -typedef enum -{ - IVAS_DEC_VOIP_MODE_VOIP = 0, - IVAS_DEC_VOIP_MODE_VARIABLE_SPEED = 1 -} IVAS_DEC_VOIP_MODE; -#endif -#endif #ifdef DEBUGGING typedef enum _IVAS_DEC_FORCED_REND_MODE @@ -83,7 +74,7 @@ typedef enum _IVAS_DEC_FORCED_REND_MODE } IVAS_DEC_FORCED_REND_MODE; #endif -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT typedef enum _IVAS_DEC_PCM_TYPE { IVAS_DEC_PCM_INT16, @@ -133,10 +124,8 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ const AUDIO_CONFIG outputConfig, /* i : audio configuration */ -#ifdef API_5MS const int16_t tsmEnabled, /* i : enable TSM */ const int16_t enable5ms, /* i : enable 5ms rendering path */ -#endif const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -165,10 +154,9 @@ ivas_error IVAS_DEC_FeedFrame_Serial( /*! r: decoder error code */ ivas_error IVAS_DEC_GetSamples( -#ifdef API_5MS IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked, /* i: number of samples wanted by the caller */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ void *pcmBuf, /* o : output synthesis signal */ #else @@ -176,18 +164,9 @@ ivas_error IVAS_DEC_GetSamples( #endif int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ bool *needNewFrame /* indication that the decoder needs a new frame */ -#else - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ -#endif -#if defined SPLIT_REND_WITH_HEAD_ROT && !defined API_5MS - , - uint8_t *splitRendBitsBuf /* o : output split rendering bits */ -#endif ); -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT ivas_error IVAS_DEC_GetSplitBinauralBitstream( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ void *pcmBuf_out, /* o : output synthesis signal for BINAURAL_SPLIT_PCM */ @@ -232,14 +211,9 @@ ivas_error IVAS_DEC_GetMasaMetadata( /*! r: error code */ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef API_5MS IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ IVAS_VECTOR3 Pos, /* i : listener position */ const int16_t subframe_idx /*subframe index*/ -#else - IVAS_QUATERNION *orientation, /* i : head-tracking data, listener orientation */ - IVAS_VECTOR3 *Pos /* i : listener position */ -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , IVAS_SPLIT_REND_ROT_AXIS rot_axis /*i : external control for rotation axis for split rendering */ @@ -261,20 +235,12 @@ ivas_error IVAS_DEC_FeedRefVectorData( /*! r: error code */ ivas_error IVAS_DEC_FeedExternalOrientationData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifdef API_5MS IVAS_QUATERNION orientation, /* i : external orientation data */ int8_t enableHeadRotation, /* i : flag to enable head rotation for this frame */ int8_t enableExternalOrientation, /* i : flag to enable external orientation for this frame */ int8_t enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ int16_t numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */ const int16_t subframe_idx /*i : subframe index*/ -#else - IVAS_QUATERNION *orientation, /* i : external orientation data */ - int8_t *enableHeadRotation, /* i : flag to enable head rotation for this frame */ - int8_t *enableExternalOrientation, /* i : flag to enable external orientation for this frame */ - int8_t *enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ - int16_t *numFramesToTargetOrientation /* i : number of frames until target orientation is reached */ -#endif ); /*! r: error code */ @@ -288,39 +254,23 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( const bool qBit /* i : Q bit for AMR-WB IO */ ); -#ifdef API_5MS ivas_error IVAS_DEC_VoIP_SetScale( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t maxScaling, /* i : maximum allowed TSM scale */ const int16_t scale /* i : TSM scale to set */ ); -#else -#ifdef VARIABLE_SPEED_DECODING -#ifdef DEBUGGING -/*! r: error code */ -ivas_error IVAS_DEC_VoIP_SetScale( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const int16_t scale /* i : TSM scale to set */ -); -#endif -#endif -#endif /*! r: error code */ ivas_error IVAS_DEC_VoIP_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, #else int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ #endif const uint32_t systemTimestamp_ms /* i : current system timestamp */ -#ifndef API_5MS - , - uint16_t *sampleAvailableNext /* o : samples available for the next call */ -#endif #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, void* jbmWriter @@ -330,14 +280,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples( ivas_error IVAS_DEC_Flush( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf, #else int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ -#endif -#ifndef API_5MS - uint16_t *nSamplesAvailableNext, /* o : number of samples still available */ #endif int16_t *nSamplesFlushed /* o : number of samples flushed */ ); @@ -347,17 +294,10 @@ ivas_error IVAS_DEC_Flush( /*! r: error code */ ivas_error IVAS_DEC_EnableVoIP( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -#ifndef API_5MS -#ifdef VARIABLE_SPEED_DECODING - const IVAS_DEC_VOIP_MODE voipMode, /* i : VoIP or variable speed */ - const uint16_t speedFac, /* i : speed factor for variable speed */ -#endif -#endif const int16_t jbmSafetyMargin, /* i : allowed delay reserve for JBM, in milliseconds */ const IVAS_DEC_INPUT_FORMAT inputFormat /* i : format of the input bitstream */ ); -#ifdef API_5MS #ifdef SPLIT_REND_WITH_HEAD_ROT /*! r: error code */ @@ -370,7 +310,6 @@ ivas_error IVAS_DEC_Get5msFlag( int16_t *enable5ms /* o : 5ms flag */ ); -#endif #ifdef DEBUGGING bool IVAS_DEC_GetBerDetectFlag( @@ -456,12 +395,10 @@ ivas_error IVAS_DEC_GetRenderConfig( const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ ); -#ifdef API_5MS /*! r: error code*/ ivas_error IVAS_DEC_GetDefaultRenderConfig( IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ ); -#endif /*! r: error code*/ ivas_error IVAS_DEC_FeedRenderConfig( diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 6c0ca0e73a..c1b066abc2 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1713,21 +1713,15 @@ ivas_error ivas_rend_crendProcess( EFAP_HANDLE hEFAPdata, float *output[], /* i/o: input/output audio channels */ const int32_t output_Fs -#ifdef API_5MS , const int16_t num_subframes /* i : number of subframes to render */ -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , const int16_t pos_idx #endif ) { -#ifdef API_5MS int16_t i, subframe_idx, subframe_len; -#else - int16_t i, subframe_idx, output_frame, subframe_len; -#endif int16_t nchan_out; float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; float *p_pcm_tmp[BINAURAL_CHANNELS]; @@ -1746,11 +1740,7 @@ ivas_error ivas_rend_crendProcess( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { if ( hCombinedOrientationData->enableCombinedOrientation[subframe_idx] != 0 ) { @@ -1769,23 +1759,14 @@ ivas_error ivas_rend_crendProcess( return error; } -#ifdef API_5MS subframe_len = (int16_t) ( output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); -#else - output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); - subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#endif for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { p_pcm_tmp[i] = pcm_tmp[i]; } -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { /* Early Reflections */ if ( hCrend->reflections != NULL ) @@ -1851,11 +1832,7 @@ ivas_error ivas_rend_crendProcess( /* move to output */ for ( i = 0; i < nchan_out; i++ ) { -#ifdef API_5MS mvr2r( pcm_tmp[i], output[i], num_subframes * subframe_len ); -#else - mvr2r( pcm_tmp[i], output[i], output_frame ); -#endif } pop_wmops(); @@ -1904,21 +1881,10 @@ ivas_error ivas_rend_crendProcessSubframe( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { -#ifdef API_5MS if ( hCombinedOrientationData->enableCombinedOrientation[0] != 0 ) { combinedOrientationEnabled = 1; } -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) - { - if ( hCombinedOrientationData->enableCombinedOrientation[subframe_idx] != 0 ) - { - combinedOrientationEnabled = 1; - break; - } - } -#endif } push_wmops( "ivas_rend_crendProcessSubframe" ); @@ -2099,11 +2065,7 @@ ivas_error ivas_rend_crendProcessSplitBin( combinedOrientationDataLocal = *pCombinedOrientationDataLocal; if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { -#ifdef API_5MS for ( sf = 1; sf < hCombinedOrientationData->num_subframes; ++sf ) -#else - for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf ) -#endif { combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; for ( i = 0; i < 3; i++ ) @@ -2133,11 +2095,7 @@ ivas_error ivas_rend_crendProcessSplitBin( /* Update head positions */ IVAS_QUATERNION Quaternions_orig[MAX_PARAM_SPATIAL_SUBFRAMES], Quaternions_abs; -#ifdef API_5MS for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#else - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) -#endif { Quaternions_orig[i] = combinedOrientationDataLocal.Quaternions[i]; Quaternions_abs.w = -3.0f; @@ -2167,9 +2125,7 @@ ivas_error ivas_rend_crendProcessSplitBin( hEFAPdata, p_tmpInputBuffer, output_Fs, -#ifdef API_5MS hCombinedOrientationData->num_subframes, -#endif pos_idx ) ) != IVAS_ERR_OK ) { return error; @@ -2196,11 +2152,7 @@ ivas_error ivas_rend_crendProcessSplitBin( } /* restore original headrotation data */ -#ifdef API_5MS for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#else - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) -#endif { combinedOrientationDataLocal.Quaternions[i] = Quaternions_orig[i]; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 69d40c4a17..4e927c78b2 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -314,13 +314,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( /* allocate transport channels*/ if ( -#ifdef API_5MS -#ifdef API_5MS_BASELINE st_ivas->hDecoderConfig->Opt_5ms && -#endif -#else - st_ivas->hDecoderConfig->voip_active == 1 && -#endif st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate; @@ -566,10 +560,8 @@ void ivas_dirac_dec_binaural( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport /* i : number of transport channels */ -#ifdef API_5MS , const int16_t num_subframes /* i : number of subframes to render */ -#endif ) { int16_t subframe; @@ -638,11 +630,7 @@ void ivas_dirac_dec_binaural( generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[nchan_transport], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna ); } -#ifdef API_5MS for ( subframe = 0; subframe < num_subframes; subframe++ ) -#else - for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) -#endif { int16_t n_samples_sf = slot_size * hSpatParamRendCom->subframe_nbslots[subframe]; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index e50b625e4c..68dbbe73b4 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -273,10 +273,8 @@ ivas_error ivas_td_binaural_renderer_unwrap( const int16_t ism_md_subframe_update, /* i : Number of subframes to delay ism metadata to sync with audio */ float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ -#ifdef API_5MS , const int16_t num_subframes /* i : number of subframes to render */ -#endif ) { int16_t subframe_length; @@ -292,11 +290,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( p_reverb_signal[ch] = reverb_signal[ch]; } -#ifdef API_5MS subframe_length = output_frame / num_subframes; -#else - subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#endif c_indx = 0; for ( nS = 0; nS < num_src; nS++ ) @@ -309,11 +303,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( } } -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { if ( subframe_idx == ism_md_subframe_update ) { @@ -646,9 +636,7 @@ ivas_error ivas_td_binaural_renderer_ext( const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ -#ifdef API_5MS const int32_t output_Fs, /* i : output sampling rate */ -#endif const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) @@ -712,10 +700,8 @@ ivas_error ivas_td_binaural_renderer_ext( ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->Quaternions : NULL, ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->listenerPos : NULL, ism_md_subframe_update_ext, p_output, output_frame -#ifdef API_5MS , (int16_t) ( ( output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) / output_Fs ) -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -777,11 +763,7 @@ ivas_error ObjRenderIvasFrame_splitBinaural( } /* Save current head positions */ -#ifdef API_5MS for ( i = 0; i < st_ivas->hCombinedOrientationData->num_subframes; ++i ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) -#endif { originalHeadRot[i] = st_ivas->hCombinedOrientationData->Quaternions[i]; } @@ -799,11 +781,7 @@ ivas_error ObjRenderIvasFrame_splitBinaural( /* Update head positions */ if ( pos_idx != 0 ) { -#ifdef API_5MS for ( i = 0; i < st_ivas->hCombinedOrientationData->num_subframes; ++i ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) -#endif { if ( originalHeadRot[i].w == -3.0f ) { @@ -873,11 +851,7 @@ ivas_error ObjRenderIvasFrame_splitBinaural( } /* Restore original head rotation */ -#ifdef API_5MS for ( i = 0; i < st_ivas->hCombinedOrientationData->num_subframes; ++i ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) -#endif { st_ivas->hCombinedOrientationData->Quaternions[i] = originalHeadRot[i]; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 578bac9dee..6e81113fee 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -162,9 +162,7 @@ void ivas_dirac_dec_binaural( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport /* i : number of transport channels */ -#ifdef API_5MS ,const int16_t num_subframes /* i : number of subframes to render */ -#endif ); void ivas_dirac_dec_binaural_render( @@ -563,9 +561,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( const int16_t ism_md_subframe_update, float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ -#ifdef API_5MS ,const int16_t num_subframes /* i : number of subframes to render */ -#endif ); ivas_error ivas_td_binaural_renderer_ext( @@ -576,9 +572,7 @@ ivas_error ivas_td_binaural_renderer_ext( const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ -#ifdef API_5MS const int32_t output_Fs, /* i : output sampling rate */ -#endif const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ); @@ -859,9 +853,7 @@ ivas_error ivas_rend_crendProcess( EFAP_HANDLE hEFAPdata, float *output[], /* i/o: input/output audio channels */ const int32_t output_Fs -#ifdef API_5MS ,const int16_t num_subframes /* i : number of subframes to render */ -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , const int16_t pos_idx @@ -1258,10 +1250,8 @@ void rotateFrame_sd_cldfb( ivas_error ivas_external_orientation_open( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData /* o : external orientation handle */ -#ifdef API_5MS , const int16_t num_subframes -#endif ); void ivas_external_orientation_close( @@ -1270,10 +1260,8 @@ void ivas_external_orientation_close( ivas_error ivas_combined_orientation_open( COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData /* o : combined orientation handle */ -#ifdef API_5MS , const int16_t num_subframes -#endif ); void ivas_combined_orientation_close( @@ -1374,11 +1362,9 @@ ivas_error ivas_orient_trk_Process( ); #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef API_5MS void ivas_set_split_rend_ht_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ); -#endif /*----------------------------------------------------------------------------------* * Split binaural renderer prototypes *----------------------------------------------------------------------------------*/ @@ -1387,11 +1373,7 @@ ivas_error ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */ -#ifdef API_5MS IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits -#else - uint8_t *splitRendBitsBuf -#endif ); void ivas_init_split_rend_handles( @@ -1408,10 +1390,8 @@ ivas_error ivas_split_renderer_open( const int32_t output_Fs, const int16_t is_cldfb_in, const int16_t is_pcm_out -#ifdef API_5MS , const int16_t is_5ms_frame -#endif ); void ivas_split_renderer_close( @@ -1486,16 +1466,10 @@ void ivas_renderSplitUpdateNoCorrectionPoseData( ivas_error ivas_renderMultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, -#ifdef API_5MS const IVAS_QUATERNION headPosition, -#else - const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], -#endif const int32_t SplitRendBitRate, IVAS_SPLIT_REND_CODEC splitCodec, -#ifdef API_5MS int16_t codec_frame_size_ms, -#endif ivas_split_rend_bits_t *pBits, float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -1508,11 +1482,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( void ivas_rend_CldfbSplitPreRendProcess( const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, -#ifdef API_5MS const IVAS_QUATERNION headPosition, -#else - const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], -#endif MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -1524,15 +1494,9 @@ void ivas_rend_CldfbSplitPreRendProcess( void ivas_rend_CldfbSplitPostRendProcess( BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, -#ifdef API_5MS const IVAS_QUATERNION QuaternionPost, float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], -#else - const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], - float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], -#endif float output[][L_FRAME48k], const int16_t is_cldfb_in ); @@ -1606,15 +1570,9 @@ void ivas_SplitRenderer_GetRotMd( void ivas_SplitRenderer_PostRenderer( BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, -#ifdef API_5MS float Cldfb_RealBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ float Cldfb_ImagBuffer_Ref_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ const IVAS_QUATERNION Quaternion_act -#else - float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - const IVAS_QUATERNION Quaternions_act[MAX_PARAM_SPATIAL_SUBFRAMES] -#endif ); #endif @@ -1770,10 +1728,8 @@ void ivas_rend_CldfbMultiBinRendProcess( float Cldfb_Out_Real[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_Out_Imag[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t low_res_pre_rend_rot -#ifdef API_5MS , int16_t num_subframes -#endif ); ivas_error ivas_rend_openCldfb( @@ -1846,12 +1802,6 @@ int32_t ivas_split_rend_bitstream_read_int32( const int32_t bits ); -#ifndef API_5MS -IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( - const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME], - int16_t subframe_idx -); -#endif void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend @@ -1870,9 +1820,7 @@ int32_t ivas_get_split_rend_md_target_brate( int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode -#ifdef API_5MS , int16_t split_prerender_frame_size_ms -#endif ); int8_t ivas_get_lc3plus_bitrate_id( @@ -1882,9 +1830,7 @@ int8_t ivas_get_lc3plus_bitrate_id( int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode -#ifdef API_5MS ,int16_t split_prerender_frame_size_ms -#endif ); ivas_error ivas_split_rend_validate_config( @@ -1909,16 +1855,10 @@ void ivas_split_rend_get_quant_params( int16_t *num_complex_bands ); -#ifdef API_5MS ivas_error -#else -void -#endif ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ -#ifdef API_5MS int16_t *pCodec_frame_size_ms, /* i/o: pointer to codec frame size setting */ -#endif int16_t isRenderingInTd, /* i : flag: is rendering done in TD? */ int16_t pcm_out /*i : flag to indicate PCM output*/ ); diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 5f12c75214..16b91df825 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -136,9 +136,7 @@ ivas_error ivas_render_config_init_from_rom( ( *hRenderConfig )->split_rend_config.dof = 3; ( *hRenderConfig )->split_rend_config.hq_mode = 0; ( *hRenderConfig )->split_rend_config.codec_delay_ms = 0; -#ifdef API_5MS ( *hRenderConfig )->split_rend_config.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ -#endif ( *hRenderConfig )->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; ( *hRenderConfig )->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; ( *hRenderConfig )->split_rend_config.rendererSelection = IVAS_SPLIT_REND_RENDERER_SELECTION_DEFAULT; diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 0497275508..cdcc961a08 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -53,9 +53,6 @@ static ivas_error combine_external_and_head_orientations( IVAS_VECTOR3 *listenerPos, #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i : split rend pose prediction axis*/ -#endif -#ifndef API_5MS - int16_t numHeadRotQuaternions, #endif EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ); @@ -88,9 +85,6 @@ ivas_error ivas_headTrack_open( } /* Initialization */ -#ifndef API_5MS - ( *hHeadTrackData )->num_quaternions = 0; -#endif ( *hHeadTrackData )->lrSwitchInterpVal = 0.0f; ( *hHeadTrackData )->lrSwitchedCurrent = 0; ( *hHeadTrackData )->lrSwitchedNext = 0; @@ -823,10 +817,8 @@ void rotateFrame_sd_cldfb( ivas_error ivas_external_orientation_open( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData /* o : external orientation handle */ -#ifdef API_5MS , const int16_t num_subframes -#endif ) { @@ -841,9 +833,7 @@ ivas_error ivas_external_orientation_open( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for external orientation memory\n" ) ); } -#ifdef API_5MS ( *hExtOrientationData )->num_subframes = num_subframes; -#endif /* Enable head rotation and disable external orientation as default */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { @@ -887,10 +877,8 @@ void ivas_external_orientation_close( ivas_error ivas_combined_orientation_open( COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData /* o : combined orientation handle */ -#ifdef API_5MS , const int16_t num_subframes -#endif ) { int16_t i; @@ -912,12 +900,9 @@ ivas_error ivas_combined_orientation_open( } /* Initialization */ -#ifdef API_5MS ( *hCombinedOrientationData )->num_subframes = num_subframes; -#endif ( *hCombinedOrientationData )->interpolationCoefficient = 1.0f; ( *hCombinedOrientationData )->interpolationIncrement = 1.0f; -#ifdef API_5MS if ( num_subframes == 1 ) { ( *hCombinedOrientationData )->maximumFramesToTargetOrientation = 2000; @@ -926,9 +911,6 @@ ivas_error ivas_combined_orientation_open( { ( *hCombinedOrientationData )->maximumFramesToTargetOrientation = 500; } -#else - ( *hCombinedOrientationData )->maximumFramesToTargetOrientation = 500; -#endif ( *hCombinedOrientationData )->lrSwitchedNext = 0; ( *hCombinedOrientationData )->lrSwitchedCurrent = 0; ( *hCombinedOrientationData )->lrSwitchInterpVal = 0.0f; @@ -1022,29 +1004,13 @@ ivas_error combine_external_and_head_orientations_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; #endif -#ifdef API_5MS IVAS_QUATERNION *pHeadRotQuaternion = NULL; -#else - IVAS_QUATERNION *headRotQuaternions = NULL; -#endif IVAS_VECTOR3 *listenerPos = NULL; -#ifndef API_5MS - int16_t numHeadRotQuaternions = 0; -#endif if ( hHeadTrackData != NULL ) { -#ifdef API_5MS pHeadRotQuaternion = hHeadTrackData->Quaternions; listenerPos = hHeadTrackData->Pos; -#else - numHeadRotQuaternions = hHeadTrackData->num_quaternions; - if ( hHeadTrackData->num_quaternions >= 0 ) - { - headRotQuaternions = hHeadTrackData->Quaternions; - listenerPos = hHeadTrackData->Pos; - } -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis; #endif @@ -1057,17 +1023,10 @@ ivas_error combine_external_and_head_orientations_dec( #endif return combine_external_and_head_orientations( -#ifdef API_5MS pHeadRotQuaternion, -#else - headRotQuaternions, -#endif listenerPos, #ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis, -#endif -#ifndef API_5MS - numHeadRotQuaternions, #endif hExtOrientationData, hCombinedOrientationData ); @@ -1092,9 +1051,6 @@ ivas_error combine_external_and_head_orientations_rend( IVAS_QUATERNION *headRotQuaternions = NULL; IVAS_VECTOR3 *listenerPos = NULL; int16_t i; -#ifndef API_5MS - int16_t numHeadRotQuaternions = 0; -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis = DEFAULT_AXIS; @@ -1103,13 +1059,8 @@ ivas_error combine_external_and_head_orientations_rend( { if ( hHeadTrackData->headRotEnabled ) { -#ifdef API_5MS - headRotQuaternions = hHeadTrackData->headPositions; - listenerPos = hHeadTrackData->Pos; -#else headRotQuaternions = hHeadTrackData->headPositions; listenerPos = hHeadTrackData->Pos; -#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis; @@ -1118,7 +1069,6 @@ ivas_error combine_external_and_head_orientations_rend( else if ( hExtOrientationData != NULL ) { /* Head rotation data not available, use the freezed value or disable */ -#ifdef API_5MS for ( i = 0; i < hExtOrientationData->num_subframes; i++ ) { if ( hExtOrientationData->enableHeadRotation[i] != 2 ) @@ -1127,15 +1077,6 @@ ivas_error combine_external_and_head_orientations_rend( } } -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - if ( hExtOrientationData->enableHeadRotation[i] != 2 ) - { - hExtOrientationData->enableHeadRotation[i] = 0; - } - } -#endif } return combine_external_and_head_orientations( @@ -1143,9 +1084,6 @@ ivas_error combine_external_and_head_orientations_rend( listenerPos, #ifdef SPLIT_REND_WITH_HEAD_ROT sr_pose_pred_axis, -#endif -#ifndef API_5MS - numHeadRotQuaternions, #endif hExtOrientationData, hCombinedOrientationData ); @@ -1164,9 +1102,6 @@ ivas_error combine_external_and_head_orientations( IVAS_VECTOR3 *listenerPos, /* i : listener position */ #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis, /* i : split rend pose prediction axis*/ -#endif -#ifndef API_5MS - int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ #endif EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ @@ -1184,11 +1119,7 @@ ivas_error combine_external_and_head_orientations( /* Form combined orientations or return if no data available */ if ( hCombinedOrientationData == NULL ) { -#ifdef API_5MS - if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) -#else if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) -#endif { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -1197,11 +1128,7 @@ ivas_error combine_external_and_head_orientations( return IVAS_ERR_OK; } } -#ifdef API_5MS - else if ( headRotQuaternions == NULL && hExtOrientationData == NULL ) -#else else if ( headRotQuaternions == NULL && hExtOrientationData == NULL ) -#endif { /* Reset the combined orientations and rotations */ hCombinedOrientationData->isInterpolationOngoing = FALSE; @@ -1209,11 +1136,7 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->interpolationIncrement = 1.0f; hCombinedOrientationData->Quaternions_ext_interpolation_start = identity; hCombinedOrientationData->Quaternions_ext_interpolation_target = identity; -#ifndef API_5MS - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#endif { hCombinedOrientationData->enableCombinedOrientation[i] = 0; hCombinedOrientationData->Quaternions[i] = identity; @@ -1226,37 +1149,19 @@ ivas_error combine_external_and_head_orientations( } } } -#ifdef API_5MS else if ( hExtOrientationData == NULL && headRotQuaternions != NULL ) -#else - else if ( hExtOrientationData == NULL && headRotQuaternions != NULL ) -#endif { /* Head rotation only */ -#ifdef API_5MS for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) { hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; } -#else - if ( numHeadRotQuaternions >= 0 ) - { - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; - } - } -#endif } if ( hExtOrientationData != NULL ) { /* External orientations */ -#ifndef API_5MS - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#endif { /* Check for frozen external orientation */ if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) @@ -1308,25 +1213,13 @@ ivas_error combine_external_and_head_orientations( } } -#ifdef API_5MS - if ( hExtOrientationData != NULL && headRotQuaternions != NULL ) -#else if ( hExtOrientationData != NULL && headRotQuaternions != NULL ) -#endif { /* Combine head and external orientations */ -#ifndef API_5MS - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#endif { /* Check for frozen head rotation */ -#ifndef API_5MS - if ( hExtOrientationData->enableHeadRotation[i] == 2 && numHeadRotQuaternions >= 0 ) -#else if ( hExtOrientationData->enableHeadRotation[i] == 2 ) -#endif { if ( hCombinedOrientationData->isHeadRotationFrozen != 1 ) { @@ -1340,11 +1233,7 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->isHeadRotationFrozen = 0; } /* Use the most recent head rotation */ -#ifndef API_5MS - if ( hExtOrientationData->enableHeadRotation[i] == 1 && numHeadRotQuaternions >= 0 ) -#else if ( hExtOrientationData->enableHeadRotation[i] == 1 ) -#endif { if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) { @@ -1356,11 +1245,7 @@ ivas_error combine_external_and_head_orientations( } } /* Use the freezed head rotation */ -#ifndef API_5MS - else if ( hExtOrientationData->enableHeadRotation[i] == 2 && numHeadRotQuaternions >= 0 ) -#else else if ( hExtOrientationData->enableHeadRotation[i] == 2 ) -#endif { if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) { @@ -1380,18 +1265,10 @@ ivas_error combine_external_and_head_orientations( } } -#ifdef API_5MS - if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) -#else if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) -#endif { /* Calculate the combined rotation matrix */ -#ifndef API_5MS - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#endif { QuatToRotMat( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Rmat[i] ); } @@ -1400,77 +1277,34 @@ ivas_error combine_external_and_head_orientations( /* Save the current orientations */ if ( hExtOrientationData != NULL ) { -#ifdef API_5MS if ( hExtOrientationData->enableExternalOrientation[hExtOrientationData->num_subframes - 1] > 0 ) -#else - if ( hExtOrientationData->enableExternalOrientation[MAX_PARAM_SPATIAL_SUBFRAMES - 1] > 0 ) -#endif { -#ifdef API_5MS hCombinedOrientationData->Quaternion_prev_extOrientation = hExtOrientationData->Quaternions[hExtOrientationData->num_subframes - 1]; -#else - hCombinedOrientationData->Quaternion_prev_extOrientation = hExtOrientationData->Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES - 1]; -#endif } else { hCombinedOrientationData->Quaternion_prev_extOrientation = identity; } } -#ifdef API_5MS if ( headRotQuaternions != NULL ) -#else - if ( headRotQuaternions != NULL ) -#endif { -#ifndef API_5MS - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#endif { hCombinedOrientationData->listenerPos[i] = listenerPos[i]; } } /* Check if combined orientation is enabled */ -#ifdef API_5MS - if ( headRotQuaternions != NULL && hExtOrientationData == NULL ) -#else if ( headRotQuaternions != NULL && hExtOrientationData == NULL ) -#endif { -#ifndef API_5MS - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#endif { -#ifndef API_5MS - if ( numHeadRotQuaternions >= 0 ) - { - hCombinedOrientationData->enableCombinedOrientation[i] = 1; - } - else - { - hCombinedOrientationData->enableCombinedOrientation[i] = 0; - } -#else hCombinedOrientationData->enableCombinedOrientation[i] = 1; -#endif } } -#ifdef API_5MS else if ( headRotQuaternions == NULL && hExtOrientationData != NULL ) -#else - else if ( headRotQuaternions == NULL && hExtOrientationData != NULL ) -#endif { -#ifndef API_5MS - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#endif { if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) { @@ -1482,23 +1316,11 @@ ivas_error combine_external_and_head_orientations( } } } -#ifdef API_5MS else if ( headRotQuaternions != NULL && hExtOrientationData != NULL ) -#else - else if ( headRotQuaternions != NULL && hExtOrientationData != NULL ) -#endif { -#ifndef API_5MS - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#endif { -#ifndef API_5MS - if ( hExtOrientationData->enableExternalOrientation[i] > 0 || ( hExtOrientationData->enableHeadRotation[i] > 0 && numHeadRotQuaternions >= 0 ) ) -#else if ( hExtOrientationData->enableExternalOrientation[i] > 0 || ( hExtOrientationData->enableHeadRotation[i] > 0 ) ) -#endif { hCombinedOrientationData->enableCombinedOrientation[i] = 1; } @@ -1510,11 +1332,7 @@ ivas_error combine_external_and_head_orientations( } else { -#ifndef API_5MS - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) -#endif { hCombinedOrientationData->enableCombinedOrientation[i] = 0; } diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index ab872c618f..e077679c11 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -1589,22 +1589,13 @@ static void interpolate_rend_md( void ivas_SplitRenderer_PostRenderer( BIN_HR_SPLIT_POST_REND_HANDLE hBinPostRenderer, /* i/o: binaural renderer handle */ MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, -#ifdef API_5MS float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ const IVAS_QUATERNION Quaternion_act -#else - float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - const IVAS_QUATERNION Quaternions_act[MAX_PARAM_SPATIAL_SUBFRAMES] -#endif ) { int16_t pos_idx, b, brange[2], ch_idx1; int16_t num_md_bands, slot_idx, b2, index_slot, num_slots, sf_idx_md; -#ifndef API_5MS - int16_t sf_idx, num_subframes; -#endif float pred_out_re[BINAURAL_CHANNELS], pred_out_im[BINAURAL_CHANNELS], tmp_re, tmp_im, gd_int; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG BIN_HR_SPLIT_REND_MD rot_md_act[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS]; @@ -1629,29 +1620,16 @@ void ivas_SplitRenderer_PostRenderer( push_wmops( "ivas_SplitRenderer_PostRenderer" ); num_slots = MAX_PARAM_SPATIAL_SUBFRAMES; -#ifndef API_5MS - num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; - for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) - { -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG pos_idx = MAX_HEAD_ROT_POSES - 1; #else pos_idx = 0; #endif -#ifdef API_5MS sf_idx_md = 0; -#else - sf_idx_md = ( hBinPostRenderer->low_Res == 0 ) ? sf_idx : 0; -#endif get_interpolation_vars( pMultiBinPoseData, &hBinPostRenderer->QuaternionsPre[sf_idx_md], -#ifdef API_5MS &Quaternion_act, -#else - &Quaternions_act[sf_idx], -#endif interp_yaw_pose_idx, interp_pitch_pose_idx, interp_roll_pose_idx, @@ -1727,11 +1705,7 @@ void ivas_SplitRenderer_PostRenderer( { for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) { -#ifdef API_5MS index_slot = slot_idx; /* TODO: can be cleaned up */ -#else - index_slot = sf_idx * num_slots + slot_idx; -#endif fade = ( (float) slot_idx + 1.0f ) / MAX_PARAM_SPATIAL_SUBFRAMES; fade = min( fade, 1.0f ); for ( b = 0; b < num_md_bands; b++ ) @@ -1858,9 +1832,6 @@ void ivas_SplitRenderer_PostRenderer( } } #endif -#ifndef API_5MS - } -#endif pop_wmops(); return; @@ -1876,32 +1847,19 @@ void ivas_SplitRenderer_PostRenderer( static void ivas_rend_CldfbSplitPostRendProcessTdIn( BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, -#ifdef API_5MS const IVAS_QUATERNION QuaternionPost, -#else - const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], -#endif float output[][L_FRAME48k] ) { int16_t ch_idx, slot_idx, num_cldfb_bands; -#ifdef API_5MS float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#else - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -#endif num_cldfb_bands = hBinHrSplitPostRend->cldfbSyn[0]->no_channels; /* Implement CLDFB analysis */ for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { for ( slot_idx = 0; -#ifdef API_5MS slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; -#else - slot_idx < CLDFB_NO_COL_MAX; -#endif slot_idx++ ) { cldfbAnalysis_ts( &( output[ch_idx][num_cldfb_bands * slot_idx] ), @@ -1917,30 +1875,17 @@ static void ivas_rend_CldfbSplitPostRendProcessTdIn( pMultiBinPoseData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, -#ifdef API_5MS QuaternionPost -#else - QuaternionsPost -#endif ); /* Implement CLDFB synthesis */ for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { -#ifdef API_5MS float *RealBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES]; float *ImagBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES]; -#else - float *RealBuffer[CLDFB_NO_COL_MAX]; - float *ImagBuffer[CLDFB_NO_COL_MAX]; -#endif for ( slot_idx = 0; -#ifdef API_5MS slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; -#else - slot_idx < CLDFB_NO_COL_MAX; -#endif slot_idx++ ) { RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch_idx][slot_idx]; @@ -1948,11 +1893,7 @@ static void ivas_rend_CldfbSplitPostRendProcessTdIn( } cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), -#ifdef API_5MS num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, -#else - num_cldfb_bands * CLDFB_NO_COL_MAX, -#endif hBinHrSplitPostRend->cldfbSyn[ch_idx] ); } @@ -1969,15 +1910,9 @@ static void ivas_rend_CldfbSplitPostRendProcessTdIn( void ivas_rend_CldfbSplitPostRendProcess( BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, -#ifdef API_5MS const IVAS_QUATERNION QuaternionPost, float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], -#else - const IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], - float Cldfb_RealBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], -#endif float output[][L_FRAME48k], const int16_t is_cldfb_in ) { @@ -1990,11 +1925,7 @@ void ivas_rend_CldfbSplitPostRendProcess( if ( is_cldfb_in == 0 ) { ivas_rend_CldfbSplitPostRendProcessTdIn( hBinHrSplitPostRend, pMultiBinPoseData, -#ifdef API_5MS QuaternionPost, -#else - QuaternionsPost, -#endif output ); pop_wmops(); return; @@ -2005,36 +1936,23 @@ void ivas_rend_CldfbSplitPostRendProcess( pMultiBinPoseData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, -#ifdef API_5MS QuaternionPost -#else - QuaternionsPost -#endif ); /* Implement CLDFB synthesis */ for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { -#ifdef API_5MS float *RealBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES]; float *ImagBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES]; for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) -#else - float *RealBuffer[CLDFB_NO_COL_MAX]; - float *ImagBuffer[CLDFB_NO_COL_MAX]; - - for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) -#endif { RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch_idx][slot_idx]; ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx]; } cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX -#ifdef API_5MS / MAX_PARAM_SPATIAL_SUBFRAMES -#endif , hBinHrSplitPostRend->cldfbSyn[ch_idx] ); } diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 67c02ae608..b40c4e519b 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1173,11 +1173,7 @@ static void ivas_SplitRenderer_code_md_huff( static void ivas_SplitRenderer_quant_code( const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, -#ifdef API_5MS const IVAS_QUATERNION headPosition, -#else - const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], -#endif MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, ivas_split_rend_bits_t *pBits, const int16_t low_res_pre_rend_rot, @@ -1217,11 +1213,7 @@ static void ivas_SplitRenderer_quant_code( int16_t angle; IVAS_QUATERNION head_pos_euler; -#ifdef API_5MS Quat2EulerDegree( headPosition, &head_pos_euler.z, &head_pos_euler.y, &head_pos_euler.x ); -#else - Quat2EulerDegree( headPositions[sf_idx], &head_pos_euler.z, &head_pos_euler.y, &head_pos_euler.x ); -#endif angle = (int16_t) roundf( head_pos_euler.x ); angle += 180; ivas_split_rend_bitstream_write_int32( pBits, angle, IVAS_SPLIT_REND_HEAD_POSE_BITS ); @@ -1558,11 +1550,7 @@ void ivas_SplitRenderer_GetRotMd( void ivas_rend_CldfbSplitPreRendProcess( const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, -#ifdef API_5MS const IVAS_QUATERNION headPosition, -#else - const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], -#endif MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -1576,11 +1564,7 @@ void ivas_rend_CldfbSplitPreRendProcess( ivas_SplitRenderer_quant_code( hBinHrSplitPreRend, -#ifdef API_5MS headPosition, -#else - headPositions, -#endif pMultiBinPoseData, pBits, low_res_pre_rend_rot, @@ -1798,7 +1782,6 @@ void ivas_splitBinPreRendClose( return; } -#ifdef API_5MS void ivas_set_split_rend_ht_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ) @@ -1821,7 +1804,6 @@ void ivas_set_split_rend_ht_setup( } return; } -#endif /*-------------------------------------------------------------------------* * ivas_set_split_rend_setup() * @@ -1832,21 +1814,11 @@ ivas_error ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, -#ifdef API_5MS IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits -#else - uint8_t *splitRendBitsBuf -#endif ) { int16_t sf, i, j; -#ifndef API_5MS - hSplitBinRend->hSplitRendBits->bits_buf = splitRendBitsBuf; - hSplitBinRend->hSplitRendBits->bits_written = 0; - hSplitBinRend->hSplitRendBits->bits_read = 0; -#else hSplitBinRend->hSplitRendBits = hSplitRendBits; -#endif if ( ( hSplitBinRend->hMultiBinCldfbData = (IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" ); @@ -1914,17 +1886,14 @@ void ivas_init_split_rend_handles( static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper, const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate -#ifdef API_5MS , const int16_t is_5ms_frame -#endif ) { ivas_error error; int16_t i, delayBufferLength; LC3PLUS_CONFIG config; -#ifdef API_5MS if ( is_5ms_frame ) { config.lc3plus_frame_duration_us = pSplitRendConfig->codec_frame_size_ms * 1000; @@ -1935,19 +1904,13 @@ static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWra config.lc3plus_frame_duration_us = 5000; config.ivas_frame_duration_us = 20000; } -#else - config.lc3plus_frame_duration_us = 5000; - config.ivas_frame_duration_us = 20000; -#endif config.samplerate = OutSampleRate; config.channels = BINAURAL_CHANNELS; error = IVAS_LC3PLUS_ENC_Open( config, ivas_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode -#ifdef API_5MS , (int16_t) ( config.ivas_frame_duration_us / 1000 ) -#endif ), &hSplitRendWrapper->hLc3plusEnc ); if ( error != IVAS_ERR_OK ) @@ -2007,10 +1970,8 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const int32_t OutSampleRate, const int16_t is_cldfb_in, const int16_t is_pcm_out -#ifdef API_5MS , const int16_t is_5ms_frame -#endif ) { ivas_error error, ch, num_ch; @@ -2124,10 +2085,8 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ) { error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate -#ifdef API_5MS , is_5ms_frame -#endif ); if ( error != IVAS_ERR_OK ) { @@ -2268,9 +2227,7 @@ static ivas_error splitRendLc3plusEncodeAndWrite( pBits->bits_written += 8 * lc3plusBitstreamSize; pBits->codec = IVAS_SPLIT_REND_CODEC_LC3PLUS; pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; -#ifdef API_5MS pBits->codec_frame_size_ms = (int16_t) ( hSplitBin->hLc3plusEnc->config.lc3plus_frame_duration_us / 1000 ); -#endif return IVAS_ERR_OK; } @@ -2283,15 +2240,9 @@ static ivas_error splitRendLc3plusEncodeAndWrite( static ivas_error ivas_renderMultiTDBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, -#ifdef API_5MS const IVAS_QUATERNION headPosition, -#else - const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], -#endif const int32_t SplitRendBitRate, -#ifdef API_5MS const int16_t codec_frame_size_ms, -#endif ivas_split_rend_bits_t *pBits, const int16_t max_bands, float *in[], @@ -2338,12 +2289,10 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( actual_md_bits = pBits->bits_written; if ( ( hSplitBin->multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) || ( !useLc3plus && !pcm_out ) ) { -#ifdef API_5MS if ( !useLc3plus && codec_frame_size_ms != 20 && !pcm_out ) { return IVAS_ERROR( IVAS_ERR_INVALID_INPUT_BUFFER_SIZE, "Unsupported framing for LCLD codec!" ); } -#endif num_cldfb_bands = hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels; /* CLDFB Analysis*/ @@ -2384,11 +2333,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( actual_md_bits = pBits->bits_written; ivas_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, -#ifdef API_5MS headPosition, -#else - headPositions, -#endif &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, @@ -2407,9 +2352,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( available_bits = SplitRendBitRate * L_FRAME48k / 48000; actual_md_bits = pBits->bits_written - actual_md_bits; available_bits -= actual_md_bits; -#ifdef API_5MS pBits->codec_frame_size_ms = 20; -#endif ivas_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal, @@ -2432,12 +2375,9 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( } /*zero pad*/ -#ifdef API_5MS if ( pcm_out ) { -#endif bit_len = SplitRendBitRate / FRAMES_PER_SEC; -#ifdef API_5MS } else { @@ -2451,7 +2391,6 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( bit_len = SplitRendBitRate * bit_len / 1000; } } -#endif while ( pBits->bits_written < bit_len ) { @@ -2534,16 +2473,10 @@ static void lc3plusTimeAlignCldfbPoseCorr( ivas_error ivas_renderMultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, -#ifdef API_5MS const IVAS_QUATERNION headPosition, -#else - const IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES], -#endif const int32_t SplitRendBitRate, IVAS_SPLIT_REND_CODEC splitCodec, -#ifdef API_5MS int16_t codec_frame_size_ms, -#endif ivas_split_rend_bits_t *pBits, float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -2568,29 +2501,19 @@ ivas_error ivas_renderMultiBinToSplitBinaural( /* Needs to be done at runtime. If this was in another API function, * there would be no guarantee that the user did not change * the split rendering config before calling the main rendering function */ -#ifdef API_5MS if ( ( error = ivas_split_rend_choose_default_codec( &splitCodec, &codec_frame_size_ms, td_input, pcm_out ) ) != IVAS_ERR_OK ) { return error; } -#else - ivas_split_rend_choose_default_codec( &splitCodec, td_input, pcm_out ); -#endif 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, -#ifdef API_5MS headPosition, -#else - headPositions, -#endif SplitRendBitRate, -#ifdef API_5MS codec_frame_size_ms, -#endif pBits, max_bands, output, low_res_pre_rend_rot, pcm_out ); pop_wmops(); @@ -2611,11 +2534,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( actual_md_bits = pBits->bits_written; ivas_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, -#ifdef API_5MS headPosition, -#else - headPositions, -#endif &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, @@ -2692,12 +2611,9 @@ ivas_error ivas_renderMultiBinToSplitBinaural( /*zero pad*/ /*TODO: do this inside the LCLD ENC codec */ -#ifdef API_5MS if ( pcm_out ) { -#endif bit_len = SplitRendBitRate / FRAMES_PER_SEC; -#ifdef API_5MS } else { @@ -2711,7 +2627,6 @@ ivas_error ivas_renderMultiBinToSplitBinaural( bit_len = SplitRendBitRate * bit_len / 1000; } } -#endif while ( pBits->bits_written < bit_len ) { diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 6330962fce..48f6683eee 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -455,23 +455,6 @@ void ivas_split_rend_bitstream_write_int32( return; } -#ifndef API_5MS -/*------------------------------------------------------------------------- - * Function ivas_split_rend_get_sf_rot_data() - * - * - *------------------------------------------------------------------------*/ -IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( - const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME], - int16_t subframe_idx ) -{ - int16_t idx; - - idx = ( subframe_idx * RENDERER_HEAD_POSITIONS_PER_FRAME ) / MAX_PARAM_SPATIAL_SUBFRAMES; - - return headPositions[idx]; -} -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -611,20 +594,14 @@ int32_t ivas_get_lcld_bitrate( * *------------------------------------------------------------------------*/ int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode -#ifdef API_5MS , int16_t split_prerender_frame_size_ms -#endif ) { if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { int32_t inBandMdBps = (int32_t) ( 8 * 1000 / -#ifdef API_5MS split_prerender_frame_size_ms -#else - FRAMES_PER_SEC -#endif ); return ivas_get_lcld_bitrate( SplitRendBitRate, poseCorrectionMode ) - inBandMdBps; } @@ -685,10 +662,8 @@ int8_t ivas_get_lc3plus_bitrate_id( * *------------------------------------------------------------------------*/ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode -#ifdef API_5MS , int16_t split_prerender_frame_size_ms -#endif ) { int32_t bitrate; @@ -728,19 +703,13 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL } bitrate = ivas_get_lc3plus_bitrate( bitrate, poseCorrectionMode -#ifdef API_5MS , split_prerender_frame_size_ms -#endif ); /* Return size in bytes */ return (int32_t) ( bitrate * -#ifdef API_5MS split_prerender_frame_size_ms -#else - FRAMES_PER_SEC -#endif / 1000 / 8 ); } @@ -774,7 +743,6 @@ ivas_error ivas_split_rend_validate_config( return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "0 DOF and pose correction NONE must only ever be set together" ); } -#ifdef API_5MS if ( pSplitRendConfig->codec_frame_size_ms != 0 ) /* 0 means "default for current codec", will be set to actual value at a later stage */ { if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD && pSplitRendConfig->codec_frame_size_ms != 20 ) @@ -787,7 +755,6 @@ ivas_error ivas_split_rend_validate_config( return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Invalid framing for LC3plus codec" ); } } -#endif /* Validate bitrate */ if ( is_pcm_out == 0 ) @@ -1121,15 +1088,9 @@ void ivas_init_multi_bin_pose_data( * * *------------------------------------------------------------------------*/ -#ifdef API_5MS ivas_error -#else -void -#endif ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, -#ifdef API_5MS int16_t *pCodec_frame_size_ms, -#endif int16_t isRenderingInTd, int16_t pcm_out ) { @@ -1145,7 +1106,6 @@ ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, *pCodec = IVAS_SPLIT_REND_CODEC_NONE; } -#ifdef API_5MS if ( *pCodec_frame_size_ms == 0 ) /* codec frame size hasn't been set yet - use default for current configuration */ { switch ( *pCodec ) @@ -1163,8 +1123,5 @@ ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, } return IVAS_ERR_OK; -#else - return; -#endif } #endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 18dba0c798..b53687587c 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -621,15 +621,9 @@ typedef struct ivas_orient_trk_state_t typedef struct { int8_t headRotEnabled; -#ifdef API_5MS IVAS_QUATERNION headPositions[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_VECTOR3 Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; float crossfade[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; -#else - IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; - IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; - float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_SPLIT_REND_ROT_AXIS sr_pose_pred_axis; #endif @@ -639,9 +633,6 @@ typedef struct typedef struct ivas_binaural_head_track_struct { -#ifndef API_5MS - int16_t num_quaternions; -#endif IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_VECTOR3 Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; float Rmat[3][3]; @@ -674,9 +665,7 @@ typedef struct ivas_external_orientation_struct int8_t enableRotationInterpolation[MAX_PARAM_SPATIAL_SUBFRAMES]; /* 0 - disable, 1 - enable */ int16_t numFramesToTargetOrientation[MAX_PARAM_SPATIAL_SUBFRAMES]; /* Number of frames until target orientation is reached */ IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; /* External orientation in quaternions */ -#ifdef API_5MS int16_t num_subframes; -#endif } EXTERNAL_ORIENTATION_DATA, *EXTERNAL_ORIENTATION_HANDLE; /*----------------------------------------------------------------------------------* @@ -714,9 +703,7 @@ typedef struct ivas_combined_orientation_struct IVAS_QUATERNION Quaternion_frozen_head; int8_t isExtOrientationFrozen; int8_t isHeadRotationFrozen; -#ifdef API_5MS int16_t num_subframes; -#endif } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 96f2d4952a..4d70f28d65 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -61,9 +61,7 @@ #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #define MAX_CLDFB_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #define MAX_BIN_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) -#ifdef API_5MS #define MAX_CLDFB_BIN_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) -#endif #else #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) #endif @@ -72,11 +70,7 @@ #define MAX_BIN_DELAY_SAMPLES 50 /* Maximum supported rendering latency for binaural IRs */ /* Frame size required when rendering to binaural */ -#ifdef API_5MS #define BINAURAL_RENDERING_FRAME_SIZE_MS 5 -#else -#define BINAURAL_RENDERING_FRAME_SIZE_MS 20 -#endif /*-------------------------------------------------------------------* @@ -276,9 +270,7 @@ struct IVAS_REND int8_t rendererConfigEnabled; RENDER_CONFIG_DATA *hRendererConfig; /* Renderer config pointer */ -#ifdef API_5MS int16_t num_subframes; -#endif }; @@ -358,9 +350,7 @@ static void convertBitsBufferToInternalBitsBuff( hBits->buf_len = outBits.config.bufLenInBytes; hBits->codec = outBits.config.codec; hBits->pose_correction = outBits.config.poseCorrection; -#ifdef API_5MS hBits->codec_frame_size_ms = outBits.config.codec_frame_size_ms; -#endif return; } @@ -375,9 +365,7 @@ static void convertInternalBitsBuffToBitsBuffer( hOutBits->config.bufLenInBytes = bits.buf_len; hOutBits->config.codec = bits.codec; hOutBits->config.poseCorrection = bits.pose_correction; -#ifdef API_5MS hOutBits->config.codec_frame_size_ms = bits.codec_frame_size_ms; -#endif return; } @@ -916,11 +904,7 @@ static ivas_error getNumNonLfeChannelsInSpeakerLayout( static ivas_error getMcConfigValues( AUDIO_CONFIG inConfig, -#ifdef API_5MS const LSSETUP_CUSTOM_STRUCT *pInCustomLs, -#else - LSSETUP_CUSTOM_STRUCT inCustomLs, -#endif const float **azimuth, const float **elevation, int16_t *lfe_idx, @@ -933,7 +917,6 @@ static ivas_error getMcConfigValues( switch ( inConfig ) { case AUDIO_CONFIG_LS_CUSTOM: -#ifdef API_5MS *azimuth = (const float *) &pInCustomLs->ls_azimuth; *elevation = (const float *) &pInCustomLs->ls_elevation; if ( pInCustomLs->num_lfe > 0 ) @@ -948,22 +931,6 @@ static ivas_error getMcConfigValues( break; } } -#else - *azimuth = (const float *) &inCustomLs.ls_azimuth; - *elevation = (const float *) &inCustomLs.ls_elevation; - if ( inCustomLs.num_lfe > 0 ) - { - *lfe_idx = inCustomLs.lfe_idx[0]; - } - for ( i = 0; i < inCustomLs.num_spk; i++ ) - { - if ( inCustomLs.ls_elevation[i] != 0 ) - { - *is_planar = 0; - break; - } - } -#endif break; case AUDIO_CONFIG_MONO: case AUDIO_CONFIG_STEREO: @@ -1135,11 +1102,7 @@ static ivas_error initHeadRotation( } /* Initialize with unit quaternions */ -#ifdef API_5MS for ( i = 0; i < hIvasRend->num_subframes; ++i ) -#else - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) -#endif { hIvasRend->headRotData.headPositions[i] = quaternionInit(); } @@ -2784,11 +2747,7 @@ static ivas_error setRendInputActiveSplitPostRend( outConfig = *rendCtx.pOutConfig; if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, -#ifdef API_5MS MAX_CLDFB_BIN_BUFFER_LENGTH -#else - MAX_BIN_BUFFER_LENGTH -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -2796,11 +2755,7 @@ static ivas_error setRendInputActiveSplitPostRend( initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx, inputSplitPostRend->bufferData, -#ifdef API_5MS MAX_CLDFB_BIN_BUFFER_LENGTH -#else - MAX_BIN_BUFFER_LENGTH -#endif ); inputSplitPostRend->numCachedSamples = 0; @@ -3225,10 +3180,8 @@ static DecoderDummy *initDecoderDummy( int16_t i; int16_t numOutChannels; DecoderDummy *decDummy; -#ifdef APLIT_5MS_FIX_TODO int16_t num_subframes; num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; -#endif if ( ( error = getAudioConfigNumChannels( outConfig, &numOutChannels ) ) != IVAS_ERR_OK ) { @@ -3241,14 +3194,8 @@ static DecoderDummy *initDecoderDummy( decDummy->hDecoderConfig->output_Fs = sampleRate; decDummy->hDecoderConfig->nchan_out = numOutChannels; decDummy->hDecoderConfig->Opt_Headrotation = 0; -#ifdef API_5MS decDummy->hDecoderConfig->Opt_tsm = 0; -#ifdef API_5MS_BASELINE decDummy->hDecoderConfig->Opt_5ms = 0; -#endif -#else - decDummy->hDecoderConfig->voip_active = 0; -#endif decDummy->hBinRenderer = NULL; #ifdef SPLIT_REND_WITH_HEAD_ROT decDummy->hSplitBinRend.hSplitRendBits = NULL; @@ -3322,10 +3269,8 @@ static DecoderDummy *initDecoderDummy( /* External orientations */ if ( ( error = ivas_external_orientation_open( &( decDummy->hExtOrientationData ) -#ifdef APLIT_5MS_FIX_TODO , num_subframes -#endif ) ) != IVAS_ERR_OK ) { assert( error == IVAS_ERR_OK ); @@ -3333,10 +3278,8 @@ static DecoderDummy *initDecoderDummy( /* Combined orientations */ if ( ( error = ivas_combined_orientation_open( &( decDummy->hCombinedOrientationData ) -#ifdef APLIT_5MS_FIX_TODO , num_subframes -#endif ) ) != IVAS_ERR_OK ) { assert( error == IVAS_ERR_OK ); @@ -3557,10 +3500,8 @@ static void clearInputMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const AUDIO_CONFIG outConfig, const int16_t cldfb_in -#ifdef API_5MS , const int16_t is_5ms_frame -#endif ) { ivas_error error; @@ -3578,10 +3519,8 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN } if ( ( error = ivas_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in, outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM -#ifdef API_5MS , is_5ms_frame -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -3620,10 +3559,8 @@ ivas_error IVAS_REND_Open( const AUDIO_CONFIG outConfig, const int16_t nonDiegeticPan, const float nonDiegeticPanGain -#ifdef API_5MS , const int16_t num_subframes -#endif ) { int16_t i; @@ -3666,9 +3603,7 @@ ivas_error IVAS_REND_Open( #ifdef DEBUGGING hIvasRend->numClipping = 0; #endif -#ifdef API_5MS hIvasRend->num_subframes = num_subframes; -#endif /* Initialize limiter */ if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) @@ -3689,10 +3624,8 @@ ivas_error IVAS_REND_Open( /* Initialize external orientation data */ if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ) -#ifdef API_5MS , num_subframes -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -3700,10 +3633,8 @@ ivas_error IVAS_REND_Open( /* Initilize combined orientation data */ if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ) -#ifdef API_5MS , num_subframes -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -4268,9 +4199,7 @@ ivas_error IVAS_REND_AddInput( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( -#ifdef API_5MS ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && -#endif hIvasRend->splitRendEncBuffer.data == NULL && hIvasRend->hRendererConfig != NULL ) { int16_t cldfb_in; @@ -4278,21 +4207,15 @@ ivas_error IVAS_REND_AddInput( #ifdef FIX_658_SPLIT_REND_MASA -#ifdef API_5MS error = -#endif ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, -#ifdef API_5MS &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, -#endif ( cldfb_in == 0 ), hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); -#ifdef API_5MS if ( error != IVAS_ERR_OK ) { return error; } -#endif #endif if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, @@ -4302,10 +4225,8 @@ ivas_error IVAS_REND_AddInput( hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in -#ifdef API_5MS , ( hIvasRend->num_subframes == 1 ) ? 1 : 0 -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -5090,9 +5011,7 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->split_rend_config.dof = 3; hRCout->split_rend_config.hq_mode = 0; hRCout->split_rend_config.codec_delay_ms = 0; -#ifdef API_5MS hRCout->split_rend_config.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */ -#endif hRCout->split_rend_config.codec = IVAS_SPLIT_REND_CODEC_DEFAULT; hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; @@ -5182,7 +5101,6 @@ int16_t IVAS_REND_FeedRenderConfig( int16_t cldfb_in; cldfb_in = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); -#ifdef API_5MS if ( ( error = ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, ( cldfb_in == 0 ), @@ -5190,11 +5108,6 @@ int16_t IVAS_REND_FeedRenderConfig( { return error; } -#else - ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, - ( cldfb_in == 0 ), - hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); -#endif if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, @@ -5202,10 +5115,8 @@ int16_t IVAS_REND_FeedRenderConfig( hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in -#ifdef API_5MS , ( hIvasRend->num_subframes == 1 ) ? 1 : 0 -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -5216,7 +5127,7 @@ int16_t IVAS_REND_FeedRenderConfig( return IVAS_ERR_OK; } -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT /*-------------------------------------------------------------------* * IVAS_REND_FeedSplitBinauralBitstream() * @@ -5260,26 +5171,16 @@ ivas_error IVAS_REND_FeedSplitBinauralBitstream( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef API_5MS const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ const IVAS_VECTOR3 Pos /* i : listener positions for next rendering call */ -#else - const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ - const IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , IVAS_SPLIT_REND_ROT_AXIS rot_axis #endif -#ifdef API_5MS , const int16_t sf_idx -#endif ) { -#ifndef API_5MS - int16_t i; -#endif IVAS_QUATERNION rotQuat; /* Validate function arguments */ @@ -5294,7 +5195,6 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } -#ifdef API_5MS /* check for Euler angle signaling */ if ( headRot.w == -3.0f ) { @@ -5307,64 +5207,6 @@ ivas_error IVAS_REND_SetHeadRotation( ivas_orient_trk_Process( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[sf_idx] ); hIvasRend->headRotData.Pos[sf_idx] = Pos; -#else - if ( headRot == NULL ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - hIvasRend->headRotData.headRotEnabled = 1; - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) - { - hIvasRend->headRotData.headPositions[i].w = -3.0f; - hIvasRend->headRotData.headPositions[i].x = 0.0f; - hIvasRend->headRotData.headPositions[i].y = 0.0f; - hIvasRend->headRotData.headPositions[i].z = 0.0f; - hIvasRend->headRotData.Pos[i].x = 0.0f; - hIvasRend->headRotData.Pos[i].y = 0.0f; - hIvasRend->headRotData.Pos[i].z = 0.0f; - } - } - else - { - hIvasRend->headRotData.headRotEnabled = 0; - } -#else - hIvasRend->headRotData.headRotEnabled = 0; -#endif - } - else - { - hIvasRend->headRotData.headRotEnabled = 1; - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) - { - /* check for Euler angle signaling */ - if ( headRot[i].w == -3.0f ) - { -#ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || - ( hIvasRend->inputsSplitPost[0].base.inConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( hIvasRend->inputsSplitPost[0].base.inConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) - { - Euler2Quat( deg2rad( headRot[i].x ), deg2rad( headRot[i].y ), deg2rad( headRot[i].z ), &rotQuat ); - } - else -#endif - { - Euler2Quat( deg2rad( headRot[i].x ), deg2rad( headRot[i].y ), deg2rad( headRot[i].z ), &rotQuat ); - } - } - else - { - rotQuat = headRot[i]; - } - - ivas_orient_trk_Process( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[i] ); - hIvasRend->headRotData.Pos[i] = Pos[i]; - } - } -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT hIvasRend->headRotData.sr_pose_pred_axis = rot_axis; @@ -5373,7 +5215,6 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_OK; } -#ifdef API_5MS ivas_error IVAS_REND_DisableHeadRotation( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ @@ -5388,7 +5229,6 @@ IVAS_REND_DisableHeadRotation( hIvasRend->headRotData.headRotEnabled = 0; return IVAS_ERR_OK; } -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT /*-------------------------------------------------------------------* @@ -5537,23 +5377,13 @@ ivas_error IVAS_REND_SetReferenceVector( ivas_error IVAS_REND_SetExternalOrientation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *orientation, /* i : external orientation data */ -#ifdef API_5MS int8_t enableHeadRotation, /* i : flag to enable head rotation for this frame */ int8_t enableExternalOrientation, /* i : flag to enable external orientation for this frame */ int8_t enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ int16_t numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */ const int16_t sf_idx /*i : subframe index*/ -#else - int8_t *enableHeadRotation, /* i : flag to enable head rotation for this frame */ - int8_t *enableExternalOrientation, /* i : flag to enable external orientation for this frame */ - int8_t *enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ - int16_t *numFramesToTargetOrientation /* i : number of frames until target orientation is reached */ -#endif ) { -#ifndef API_5MS - int16_t i; -#endif /* Validate function arguments */ if ( hIvasRend == NULL || hIvasRend->hExternalOrientationData == NULL ) @@ -5563,45 +5393,16 @@ ivas_error IVAS_REND_SetExternalOrientation( if ( orientation == NULL ) { -#ifdef API_5MS hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = 0; -#else - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) - { - hIvasRend->hExternalOrientationData->enableExternalOrientation[i] = 0; - } -#endif } else { -#ifdef API_5MS QuaternionInverse( *orientation, &hIvasRend->hExternalOrientationData->Quaternions[sf_idx] ); hIvasRend->hExternalOrientationData->enableHeadRotation[sf_idx] = enableHeadRotation; hIvasRend->hExternalOrientationData->enableExternalOrientation[sf_idx] = enableExternalOrientation; hIvasRend->hExternalOrientationData->enableRotationInterpolation[sf_idx] = enableRotationInterpolation; hIvasRend->hExternalOrientationData->numFramesToTargetOrientation[sf_idx] = numFramesToTargetOrientation; -#else - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) - { -#ifdef API_5MS - /* just fix compilation issues, ToDo: change ext renderer also to 5ms */ - QuaternionInverse( orientation[i], &hIvasRend->hExternalOrientationData->Quaternion ); - - hIvasRend->hExternalOrientationData->enableHeadRotation = enableHeadRotation[i]; - hIvasRend->hExternalOrientationData->enableExternalOrientation = enableExternalOrientation[i]; - hIvasRend->hExternalOrientationData->enableRotationInterpolation = enableRotationInterpolation[i]; - hIvasRend->hExternalOrientationData->numFramesToTargetOrientation = numFramesToTargetOrientation[i]; -#else - QuaternionInverse( orientation[i], &hIvasRend->hExternalOrientationData->Quaternions[i] ); - - hIvasRend->hExternalOrientationData->enableHeadRotation[i] = enableHeadRotation[i]; - hIvasRend->hExternalOrientationData->enableExternalOrientation[i] = enableExternalOrientation[i]; - hIvasRend->hExternalOrientationData->enableRotationInterpolation[i] = enableRotationInterpolation[i]; - hIvasRend->hExternalOrientationData->numFramesToTargetOrientation[i] = numFramesToTargetOrientation[i]; -#endif - } -#endif } return IVAS_ERR_OK; @@ -5647,11 +5448,7 @@ ivas_error IVAS_REND_GetCombinedOrientation( if ( hIvasRend->hCombinedOrientationData != NULL ) { -#ifdef API_5MS for ( i = 0; i < hIvasRend->hCombinedOrientationData->num_subframes; ++i ) -#else - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) -#endif { pOrientation[i] = hIvasRend->hCombinedOrientationData->Quaternions[i]; } @@ -5751,22 +5548,16 @@ static void renderBufferChannel( return; } -#ifdef API_5MS static ivas_error chooseCrossfade( const IVAS_REND_HeadRotData *headRotData, const float **pCrossfade ) { *pCrossfade = headRotData->crossfade; return IVAS_ERR_OK; } -#endif static ivas_error rotateFrameMc( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ AUDIO_CONFIG inConfig, /* i : Input Audio config */ -#ifdef API_5MS const LSSETUP_CUSTOM_STRUCT *pInCustomLs, /* i : Input Custom LS setup */ -#else - LSSETUP_CUSTOM_STRUCT inCustomLs, /* i : Input Custom LS setup */ -#endif const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ @@ -5776,10 +5567,8 @@ static ivas_error rotateFrameMc( { int16_t i; int16_t j; -#ifdef API_5MS const float *crossfade; int16_t num_subframes; -#endif int16_t subframe_idx, subframe_len; int16_t azimuth, elevation; @@ -5796,13 +5585,11 @@ static ivas_error rotateFrameMc( push_wmops( "rotateFrameMc" ); -#ifdef API_5MS if ( ( error = chooseCrossfade( headRotData, &crossfade ) ) != IVAS_ERR_OK ) { return error; } num_subframes = ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->num_subframes : MAX_PARAM_SPATIAL_SUBFRAMES; -#endif if ( inConfig != AUDIO_CONFIG_LS_CUSTOM ) { @@ -5813,19 +5600,11 @@ static ivas_error rotateFrameMc( } else { -#ifdef API_5MS nchan = pInCustomLs->num_spk + pInCustomLs->num_lfe; -#else - nchan = inCustomLs.num_spk + inCustomLs.num_lfe; -#endif } if ( ( error = getMcConfigValues( inConfig, -#ifdef API_5MS pInCustomLs, -#else - inCustomLs, -#endif &ls_azimuth, &ls_elevation, &lfe_idx, &is_planar_setup ) ) != IVAS_ERR_OK ) { return error; @@ -5840,13 +5619,8 @@ static ivas_error rotateFrameMc( /* subframe loop */ -#ifndef API_5MS - subframe_len = inAudio.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; - for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) -#else subframe_len = inAudio.config.numSamplesPerChannel / num_subframes; for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) -#endif { for ( i = 0; i < 3; i++ ) { @@ -5904,7 +5678,6 @@ static ivas_error rotateFrameMc( { for ( ch_in = 0; ch_in < nchan; ch_in++ ) { -#ifdef API_5MS writePtr = getSmplPtr( outAudio, ch_out, subframe_idx * subframe_len ); readPtr = getSmplPtr( inAudio, ch_in, subframe_idx * subframe_len ); /* crossfade with previous rotation gains */ @@ -5915,18 +5688,6 @@ static ivas_error rotateFrameMc( ( *readPtr ) * ( crossfade[i] * gains[ch_in][ch_out] ); readPtr++; } -#else - writePtr = getSmplPtr( outAudio, ch_out, subframe_idx * subframe_len ); - readPtr = getSmplPtr( inAudio, ch_in, subframe_idx * subframe_len ); - /* crossfade with previous rotation gains */ - for ( i = 0; i < subframe_len; i++ ) - { - *writePtr++ += - ( *readPtr ) * ( ( 1 - headRotData->crossfade[i] ) * gains_prev[ch_in][ch_out] ) + - ( *readPtr ) * ( headRotData->crossfade[i] * gains[ch_in][ch_out] ); - readPtr++; - } -#endif } } @@ -5955,10 +5716,8 @@ static ivas_error rotateFrameSba( int16_t i, l, n, m; int16_t m1, m2; int16_t shd_rot_max_order; -#ifdef API_5MS const float *crossfade; int16_t num_subframes; -#endif int16_t subframe_idx, subframe_len; float *writePtr; @@ -5971,28 +5730,19 @@ static ivas_error rotateFrameSba( push_wmops( "rotateFrameSba" ); -#ifdef API_5MS if ( ( error = chooseCrossfade( headRotData, &crossfade ) ) != IVAS_ERR_OK ) { return error; } -#endif -#ifdef API_5MS num_subframes = ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->num_subframes : MAX_PARAM_SPATIAL_SUBFRAMES; -#endif if ( ( error = getAmbisonicsOrder( inConfig, &shd_rot_max_order ) ) != IVAS_ERR_OK ) { return error; } -#ifndef API_5MS - subframe_len = inAudio.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; - for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) -#else subframe_len = inAudio.config.numSamplesPerChannel / num_subframes; for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) -#endif { /* initialize rotation matrices with zeros */ for ( i = 0; i < HEADROT_SHMAT_DIM; i++ ) @@ -6023,11 +5773,7 @@ static ivas_error rotateFrameSba( for ( i = 0; i < subframe_len; i++ ) { idx = subframe_idx * subframe_len + i; -#ifndef API_5MS - cf = headRotData->crossfade[i]; -#else cf = crossfade[i]; -#endif oneminuscf = 1 - cf; /* As the rotation matrix becomes block diagonal in a SH basis, we can*/ /* apply each angular-momentum block individually to save complexity. */ @@ -6088,9 +5834,7 @@ static ivas_error renderIsmToBinaural( if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, -#ifdef API_5MS *ismInput->base.ctx.pOutSampleRate, -#endif outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK ) { return error; @@ -6103,7 +5847,6 @@ static ivas_error renderIsmToBinaural( return IVAS_ERR_OK; } -#ifdef API_5MS static int16_t getNumSubframesInBuffer( const IVAS_REND_AudioBuffer *buffer, int32_t sampleRate ) { #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -6126,7 +5869,6 @@ static int16_t getNumSubframesInBuffer( const IVAS_REND_AudioBuffer *buffer, int return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif } -#endif static ivas_error renderIsmToBinauralRoom( input_ism *ismInput, @@ -6135,9 +5877,6 @@ static ivas_error renderIsmToBinauralRoom( int16_t i; int16_t azi_rot, ele_rot; int16_t subframe_idx; -#ifndef API_5MS - int16_t subframe_len; -#endif int16_t tmp; rotation_matrix Rmat; float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -6164,11 +5903,7 @@ static ivas_error renderIsmToBinauralRoom( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) @@ -6181,15 +5916,8 @@ static ivas_error renderIsmToBinauralRoom( if ( combinedOrientationEnabled ) { -#ifndef API_5MS - subframe_len = ismInput->base.inputBuffer.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; - // for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) { -#else - for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) - { -#endif for ( i = 0; i < 3; i++ ) { if ( hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] ) @@ -6207,9 +5935,6 @@ static ivas_error renderIsmToBinauralRoom( } } } -#ifndef API_5MS - (void) subframe_len; // avoid warning -#endif } /* TODO tmu : see issue #518 */ @@ -6270,10 +5995,8 @@ static ivas_error renderIsmToBinauralRoom( if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -6313,9 +6036,7 @@ static ivas_error renderIsmToBinauralReverb( &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, -#ifdef API_5MS *ismInput->base.ctx.pOutSampleRate, -#endif outAudio.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { @@ -6473,22 +6194,14 @@ static ivas_error renderIsmToSplitBinaural( if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { -#ifdef API_5MS for ( i = 1; i < pCombinedOrientationData->num_subframes; ++i ) -#else - for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) -#endif { pCombinedOrientationData->Quaternions[i] = pCombinedOrientationData->Quaternions[0]; } } /* Save current head positions */ -#ifdef API_5MS for ( i = 0; i < pCombinedOrientationData->num_subframes; ++i ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) -#endif { originalHeadRot[i] = pCombinedOrientationData->Quaternions[i]; } @@ -6501,11 +6214,7 @@ static ivas_error renderIsmToSplitBinaural( /* Update head positions */ if ( pos_idx != 0 ) { -#ifdef API_5MS for ( i = 0; i < pCombinedOrientationData->num_subframes; ++i ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) -#endif { if ( originalHeadRot[i].w == -3.0f ) { @@ -6536,9 +6245,7 @@ static ivas_error renderIsmToSplitBinaural( &ismInput->currentPos, NULL, ism_md_subframe_update_ext, -#ifdef API_5MS *ismInput->base.ctx.pOutSampleRate, -#endif output_frame, tmpProcessing ); if ( error != IVAS_ERR_OK ) @@ -6556,11 +6263,7 @@ static ivas_error renderIsmToSplitBinaural( } /* Restore original head rotation */ -#ifdef API_5MS for ( i = 0; i < pCombinedOrientationData->num_subframes; ++i ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; ++i ) -#endif { pCombinedOrientationData->Quaternions[i] = originalHeadRot[i]; } @@ -6809,11 +6512,7 @@ static ivas_error renderMcToBinaural( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { @@ -6832,9 +6531,7 @@ static ivas_error renderMcToBinaural( NULL, mcInput->hReverb, 0, -#ifdef API_5MS *mcInput->base.ctx.pOutSampleRate, -#endif mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; @@ -6850,11 +6547,7 @@ static ivas_error renderMcToBinaural( set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, -#ifdef API_5MS &mcInput->customLsInput, -#else - mcInput->customLsInput, -#endif mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -6877,10 +6570,8 @@ static ivas_error renderMcToBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -6937,11 +6628,7 @@ static ivas_error renderMcToBinauralRoom( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { @@ -6959,9 +6646,7 @@ static ivas_error renderMcToBinauralRoom( mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb, 0, -#ifdef API_5MS *mcInput->base.ctx.pOutSampleRate, -#endif mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; @@ -6977,11 +6662,7 @@ static ivas_error renderMcToBinauralRoom( set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, -#ifdef API_5MS &mcInput->customLsInput, -#else - mcInput->customLsInput, -#endif mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -7004,10 +6685,8 @@ static ivas_error renderMcToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -7065,11 +6744,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { @@ -7087,11 +6762,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, -#ifdef API_5MS &mcInput->customLsInput, -#else - mcInput->customLsInput, -#endif mcInput->base.ctx.pHeadRotData, mcInput->base.ctx.pCombinedOrientationData, #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -7127,10 +6798,8 @@ static ivas_error renderMcCustomLsToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -7265,11 +6934,7 @@ static ivas_error renderMcToSplitBinaural( combinedOrientationDataLocal = *pCombinedOrientationDataLocal; if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { -#ifdef API_5MS for ( sf = 1; sf < combinedOrientationDataLocal.num_subframes; ++sf ) -#else - for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf ) -#endif { combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; for ( i = 0; i < 3; i++ ) @@ -7292,13 +6957,8 @@ static ivas_error renderMcToSplitBinaural( for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) { /* Update head positions */ -#ifdef API_5MS IVAS_QUATERNION Quaternions_orig[MAX_PARAM_SPATIAL_SUBFRAMES], Quaternions_abs; for ( i = 0; i < combinedOrientationDataLocal.num_subframes; i++ ) -#else - IVAS_QUATERNION Quaternions_orig[RENDERER_HEAD_POSITIONS_PER_FRAME], Quaternions_abs; - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) -#endif { Quaternions_orig[i] = combinedOrientationDataLocal.Quaternions[i]; Quaternions_abs.w = -3.0f; @@ -7331,9 +6991,7 @@ static ivas_error renderMcToSplitBinaural( NULL, mcInput->hReverb, 0, /* Ism Audio Metadata Delay Sync in ms for External Renderer */ -#ifdef API_5MS *mcInput->base.ctx.pOutSampleRate, -#endif mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { @@ -7362,11 +7020,7 @@ static ivas_error renderMcToSplitBinaural( pCombinedOrientationDataLocal = &combinedOrientationDataLocal; if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, -#ifdef API_5MS &mcInput->customLsInput, -#else - mcInput->customLsInput, -#endif mcInput->base.ctx.pHeadRotData, &pCombinedOrientationDataLocal, #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -7392,9 +7046,7 @@ static ivas_error renderMcToSplitBinaural( NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, -#ifdef API_5MS getNumSubframesInBuffer( &mcInput->base.inputBuffer, *mcInput->base.ctx.pOutSampleRate ), -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT pos_idx #endif @@ -7410,11 +7062,7 @@ static ivas_error renderMcToSplitBinaural( } /* restore original headrotation data */ -#ifdef API_5MS for ( i = 0; i < combinedOrientationDataLocal.num_subframes; i++ ) -#else - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) -#endif { combinedOrientationDataLocal.Quaternions[i] = Quaternions_orig[i]; } @@ -7602,10 +7250,8 @@ static ivas_error splitBinLc3plusDecode( /* Read LC3plus bitstream size info */ lc3plusBitrateId = ivas_split_rend_bitstream_read_int32( bits, 8 ); lc3plusBitstreamSize = ivas_get_lc3plus_size_from_id( (int8_t) lc3plusBitrateId, pose_correction -#ifdef API_5MS , (int16_t) ( hSplitBin->hLc3plusDec->config.ivas_frame_duration_us / 1000 ) -#endif ); for ( int16_t i = 0; i < BINAURAL_CHANNELS * hSplitBin->multiBinPoseData.num_poses; ++i ) @@ -7627,18 +7273,13 @@ static ivas_error splitBinLc3plusDecode( static ivas_error renderSplitBinauralWithPostRot( input_split_post_rend *splitBinInput, IVAS_REND_AudioBuffer outAudio, -#ifndef API_5MS - IVAS_REND_BitstreamBuffer *hBits, -#endif const int16_t SplitRendBFI ) { float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; ivas_error error; -#ifdef API_5MS float Cldfb_RealBuffer_Binaural_5ms[MAX_PARAM_SPATIAL_SUBFRAMES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural_5ms[MAX_PARAM_SPATIAL_SUBFRAMES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t sf_idx; @@ -7648,13 +7289,11 @@ static ivas_error renderSplitBinauralWithPostRot( COMBINED_ORIENTATION_HANDLE pCombinedOrientationData; SPLIT_POST_REND_WRAPPER *hSplitBin; int8_t isPostRendInputCldfb; -#ifdef API_5MS int16_t chnlIdx, slotIdx, smplIdx; int16_t preRendFrameSize_ms; int16_t outBufNumSamplesPerChannel, outBufNumColPerChannel; int16_t numSamplesPerChannelCacheSize, numColPerChannelCacheSize; float *readPtr, *writePtr; -#endif isPostRendInputCldfb = 0; @@ -7665,11 +7304,7 @@ static ivas_error renderSplitBinauralWithPostRot( pCombinedOrientationData = *splitBinInput->base.ctx.pCombinedOrientationData; hSplitBin = &splitBinInput->splitPostRendWrapper; -#ifdef API_5MS convertBitsBufferToInternalBitsBuff( *splitBinInput->hBits, &bits ); -#else - convertBitsBufferToInternalBitsBuff( *hBits, &bits ); -#endif if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD && splitBinInput->splitPostRendWrapper.hSplitBinLCLDDec == NULL ) { @@ -7682,7 +7317,6 @@ static ivas_error renderSplitBinauralWithPostRot( { LC3PLUS_CONFIG config; -#ifdef API_5MS if ( outAudio.config.numSamplesPerChannel == 240 ) { config.lc3plus_frame_duration_us = bits.codec_frame_size_ms * 1000; @@ -7693,10 +7327,6 @@ static ivas_error renderSplitBinauralWithPostRot( config.lc3plus_frame_duration_us = 5000; config.ivas_frame_duration_us = 20000; } -#else - config.lc3plus_frame_duration_us = 5000; - config.ivas_frame_duration_us = 20000; -#endif config.channels = BINAURAL_CHANNELS; config.samplerate = *splitBinInput->base.ctx.pOutSampleRate; @@ -7710,12 +7340,8 @@ static ivas_error renderSplitBinauralWithPostRot( } } -#ifdef API_5MS outBufNumSamplesPerChannel = outAudio.config.numSamplesPerChannel / pCombinedOrientationData->num_subframes; for ( sf_idx = 0; sf_idx < pCombinedOrientationData->num_subframes; sf_idx++ ) -#else - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) -#endif { QuaternionsPost[sf_idx] = pCombinedOrientationData->Quaternions[sf_idx]; } @@ -7746,7 +7372,6 @@ static ivas_error renderSplitBinauralWithPostRot( /* decode audio */ if ( splitBinInput->base.inConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { -#ifdef API_5MS if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD ) { isPostRendInputCldfb = 1; @@ -7763,7 +7388,6 @@ static ivas_error renderSplitBinauralWithPostRot( { if ( splitBinInput->numCachedSamples == 0 ) { -#endif if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD ) { ivas_splitBinLCLDDecProcess( @@ -7772,11 +7396,7 @@ static ivas_error renderSplitBinauralWithPostRot( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, SplitRendBFI ); -#ifndef API_5MS - isPostRendInputCldfb = 1; -#endif -#ifdef API_5MS /* copy data over to 5ms buffer */ for ( chnlIdx = 0; chnlIdx < BINAURAL_CHANNELS; ++chnlIdx ) { @@ -7803,7 +7423,6 @@ static ivas_error renderSplitBinauralWithPostRot( } } } -#endif } else { @@ -7812,7 +7431,6 @@ static ivas_error renderSplitBinauralWithPostRot( { return error; } -#ifdef API_5MS /* cache the remaining 15ms */ splitBinInput->numCachedSamples = numSamplesPerChannelCacheSize; mvr2r( &tmpCrendBuffer[0][outBufNumSamplesPerChannel], @@ -7821,9 +7439,7 @@ static ivas_error renderSplitBinauralWithPostRot( mvr2r( &tmpCrendBuffer[1][outBufNumSamplesPerChannel], splitBinInput->bufferData + numSamplesPerChannelCacheSize, numSamplesPerChannelCacheSize ); -#endif } -#ifdef API_5MS } else { @@ -7865,7 +7481,6 @@ static ivas_error renderSplitBinauralWithPostRot( } } } -#endif } else { @@ -7873,10 +7488,8 @@ static ivas_error renderSplitBinauralWithPostRot( } /* apply pose correction if enabled */ -#ifdef API_5MS for ( sf_idx = 0; sf_idx < pCombinedOrientationData->num_subframes; sf_idx++ ) { -#endif if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE && isPostRendInputCldfb ) { /* 0DOF with LCLD codec requires CLDFB synthesis */ @@ -7884,76 +7497,49 @@ static ivas_error renderSplitBinauralWithPostRot( for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { -#ifdef API_5MS float *RealBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES]; float *ImagBuffer[CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES]; for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) -#else - float *RealBuffer[CLDFB_NO_COL_MAX]; - float *ImagBuffer[CLDFB_NO_COL_MAX]; - - for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) -#endif { -#ifdef API_5MS RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural_5ms[sf_idx][ch_idx][slot_idx]; ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural_5ms[sf_idx][ch_idx][slot_idx]; -#else - RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch_idx][slot_idx]; - ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx]; -#endif } cldfbSynthesis( RealBuffer, ImagBuffer, &( tmpCrendBuffer[ch_idx][sf_idx * outBufNumSamplesPerChannel] ), hSplitBin->hBinHrSplitPostRend->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX -#ifdef API_5MS / MAX_PARAM_SPATIAL_SUBFRAMES -#endif , hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx] ); } } else if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { -#ifdef API_5MS mvr2r( &tmpCrendBuffer[0][sf_idx * outBufNumSamplesPerChannel], tmpCrendBuffer_sf[0], outBufNumSamplesPerChannel ); mvr2r( &tmpCrendBuffer[1][sf_idx * outBufNumSamplesPerChannel], tmpCrendBuffer_sf[1], outBufNumSamplesPerChannel ); -#endif ivas_rend_CldfbSplitPostRendProcess( hSplitBin->hBinHrSplitPostRend, &hSplitBin->multiBinPoseData, -#ifdef API_5MS QuaternionsPost[sf_idx], Cldfb_RealBuffer_Binaural_5ms[sf_idx], Cldfb_ImagBuffer_Binaural_5ms[sf_idx], tmpCrendBuffer_sf, -#else - QuaternionsPost, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - tmpCrendBuffer, -#endif isPostRendInputCldfb ); -#ifdef API_5MS mvr2r( tmpCrendBuffer_sf[0], &tmpCrendBuffer[0][sf_idx * outBufNumSamplesPerChannel], outBufNumSamplesPerChannel ); mvr2r( tmpCrendBuffer_sf[1], &tmpCrendBuffer[1][sf_idx * outBufNumSamplesPerChannel], outBufNumSamplesPerChannel ); -#endif } -#ifdef API_5MS } -#endif } else { @@ -7971,11 +7557,7 @@ static ivas_error renderSplitBinauralWithPostRot( } } -#ifdef API_5MS convertInternalBitsBuffToBitsBuffer( splitBinInput->hBits, bits ); -#else - convertInternalBitsBuffToBitsBuffer( hBits, bits ); -#endif accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); pop_wmops(); @@ -8010,11 +7592,7 @@ static ivas_error renderSbaToMultiBinaural( combinedOrientationDataLocal = *pCombinedOrientationDataLocal; if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { -#ifdef API_5MS for ( sf = 1; sf < combinedOrientationDataLocal.num_subframes; sf++ ) -#else - for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; sf++ ) -#endif { combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0]; for ( i = 0; i < 3; i++ ) @@ -8032,14 +7610,8 @@ static ivas_error renderSbaToMultiBinaural( for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) { -#ifdef API_5MS IVAS_QUATERNION Quaternions_orig[MAX_PARAM_SPATIAL_SUBFRAMES], Quaternions_abs; for ( i = 0; i < combinedOrientationDataLocal.num_subframes; i++ ) -#else - IVAS_QUATERNION Quaternions_orig[RENDERER_HEAD_POSITIONS_PER_FRAME], Quaternions_abs; - - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) -#endif { Quaternions_orig[i] = combinedOrientationDataLocal.Quaternions[i]; Quaternions_abs.w = -3.0f; @@ -8072,9 +7644,7 @@ static ivas_error renderSbaToMultiBinaural( NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, -#ifdef API_5MS getNumSubframesInBuffer( &sbaInput->base.inputBuffer, *sbaInput->base.ctx.pOutSampleRate ), -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT pos_idx #endif @@ -8083,11 +7653,7 @@ static ivas_error renderSbaToMultiBinaural( return error; } -#ifdef API_5MS for ( i = 0; i < combinedOrientationDataLocal.num_subframes; i++ ) -#else - for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) -#endif { combinedOrientationDataLocal.Quaternions[i] = Quaternions_orig[i]; } @@ -8111,10 +7677,8 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t low_res_pre_rend_rot -#ifdef API_5MS , int16_t num_subframes -#endif ) { float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -8131,10 +7695,8 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, Cldfb_Out_Real, Cldfb_Out_Imag, low_res_pre_rend_rot -#ifdef API_5MS , num_subframes -#endif ); return IVAS_ERR_OK; } @@ -8161,10 +7723,8 @@ static ivas_error renderSbaToSplitBinaural( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, low_res_pre_rend_rot -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) -#endif ); accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio ); } @@ -8210,10 +7770,8 @@ static ivas_error renderSbaToBinaural( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, 0 -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) -#endif ); accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio ); } @@ -8229,11 +7787,7 @@ static ivas_error renderSbaToBinaural( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { @@ -8276,10 +7830,8 @@ static ivas_error renderSbaToBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -8327,11 +7879,7 @@ static ivas_error renderSbaToBinauralRoom( combinedOrientationEnabled = 0; if ( hCombinedOrientationData != NULL ) { -#ifdef API_5MS for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) -#else - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) -#endif { if ( ( *hCombinedOrientationData )->enableCombinedOrientation[subframe_idx] != 0 ) { @@ -8386,10 +7934,8 @@ static ivas_error renderSbaToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -8417,22 +7963,12 @@ static ivas_error renderInputSplitBin( input_split_post_rend *splitBinInput, const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio, -#ifndef API_5MS - IVAS_REND_BitstreamBuffer *hBits, -#endif const int16_t SplitRendBFI ) { ivas_error error; IVAS_REND_AudioBuffer inAudio; inAudio = splitBinInput->base.inputBuffer; -#ifndef API_5MS - if ( splitBinInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) - { - /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */ - return IVAS_ERR_INVALID_BUFFER_SIZE; - } -#endif splitBinInput->base.numNewSamplesPerChannel = 0; @@ -8445,9 +7981,6 @@ static ivas_error renderInputSplitBin( { case AUDIO_CONFIG_BINAURAL: error = renderSplitBinauralWithPostRot( splitBinInput, outAudio, -#ifndef API_5MS - hBits, -#endif SplitRendBFI ); break; default: @@ -8482,7 +8015,7 @@ static ivas_error renderInputSba( { ivas_error error; IVAS_REND_AudioBuffer inAudio; -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) int16_t cldfb2tdSampleFact; #endif @@ -8491,13 +8024,9 @@ static ivas_error renderInputSba( inAudio = sbaInput->base.inputBuffer; #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef API_5MS cldfb2tdSampleFact = outAudio.config.is_cldfb ? 2 : 1; -#endif if ( ( sbaInput->base.numNewSamplesPerChannel -#ifdef API_5MS * cldfb2tdSampleFact -#endif != outAudio.config.numSamplesPerChannel ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else @@ -8561,10 +8090,6 @@ static ivas_error renderInputSba( static ivas_error renderActiveInputsSplitBin( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio -#ifndef API_5MS - , - IVAS_REND_BitstreamBuffer *hBits -#endif ) { int16_t i; @@ -8580,9 +8105,6 @@ static ivas_error renderActiveInputsSplitBin( } if ( ( error = renderInputSplitBin( pCurrentInput, hIvasRend->outputConfig, outAudio, -#ifndef API_5MS - hBits, -#endif hIvasRend->splitRendBFI ) ) != IVAS_ERR_OK ) { return error; @@ -8679,19 +8201,15 @@ static void renderMasaToMc( if ( masaInput->decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) -#endif ); } else { ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) -#endif ); } @@ -8716,10 +8234,8 @@ static void renderMasaToSba( copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) -#endif ); accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); @@ -8748,10 +8264,8 @@ static void renderMasaToBinaural( copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels -#ifdef API_5MS , getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) -#endif ); #ifdef SPLIT_REND_WITH_HEAD_ROT if ( is_split_rend_mode ) @@ -8903,7 +8417,7 @@ static ivas_error renderInputMasa( IVAS_REND_AudioBuffer outAudio ) { IVAS_REND_AudioBuffer inAudio; -#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS ) +#if defined( SPLIT_REND_WITH_HEAD_ROT ) int16_t cldfb2tdSampleFact; #endif @@ -8914,13 +8428,9 @@ static ivas_error renderInputMasa( inAudio = masaInput->base.inputBuffer; #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef API_5MS cldfb2tdSampleFact = outAudio.config.is_cldfb ? 2 : 1; -#endif if ( ( masaInput->base.numNewSamplesPerChannel -#ifdef API_5MS * cldfb2tdSampleFact -#endif != outAudio.config.numSamplesPerChannel ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else @@ -9010,11 +8520,7 @@ static ivas_error renderActiveInputsMasa( if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && pCurrentInput->decDummy->hHeadTrackData != NULL ) { -#ifdef API_5MS for ( sf_idx = 0; sf_idx < hIvasRend->num_subframes; ++sf_idx ) -#else - for ( sf_idx = 0; sf_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf_idx ) -#endif { pCurrentInput->decDummy->hHeadTrackData->Quaternions[sf_idx] = hIvasRend->headRotData.headPositions[sf_idx]; pCurrentInput->decDummy->hHeadTrackData->Pos[sf_idx] = hIvasRend->headRotData.Pos[sf_idx]; @@ -9201,7 +8707,6 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( return IVAS_ERR_OK; } -#ifdef API_5MS /*-------------------------------------------------------------------* * getSamplesInternal() * @@ -9209,15 +8714,6 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( *-------------------------------------------------------------------*/ static ivas_error getSamplesInternal( -#else -/*-------------------------------------------------------------------* - * IVAS_REND_GetSamples() - * - * - *-------------------------------------------------------------------*/ - -ivas_error IVAS_REND_GetSamples( -#endif IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -9327,14 +8823,6 @@ ivas_error IVAS_REND_GetSamples( int16_t num_poses_orig; num_poses_orig = hIvasRend->splitRendWrapper.multiBinPoseData.num_poses; outAudio = hIvasRend->splitRendEncBuffer; -#ifndef API_5MS - if ( ( outAudioOrig.config.is_cldfb == 0 ) && - ( hIvasRend->inputsMasa[0].base.inConfig == AUDIO_CONFIG_INVALID ) ) - { - outAudio.config.is_cldfb = 0; - outAudio.config.numSamplesPerChannel >>= 1; - } -#endif ivas_renderSplitGetMultiBinPoseData( &hIvasRend->hRendererConfig->split_rend_config, &hIvasRend->splitRendWrapper.multiBinPoseData, @@ -9366,10 +8854,6 @@ ivas_error IVAS_REND_GetSamples( } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderActiveInputsSplitBin( hIvasRend, outAudio -#ifndef API_5MS - , - hBits -#endif ) ) != IVAS_ERR_OK ) { return error; @@ -9426,9 +8910,7 @@ ivas_error IVAS_REND_GetSamples( hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, -#ifdef API_5MS hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, -#endif &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, @@ -9457,7 +8939,6 @@ ivas_error IVAS_REND_GetSamples( return IVAS_ERR_OK; } -#ifdef API_5MS /*-------------------------------------------------------------------* * IVAS_REND_GetSamples() * @@ -9520,7 +9001,6 @@ ivas_error IVAS_REND_GetSplitBinauralSamples( return IVAS_ERR_OK; } #endif -#endif /*-------------------------------------------------------------------* diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 52fbea2863..329f682e72 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -91,9 +91,7 @@ typedef struct int32_t bitsRead; IVAS_SPLIT_REND_CODEC codec; IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection; -#ifdef API_5MS int16_t codec_frame_size_ms; -#endif } IVAS_REND_BitstreamBufferConfig; typedef struct { @@ -144,10 +142,8 @@ ivas_error IVAS_REND_Open( const AUDIO_CONFIG outConfig, /* i : output audio config */ const int16_t nonDiegeticPan, /* i : non-diegetic object flag */ const float nonDiegeticPanGain /* i : non-diegetic panning gain */ -#ifdef API_5MS , const int16_t num_subframes -#endif ); /* Note: this will reset custom LFE routings set for any MC input */ @@ -255,7 +251,7 @@ int16_t IVAS_REND_FeedRenderConfig( const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); -#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT +#if defined SPLIT_REND_WITH_HEAD_ROT ivas_error IVAS_REND_FeedSplitBinauralBitstream( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ @@ -275,28 +271,19 @@ ivas_error IVAS_REND_GetSplitBinauralBitstream( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef API_5MS const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ const IVAS_VECTOR3 Pos /* i : listener positions for next rendering call */ -#else - const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ - const IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT , IVAS_SPLIT_REND_ROT_AXIS rot_axis #endif -#ifdef API_5MS , const int16_t sf_idx -#endif ); -#ifdef API_5MS /* Head rotation becomes enabled by calling IVAS_REND_SetHeadRotation. Use this to disable. */ ivas_error IVAS_REND_DisableHeadRotation( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ ); -#endif ivas_error IVAS_REND_SetOrientationTrackingMode( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ @@ -333,18 +320,11 @@ ivas_error IVAS_REND_SetSplitRendBFI( ivas_error IVAS_REND_SetExternalOrientation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_QUATERNION *orientation, /* i : external orientation data */ -#ifdef API_5MS int8_t enableHeadRotation, /* i : flag to enable head rotation for this frame */ int8_t enableExternalOrientation, /* i : flag to enable external orientation for this frame */ int8_t enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ int16_t numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */ const int16_t sf_idx /*i : subframe index*/ -#else - int8_t *enableHeadRotation, /* i : flag to enable head rotation for this frame */ - int8_t *enableExternalOrientation, /* i : flag to enable external orientation for this frame */ - int8_t *enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ - int16_t *numFramesToTargetOrientation /* i : number of frames until target orientation is reached */ -#endif ); ivas_error IVAS_REND_CombineHeadAndExternalOrientation( @@ -387,12 +367,6 @@ ivas_error IVAS_REND_GetNumAllObjects( ivas_error IVAS_REND_GetSamples( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ -#ifndef API_5MS -#ifdef SPLIT_REND_WITH_HEAD_ROT - , - IVAS_REND_BitstreamBuffer *hBits /*i/o: buffer for input/output bitstream. Needed in split rendering mode*/ -#endif -#endif ); /* Functions to be called after rendering */ diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index bdbfe3ec2b..3293e4d4a5 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -1333,10 +1333,8 @@ static ivas_error RenderConfigReader_readBinary( fread( pRenderConfigReader->pBitstream, sizeof( uint8_t ), file_size, pReverbConfigFile ); pRenderConfigReader->length = file_size; -#ifdef API_5MS /* we read the config twice in the decoder, so reset the read offset here */ pRenderConfigReader->readOffset = 0; -#endif /****************************/ /* Read the presence flag */ @@ -2498,7 +2496,6 @@ ivas_error RenderConfigReader_read( errorHandler( pValue, ERROR_VALUE_INVALID ); } } -#ifdef API_5MS else if ( strcmp( item, "FRAMESIZE" ) == 0 ) { if ( !sscanf( pValue, "%hd", &hRenderConfig->split_rend_config.codec_frame_size_ms ) ) @@ -2512,7 +2509,6 @@ ivas_error RenderConfigReader_read( errorHandler( item, ERROR_VALUE_INVALID ); } } -#endif else if ( strcmp( item, "POSECORRECTION" ) == 0 ) { poseCorrProvided = true; diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index ea9e6da739..2d9967811d 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -199,10 +199,8 @@ ivas_error split_rend_write_bitstream_to_file( int32_t *bits_written, IVAS_SPLIT_REND_CODEC codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection -#ifdef API_5MS , int16_t codec_frame_size_ms -#endif ) { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; @@ -247,13 +245,11 @@ ivas_error split_rend_write_bitstream_to_file( { return IVAS_ERR_FAILED_FILE_WRITE; } -#ifdef API_5MS /* Write frame size signalling */ if ( fwrite( &codec_frame_size_ms, sizeof( codec_frame_size_ms ), 1, hSplitRendFileReadWrite->file ) != 1 ) { return IVAS_ERR_FAILED_FILE_WRITE; } -#endif /* write num bytes */ if ( fwrite( bits_written, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) @@ -287,10 +283,8 @@ ivas_error split_rend_read_bits_from_file( int32_t *bits_written, IVAS_SPLIT_REND_CODEC *codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection -#ifdef API_5MS , int16_t *codec_frame_size_ms -#endif ) { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; @@ -347,13 +341,11 @@ ivas_error split_rend_read_bits_from_file( { return IVAS_ERR_FAILED_FILE_READ; } -#ifdef API_5MS /* read frame size signalling */ if ( fread( codec_frame_size_ms, sizeof( *codec_frame_size_ms ), 1, hSplitRendFileReadWrite->file ) != 1 ) { return IVAS_ERR_FAILED_FILE_READ; } -#endif /* write num bytes */ if ( fread( &bit_len, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ) != 1 ) diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index dacc2f72bc..a7b21a8e6b 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -62,10 +62,8 @@ ivas_error split_rend_write_bitstream_to_file( int32_t *bits_written, IVAS_SPLIT_REND_CODEC codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection -#ifdef API_5MS , int16_t codec_frame_size_ms -#endif ); /* read split rend coded bits from file */ @@ -76,10 +74,8 @@ ivas_error split_rend_read_bits_from_file( int32_t *bits_written, IVAS_SPLIT_REND_CODEC *codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection -#ifdef API_5MS , int16_t *codec_frame_size_ms -#endif ); /* read split pre rend delay */ -- GitLab From 9b414871e995517c4d3534238e7ae19066a47f42 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 30 Aug 2023 22:51:33 +0200 Subject: [PATCH 9/9] formatting --- apps/decoder.c | 22 +- apps/renderer.c | 46 ++-- lib_com/common_api_types.h | 20 +- lib_dec/ivas_binRenderer_internal.c | 6 +- lib_dec/ivas_dec.c | 48 ++-- lib_dec/ivas_init_dec.c | 18 +- lib_dec/ivas_ism_param_dec.c | 8 +- lib_dec/ivas_ism_renderer.c | 4 +- lib_dec/ivas_jbm_dec.c | 8 +- lib_dec/ivas_mc_param_dec.c | 4 +- lib_dec/ivas_objectRenderer_internal.c | 6 +- lib_dec/ivas_omasa_dec.c | 12 +- lib_dec/ivas_osba_dec.c | 6 +- lib_dec/ivas_stat_dec.h | 2 +- lib_dec/lib_dec.c | 38 ++- lib_rend/ivas_crend.c | 3 +- lib_rend/ivas_objectRenderer.c | 12 +- lib_rend/ivas_rotation.c | 7 +- lib_rend/ivas_splitRendererPost.c | 313 ++++++++++++------------ lib_rend/ivas_splitRendererPre.c | 30 +-- lib_rend/ivas_splitRenderer_utils.c | 23 +- lib_rend/lib_rend.c | 170 +++++-------- lib_util/split_render_file_read_write.c | 12 +- lib_util/split_render_file_read_write.h | 12 +- 24 files changed, 332 insertions(+), 498 deletions(-) mode change 100755 => 100644 lib_dec/ivas_stat_dec.h diff --git a/apps/decoder.c b/apps/decoder.c index ff058bb484..c9741068f5 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1793,10 +1793,8 @@ static ivas_error initOnFirstGoodFrame( splitRendBitsZero.pose_correction = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE; splitRendBitsZero.codec_frame_size_ms = 20; if ( split_rend_write_bitstream_to_file( *hSplitRendFileReadWrite, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written, - -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE - , - splitRendBitsZero.codec_frame_size_ms - ) != IVAS_ERR_OK ) + -1, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE, + splitRendBitsZero.codec_frame_size_ms ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); @@ -2066,9 +2064,7 @@ static ivas_error decodeG192( nSamplesAvailableNext = 0; vec_pos_update = 0; - if ( arg.enableHeadRotation - && arg.enable5ms - ) + if ( arg.enableHeadRotation && arg.enable5ms ) { nOutSamples = (int16_t) ( arg.output_Fs / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS ); vec_pos_len = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; @@ -2373,10 +2369,8 @@ static ivas_error decodeG192( if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, - splitRendBits.codec, splitRendBits.pose_correction - , - splitRendBits.codec_frame_size_ms - ) != IVAS_ERR_OK ) + splitRendBits.codec, splitRendBits.pose_correction, + splitRendBits.codec_frame_size_ms ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); goto cleanup; @@ -2387,10 +2381,8 @@ static ivas_error decodeG192( if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, - splitRendBits.codec, splitRendBits.pose_correction - , - splitRendBits.codec_frame_size_ms - ) != IVAS_ERR_OK ) + splitRendBits.codec, splitRendBits.pose_correction, + splitRendBits.codec_frame_size_ms ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); goto cleanup; diff --git a/apps/renderer.c b/apps/renderer.c index 100d8e3e73..b23908574e 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -996,9 +996,7 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT } #endif - const int16_t frameSize_smpls = (int16_t) ( - ( args.framing_5ms ? 5 : 20 ) - * args.sampleRate / 1000 ); + const int16_t frameSize_smpls = (int16_t) ( ( args.framing_5ms ? 5 : 20 ) * args.sampleRate / 1000 ); IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 }; @@ -1008,10 +1006,8 @@ int main( IVAS_REND_InputId splitBinIds[RENDERER_MAX_BIN_INPUTS] = { 0 }; #endif - if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain - , - ( args.framing_5ms ) ? 1 : 4 - ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, + ( args.framing_5ms ) ? 1 : 4 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1455,17 +1451,13 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT numSamplesRead = 0; - if ( ( hSplitRendFileReadWrite != NULL ) && is_split_post_rend_mode( &args ) - && splitBinNeedsNewFrame - ) + if ( ( hSplitRendFileReadWrite != NULL ) && is_split_post_rend_mode( &args ) && splitBinNeedsNewFrame ) { ivas_error error_tmp; numSamplesRead = (int16_t) inBufferSize; error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, - &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection - , - &bitsBuffer.config.codec_frame_size_ms - ); + &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, + &bitsBuffer.config.codec_frame_size_ms ); if ( error_tmp != IVAS_ERR_OK ) { if ( error_tmp == IVAS_ERR_END_OF_FILE ) @@ -1493,9 +1485,7 @@ int main( } #endif - if ( numSamplesRead == 0 - && splitBinNeedsNewFrame - ) + if ( numSamplesRead == 0 && splitBinNeedsNewFrame ) { /* end of input data */ break; @@ -1570,8 +1560,7 @@ int main( DEFAULT_AXIS #endif , - sf_idx - ) ) != IVAS_ERR_OK ) + sf_idx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1589,9 +1578,7 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT /* Read from split renderer bfi file if specified */ - if ( splitRendBFIReader != NULL - && splitBinNeedsNewFrame - ) + if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame ) { int16_t bfi; SplitRendBFIFileReading( splitRendBFIReader, &bfi ); @@ -1617,10 +1604,8 @@ int main( } for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { - if ( ( error = IVAS_REND_SetExternalOrientation( hIvasRend, &quatBuffer[sf_idx], enableHeadRotation[sf_idx], enableExternalOrientation[sf_idx], enableRotationInterpolation[sf_idx], numFramesToTargetOrientation[sf_idx] - , - sf_idx - ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_REND_SetExternalOrientation( hIvasRend, &quatBuffer[sf_idx], enableHeadRotation[sf_idx], enableExternalOrientation[sf_idx], enableRotationInterpolation[sf_idx], numFramesToTargetOrientation[sf_idx], + sf_idx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error setting External Orientation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1784,8 +1769,7 @@ int main( else { #endif - if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer - ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK ) { #ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stderr, "Error %s\n", ivas_error_to_string( error ) ); @@ -1845,10 +1829,8 @@ int main( if ( ( hSplitRendFileReadWrite != NULL ) && is_split_pre_rend_mode( &args ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, - bitsBuffer.config.codec, bitsBuffer.config.poseCorrection - , - bitsBuffer.config.codec_frame_size_ms - ) != IVAS_ERR_OK ) + bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, + bitsBuffer.config.codec_frame_size_ms ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); exit( -1 ); diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 440892803d..8e4a1d0e13 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -251,16 +251,16 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG typedef struct _IVAS_SPLIT_REND_CONFIG { - int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ - int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ - int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ - /*The axis can be set dynamically per frame based on a file input */ - /*possible values: - 1 - (1dof correction. By default YAW correction) - 2 - (2dof correction. By default YAW and PITCH correction) - 3 - (3dof correction. By default YAW, PITCH and ROLL correction) - */ - int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ + int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ + int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ + int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ + /*The axis can be set dynamically per frame based on a file input */ + /*possible values: + 1 - (1dof correction. By default YAW correction) + 2 - (2dof correction. By default YAW and PITCH correction) + 3 - (3dof correction. By default YAW, PITCH and ROLL correction) + */ + int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */ IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; IVAS_SPLIT_REND_CODEC codec; diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 5f71f79088..8cd36f7c9e 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -2110,10 +2110,8 @@ void ivas_rend_CldfbMultiBinRendProcess( float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_Out_Real[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_Out_Imag[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t low_res_pre_rend_rot - , - int16_t num_subframes -) + const int16_t low_res_pre_rend_rot, + int16_t num_subframes ) { int16_t slot_idx, ch_idx, idx, pose_idx, i, j; int16_t sf_idx; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 4dcec5509d..8d41109c07 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -228,10 +228,8 @@ ivas_error ivas_dec( ivas_param_ism_params_to_masa_param_mapping( st_ivas ); - ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport, + MAX_PARAM_SPATIAL_SUBFRAMES ); } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { @@ -309,8 +307,7 @@ ivas_error ivas_dec( else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL, - NULL, NULL, NULL, p_output, output_Fs - , + NULL, NULL, NULL, p_output, output_Fs, MAX_PARAM_SPATIAL_SUBFRAMES #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -459,10 +456,8 @@ ivas_error ivas_dec( /* Loudspeakers, Ambisonics or Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { - ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, nchan_remapped - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, nchan_remapped, + MAX_PARAM_SPATIAL_SUBFRAMES ); } else if ( st_ivas->ivas_format == MASA_FORMAT ) { @@ -477,10 +472,8 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_DIRAC ) { - ivas_dirac_dec( st_ivas, output, nchan_remapped - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec( st_ivas, output, nchan_remapped, + MAX_PARAM_SPATIAL_SUBFRAMES ); } } else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) @@ -567,10 +560,8 @@ ivas_error ivas_dec( } else { - ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport, + MAX_PARAM_SPATIAL_SUBFRAMES ); } } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) @@ -710,10 +701,8 @@ ivas_error ivas_dec( /* Loudspeakers, Ambisonics or Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { - ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[sba_ch_idx], nchan_remapped - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[sba_ch_idx], nchan_remapped, + MAX_PARAM_SPATIAL_SUBFRAMES ); } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { @@ -840,8 +829,7 @@ ivas_error ivas_dec( { #endif if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, - st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs - , + st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs, MAX_PARAM_SPATIAL_SUBFRAMES #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -1080,17 +1068,13 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { - ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport, + MAX_PARAM_SPATIAL_SUBFRAMES ); } else if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) /* rendering to CICPxx and Ambisonics */ { - ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, + MAX_PARAM_SPATIAL_SUBFRAMES ); if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 0be2bb49e6..6a462fcd25 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -264,10 +264,8 @@ static ivas_error ivas_dec_init_split_rend( error = ivas_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, - cldfb_in, pcm_out - , - st_ivas->hDecoderConfig->Opt_5ms - ); + cldfb_in, pcm_out, + st_ivas->hDecoderConfig->Opt_5ms ); return error; } #endif @@ -995,10 +993,8 @@ ivas_error ivas_init_decoder_front( if ( st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { - if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ) - , - ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ), + ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES ) ) != IVAS_ERR_OK ) { return error; } @@ -1010,10 +1006,8 @@ ivas_error ivas_init_decoder_front( if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { - if ( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ) - , - ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ), + ( st_ivas->hDecoderConfig->Opt_5ms ) ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 23740664fa..bf60d8c4d3 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1195,9 +1195,7 @@ void ivas_param_ism_dec_digest_tc( } } } - if ( st_ivas->hDecoderConfig->Opt_tsm - || !st_ivas->hDecoderConfig->Opt_5ms - ) + if ( st_ivas->hDecoderConfig->Opt_tsm || !st_ivas->hDecoderConfig->Opt_5ms ) { /*TODO : FhG to check*/ ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, fade_len, transport_channels_f ); @@ -1210,9 +1208,7 @@ void ivas_param_ism_dec_digest_tc( *-----------------------------------------------------------------*/ for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) { - if ( st_ivas->hDecoderConfig->Opt_tsm - || !st_ivas->hDecoderConfig->Opt_5ms - ) + if ( st_ivas->hDecoderConfig->Opt_tsm || !st_ivas->hDecoderConfig->Opt_5ms ) { float RealBuffer[CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index ead528fb3f..fabe708603 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -371,8 +371,8 @@ ivas_error ivas_omasa_separate_object_renderer_open( set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); } - init_interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); - interpolator_length = init_interpolator_length; + init_interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ); + interpolator_length = init_interpolator_length; st_ivas->hIsmRendererData->interpolator = (float *) malloc( sizeof( float ) * init_interpolator_length ); for ( i = 0; i < interpolator_length; i++ ) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 6cb0588b53..1fe58874a0 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -603,9 +603,7 @@ ivas_error ivas_jbm_dec_tc( /*----------------------------------------------------------------* * Write IVAS transport channels *----------------------------------------------------------------*/ - if ( st_ivas->hDecoderConfig->Opt_tsm == 1 - || !st_ivas->hDecoderConfig->Opt_5ms - ) + if ( st_ivas->hDecoderConfig->Opt_tsm == 1 || !st_ivas->hDecoderConfig->Opt_5ms ) { ivas_syn_output_f( p_output, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data ); } @@ -679,9 +677,7 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer( { p_data_f[n] = &data_f[n][0]; } - if ( st_ivas->hDecoderConfig->Opt_tsm - || !st_ivas->hDecoderConfig->Opt_5ms - ) + if ( st_ivas->hDecoderConfig->Opt_tsm || !st_ivas->hDecoderConfig->Opt_5ms ) { ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data, p_data_f ); } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 3c33c986c3..abcf0af5e0 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1473,9 +1473,7 @@ void ivas_param_mc_dec_digest_tc( /* slot loop for gathering the input data */ for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) { - if ( st_ivas->hDecoderConfig->Opt_tsm - || !st_ivas->hDecoderConfig->Opt_5ms - ) + if ( st_ivas->hDecoderConfig->Opt_tsm || !st_ivas->hDecoderConfig->Opt_5ms ) { float RealBuffer[CLDFB_NO_CHANNELS_MAX]; float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index c041e8e702..b2857673fe 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -110,10 +110,8 @@ ivas_error ivas_td_binaural_renderer( ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation : NULL, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL, - ism_md_subframe_update, output, output_frame - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ism_md_subframe_update, output, output_frame, + MAX_PARAM_SPATIAL_SUBFRAMES ); } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 761fe88390..b0f2c872ee 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -633,10 +633,8 @@ void ivas_omasa_dirac_rend( dirac_read_idx = st_ivas->hSpatParamRendCom->dirac_read_idx; - ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, + MAX_PARAM_SPATIAL_SUBFRAMES ); st_ivas->hSpatParamRendCom->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ @@ -709,10 +707,8 @@ ivas_error ivas_omasa_dirac_td_binaural( delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); } - ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport, + MAX_PARAM_SPATIAL_SUBFRAMES ); if ( ( error = ivas_td_binaural_renderer( st_ivas, p_sepobj, output_frame ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 27fe7a144d..0995089956 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -183,10 +183,8 @@ ivas_error ivas_osba_dirac_td_binaural( } else { - ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[channel_offset], st_ivas->nchan_transport - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[channel_offset], st_ivas->nchan_transport, + MAX_PARAM_SPATIAL_SUBFRAMES ); } #ifdef DEBUG_OSBA diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h old mode 100755 new mode 100644 index b63994d7bf..e70403488d --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -939,7 +939,7 @@ typedef struct IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits; /*scratch buffer for frame by frame processing*/ SPLIT_REND_WRAPPER splitrend; IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE hCldfbDataOut; /*buffer to store cldfb data before binauralization*/ - float *tdDataOut; /*buffer to store TD data before binauralization*/ + float *tdDataOut; /*buffer to store TD data before binauralization*/ int16_t numTdSamplesPerChannelCached; } IVAS_DEC_SPLIT_REND_WRAPPER; #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 71c9432882..dfbd0d7998 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -76,7 +76,7 @@ struct IVAS_DEC int16_t bitstreamformat; /* Bitstream format flag (G.192/MIME/VOIP_G192_RTP/VOIP_RTPDUMP) */ bool Opt_VOIP; /* flag indicating VOIP mode with JBM */ - int16_t tsm_scale; /* scale for TSM operation */ + int16_t tsm_scale; /* scale for TSM operation */ int16_t tsm_max_scaling; float *apaExecBuffer; /* Buffer for APA scaling */ PCMDSP_APA_HANDLE hTimeScaler; @@ -368,7 +368,7 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ const AUDIO_CONFIG outputConfig, /* i : output configuration */ - const int16_t tsmEnabled, /* i : enable TSM */ + const int16_t tsmEnabled, /* i : enable TSM */ const int16_t enable5ms, const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ @@ -521,7 +521,7 @@ ivas_error IVAS_DEC_Get5msFlag( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_EnableVoIP( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t jbmSafetyMargin, /* i : allowed delay reserve for JBM, in milliseconds */ const IVAS_DEC_INPUT_FORMAT inputFormat /* i : format of the input bitstream */ ) @@ -580,14 +580,14 @@ ivas_error IVAS_DEC_EnableVoIP( } /* initialize JBM */ - if ( ( error = JB4_Create( &hIvasDec->hVoIP->hJBM ) != IVAS_ERR_OK ) != IVAS_ERR_OK ) - { - return error; - } - if ( JB4_Init( hIvasDec->hVoIP->hJBM, jbmSafetyMargin ) != 0 ) - { - return IVAS_ERR_FAILED_ALLOC; - } + if ( ( error = JB4_Create( &hIvasDec->hVoIP->hJBM ) != IVAS_ERR_OK ) != IVAS_ERR_OK ) + { + return error; + } + if ( JB4_Init( hIvasDec->hVoIP->hJBM, jbmSafetyMargin ) != 0 ) + { + return IVAS_ERR_FAILED_ALLOC; + } return error; } @@ -738,8 +738,7 @@ static ivas_error _GetSamples( #if defined SPLIT_REND_WITH_HEAD_ROT pcm_resolution, #endif - pcmBuf - ) ) != IVAS_ERR_OK ) + pcmBuf ) ) != IVAS_ERR_OK ) { return error; } @@ -913,7 +912,7 @@ ivas_error IVAS_DEC_GetSamples( pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) #else - pcmBuf + nSamplesRendered * nOutChannels + pcmBuf + nSamplesRendered * nOutChannels #endif ) ) != IVAS_ERR_OK ) @@ -1538,7 +1537,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedHeadTrackData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ IVAS_VECTOR3 Pos, /* i : listener position */ const int16_t subframe_idx /*subframe index*/ @@ -1646,7 +1645,7 @@ ivas_error IVAS_DEC_FeedRefVectorData( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedExternalOrientationData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION orientation, /* i : external orientation data */ int8_t enableHeadRotation, /* i : flag to enable head rotation for this frame */ int8_t enableExternalOrientation, /* i : flag to enable external orientation for this frame */ @@ -3055,15 +3054,13 @@ static ivas_error evs_dec_main( } - if ( !st_ivas->hDecoderConfig->Opt_tsm - && st_ivas->hDecoderConfig->Opt_5ms + if ( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hDecoderConfig->Opt_5ms ) { ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); } - else - if ( floatBuf != NULL ) + else if ( floatBuf != NULL ) { /* BE workaround */ int16_t pcm_buf_local[L_FRAME48k * MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; @@ -3295,7 +3292,6 @@ static int16_t IVAS_DEC_VoIP_GetRenderGranularity( } - /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_reconfigure() * diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index c1b066abc2..21977a38b8 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1712,8 +1712,7 @@ ivas_error ivas_rend_crendProcess( IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, float *output[], /* i/o: input/output audio channels */ - const int32_t output_Fs - , + const int32_t output_Fs, const int16_t num_subframes /* i : number of subframes to render */ #ifdef SPLIT_REND_WITH_HEAD_ROT , diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 68dbbe73b4..61bfcf68ab 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -636,9 +636,9 @@ ivas_error ivas_td_binaural_renderer_ext( const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ - const int32_t output_Fs, /* i : output sampling rate */ - const int16_t output_frame, /* i : output frame length */ - float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t output_frame, /* i : output frame length */ + float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { ISM_METADATA_FRAME hIsmMetaDataFrame; @@ -699,10 +699,8 @@ ivas_error ivas_td_binaural_renderer_ext( ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->enableCombinedOrientation : NULL, ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->Quaternions : NULL, ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->listenerPos : NULL, - ism_md_subframe_update_ext, p_output, output_frame - , - (int16_t) ( ( output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) / output_Fs ) - ) ) != IVAS_ERR_OK ) + ism_md_subframe_update_ext, p_output, output_frame, + (int16_t) ( ( output_frame * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) / output_Fs ) ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index cdcc961a08..fac6056f35 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -818,8 +818,7 @@ void rotateFrame_sd_cldfb( ivas_error ivas_external_orientation_open( EXTERNAL_ORIENTATION_HANDLE *hExtOrientationData /* o : external orientation handle */ , - const int16_t num_subframes -) + const int16_t num_subframes ) { int16_t i; @@ -878,8 +877,7 @@ void ivas_external_orientation_close( ivas_error ivas_combined_orientation_open( COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData /* o : combined orientation handle */ , - const int16_t num_subframes -) + const int16_t num_subframes ) { int16_t i; int16_t j; @@ -1076,7 +1074,6 @@ ivas_error combine_external_and_head_orientations_rend( hExtOrientationData->enableHeadRotation[i] = 0; } } - } return combine_external_and_head_orientations( diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index e077679c11..5d545b4156 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -1591,8 +1591,7 @@ void ivas_SplitRenderer_PostRenderer( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o : Reference/out Binaural signals */ - const IVAS_QUATERNION Quaternion_act -) + const IVAS_QUATERNION Quaternion_act ) { int16_t pos_idx, b, brange[2], ch_idx1; int16_t num_md_bands, slot_idx, b2, index_slot, num_slots, sf_idx_md; @@ -1621,216 +1620,216 @@ void ivas_SplitRenderer_PostRenderer( num_slots = MAX_PARAM_SPATIAL_SUBFRAMES; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - pos_idx = MAX_HEAD_ROT_POSES - 1; + pos_idx = MAX_HEAD_ROT_POSES - 1; #else pos_idx = 0; #endif - sf_idx_md = 0; - get_interpolation_vars( pMultiBinPoseData, - &hBinPostRenderer->QuaternionsPre[sf_idx_md], - &Quaternion_act, - interp_yaw_pose_idx, - interp_pitch_pose_idx, - interp_roll_pose_idx, - &interp_yaw_fact, - &interp_pitch_fact, - &interp_roll_fact ); - for ( b = 0; b < num_md_bands; b++ ) + sf_idx_md = 0; + get_interpolation_vars( pMultiBinPoseData, + &hBinPostRenderer->QuaternionsPre[sf_idx_md], + &Quaternion_act, + interp_yaw_pose_idx, + interp_pitch_pose_idx, + interp_roll_pose_idx, + &interp_yaw_fact, + &interp_pitch_fact, + &interp_roll_fact ); + for ( b = 0; b < num_md_bands; b++ ) + { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - set_zero( mix_mat_re[ch_idx1], BINAURAL_CHANNELS ); - set_zero( mix_mat_im[ch_idx1], BINAURAL_CHANNELS ); - mix_mat_re[ch_idx1][ch_idx1] = 1.0f; - } - gd_int = 0.0f; - interpolate_rend_md( hBinPostRenderer->rot_md, mix_mat_re, mix_mat_im, &gd_int, sf_idx_md, b, interp_yaw_pose_idx, interp_pitch_pose_idx, interp_roll_pose_idx, interp_yaw_fact, interp_pitch_fact, interp_roll_fact ); + set_zero( mix_mat_re[ch_idx1], BINAURAL_CHANNELS ); + set_zero( mix_mat_im[ch_idx1], BINAURAL_CHANNELS ); + mix_mat_re[ch_idx1][ch_idx1] = 1.0f; + } + gd_int = 0.0f; + interpolate_rend_md( hBinPostRenderer->rot_md, mix_mat_re, mix_mat_im, &gd_int, sf_idx_md, b, interp_yaw_pose_idx, interp_pitch_pose_idx, interp_roll_pose_idx, interp_yaw_fact, interp_pitch_fact, interp_roll_fact ); - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - /*update the prediction matrix with interpolated matrix*/ - rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] = mix_mat_re[ch_idx1][0]; - rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] = mix_mat_re[ch_idx1][1]; - rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] = mix_mat_im[ch_idx1][0]; - rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] = mix_mat_im[ch_idx1][1]; - rot_md_act[pos_idx][b].gd = gd_int; - } + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { + /*update the prediction matrix with interpolated matrix*/ + rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] = mix_mat_re[ch_idx1][0]; + rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] = mix_mat_re[ch_idx1][1]; + rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] = mix_mat_im[ch_idx1][0]; + rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] = mix_mat_im[ch_idx1][1]; + rot_md_act[pos_idx][b].gd = gd_int; } + } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES - 1; pos_idx++ ) + { + for ( b = 0; b < num_md_bands; b++ ) { - for ( b = 0; b < num_md_bands; b++ ) + if ( hBinPostRenderer->pose_type[pos_idx] == PITCH_ONLY ) { - if ( hBinPostRenderer->pose_type[pos_idx] == PITCH_ONLY ) - { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - set_zero( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1], BINAURAL_CHANNELS ); - set_zero( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1], BINAURAL_CHANNELS ); - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][ch_idx1] = 1.0f; - } - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[0][0] *= hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[1][1] *= hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd2; - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = 0.0f; - } - else if ( hBinPostRenderer->pose_type[pos_idx] == ANY_ROLL ) + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = 0.0f; + set_zero( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1], BINAURAL_CHANNELS ); + set_zero( hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1], BINAURAL_CHANNELS ); + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][ch_idx1] = 1.0f; } + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[0][0] *= hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[1][1] *= hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd2; + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = 0.0f; + } + else if ( hBinPostRenderer->pose_type[pos_idx] == ANY_ROLL ) + { + hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd = 0.0f; + } - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { - /*update the prediction matrix with interpolated matrix*/ - rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; - rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; - rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; - rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; - rot_md_act[pos_idx][b].gd = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; - } + /*update the prediction matrix with interpolated matrix*/ + rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][0]; + rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_re[ch_idx1][1]; + rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][0]; + rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].pred_mat_im[ch_idx1][1]; + rot_md_act[pos_idx][b].gd = hBinPostRenderer->rot_md[pos_idx][sf_idx][b].gd; } } + } #endif #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) #else pos_idx = 0; #endif + { + for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) { - for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) + index_slot = slot_idx; /* TODO: can be cleaned up */ + fade = ( (float) slot_idx + 1.0f ) / MAX_PARAM_SPATIAL_SUBFRAMES; + fade = min( fade, 1.0f ); + for ( b = 0; b < num_md_bands; b++ ) { - index_slot = slot_idx; /* TODO: can be cleaned up */ - fade = ( (float) slot_idx + 1.0f ) / MAX_PARAM_SPATIAL_SUBFRAMES; - fade = min( fade, 1.0f ); - for ( b = 0; b < num_md_bands; b++ ) + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + if ( hBinPostRenderer->cf_flag ) { - if ( hBinPostRenderer->cf_flag ) - { - pMix_mat_re_prev[ch_idx1] = hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1]; - pMix_mat_im_prev[ch_idx1] = hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1]; - mix_mat_re[ch_idx1][0] = fade * ( rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] ) + - ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][0]; - mix_mat_re[ch_idx1][1] = fade * ( rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] ) + - ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][1]; - - mix_mat_im[ch_idx1][0] = fade * ( rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] ) + - ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][0]; - mix_mat_im[ch_idx1][1] = fade * ( rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] ) + - ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][1]; - } - else - { - mix_mat_re[ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0]; - mix_mat_re[ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1]; - mix_mat_im[ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0]; - mix_mat_im[ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1]; - } + pMix_mat_re_prev[ch_idx1] = hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1]; + pMix_mat_im_prev[ch_idx1] = hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1]; + mix_mat_re[ch_idx1][0] = fade * ( rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0] ) + + ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][0]; + mix_mat_re[ch_idx1][1] = fade * ( rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1] ) + + ( 1.0f - fade ) * pMix_mat_re_prev[ch_idx1][1]; + + mix_mat_im[ch_idx1][0] = fade * ( rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0] ) + + ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][0]; + mix_mat_im[ch_idx1][1] = fade * ( rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1] ) + + ( 1.0f - fade ) * pMix_mat_im_prev[ch_idx1][1]; + } + else + { + mix_mat_re[ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0]; + mix_mat_re[ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1]; + mix_mat_im[ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0]; + mix_mat_im[ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1]; } + } - brange[0] = pBand_grouping[b]; - brange[1] = pBand_grouping[b + 1]; - for ( b2 = brange[0]; b2 < brange[1]; b2++ ) + brange[0] = pBand_grouping[b]; + brange[1] = pBand_grouping[b + 1]; + for ( b2 = brange[0]; b2 < brange[1]; b2++ ) + { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - /* Apply prediction matrix */ - IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[0][index_slot][b2], - Cldfb_ImagBuffer_Ref_Binaural[0][index_slot][b2], - mix_mat_re[0][ch_idx1], - mix_mat_im[0][ch_idx1], - tmp_re, - tmp_im ); - pred_out_re[ch_idx1] = tmp_re; - pred_out_im[ch_idx1] = tmp_im; - - IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[1][index_slot][b2], - Cldfb_ImagBuffer_Ref_Binaural[1][index_slot][b2], - mix_mat_re[1][ch_idx1], - mix_mat_im[1][ch_idx1], - tmp_re, - tmp_im ); - pred_out_re[ch_idx1] += tmp_re; - pred_out_im[ch_idx1] += tmp_im; - } + /* Apply prediction matrix */ + IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[0][index_slot][b2], + Cldfb_ImagBuffer_Ref_Binaural[0][index_slot][b2], + mix_mat_re[0][ch_idx1], + mix_mat_im[0][ch_idx1], + tmp_re, + tmp_im ); + pred_out_re[ch_idx1] = tmp_re; + pred_out_im[ch_idx1] = tmp_im; + + IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[1][index_slot][b2], + Cldfb_ImagBuffer_Ref_Binaural[1][index_slot][b2], + mix_mat_re[1][ch_idx1], + mix_mat_im[1][ch_idx1], + tmp_re, + tmp_im ); + pred_out_re[ch_idx1] += tmp_re; + pred_out_im[ch_idx1] += tmp_im; + } - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) + { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - Cldfb_RealBuffer_Recons_Binaural[pos_idx][ch_idx1][index_slot][b2] = pred_out_re[ch_idx1]; - Cldfb_ImagBuffer_Recons_Binaural[pos_idx][ch_idx1][index_slot][b2] = pred_out_im[ch_idx1]; + Cldfb_RealBuffer_Recons_Binaural[pos_idx][ch_idx1][index_slot][b2] = pred_out_re[ch_idx1]; + Cldfb_ImagBuffer_Recons_Binaural[pos_idx][ch_idx1][index_slot][b2] = pred_out_im[ch_idx1]; #else Cldfb_RealBuffer_Ref_Binaural[ch_idx1][index_slot][b2] = pred_out_re[ch_idx1]; Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][index_slot][b2] = pred_out_im[ch_idx1]; #endif - } } } } } + } #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) #else pos_idx = 0; #endif + { + for ( b = 0; b < num_md_bands; b++ ) { - for ( b = 0; b < num_md_bands; b++ ) + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0]; - hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1]; - hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0]; - hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1]; - } - hBinPostRenderer->gd_mem[pos_idx][b] = rot_md_act[pos_idx][b].gd; + hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][0]; + hBinPostRenderer->mixer_mat_re[pos_idx][b][ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_re[ch_idx1][1]; + hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][0] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][0]; + hBinPostRenderer->mixer_mat_im[pos_idx][b][ch_idx1][1] = rot_md_act[pos_idx][b].pred_mat_im[ch_idx1][1]; } + hBinPostRenderer->gd_mem[pos_idx][b] = rot_md_act[pos_idx][b].gd; } - hBinPostRenderer->cf_flag = 1; + } + hBinPostRenderer->cf_flag = 1; #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG + { + int16_t num_cldfb_bands; + num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; + for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) { - int16_t num_cldfb_bands; - num_cldfb_bands = CLDFB_NO_CHANNELS_MAX; - for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ ) + index_slot = sf_idx * num_slots + slot_idx; + for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) { - index_slot = sf_idx * num_slots + slot_idx; - for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ ) - { - mvr2r( Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][index_slot], Cldfb_RealBuffer_Ref_Binaural[ch_idx1][index_slot], num_cldfb_bands ); - mvr2r( Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][index_slot], Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][index_slot], num_cldfb_bands ); - } + mvr2r( Cldfb_RealBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][index_slot], Cldfb_RealBuffer_Ref_Binaural[ch_idx1][index_slot], num_cldfb_bands ); + mvr2r( Cldfb_ImagBuffer_Recons_Binaural[MAX_HEAD_ROT_POSES - 1][ch_idx1][index_slot], Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][index_slot], num_cldfb_bands ); } + } - for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) - { - char fname[200] = "recons_out_pos"; - char tag[2]; - tag[0] = (char) ( '0' + pos_idx ); - tag[1] = '\0'; - strcat( fname, tag ); - strcat( fname, ".wav" ); - ivas_log_cldfb2wav_data( - Cldfb_RealBuffer_Recons_Binaural[pos_idx], - Cldfb_ImagBuffer_Recons_Binaural[pos_idx], - hBinPostRenderer->cldfbSynReconsBinDec[pos_idx], - BINAURAL_CHANNELS, - num_cldfb_bands, - 48000, - num_slots, - sf_idx * num_slots, - fname ); - } + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + char fname[200] = "recons_out_pos"; + char tag[2]; + tag[0] = (char) ( '0' + pos_idx ); + tag[1] = '\0'; + strcat( fname, tag ); + strcat( fname, ".wav" ); + ivas_log_cldfb2wav_data( + Cldfb_RealBuffer_Recons_Binaural[pos_idx], + Cldfb_ImagBuffer_Recons_Binaural[pos_idx], + hBinPostRenderer->cldfbSynReconsBinDec[pos_idx], + BINAURAL_CHANNELS, + num_cldfb_bands, + 48000, + num_slots, + sf_idx * num_slots, + fname ); } + } #endif pop_wmops(); @@ -1875,8 +1874,7 @@ static void ivas_rend_CldfbSplitPostRendProcessTdIn( pMultiBinPoseData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - QuaternionPost - ); + QuaternionPost ); /* Implement CLDFB synthesis */ for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) @@ -1936,8 +1934,7 @@ void ivas_rend_CldfbSplitPostRendProcess( pMultiBinPoseData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - QuaternionPost - ); + QuaternionPost ); /* Implement CLDFB synthesis */ for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) @@ -1951,9 +1948,7 @@ void ivas_rend_CldfbSplitPostRendProcess( ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch_idx][slot_idx]; } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX - / MAX_PARAM_SPATIAL_SUBFRAMES - , + cldfbSynthesis( RealBuffer, ImagBuffer, &( output[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); } diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index b40c4e519b..91cbd044ee 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -1814,8 +1814,7 @@ ivas_error ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, - IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits -) + IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ) { int16_t sf, i, j; hSplitBinRend->hSplitRendBits = hSplitRendBits; @@ -1885,10 +1884,8 @@ void ivas_init_split_rend_handles( *------------------------------------------------------------------------*/ static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWrapper, const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, - const int32_t OutSampleRate - , - const int16_t is_5ms_frame -) + const int32_t OutSampleRate, + const int16_t is_5ms_frame ) { ivas_error error; int16_t i, delayBufferLength; @@ -1908,10 +1905,7 @@ static ivas_error split_renderer_open_lc3plus( SPLIT_REND_WRAPPER *hSplitRendWra config.channels = BINAURAL_CHANNELS; - error = IVAS_LC3PLUS_ENC_Open( config, ivas_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode - , - (int16_t) ( config.ivas_frame_duration_us / 1000 ) - ), + error = IVAS_LC3PLUS_ENC_Open( config, ivas_get_lc3plus_bitrate( pSplitRendConfig->splitRendBitRate, pSplitRendConfig->poseCorrectionMode, (int16_t) ( config.ivas_frame_duration_us / 1000 ) ), &hSplitRendWrapper->hLc3plusEnc ); if ( error != IVAS_ERR_OK ) { @@ -1969,10 +1963,8 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const IVAS_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate, const int16_t is_cldfb_in, - const int16_t is_pcm_out - , - const int16_t is_5ms_frame -) + const int16_t is_pcm_out, + const int16_t is_5ms_frame ) { ivas_error error, ch, num_ch; #ifndef OSBA_SPLIT_RENDERING @@ -2084,10 +2076,8 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, { if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS ) { - error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate - , - is_5ms_frame - ); + error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate, + is_5ms_frame ); if ( error != IVAS_ERR_OK ) { return error; @@ -2609,8 +2599,8 @@ ivas_error ivas_renderMultiBinToSplitBinaural( pBits->codec = IVAS_SPLIT_REND_CODEC_NONE; } -/*zero pad*/ -/*TODO: do this inside the LCLD ENC codec */ + /*zero pad*/ + /*TODO: do this inside the LCLD ENC codec */ if ( pcm_out ) { bit_len = SplitRendBitRate / FRAMES_PER_SEC; diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 48f6683eee..af0672445b 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -456,7 +456,6 @@ void ivas_split_rend_bitstream_write_int32( } - #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG /*------------------------------------------------------------------------- * ivas_mat_mult_2by2_complex() @@ -593,16 +592,12 @@ int32_t ivas_get_lcld_bitrate( * * *------------------------------------------------------------------------*/ -int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode - , - int16_t split_prerender_frame_size_ms -) +int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, int16_t split_prerender_frame_size_ms ) { if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { int32_t inBandMdBps = (int32_t) ( 8 * 1000 / - split_prerender_frame_size_ms - ); + split_prerender_frame_size_ms ); return ivas_get_lcld_bitrate( SplitRendBitRate, poseCorrectionMode ) - inBandMdBps; } if ( poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) @@ -661,10 +656,7 @@ int8_t ivas_get_lc3plus_bitrate_id( * * *------------------------------------------------------------------------*/ -int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode - , - int16_t split_prerender_frame_size_ms -) +int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode, int16_t split_prerender_frame_size_ms ) { int32_t bitrate; @@ -702,15 +694,12 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL } } - bitrate = ivas_get_lc3plus_bitrate( bitrate, poseCorrectionMode - , - split_prerender_frame_size_ms - ); + bitrate = ivas_get_lc3plus_bitrate( bitrate, poseCorrectionMode, + split_prerender_frame_size_ms ); /* Return size in bytes */ return (int32_t) ( bitrate * - split_prerender_frame_size_ms - / 1000 / 8 ); + split_prerender_frame_size_ms / 1000 / 8 ); } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4d70f28d65..ba35d95042 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -58,9 +58,9 @@ /* Maximum buffer length (total) in samples. */ /* Maximum buffer length (total) in samples. */ #ifdef SPLIT_REND_WITH_HEAD_ROT -#define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) -#define MAX_CLDFB_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) -#define MAX_BIN_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) +#define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#define MAX_CLDFB_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#define MAX_BIN_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) #define MAX_CLDFB_BIN_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) #else #define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) @@ -2747,16 +2747,14 @@ static ivas_error setRendInputActiveSplitPostRend( outConfig = *rendCtx.pOutConfig; if ( ( error = allocateInputBaseBufferData( &inputSplitPostRend->bufferData, - MAX_CLDFB_BIN_BUFFER_LENGTH - ) ) != IVAS_ERR_OK ) + MAX_CLDFB_BIN_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } initRendInputBase( &inputSplitPostRend->base, inConfig, id, rendCtx, inputSplitPostRend->bufferData, - MAX_CLDFB_BIN_BUFFER_LENGTH - ); + MAX_CLDFB_BIN_BUFFER_LENGTH ); inputSplitPostRend->numCachedSamples = 0; @@ -3268,19 +3266,15 @@ static DecoderDummy *initDecoderDummy( ivas_orient_trk_Init( decDummy->hHeadTrackData->OrientationTracker ); /* External orientations */ - if ( ( error = ivas_external_orientation_open( &( decDummy->hExtOrientationData ) - , - num_subframes - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_external_orientation_open( &( decDummy->hExtOrientationData ), + num_subframes ) ) != IVAS_ERR_OK ) { assert( error == IVAS_ERR_OK ); } /* Combined orientations */ - if ( ( error = ivas_combined_orientation_open( &( decDummy->hCombinedOrientationData ) - , - num_subframes - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_combined_orientation_open( &( decDummy->hCombinedOrientationData ), + num_subframes ) ) != IVAS_ERR_OK ) { assert( error == IVAS_ERR_OK ); } @@ -3499,10 +3493,7 @@ static void clearInputMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT -static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const AUDIO_CONFIG outConfig, const int16_t cldfb_in - , - const int16_t is_5ms_frame -) +static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const AUDIO_CONFIG outConfig, const int16_t cldfb_in, const int16_t is_5ms_frame ) { ivas_error error; IVAS_REND_AudioBufferConfig bufConfig; @@ -3518,10 +3509,8 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN ivas_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); } - if ( ( error = ivas_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in, outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM - , - is_5ms_frame - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in, outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM, + is_5ms_frame ) ) != IVAS_ERR_OK ) { return error; } @@ -3558,10 +3547,8 @@ ivas_error IVAS_REND_Open( const int32_t outputSampleRate, const AUDIO_CONFIG outConfig, const int16_t nonDiegeticPan, - const float nonDiegeticPanGain - , - const int16_t num_subframes -) + const float nonDiegeticPanGain, + const int16_t num_subframes ) { int16_t i; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -3623,19 +3610,15 @@ ivas_error IVAS_REND_Open( } /* Initialize external orientation data */ - if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ) - , - num_subframes - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), + num_subframes ) ) != IVAS_ERR_OK ) { return error; } /* Initilize combined orientation data */ - if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ) - , - num_subframes - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), + num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -4224,10 +4207,8 @@ ivas_error IVAS_REND_AddInput( hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, - cldfb_in - , - ( hIvasRend->num_subframes == 1 ) ? 1 : 0 - ) ) != IVAS_ERR_OK ) + cldfb_in, + ( hIvasRend->num_subframes == 1 ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -5114,10 +5095,8 @@ int16_t IVAS_REND_FeedRenderConfig( hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, - cldfb_in - , - ( hIvasRend->num_subframes == 1 ) ? 1 : 0 - ) ) != IVAS_ERR_OK ) + cldfb_in, + ( hIvasRend->num_subframes == 1 ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -5170,7 +5149,7 @@ ivas_error IVAS_REND_FeedSplitBinauralBitstream( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetHeadRotation( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ const IVAS_VECTOR3 Pos /* i : listener positions for next rendering call */ #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -5178,8 +5157,7 @@ ivas_error IVAS_REND_SetHeadRotation( IVAS_SPLIT_REND_ROT_AXIS rot_axis #endif , - const int16_t sf_idx -) + const int16_t sf_idx ) { IVAS_QUATERNION rotQuat; @@ -5375,8 +5353,8 @@ ivas_error IVAS_REND_SetReferenceVector( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_SetExternalOrientation( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - IVAS_QUATERNION *orientation, /* i : external orientation data */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *orientation, /* i : external orientation data */ int8_t enableHeadRotation, /* i : flag to enable head rotation for this frame */ int8_t enableExternalOrientation, /* i : flag to enable external orientation for this frame */ int8_t enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */ @@ -5555,9 +5533,9 @@ static ivas_error chooseCrossfade( const IVAS_REND_HeadRotData *headRotData, con } static ivas_error rotateFrameMc( - IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ - AUDIO_CONFIG inConfig, /* i : Input Audio config */ - const LSSETUP_CUSTOM_STRUCT *pInCustomLs, /* i : Input Custom LS setup */ + IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ + AUDIO_CONFIG inConfig, /* i : Input Audio config */ + const LSSETUP_CUSTOM_STRUCT *pInCustomLs, /* i : Input Custom LS setup */ const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ @@ -5994,8 +5972,7 @@ static ivas_error renderIsmToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate - , + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -6569,8 +6546,7 @@ static ivas_error renderMcToBinaural( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate - , + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -6684,8 +6660,7 @@ static ivas_error renderMcToBinauralRoom( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate - , + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -6797,8 +6772,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, - p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate - , + p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -7249,10 +7223,8 @@ static ivas_error splitBinLc3plusDecode( } /* Read LC3plus bitstream size info */ lc3plusBitrateId = ivas_split_rend_bitstream_read_int32( bits, 8 ); - lc3plusBitstreamSize = ivas_get_lc3plus_size_from_id( (int8_t) lc3plusBitrateId, pose_correction - , - (int16_t) ( hSplitBin->hLc3plusDec->config.ivas_frame_duration_us / 1000 ) - ); + lc3plusBitstreamSize = ivas_get_lc3plus_size_from_id( (int8_t) lc3plusBitrateId, pose_correction, + (int16_t) ( hSplitBin->hLc3plusDec->config.ivas_frame_duration_us / 1000 ) ); for ( int16_t i = 0; i < BINAURAL_CHANNELS * hSplitBin->multiBinPoseData.num_poses; ++i ) { @@ -7509,9 +7481,7 @@ static ivas_error renderSplitBinauralWithPostRot( cldfbSynthesis( RealBuffer, ImagBuffer, &( tmpCrendBuffer[ch_idx][sf_idx * outBufNumSamplesPerChannel] ), - hSplitBin->hBinHrSplitPostRend->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX - / MAX_PARAM_SPATIAL_SUBFRAMES - , + hSplitBin->hBinHrSplitPostRend->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx] ); } } @@ -7676,10 +7646,8 @@ static ivas_error renderSbaToMultiBinaural( static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t low_res_pre_rend_rot - , - int16_t num_subframes -) + const int16_t low_res_pre_rend_rot, + int16_t num_subframes ) { float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -7694,10 +7662,8 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, Cldfb_ImagBuffer, Cldfb_Out_Real, Cldfb_Out_Imag, - low_res_pre_rend_rot - , - num_subframes - ); + low_res_pre_rend_rot, + num_subframes ); return IVAS_ERR_OK; } @@ -7722,10 +7688,8 @@ static ivas_error renderSbaToSplitBinaural( renderSbaToMultiBinauralCldfb( sbaInput, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - low_res_pre_rend_rot - , - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) - ); + low_res_pre_rend_rot, + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ); accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio ); } else @@ -7769,10 +7733,8 @@ static ivas_error renderSbaToBinaural( renderSbaToMultiBinauralCldfb( sbaInput, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - 0 - , - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) - ); + 0, + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ); accumulateCLDFBArrayToBuffer( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, &outAudio ); } else @@ -7829,8 +7791,7 @@ static ivas_error renderSbaToBinaural( /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, - NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate - , + NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -7933,8 +7894,7 @@ static ivas_error renderSbaToBinauralRoom( /* call CREND */ if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, - NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate - , + NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -8025,9 +7985,7 @@ static ivas_error renderInputSba( #ifdef SPLIT_REND_WITH_HEAD_ROT cldfb2tdSampleFact = outAudio.config.is_cldfb ? 2 : 1; - if ( ( sbaInput->base.numNewSamplesPerChannel - * cldfb2tdSampleFact - != outAudio.config.numSamplesPerChannel ) && + if ( ( sbaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) @@ -8089,8 +8047,7 @@ static ivas_error renderInputSba( #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderActiveInputsSplitBin( IVAS_REND_HANDLE hIvasRend, - IVAS_REND_AudioBuffer outAudio -) + IVAS_REND_AudioBuffer outAudio ) { int16_t i; input_split_post_rend *pCurrentInput; @@ -8200,17 +8157,13 @@ static void renderMasaToMc( if ( masaInput->decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { - ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels - , - getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) - ); + ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, + getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) ); } else { - ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels - , - getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) - ); + ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, + getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) ); } accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); @@ -8233,10 +8186,8 @@ static void renderMasaToSba( copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer_buff ); copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); - ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels - , - getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) - ); + ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, + getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) ); accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); @@ -8263,10 +8214,8 @@ static void renderMasaToBinaural( copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer_buff ); copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hSpatParamRendCom ); - ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels - , - getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) - ); + ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, + getNumSubframesInBuffer( &outAudio, *masaInput->base.ctx.pOutSampleRate ) ); #ifdef SPLIT_REND_WITH_HEAD_ROT if ( is_split_rend_mode ) { @@ -8429,9 +8378,7 @@ static ivas_error renderInputMasa( inAudio = masaInput->base.inputBuffer; #ifdef SPLIT_REND_WITH_HEAD_ROT cldfb2tdSampleFact = outAudio.config.is_cldfb ? 2 : 1; - if ( ( masaInput->base.numNewSamplesPerChannel - * cldfb2tdSampleFact - != outAudio.config.numSamplesPerChannel ) && + if ( ( masaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) @@ -8853,8 +8800,7 @@ static ivas_error getSamplesInternal( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( error = renderActiveInputsSplitBin( hIvasRend, outAudio - ) ) != IVAS_ERR_OK ) + if ( ( error = renderActiveInputsSplitBin( hIvasRend, outAudio ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 2d9967811d..d81d494828 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -198,10 +198,8 @@ ivas_error split_rend_write_bitstream_to_file( int32_t *bits_read, int32_t *bits_written, IVAS_SPLIT_REND_CODEC codec, - IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection - , - int16_t codec_frame_size_ms -) + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection, + int16_t codec_frame_size_ms ) { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; size_t header_len, i, num_bytes; @@ -282,10 +280,8 @@ ivas_error split_rend_read_bits_from_file( int32_t *bits_read, int32_t *bits_written, IVAS_SPLIT_REND_CODEC *codec, - IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection - , - int16_t *codec_frame_size_ms -) + IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, + int16_t *codec_frame_size_ms ) { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index a7b21a8e6b..86db58bb7f 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -61,10 +61,8 @@ ivas_error split_rend_write_bitstream_to_file( int32_t *bits_read, int32_t *bits_written, IVAS_SPLIT_REND_CODEC codec, - IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection - , - int16_t codec_frame_size_ms -); + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection, + int16_t codec_frame_size_ms ); /* read split rend coded bits from file */ ivas_error split_rend_read_bits_from_file( @@ -73,10 +71,8 @@ ivas_error split_rend_read_bits_from_file( int32_t *bits_read, int32_t *bits_written, IVAS_SPLIT_REND_CODEC *codec, - IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection - , - int16_t *codec_frame_size_ms -); + IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, + int16_t *codec_frame_size_ms ); /* read split pre rend delay */ ivas_error split_rend_read_pre_rend_delay_ns( -- GitLab