From 1b01c0a35b60fbcd1257515bb24bd853ee32803c Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:01:09 +0200 Subject: [PATCH 01/14] accept REMOVE_UNUSED_FUNCTION --- lib_com/ivas_fb_mixer.c | 64 ++------ lib_com/ivas_prot.h | 15 +- lib_com/ivas_spar_com.c | 17 +-- lib_com/options.h | 2 - lib_dec/ivas_agc_dec.c | 17 +-- lib_dec/ivas_dec.c | 9 +- lib_dec/ivas_dirac_dec.c | 6 - lib_dec/ivas_jbm_dec.c | 9 +- lib_dec/ivas_lfe_dec.c | 38 +---- lib_dec/ivas_qmetadata_dec.c | 85 +---------- lib_dec/ivas_sba_dec.c | 13 +- lib_dec/ivas_sba_rendering_internal.c | 110 +------------ lib_dec/ivas_spar_md_dec.c | 75 +++------ lib_enc/ivas_qmetadata_enc.c | 212 +------------------------- lib_enc/ivas_sba_enc.c | 33 ---- lib_enc/ivas_spar_encoder.c | 10 +- lib_enc/ivas_spar_md_enc.c | 69 +++------ 17 files changed, 70 insertions(+), 714 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 2b11a08405..a8f5d23365 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -726,73 +726,33 @@ void ivas_fb_mixer_process( *-----------------------------------------------------------------------------------------*/ void ivas_fb_mixer_get_in_out_mapping( - const IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */ -#ifndef REMOVE_UNUSED_FUNCTION - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t enc_dec_flag, /* i : encoder or decoder flag */ - const int16_t *order, /* i : downmix order */ -#endif - int16_t in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i/o: mixing mapping */ + const IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */ + int16_t in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i/o: mixing mapping */ ) { int16_t i, j; set_s( (int16_t *) in_out_mixer_map, 0, IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH ); -#ifndef REMOVE_UNUSED_FUNCTION - if ( enc_dec_flag == ENC ) + + if ( fb_cfg->active_w_mixing ) { -#endif - if ( fb_cfg->active_w_mixing ) - { - for ( i = 0; i < fb_cfg->num_out_chans; i++ ) - { - for ( j = 0; j < fb_cfg->num_in_chans; j++ ) - { - in_out_mixer_map[i][j] = 1; - } - } - } - else + for ( i = 0; i < fb_cfg->num_out_chans; i++ ) { - in_out_mixer_map[0][0] = 1; /* W depends on only W input*/ - for ( i = 1; i < fb_cfg->num_out_chans; i++ ) + for ( j = 0; j < fb_cfg->num_in_chans; j++ ) { - in_out_mixer_map[i][0] = 1; + in_out_mixer_map[i][j] = 1; } } -#ifndef REMOVE_UNUSED_FUNCTION } else { in_out_mixer_map[0][0] = 1; /* W depends on only W input*/ - for ( i = 1; i < nchan_transport; i++ ) + for ( i = 1; i < fb_cfg->num_out_chans; i++ ) { - in_out_mixer_map[order[i]][0] = 1; - in_out_mixer_map[order[i]][i] = 1; - } - if ( nchan_transport == 1 ) - { - /* no cross predicitons in 1 ch dmx*/ - for ( i = nchan_transport; i < fb_cfg->num_out_chans; i++ ) - { - in_out_mixer_map[order[i]][0] = 1; - in_out_mixer_map[order[i]][i] = 1; - } - } - else - { - /* handle the cross predictions and decorrelation*/ - for ( i = nchan_transport; i < fb_cfg->num_out_chans; i++ ) - { - for ( j = 0; j < nchan_transport; j++ ) - { - in_out_mixer_map[order[i]][j] = 1; - } - in_out_mixer_map[order[i]][i] = 1; - } + in_out_mixer_map[i][0] = 1; } } -#endif + return; } @@ -825,8 +785,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 06b5e86191..5656733f5f 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -110,12 +110,7 @@ ivas_error mct_enc_reconfigure( ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -#ifndef REMOVE_UNUSED_FUNCTION -/*! r: maximum SBA metadata bit-budget */ -int16_t ivas_sba_get_max_md_bits( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -); -#endif + void destroy_sce_enc( SCE_ENC_HANDLE hSCE /* i/o: SCE encoder structure */ ); @@ -4164,9 +4159,6 @@ ivas_error ivas_sba_linear_renderer( const int16_t nchan_ism, const AUDIO_CONFIG output_config, /* i : output audio configuration */ const IVAS_OUTPUT_SETUP output_setup /* i : output format setup */ -#ifndef REMOVE_UNUSED_FUNCTION - ,const float hoa_dec_mtx[] /* i : HOA decoding mtx */ -#endif ); void ivas_sba_mix_matrix_determiner( @@ -6036,11 +6028,6 @@ void ivas_fb_mixer_process( void ivas_fb_mixer_get_in_out_mapping( const IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */ -#ifndef REMOVE_UNUSED_FUNCTION - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t enc_dec_flag, /* i : encoder or decoder flag */ - const int16_t *order, /* i : downmix order */ -#endif int16_t in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i/o: mixing mapping */ ); diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index d2ad98012f..ba3fd9b995 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -251,20 +251,11 @@ int16_t ivas_get_sba_num_TCs( ) { int16_t table_idx, nchan_transport; -#ifndef REMOVE_UNUSED_FUNCTION - if ( ivas_total_brate == IVAS_SID_5k2 ) - { - nchan_transport = 1; - } - else - { -#endif - table_idx = ivas_get_spar_table_idx( ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); - nchan_transport = ivas_spar_br_table_consts[table_idx].nchan_transport; -#ifndef REMOVE_UNUSED_FUNCTION - } -#endif + table_idx = ivas_get_spar_table_idx( ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + + nchan_transport = ivas_spar_br_table_consts[table_idx].nchan_transport; + return nchan_transport; } diff --git a/lib_com/options.h b/lib_com/options.h index 715489a10b..5d5731eb42 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,8 +158,6 @@ #define ROM_TO_RAM /*Dlb : ROM optimization in SR mode*/ #define FIX_712_713_SPLIT_REND_MASA_MC /*Dlb : Fix for issue 712 and 713*/ #endif -#define REMOVE_UNUSED_FUNCTION /* Dlb: Remove functions that are unhit/unused */ - #define FIX_708_DPID_COMMAND_LINE /* issue 708: sanity checks for '-dpid' command-line */ #define FIX_513_REND_MC_ALLOC /* FhG: issue 513, optimise external renderer allocation for multichannel */ diff --git a/lib_dec/ivas_agc_dec.c b/lib_dec/ivas_agc_dec.c index c1ddd8c05d..9722514dbf 100644 --- a/lib_dec/ivas_agc_dec.c +++ b/lib_dec/ivas_agc_dec.c @@ -255,21 +255,8 @@ void ivas_agc_read_bits( /* read AGC parameters */ if ( AGC_flag == 1 ) { -#ifndef REMOVE_UNUSED_FUNCTION - if ( n_channels > 1 ) - { - for ( i = 0; i < n_channels; i++ ) - { - per_ch_bit[i] = get_next_indice( st0, 1 ); - } - } - else - { -#endif - per_ch_bit[0] = 1; -#ifndef REMOVE_UNUSED_FUNCTION - } -#endif + per_ch_bit[0] = 1; + assert( AGC_BITS_PER_CH == ( pState->agc_com.betaE + 1 ) ); for ( i = 0; i < n_channels; i++ ) { diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 95a2823ddd..b603b10b3a 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -442,14 +442,7 @@ ivas_error ivas_dec( { if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { - if ( ( error = ivas_sba_linear_renderer( p_output, output_frame, nchan_remapped, - 0, - output_config, st_ivas->hOutSetup -#ifndef REMOVE_UNUSED_FUNCTION - , - st_ivas->hoa_dec_mtx -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_linear_renderer( p_output, output_frame, nchan_remapped, 0, output_config, st_ivas->hOutSetup ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 8768d76300..e23a4171db 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -310,12 +310,6 @@ static ivas_error ivas_dirac_rend_config( /* Directional and diffuses components in SHD */ /* Diffuseness components up to 1st order */ hDirACRend->num_outputs_diff = ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ) * ( min( hDirACRend->hOutSetup.ambisonics_order, 1 ) + 1 ); -#ifndef REMOVE_UNUSED_FUNCTION - if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ivas_total_brate >= IVAS_96k ) && ( hDirACRend->hOutSetup.ambisonics_order > 1 ) && ( nchan_transport < 4 ) ) - { - hDirACRend->num_outputs_diff += 2; /* Add 2nd-order planar components for HRs */ - } -#endif hDirACRend->num_outputs_dir = ivas_sba_get_nchan( hDirACRend->hOutSetup.ambisonics_order, 0 ); } else if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index a69965d3f9..9f1e4b5375 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1135,14 +1135,7 @@ ivas_error ivas_jbm_dec_render( mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); } - if ( ( error = ivas_sba_linear_renderer( p_output, *nSamplesRendered, nchan_remapped, - 0, - output_config, st_ivas->hOutSetup -#ifndef REMOVE_UNUSED_FUNCTION - , - st_ivas->hoa_dec_mtx -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_linear_renderer( p_output, *nSamplesRendered, nchan_remapped, 0, output_config, st_ivas->hOutSetup ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_lfe_dec.c b/lib_dec/ivas_lfe_dec.c index 25ab513af5..63899b1074 100644 --- a/lib_dec/ivas_lfe_dec.c +++ b/lib_dec/ivas_lfe_dec.c @@ -357,9 +357,6 @@ ivas_error ivas_create_lfe_dec( { float low_pass_delay_dec_out, block_offset_s; int16_t filt_order, output_frame; -#ifndef REMOVE_UNUSED_FUNCTION - const float *filt_coeff; -#endif LFE_DEC_HANDLE hLFE; float lfe_addl_delay_s; int16_t i, j; @@ -404,38 +401,9 @@ ivas_error ivas_create_lfe_dec( hLFE->lfe_block_delay_s = ( IVAS_LFE_FADE_NS / 1000000000.f ) + ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3]; block_offset_s = BLOCK_OFFSET_MS * 0.001f; -#ifndef REMOVE_UNUSED_FUNCTION - if ( ( block_offset_s - hLFE->lfe_block_delay_s ) >= ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3] ) - { - filt_order = IVAS_FILTER_ORDER_4; - low_pass_delay_dec_out = ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3]; - } - else if ( ( block_offset_s - hLFE->lfe_block_delay_s ) >= ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_2 - 2] ) - { - filt_order = IVAS_FILTER_ORDER_2; - low_pass_delay_dec_out = ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_2 - 2]; - } - else - { -#endif - filt_order = 0; - low_pass_delay_dec_out = 0; -#ifndef REMOVE_UNUSED_FUNCTION - } - - if ( filt_order > 0 ) - { - /* filter init */ - ivas_lfe_lpf_select_filt_coeff( output_Fs, filt_order, &filt_coeff ); - ivas_filters_init( &hLFE->filter_state, filt_coeff, filt_order ); - } - else - { -#endif - hLFE->filter_state.order = filt_order; -#ifndef REMOVE_UNUSED_FUNCTION - } -#endif + filt_order = 0; + low_pass_delay_dec_out = 0; + hLFE->filter_state.order = filt_order; hLFE->lfe_block_delay_s = hLFE->lfe_block_delay_s + low_pass_delay_dec_out; hLFE->lfe_prior_buf_len = NS2SA( output_Fs, IVAS_LFE_FADE_NS ); diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 3fe570e8d4..3a5510d5cb 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -88,9 +88,7 @@ static int16_t ivas_diffuseness_huff_ec_decode( const uint16_t *bitstream, int16 static int16_t read_GR_min_removed_data( uint16_t *bitstream, int16_t *p_bit_pos, const int16_t *no_cv_vec, const int16_t no_data, int16_t *decoded_idx, const int16_t no_symb ); static int16_t decode_fixed_rate_composed_index_coherence( uint16_t *bitstream, int16_t *p_bit_pos, const int16_t no_bands, int16_t *no_cv_vec, uint16_t *decoded_index, const int16_t no_symb ); -#ifndef REMOVE_UNUSED_FUNCTION -static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); -#endif + static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr_512( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction ); static int16_t ivas_qmetadata_raw_decode_dir_512( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const int16_t nbands, const int16_t start_band, const SPHERICAL_GRID_DATA *sph_grid16 ); @@ -1570,88 +1568,7 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness( return ( index_start - *index ); } -#ifndef REMOVE_UNUSED_FUNCTION -/*-------------------------------------------------------------------* - * ivas_qmetadata_entropy_decode_diffuseness_hr() - * - * - *-------------------------------------------------------------------*/ - -static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr( - uint16_t *bitstream, /* i : bitstream */ - int16_t *index, - IVAS_QDIRECTION *q_direction, - uint16_t *diffuseness_index_max_ec_frame ) -{ - int16_t b; - uint16_t dif_min; - int16_t index_start; - int16_t nbands; - int16_t start_band; - - index_start = *index; - nbands = q_direction->cfg.nbands; - start_band = q_direction->cfg.start_band; - - /* diffuseness decoding */ - /* Handle one band as special case*/ - if ( nbands == 1 ) - { - q_direction->band_data[0].energy_ratio_index[0] = 0; - for ( b = 0; b < MASA_BITS_ER_HR; b++ ) - { - q_direction->band_data[0].energy_ratio_index[0] = ( q_direction->band_data[0].energy_ratio_index[0] << 1 ) + bitstream[( *index )--]; - } - *diffuseness_index_max_ec_frame = 5; - - return MASA_BITS_ER_HR; - } - if ( bitstream[( *index )--] == 0 ) /* dif_use_raw_coding */ - { - /* Decode with similarity strategy with low band count. On higher band counts, decode with Huffman-coding strategy. */ - - if ( bitstream[( *index )--] != 0 ) /* dif_have_unique_value */ - { - dif_min = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, HR_MASA_ER_LEVELS ); /* dif_unique_value */ - - for ( b = start_band; b < nbands; b++ ) - { - q_direction->band_data[b].energy_ratio_index[0] = dif_min; - } - } - else /* all diffuseness values are dif_min_value or dif_min_value + 1 */ - { - dif_min = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, HR_MASA_ER_LEVELS - 1 ); /* dif_min_value */ - - for ( b = start_band; b < nbands; b++ ) - { - q_direction->band_data[b].energy_ratio_index[0] = dif_min + bitstream[( *index )--]; /* dif_bit_offset_values */ - } - } - } - else /* different values for diffuseness */ - { - dif_min = HR_MASA_ER_LEVELS; - - for ( b = start_band; b < nbands; b++ ) - { - q_direction->band_data[b].energy_ratio_index[0] = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, HR_MASA_ER_LEVELS ); - dif_min = min( dif_min, q_direction->band_data[b].energy_ratio_index[0] ); - } - } - - *diffuseness_index_max_ec_frame = 10; - /* adaptively select the diffuseness_index_max_ec threshold */ - if ( dif_min > 10 ) - { - *diffuseness_index_max_ec_frame = HR_MASA_ER_LEVELS - 1; - } - - return ( index_start - *index ); -} - -#endif /*-------------------------------------------------------------------* * ivas_qmetadata_entropy_decode_diffuseness_hr_512() * diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index d91c442123..6860e2f8a1 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -885,9 +885,7 @@ ivas_error ivas_sba_dec_render( SPAR_DEC_HANDLE hSpar; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; float *output_f_local[MAX_OUTPUT_CHANNELS]; -#ifndef REMOVE_UNUSED_FUNCTION - ivas_error error; -#endif + hSpar = st_ivas->hSpar; hSpatParamRendCom = st_ivas->hSpatParamRendCom; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -931,14 +929,7 @@ ivas_error ivas_sba_dec_render( if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { - ivas_sba_linear_renderer( output_f, *nSamplesRendered, st_ivas->hIntSetup.nchan_out_woLFE, - 0, - st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup -#ifndef REMOVE_UNUSED_FUNCTION - , - st_ivas->hoa_dec_mtx -#endif - ); + ivas_sba_linear_renderer( output_f, *nSamplesRendered, st_ivas->hIntSetup.nchan_out_woLFE, 0, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup ); } if ( st_ivas->hDirAC != NULL && hSpar->slots_rendered == hSpar->num_slots ) diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 37635b0810..f33ef78d53 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -496,12 +496,7 @@ ivas_error ivas_sba_upmixer_renderer( output_f[ch] = output[ch]; } - if ( ( error = ivas_sba_linear_renderer( output_f, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->nchan_ism, output_config, st_ivas->hOutSetup -#ifndef REMOVE_UNUSED_FUNCTION - , - st_ivas->hoa_dec_mtx -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_sba_linear_renderer( output_f, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->nchan_ism, output_config, st_ivas->hOutSetup ) ) != IVAS_ERR_OK ) { return error; } @@ -511,67 +506,7 @@ ivas_error ivas_sba_upmixer_renderer( return IVAS_ERR_OK; } -#ifndef REMOVE_UNUSED_FUNCTION -/*-------------------------------------------------------------------* - * ivas_sba_mtx_mult() - * - * HOA decoding with LFE insertion - *-------------------------------------------------------------------*/ - -static void ivas_sba_mtx_mult( - float *output_f[], /* i/o: synthesized core-corder transport channels/DirAC output */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t nchan_in, /* i : Number of ambisonic channels */ - const IVAS_OUTPUT_SETUP output_setup, /* i : Output configuration */ - const float *mtx_hoa_decoder /* i : HOA decoding mtx */ -) -{ - int16_t i, k, ch_idx; - int16_t idx_lfe; - float input_f[16]; - const float *hoa_decoder; - - assert( ( nchan_in >= FOA_CHANNELS ) && "Number of input channels must be at least 4 (FOA)!\n" ); - - for ( i = 0; i < output_frame; i++ ) - { - /* init*/ - idx_lfe = 0; - hoa_decoder = &mtx_hoa_decoder[0]; - for ( k = 0; k < nchan_in; k++ ) - { - input_f[k] = output_f[k][i]; - } - /* mtx mult with LFE insertion*/ - for ( ch_idx = 0; ch_idx < ( output_setup.nchan_out_woLFE + output_setup.num_lfe ); ch_idx++ ) - { - if ( ( output_setup.num_lfe > 0 ) && ( output_setup.index_lfe[idx_lfe] == ch_idx ) ) - { - /*LFE insertion*/ - output_f[ch_idx][i] = 0.f; - if ( idx_lfe < ( output_setup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else - { - /*HOA decoding*/ - output_f[ch_idx][i] = input_f[0] * hoa_decoder[0]; - for ( k = 1; k < nchan_in; k++ ) - { - output_f[ch_idx][i] += input_f[k] * hoa_decoder[k]; - } - hoa_decoder += 16; - } - } - } - - return; -} - -#endif /*-------------------------------------------------------------------* * ivas_sba_linear_renderer() * @@ -585,16 +520,9 @@ ivas_error ivas_sba_linear_renderer( const int16_t nchan_ism, const AUDIO_CONFIG output_config, /* i : output audio configuration */ const IVAS_OUTPUT_SETUP output_setup /* i : output format setup */ -#ifndef REMOVE_UNUSED_FUNCTION - , - const float hoa_dec_mtx[] /* i : HOA decoding mtx */ -#endif ) { int16_t i; -#ifndef REMOVE_UNUSED_FUNCTION - float dmx_l; -#endif int16_t nchan_hoa; ivas_error error; @@ -614,42 +542,6 @@ ivas_error ivas_sba_linear_renderer( switch ( output_config ) { -#ifndef REMOVE_UNUSED_FUNCTION - case IVAS_AUDIO_CONFIG_MONO: - /* If stereo DMX, MONO = W = Cardioids L + R*/ - if ( nchan_in == 2 ) - { - for ( i = 0; i < output_frame; i++ ) - { - output_f[0][i] += output_f[1][i]; - } - } - /* else: do nothing, MONO = W*/ - break; - case IVAS_AUDIO_CONFIG_STEREO: - assert( ( nchan_in >= 2 ) && "Number of input channels must be at least 2 (for W and Y)!\n" ); - - /* Compute L and R cardioids from SB format except if stereo DMX is transmitted already in this format*/ - if ( nchan_in > 2 ) - { - /*Build L/R cardioids*/ - for ( i = 0; i < output_frame; i++ ) - { - dmx_l = 0.5f * ( output_f[0][i] + output_f[1][i] ); /* cardioid_left = 0.5(W + Y) */ - output_f[1][i] = 0.5f * ( output_f[0][i] - output_f[1][i] ); /* cardioid_right = 0.5(W - Y) */ - output_f[0][i] = dmx_l; - } - } - break; - case IVAS_AUDIO_CONFIG_5_1: - case IVAS_AUDIO_CONFIG_7_1: - case IVAS_AUDIO_CONFIG_5_1_2: - case IVAS_AUDIO_CONFIG_5_1_4: - case IVAS_AUDIO_CONFIG_7_1_4: - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - ivas_sba_mtx_mult( output_f, output_frame, nchan_hoa, output_setup, hoa_dec_mtx ); - break; -#endif case IVAS_AUDIO_CONFIG_FOA: /* Ambisonics output, order: 1 */ case IVAS_AUDIO_CONFIG_HOA2: /* Ambisonics output, order: 2 */ case IVAS_AUDIO_CONFIG_HOA3: /* Ambisonics output, order: 3 */ diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index d87aafac27..fd232b1b0c 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -2238,9 +2238,6 @@ static void ivas_parse_parameter_bitstream_dtx( int16_t idx; float pr_min_max[2]; int16_t pr_q_lvls, pr, pd, pd_q_lvls, pr_pd_bits; -#ifndef REMOVE_UNUSED_FUNCTION - int16_t pr_q_lvls1, pr_q_lvls2, pr_idx1, pr_idx2, pr_pr_bits; -#endif int16_t zero_pad_bits, sid_bits_len; sid_bits_len = st0->next_bit_pos; @@ -2264,67 +2261,37 @@ static void ivas_parse_parameter_bitstream_dtx( if ( pr_idx_1 != 0 || pd_idx_1 != 0 || pr_idx_2 != 0 || pd_idx_2 != 0 ) { -#ifndef REMOVE_UNUSED_FUNCTION - if ( pr_idx_1 == 0 || pr_idx_2 == 0 ) - { -#endif - pr_q_lvls = dtx_pr_real_q_levels[ndm - 1][pd_idx_1 - 1]; - - if ( ( j + 1 ) > ndec ) - { - pd_q_lvls = 1; - } - else - { - pd_q_lvls = dtx_pd_real_q_levels[ndm - 1][pd_idx_2 - 1]; - } - - pr_pd_bits = ivas_get_bits_to_encode( pd_q_lvls * pr_q_lvls ); - - value = get_next_indice( st0, pr_pd_bits ); + pr_q_lvls = dtx_pr_real_q_levels[ndm - 1][pd_idx_1 - 1]; - pr = (int16_t) floor( value / pd_q_lvls ); - pd = value - pr * pd_q_lvls; - val = dtx_pd_real_min_max[0]; - ivas_quantise_real_values( &val, pd_q_lvls, dtx_pd_real_min_max[0], dtx_pd_real_min_max[1], &idx, &val, 1 ); - pd = pd + idx; - - val = pr_min_max[0]; - ivas_quantise_real_values( &val, pr_q_lvls, pr_min_max[0], pr_min_max[1], &idx, &val, 1 ); - pr = pr + idx; - - if ( ( j + 1 ) <= ndec ) - { - pSpar_md->band_coeffs_idx[i].decd_index_re[pd_idx_2 - 1] = pd; - } - - pSpar_md->band_coeffs_idx[i].pred_index_re[pd_idx_1 - 1] = pr; -#ifndef REMOVE_UNUSED_FUNCTION + if ( ( j + 1 ) > ndec ) + { + pd_q_lvls = 1; } else { - pr_q_lvls1 = dtx_pr_real_q_levels[ndm - 1][pr_idx_1 - 1]; - pr_q_lvls2 = dtx_pr_real_q_levels[ndm - 1][pr_idx_2 - 1]; - - pr_pr_bits = ivas_get_bits_to_encode( pr_q_lvls1 * pr_q_lvls2 ); + pd_q_lvls = dtx_pd_real_q_levels[ndm - 1][pd_idx_2 - 1]; + } - value = get_next_indice( st0, pr_pr_bits ); + pr_pd_bits = ivas_get_bits_to_encode( pd_q_lvls * pr_q_lvls ); - pr_idx2 = (int16_t) floor( value / pr_q_lvls1 ); - pr_idx1 = value - pr_idx2 * pr_q_lvls1; - val = pr_min_max[0]; - ivas_quantise_real_values( &val, pr_q_lvls1, pr_min_max[0], pr_min_max[1], &idx, &val, 1 ); + value = get_next_indice( st0, pr_pd_bits ); - pr_idx1 += idx; + pr = (int16_t) floor( value / pd_q_lvls ); + pd = value - pr * pd_q_lvls; + val = dtx_pd_real_min_max[0]; + ivas_quantise_real_values( &val, pd_q_lvls, dtx_pd_real_min_max[0], dtx_pd_real_min_max[1], &idx, &val, 1 ); + pd = pd + idx; - val = pr_min_max[0]; - ivas_quantise_real_values( &val, pr_q_lvls2, pr_min_max[0], pr_min_max[1], &idx, &val, 1 ); + val = pr_min_max[0]; + ivas_quantise_real_values( &val, pr_q_lvls, pr_min_max[0], pr_min_max[1], &idx, &val, 1 ); + pr = pr + idx; - pr_idx2 += idx; - pSpar_md->band_coeffs_idx[i].pred_index_re[pr_idx_1 - 1] = pr_idx1; - pSpar_md->band_coeffs_idx[i].pred_index_re[pr_idx_2 - 1] = pr_idx2; + if ( ( j + 1 ) <= ndec ) + { + pSpar_md->band_coeffs_idx[i].decd_index_re[pd_idx_2 - 1] = pd; } -#endif + + pSpar_md->band_coeffs_idx[i].pred_index_re[pd_idx_1 - 1] = pr; } } } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 2233d16489..63ad2bb680 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -114,17 +114,13 @@ static int16_t write_2dir_info( BSTR_ENC_HANDLE hMetaData, uint8_t *twoDirBands, static void transform_azimuth_dir2( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *dir2_bands ); static int16_t calc_var_azi( const IVAS_QDIRECTION *q_direction, const int16_t diffuseness_index_max_ec_frame, const float avg_azimuth, float *avg_azimuth_out ); -#ifndef REMOVE_UNUSED_FUNCTION -static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, int16_t *nbits_diff, int16_t *dfRatioBits, const int16_t bits_dir_hr ); -#endif + static int16_t ivas_qmetadata_entropy_encode_diffuseness_hr( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, const int16_t bits_dir_hr, BSTR_ENC_HANDLE hMetaData ); static int16_t encode_surround_coherence_hr( IVAS_QMETADATA *hQMetaData, BSTR_ENC_HANDLE hMetaData ); -#ifndef REMOVE_UNUSED_FUNCTION -static void ivas_qmetadata_reorder_2dir_bands_hr( IVAS_QMETADATA_HANDLE hQMetaData ); -#endif + static int16_t ivas_qmetadata_quantize_coherence_hr_512( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t bits_coh ); static int16_t write_stream_dct_coeffs_omasa( int16_t *q_idx, const int16_t len_stream, BSTR_ENC_HANDLE hMetaData, const int16_t first_line, const int16_t low_bitrate_mode ); @@ -1361,152 +1357,7 @@ int16_t quantize_direction2D( return idx_sph; } -#ifndef REMOVE_UNUSED_FUNCTION -/*------------------------------------------------------------------------- - * ivas_qmetadata_quantize_diffuseness_nrg_ratios() - * - * Quantize diffuseness - *------------------------------------------------------------------------*/ - -static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr( - IVAS_QMETADATA_HANDLE hQMetaData, - int16_t *needed_bits, - int16_t *nbits_diff, - int16_t *dfRatioBits, - const int16_t bits_dir_hr ) -{ - int16_t j, k, dir2band; - int16_t index_dirRatio1Inv, index_dirRatio2Inv, index_dirRatio1Inv_mod, index_dirRatio2Inv_mod; - int16_t index_diff; - - nbits_diff[0] = 0; - nbits_diff[1] = 0; - needed_bits[0] = 0; - needed_bits[1] = 0; - dir2band = 0; - - for ( j = hQMetaData->q_direction[0].cfg.start_band; j < hQMetaData->q_direction[0].cfg.nbands; ++j ) - { - if ( hQMetaData->no_directions == 2 && hQMetaData->twoDirBands[j] == 1 ) - { - float dirRatio1, dirRatio2, diffRatio, sumRatio, dfRatio, dfRatioQ, diffRatioQ, dirRatio1Q, dirRatio2Q; - int16_t dfRatio_index, dfRatio_qsteps, dfRatio_bits; - - /* With 2dir metadata, we quantize and transmit diffuse-to-total ratio (diffRatio) and - * distribution factor of direct-to-total ratios (dFRatio). This is more efficient and - * accurate than simple separate quantization of each direct-to-total ratio or their - * separate inverses. */ - dirRatio1 = hQMetaData->q_direction[0].band_data[j].energy_ratio[0]; - dirRatio2 = hQMetaData->q_direction[1].band_data[dir2band].energy_ratio[0]; - sumRatio = dirRatio1 + dirRatio2; - diffRatio = 1.0f - sumRatio; - dfRatio = sumRatio < EPSILON ? 0.5f : dirRatio1 / sumRatio; - - index_diff = masa_sq( diffRatio, diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); - diffRatioQ = diffuseness_reconstructions_hr[index_diff]; - - dfRatio_bits = ivas_get_df_ratio_bits( index_diff >> 1 ); - - dfRatioBits[dir2band] = dfRatio_bits; - - dfRatio_qsteps = ( 1 << dfRatio_bits ); - dfRatio_index = usquant( dfRatio, &dfRatioQ, 0.5f, 0.5f / ( dfRatio_qsteps - 1 ), dfRatio_qsteps ); - - /* Direction quantization requires also separately quantized direct-to-total ratios. Thus, we calculate them. */ - dirRatio1Q = dfRatioQ * ( 1.0f - diffRatioQ ); - dirRatio2Q = ( 1.0f - diffRatioQ ) - dirRatio1Q; - - index_dirRatio1Inv = masa_sq( 1.0f - dirRatio1Q, diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); - - /* Note: To save memory, we store temporarily index_diff and dfRatio_index into first and second direction - * energy ratio index variables until they have been encoded. index_dirRatio1Inv and index_dirRatio2Inv are - * then later retrieved for further use in encoding. */ - for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) - { - hQMetaData->q_direction[0].band_data[j].energy_ratio_index[k] = index_diff; - hQMetaData->q_direction[0].band_data[j].energy_ratio[k] = dirRatio1Q; - } - nbits_diff[0] += MASA_BITS_ER_HR; - - index_dirRatio2Inv = masa_sq( 1.0f - dirRatio2Q, diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); - for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) - { - hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[k] = dfRatio_index; - hQMetaData->q_direction[1].band_data[dir2band].energy_ratio[k] = dirRatio2Q; - } - nbits_diff[1] += dfRatio_bits; - - /* Obtain compensated direct-to-total ratios for direction quantization. This compensates for the - * fact that with 2dir data, it is harder to achieve separate high direct-to-total ratio values - * which are assumed by the direction quantization system. In practice, this improves direction - * accuracy when it is perceptual meaningful. */ - masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod, 0 ); - - for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) - { - hQMetaData->q_direction[0].band_data[j].energy_ratio_index_mod[k] = index_dirRatio1Inv_mod; - - if ( bits_dir_hr > 0 ) - { - hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_dir_hr; - } - else - { - - hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_direction_masa[index_dirRatio1Inv_mod]; - } - } - needed_bits[0] += hQMetaData->q_direction[0].cfg.nblocks * bits_direction_masa[index_dirRatio1Inv_mod]; - - for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) - { - hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index_mod[k] = index_dirRatio2Inv_mod; - - if ( bits_dir_hr > 0 ) - { - hQMetaData->q_direction[1].band_data[dir2band].bits_sph_idx[k] = bits_dir_hr; - } - else - { - - hQMetaData->q_direction[1].band_data[dir2band].bits_sph_idx[k] = bits_direction_masa[index_dirRatio2Inv_mod]; - } - } - needed_bits[1] += hQMetaData->q_direction[1].cfg.nblocks * bits_direction_masa[index_dirRatio2Inv_mod]; - - dir2band++; - } - else - { - index_dirRatio1Inv = masa_sq( 1.0f - hQMetaData->q_direction[0].band_data[j].energy_ratio[0], diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); - - for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) - { - hQMetaData->q_direction[0].band_data[j].energy_ratio_index[k] = index_dirRatio1Inv; - hQMetaData->q_direction[0].band_data[j].energy_ratio_index_mod[k] = index_dirRatio1Inv; - hQMetaData->q_direction[0].band_data[j].energy_ratio[k] = 1.0f - diffuseness_reconstructions_hr[index_dirRatio1Inv]; - - if ( bits_dir_hr > 0 ) - { - hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_dir_hr; - } - else - { - - hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_direction_masa[index_dirRatio1Inv]; - } - } - - nbits_diff[0] += MASA_BITS_ER_HR; - - needed_bits[0] += hQMetaData->q_direction[0].cfg.nblocks * bits_dir_hr; - } - } - - return; -} -#endif static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, @@ -5834,65 +5685,6 @@ static void ivas_qmetadata_reorder_2dir_bands( return; } -#ifndef REMOVE_UNUSED_FUNCTION -/*-------------------------------------------------------------------* - * ivas_qmetadata_reorder_2dir_bands_hr() - * - * - *-------------------------------------------------------------------*/ - -static void ivas_qmetadata_reorder_2dir_bands_hr( - IVAS_QMETADATA_HANDLE hQMetaData ) -{ - int16_t nbands, nsubframes; - int16_t band, sf; - uint16_t uint16_tmp; - float flt_tmp; - uint8_t uint8_tmp; - - nbands = hQMetaData->q_direction[0].cfg.nbands; - nsubframes = hQMetaData->q_direction[0].cfg.nblocks; - - for ( band = 0; band < nbands; band++ ) - { - if ( hQMetaData->twoDirBands[band] == 1 ) - { - for ( sf = 0; sf < nsubframes; sf++ ) - { - if ( hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] < hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] ) - { - uint16_tmp = hQMetaData->q_direction[0].band_data[band].spherical_index[sf]; - hQMetaData->q_direction[0].band_data[band].spherical_index[sf] = hQMetaData->q_direction[1].band_data[band].spherical_index[sf]; - hQMetaData->q_direction[1].band_data[band].spherical_index[sf] = uint16_tmp; - - flt_tmp = hQMetaData->q_direction[0].band_data[band].azimuth[sf]; - hQMetaData->q_direction[0].band_data[band].azimuth[sf] = hQMetaData->q_direction[1].band_data[band].azimuth[sf]; - hQMetaData->q_direction[1].band_data[band].azimuth[sf] = flt_tmp; - - flt_tmp = hQMetaData->q_direction[0].band_data[band].elevation[sf]; - hQMetaData->q_direction[0].band_data[band].elevation[sf] = hQMetaData->q_direction[1].band_data[band].elevation[sf]; - hQMetaData->q_direction[1].band_data[band].elevation[sf] = flt_tmp; - - uint8_tmp = hQMetaData->q_direction[0].band_data[band].distance[sf]; - hQMetaData->q_direction[0].band_data[band].distance[sf] = hQMetaData->q_direction[1].band_data[band].distance[sf]; - hQMetaData->q_direction[1].band_data[band].distance[sf] = uint8_tmp; - - uint8_tmp = hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf]; - hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = hQMetaData->q_direction[1].coherence_band_data[band].spread_coherence[sf]; - hQMetaData->q_direction[1].coherence_band_data[band].spread_coherence[sf] = uint8_tmp; - - - flt_tmp = hQMetaData->q_direction[0].band_data[band].energy_ratio[sf]; - hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = hQMetaData->q_direction[1].band_data[band].energy_ratio[sf]; - hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] = flt_tmp; - } - } - } - } - - return; -} -#endif /*-------------------------------------------------------------------* * write_2dir_info() diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 0798f8bbee..3206833930 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -262,36 +262,3 @@ ivas_error ivas_sba_enc_reconfigure( return error; } -#ifndef REMOVE_UNUSED_FUNCTION -/*-------------------------------------------------------------------* - * ivas_sba_get_max_md_bits() - * - * Return maximum SBA metadata bit-budget - *-------------------------------------------------------------------*/ - -/*! r: maximum SBA metadata bit-budget */ -int16_t ivas_sba_get_max_md_bits( - Encoder_Struct *st_ivas /* i/o: Encoder struct */ -) -{ - int16_t max_md_bits; - int16_t max_bits; - - if ( ivas_get_hodirac_flag( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ) ) - { - max_bits = 2000; - } - else - { - max_bits = 500; - } - - max_md_bits = min( st_ivas->hQMetaData->metadata_max_bits + 1, max_bits ); // TODO: remove 500 once max MD bits has been defined at all bitrates in DirAC - if ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT ) - { - max_md_bits += st_ivas->hSpar->hMdEnc->spar_md_cfg.max_md_bits_spar; - } - - return max_md_bits; -} -#endif diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index e4df299553..ec31fe9c67 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -784,15 +784,7 @@ static ivas_error ivas_spar_enc_process( * FB mixer *-----------------------------------------------------------------------------------------*/ - ivas_fb_mixer_get_in_out_mapping( hSpar->hFbMixer->fb_cfg, -#ifndef REMOVE_UNUSED_FUNCTION - nchan_transport, - - ENC, - - remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order], -#endif - in_out_mixer_map ); + ivas_fb_mixer_get_in_out_mapping( hSpar->hFbMixer->fb_cfg, in_out_mixer_map ); #ifdef DEBUG_SBA_MD_DUMP { diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index d8348c5f67..3e8666e24d 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -1719,66 +1719,33 @@ static void ivas_write_parameter_bitstream_dtx( if ( pr_idx_1 != 0 || pd_idx_1 != 0 || pr_idx_2 != 0 || pd_idx_2 != 0 ) { -#ifndef REMOVE_UNUSED_FUNCTION - if ( pr_idx_1 == 0 || pr_idx_2 == 0 ) - { -#endif - pr_q_lvls = dtx_pr_real_q_levels[ndm - 1][pd_idx_1 - 1]; - pr = pSpar_md->band_coeffs_idx[i].pred_index_re[pd_idx_1 - 1]; - - if ( ( j + 1 ) > ndec ) - { - pd_q_lvls = 1; - pd = 0; - } - else - { - pd_q_lvls = dtx_pd_real_q_levels[ndm - 1][pd_idx_2 - 1]; - pd = pSpar_md->band_coeffs_idx[i].decd_index_re[pd_idx_2 - 1]; - } - val = dtx_pd_real_min_max[0]; - ivas_quantise_real_values( &val, pd_q_lvls, dtx_pd_real_min_max[0], dtx_pd_real_min_max[1], &idx, &val, 1 ); - - pd -= idx; - - val = pr_min_max[0]; - ivas_quantise_real_values( &val, pr_q_lvls, pr_min_max[0], pr_min_max[1], &idx, &val, 1 ); + pr_q_lvls = dtx_pr_real_q_levels[ndm - 1][pd_idx_1 - 1]; + pr = pSpar_md->band_coeffs_idx[i].pred_index_re[pd_idx_1 - 1]; - pr -= idx; - pr_pd_bits = ivas_get_bits_to_encode( pd_q_lvls * pr_q_lvls ); - - value = (uint16_t) ( pr * pd_q_lvls + pd ); - - push_next_indice( hMetaData, value, pr_pd_bits ); -#ifndef REMOVE_UNUSED_FUNCTION + if ( ( j + 1 ) > ndec ) + { + pd_q_lvls = 1; + pd = 0; } else { - int16_t pr_q_lvls1, pr_q_lvls2; - int16_t pr_idx1, pr_idx2, pr_pr_bits; - - pr_q_lvls1 = dtx_pr_real_q_levels[ndm - 1][pr_idx_1 - 1]; - pr_q_lvls2 = dtx_pr_real_q_levels[ndm - 1][pr_idx_2 - 1]; - val = pr_min_max[0]; - ivas_quantise_real_values( &val, pr_q_lvls1, pr_min_max[0], pr_min_max[1], &idx, &val, 1 ); - - pr_idx1 = pSpar_md->band_coeffs_idx[i].pred_index_re[pr_idx_1 - 1]; - - pr_idx1 -= idx; + pd_q_lvls = dtx_pd_real_q_levels[ndm - 1][pd_idx_2 - 1]; + pd = pSpar_md->band_coeffs_idx[i].decd_index_re[pd_idx_2 - 1]; + } + val = dtx_pd_real_min_max[0]; + ivas_quantise_real_values( &val, pd_q_lvls, dtx_pd_real_min_max[0], dtx_pd_real_min_max[1], &idx, &val, 1 ); - val = pr_min_max[0]; - ivas_quantise_real_values( &val, pr_q_lvls2, pr_min_max[0], pr_min_max[1], &idx, &val, 1 ); + pd -= idx; - pr_idx2 = pSpar_md->band_coeffs_idx[i].pred_index_re[pr_idx_2 - 1]; + val = pr_min_max[0]; + ivas_quantise_real_values( &val, pr_q_lvls, pr_min_max[0], pr_min_max[1], &idx, &val, 1 ); - pr_idx2 -= idx; - value = (uint16_t) ( pr_idx2 * pr_q_lvls1 + pr_idx1 ); + pr -= idx; + pr_pd_bits = ivas_get_bits_to_encode( pd_q_lvls * pr_q_lvls ); - pr_pr_bits = ivas_get_bits_to_encode( pr_q_lvls1 * pr_q_lvls2 ); + value = (uint16_t) ( pr * pd_q_lvls + pd ); - push_next_indice( hMetaData, value, pr_pr_bits ); - } -#endif + push_next_indice( hMetaData, value, pr_pd_bits ); } } } -- GitLab From 5a369a8aa19de1debc0b1a4213f02a0757f06213 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:09:48 +0200 Subject: [PATCH 02/14] accept FIX_708_DPID_COMMAND_LINE --- apps/decoder.c | 33 ++++----------------------------- apps/renderer.c | 4 ---- lib_com/ivas_error.h | 4 ---- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 2 -- lib_dec/ivas_stat_dec.h | 9 +++------ lib_dec/lib_dec.c | 34 +++++++++++++--------------------- lib_dec/lib_dec.h | 2 -- 8 files changed, 20 insertions(+), 69 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index e09e8fe209..243686a50b 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -145,10 +145,9 @@ typedef struct #endif #endif uint16_t acousticEnvironmentId; -#ifdef FIX_708_DPID_COMMAND_LINE int16_t Opt_dpid_on; -#endif uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; + } DecArguments; @@ -434,13 +433,8 @@ int main( * Configure the decoder *------------------------------------------------------------------------------------------*/ - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.enable5ms, - arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, -#ifdef FIX_708_DPID_COMMAND_LINE - arg.Opt_dpid_on, -#endif - arg.acousticEnvironmentId, - arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.enable5ms, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, + arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -1002,9 +996,7 @@ static bool parseCmdlIVAS_dec( arg->renderConfigEnabled = false; arg->renderConfigFilename = NULL; -#ifdef FIX_708_DPID_COMMAND_LINE arg->Opt_dpid_on = 0; -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT arg->outputMdFilename = NULL; @@ -1031,11 +1023,7 @@ static bool parseCmdlIVAS_dec( arg->acousticEnvironmentId = 65535; for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { -#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY arg->directivityPatternId[i] = 65535; -#else - arg->directivityPatternId[i] = 0; -#endif } /*-----------------------------------------------------------------* @@ -1424,17 +1412,13 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( argv_to_upper, "-DPID" ) == 0 ) { -#ifdef FIX_708_DPID_COMMAND_LINE - int16_t id; + int16_t id, tmp; arg->Opt_dpid_on = 1; -#endif ++i; - int16_t tmp; tmp = 0; while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS ) { -#ifdef FIX_708_DPID_COMMAND_LINE id = (int16_t) atoi( argv[i + tmp] ); if ( !is_digits_only( argv[i + tmp] ) || id < 0 ) @@ -1445,13 +1429,9 @@ static bool parseCmdlIVAS_dec( } arg->directivityPatternId[tmp] = id; -#else - arg->directivityPatternId[tmp] = (int16_t) atoi( argv[i + tmp] ); -#endif ++tmp; } -#ifdef FIX_708_DPID_COMMAND_LINE if ( tmp == 0 ) { if ( argc - i <= 4 || argv[i][0] == '-' ) @@ -1468,7 +1448,6 @@ static bool parseCmdlIVAS_dec( return false; } } -#endif i += tmp; } @@ -1663,15 +1642,11 @@ static void usage_dec( void ) fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); #endif fprintf( stdout, "-exof File : External orientation File for external orientation trajectory\n" ); -#ifdef FIX_708_DPID_COMMAND_LINE fprintf( stdout, "-dpid ID : Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up\n" ); fprintf( stdout, " to 4 numbers (unsigned integers) can be specified for BINAURAL and BINAURAL_ROOM_REVERB\n" ); fprintf( stdout, " output configuration. ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\n" ); fprintf( stdout, " ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" ); fprintf( stdout, " otherwise a default directivity pattern is used.\n" ); -#else - fprintf( stdout, "-dpid ID : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration\n" ); -#endif fprintf( stdout, "-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" ); fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); diff --git a/apps/renderer.c b/apps/renderer.c index 7dd06a7223..1b11cde72a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -384,11 +384,7 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_directivityPatternId, .match = "ism_directivity_pattern_id", .matchShort = "dpid", -#ifdef FIX_708_DPID_COMMAND_LINE .description = "Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up to 4 numbers (unsigned integers) can be specified for BINAURAL and BINAURAL_ROOM_REVERB output configuration.\nID1, ID2, ID3, ID4 specify the directivity pattern IDs used for ISMs 1,2,3 and 4 respectively.\nThis options needs to be accompanied by a render_config file, otherwise a default directivity pattern is used.", -#else - .description = "Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration", -#endif }, { .id = CmdLnOptionId_acousticEnvironmentId, diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 48bbde5e2a..d2e0260646 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -75,9 +75,7 @@ typedef enum IVAS_ERR_INVALID_OUTPUT_FORMAT, IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED, IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED, -#ifdef FIX_708_DPID_COMMAND_LINE IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, -#endif IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED, IVAS_ERR_INVALID_HRTF, IVAS_ERR_INVALID_INPUT_FORMAT, @@ -253,10 +251,8 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) #endif case IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED: return "External orientation not supported"; -#ifdef FIX_708_DPID_COMMAND_LINE case IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED: return "Directivity not supported"; -#endif case IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED: return "Acoustic environment not supported"; case IVAS_ERR_INVALID_HRTF: diff --git a/lib_com/options.h b/lib_com/options.h index 5d5731eb42..820e93f69f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,7 +159,6 @@ #define FIX_712_713_SPLIT_REND_MASA_MC /*Dlb : Fix for issue 712 and 713*/ #endif -#define FIX_708_DPID_COMMAND_LINE /* issue 708: sanity checks for '-dpid' command-line */ #define FIX_513_REND_MC_ALLOC /* FhG: issue 513, optimise external renderer allocation for multichannel */ #define FIX_812_DOUBLE_PREC_MCT /* FhG: Issue 812: Avoid double precision in MCT */ #define FIX_807_VARIABLE_SPEED_DECODING /* FhG: Issue 807: Resolve "Variable Speed Decoding broken" */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 82ae35936f..12dcf0a127 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -3084,7 +3084,6 @@ static ivas_error doSanityChecks_IVAS( } } -#ifdef FIX_708_DPID_COMMAND_LINE if ( st_ivas->hDecoderConfig->Opt_dpid_on ) { if ( !( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) @@ -3092,7 +3091,6 @@ static ivas_error doSanityChecks_IVAS( return IVAS_ERROR( IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, "Wrong set-up: Directivity is not supported in this output configuration." ); } } -#endif if ( st_ivas->hDecoderConfig->Opt_aeid_on ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ceab947f3f..c30e6e2378 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1008,13 +1008,10 @@ typedef struct decoder_config_structure float non_diegetic_pan_gain; /* non diegetic panning gain*/ int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ int16_t Opt_ExternalOrientation; /* indiates whether external orientations are used */ -#ifdef FIX_708_DPID_COMMAND_LINE - int16_t Opt_dpid_on; /* indicates whether Directivity pattern option is used */ -#endif - int16_t Opt_aeid_on; /* indicates whether Acoustic environment option is used */ - - /* temp. development parameters */ + int16_t Opt_dpid_on; /* indicates whether Directivity pattern option is used */ + int16_t Opt_aeid_on; /* indicates whether Acoustic environment option is used */ #ifdef DEBUGGING + /* temp. development parameters */ int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ #endif int16_t Opt_tsm; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 27839b824a..cb72a48b5e 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -268,9 +268,7 @@ static void init_decoder_config( hDecoderConfig->Opt_5ms = 0; hDecoderConfig->Opt_delay_comp = 0; hDecoderConfig->Opt_ExternalOrientation = 0; -#ifdef FIX_708_DPID_COMMAND_LINE hDecoderConfig->Opt_dpid_on = 0; -#endif hDecoderConfig->Opt_aeid_on = 0; return; @@ -362,24 +360,22 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( *---------------------------------------------------------------------*/ 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 enable5ms, /* i : enable 5ms rendering path */ - 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 */ - const int16_t enableExternalOrientation, /* i : enable external orientations */ - const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ + 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 enable5ms, /* i : enable 5ms rendering path */ + 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 */ + const int16_t enableExternalOrientation, /* i : enable external orientations */ + const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ -#ifdef FIX_708_DPID_COMMAND_LINE - const int16_t Opt_dpid_on, /* i : enable directivity pattern option */ -#endif - const uint16_t acousticEnvironmentId, /* i : Acoustic environment ID */ - const int16_t delayCompensationEnabled /* i : enable delay compensation */ + const int16_t Opt_dpid_on, /* i : enable directivity pattern option */ + const uint16_t acousticEnvironmentId, /* i : Acoustic environment ID */ + const int16_t delayCompensationEnabled /* i : enable delay compensation */ ) { Decoder_Struct *st_ivas; @@ -437,9 +433,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->non_diegetic_pan_gain = non_diegetic_pan_gain; hDecoderConfig->Opt_delay_comp = delayCompensationEnabled; hDecoderConfig->Opt_ExternalOrientation = enableExternalOrientation; -#ifdef FIX_708_DPID_COMMAND_LINE hDecoderConfig->Opt_dpid_on = Opt_dpid_on; -#endif hDecoderConfig->Opt_aeid_on = acousticEnvironmentId != 65535 ? TRUE : FALSE; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2897,12 +2891,10 @@ static ivas_error printConfigInfo_dec( fprintf( stdout, "Non-diegetic panning: %.2f\n", st_ivas->hDecoderConfig->non_diegetic_pan_gain * 90.f ); } -#ifdef FIX_708_DPID_COMMAND_LINE if ( st_ivas->hDecoderConfig->Opt_dpid_on ) { fprintf( stdout, "Directivity pattern: ON\n" ); } -#endif if ( st_ivas->hDecoderConfig->Opt_aeid_on ) { diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index f541e49d63..5367fa9b58 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -134,9 +134,7 @@ ivas_error IVAS_DEC_Configure( const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ -#ifdef FIX_708_DPID_COMMAND_LINE const int16_t Opt_dpid_on, /* i : enable directivity pattern option */ -#endif const uint16_t acousticEnvironmentId, /* i : Acoustic environment ID */ const int16_t delayCompensationEnabled /* i : enable delay compensation */ ); -- GitLab From fbc8acdc1e3ea6bb10872d03a6bfc357a1ed4b80 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:13:42 +0200 Subject: [PATCH 03/14] accept FIX_513_REND_MC_ALLOC --- lib_com/options.h | 1 - lib_rend/lib_rend.c | 207 +++++++++++++++----------------------------- 2 files changed, 72 insertions(+), 136 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 820e93f69f..80ef681b18 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,7 +159,6 @@ #define FIX_712_713_SPLIT_REND_MASA_MC /*Dlb : Fix for issue 712 and 713*/ #endif -#define FIX_513_REND_MC_ALLOC /* FhG: issue 513, optimise external renderer allocation for multichannel */ #define FIX_812_DOUBLE_PREC_MCT /* FhG: Issue 812: Avoid double precision in MCT */ #define FIX_807_VARIABLE_SPEED_DECODING /* FhG: Issue 807: Resolve "Variable Speed Decoding broken" */ #define FIX_818_DOUBLE_PREC_KERNEN_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4da26ad279..3524045415 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2165,12 +2165,8 @@ static ivas_error initMcBinauralRendering( input_mc *inputMc, const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, - RENDER_CONFIG_DATA *hRendCfg -#ifdef FIX_513_REND_MC_ALLOC - , - uint8_t reconfigureFlag -#endif -) + RENDER_CONFIG_DATA *hRendCfg, + uint8_t reconfigureFlag ) { ivas_error error; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2178,7 +2174,6 @@ static ivas_error initMcBinauralRendering( #endif int32_t binauralDelayNs; int32_t outSampleRate; -#ifdef FIX_513_REND_MC_ALLOC int8_t useTDRend; /* Allocate TD binaural renderer for custom loudspeaker layouts (regardless of headrotation) @@ -2196,27 +2191,17 @@ static ivas_error initMcBinauralRendering( useTDRend = TRUE; } } -#endif /* if TD renderer was open and we need to use CREND, close it */ - if ( -#ifdef FIX_513_REND_MC_ALLOC - !reconfigureFlag || ( !useTDRend && -#endif - inputMc->tdRendWrapper.hBinRendererTd != NULL ) -#ifdef FIX_513_REND_MC_ALLOC - ) -#endif + if ( !reconfigureFlag || ( !useTDRend && inputMc->tdRendWrapper.hBinRendererTd != NULL ) ) { ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; } #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_513_REND_MC_ALLOC if ( !reconfigureFlag || !useTDRend ) { -#endif for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) @@ -2225,52 +2210,36 @@ static ivas_error initMcBinauralRendering( inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; } } -#ifdef FIX_513_REND_MC_ALLOC } #endif -#endif -#ifdef FIX_513_REND_MC_ALLOC /* if we need to use TD renderer and CREND was open, close it */ if ( useTDRend ) { -#endif ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT , inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); -#ifdef FIX_513_REND_MC_ALLOC } -#endif -#ifdef FIX_513_REND_MC_ALLOC if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) { -#endif ivas_reverb_close( &inputMc->hReverb ); -#ifdef FIX_513_REND_MC_ALLOC } -#endif -#ifdef FIX_513_REND_MC_ALLOC if ( !reconfigureFlag || ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) { -#endif if ( inputMc->efapInWrapper.hEfap != NULL ) { efap_free_data( &inputMc->efapInWrapper.hEfap ); } -#ifdef FIX_513_REND_MC_ALLOC } -#endif outSampleRate = *inputMc->base.ctx.pOutSampleRate; -#ifdef FIX_513_REND_MC_ALLOC if ( useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL ) -#endif { if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) { @@ -2294,11 +2263,7 @@ static ivas_error initMcBinauralRendering( } #endif - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB -#ifdef FIX_513_REND_MC_ALLOC - && inputMc->hReverb == NULL -#endif - ) + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { @@ -2306,29 +2271,21 @@ static ivas_error initMcBinauralRendering( } } } -#ifdef FIX_513_REND_MC_ALLOC - else if ( !useTDRend && inputMc->crendWrapper == NULL ) /* open CREND */ -#endif + else if ( !useTDRend && inputMc->crendWrapper == NULL ) { + /* open CREND */ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) #endif - { return error; } -#ifdef FIX_513_REND_MC_ALLOC } -#endif /* Initialise the EFAP handle for rotation on input layout */ - if ( inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled -#ifdef FIX_513_REND_MC_ALLOC - && inputMc->efapInWrapper.hEfap == NULL -#endif - ) + if ( inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled && inputMc->efapInWrapper.hEfap == NULL ) { if ( ( error = initEfap( &inputMc->efapInWrapper, inConfig, NULL ) ) != IVAS_ERR_OK ) { @@ -2365,7 +2322,7 @@ static ivas_error initMcMasaRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2493,13 +2450,11 @@ static ivas_error setRendInputActiveMc( initRotGains( inputMc->rot_gains_prev[pos_idx] ); } #else - initRotGains( inputMc->rot_gains_prev ); + initRotGains( inputMc->rot_gains_prev ); #endif inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); -#ifdef FIX_513_REND_MC_ALLOC inputMc->binauralDelaySmp = 0; -#endif #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) @@ -2509,15 +2464,10 @@ static ivas_error setRendInputActiveMc( if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { - if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg -#ifdef FIX_513_REND_MC_ALLOC - , - FALSE -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) { return error; } @@ -2564,7 +2514,7 @@ static void clearInputMc( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2776,7 +2726,7 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { @@ -2794,7 +2744,7 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -2864,7 +2814,7 @@ static ivas_error initSbaMasaRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputSba->crendWrapper ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); #endif if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) @@ -2902,7 +2852,7 @@ static ivas_error setRendInputActiveSba( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #else - if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #endif { return error; @@ -2911,7 +2861,7 @@ static ivas_error setRendInputActiveSba( #ifdef SPLIT_REND_WITH_HEAD_ROT initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ); #else - initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); + initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); #endif setZeroPanMatrix( inputSba->hoaDecMtx ); @@ -2923,9 +2873,9 @@ static ivas_error setRendInputActiveSba( initRotGains( inputSba->rot_gains_prev[pos_idx] ); } #else - inputSba->crendWrapper = NULL; - inputSba->hDirAC = NULL; - initRotGains( inputSba->rot_gains_prev ); + inputSba->crendWrapper = NULL; + inputSba->hDirAC = NULL; + initRotGains( inputSba->rot_gains_prev ); #endif if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) @@ -2997,7 +2947,7 @@ static void clearInputSba( ivas_rend_closeCldfbRend( &inputSba->cldfbRendWrapper ); } #else - ivas_rend_closeCrend( &inputSba->crendWrapper ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); #endif ivas_dirac_ana_close( &( inputSba->hDirAC ) ); @@ -3313,7 +3263,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hDiracDecBin[i] = NULL; } #else - decDummy->hDiracDecBin = NULL; + decDummy->hDiracDecBin = NULL; #endif decDummy->hDirACRend = NULL; decDummy->hSpatParamRendCom = NULL; @@ -3435,7 +3385,7 @@ static ivas_error setRendInputActiveMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0, rendCtx.pSplitRendWrapper ); #else - inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); + inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); #endif inputMasa->metadataHasBeenFed = false; @@ -3541,7 +3491,7 @@ static void freeDecoderDummy( #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN ivas_dirac_dec_close_binaural_data( pDecDummy->hDiracDecBin ); #else - ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); + ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); #endif /* TC buffer */ @@ -4417,18 +4367,10 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { - if ( ( error = initMcBinauralRendering( inputMc, - inputMc->base.inConfig, - hIvasRend->outputConfig, - hIvasRend->hRendererConfig -#ifdef FIX_513_REND_MC_ALLOC - , - FALSE -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, FALSE ) ) != IVAS_ERR_OK ) { return error; } @@ -4836,7 +4778,7 @@ ivas_error IVAS_REND_FeedInputAudio( if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) #else - if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); @@ -4853,8 +4795,8 @@ ivas_error IVAS_REND_FeedInputAudio( hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); @@ -4886,7 +4828,7 @@ ivas_error IVAS_REND_FeedInputAudio( #ifdef SPLIT_REND_WITH_HEAD_ROT inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel / cldfb2tdSampleFact; #else - inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; + inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; #endif return IVAS_ERR_OK; @@ -5244,9 +5186,7 @@ ivas_error IVAS_REND_SetHeadRotation( #endif const int16_t sf_idx ) { -#ifdef FIX_513_REND_MC_ALLOC int16_t i; -#endif IVAS_QUATERNION rotQuat; ivas_error error; @@ -5262,7 +5202,6 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } -#ifdef FIX_513_REND_MC_ALLOC hIvasRend->headRotData.headRotEnabled = 1; /* reconfigure binaural rendering to allocate @@ -5278,7 +5217,7 @@ ivas_error IVAS_REND_SetHeadRotation( TRUE ); } } -#endif + /* check for Euler angle signaling */ if ( headRot.w == -3.0f ) { @@ -5314,9 +5253,8 @@ ivas_error IVAS_REND_DisableHeadRotation( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ ) { -#ifdef FIX_513_REND_MC_ALLOC int16_t i; -#endif + /* Validate function arguments */ if ( hIvasRend == NULL ) { @@ -5324,7 +5262,7 @@ ivas_error IVAS_REND_DisableHeadRotation( } hIvasRend->headRotData.headRotEnabled = 0; -#ifdef FIX_513_REND_MC_ALLOC + /* reconfigure binaural rendering to allocate the necessary renderers and free unused ones */ if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) @@ -5342,7 +5280,6 @@ ivas_error IVAS_REND_DisableHeadRotation( } } -#endif return IVAS_ERR_OK; } @@ -5983,7 +5920,7 @@ static int16_t getNumSubframesInBuffer( #ifdef SPLIT_REND_WITH_HEAD_ROT return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES * cldfb2tdSampleFact ) ); #else - return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif } @@ -6139,9 +6076,9 @@ static ivas_error renderIsmToBinauralRoom( NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { @@ -6562,7 +6499,7 @@ static ivas_error renderLfeToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); #else - assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); + assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); #endif push_wmops( "renderLfeToBinaural" ); @@ -6621,12 +6558,12 @@ static ivas_error renderLfeToBinaural( } } #else /* SPLIT_REND_WITH_HEAD_ROT */ - /* Copy LFE to left and right ears */ - for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) - { - writePtr = getSmplPtr( outAudio, ear_idx, 0 ); - v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); - } + /* Copy LFE to left and right ears */ + for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) + { + writePtr = getSmplPtr( outAudio, ear_idx, 0 ); + v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); + } #endif /* SPLIT_REND_WITH_HEAD_ROT */ pop_wmops(); @@ -6696,7 +6633,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6716,8 +6653,8 @@ static ivas_error renderMcToBinaural( 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 ), 0 ) ) != IVAS_ERR_OK ) #else - 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 ) ) ) != IVAS_ERR_OK ) + 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 ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6729,7 +6666,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { @@ -6803,7 +6740,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6823,8 +6760,8 @@ static ivas_error renderMcToBinauralRoom( 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 ), 0 ) ) != IVAS_ERR_OK ) #else - 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 ) ) ) != IVAS_ERR_OK ) + 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 ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6836,7 +6773,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6899,7 +6836,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6931,8 +6868,8 @@ static ivas_error renderMcCustomLsToBinauralRoom( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, - p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, + p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6943,7 +6880,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7874,8 +7811,8 @@ static ivas_error renderSbaToBinaural( if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev[0], tmpRotBuffer ) ) != IVAS_ERR_OK ) #else - if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, - sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, + sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7894,8 +7831,8 @@ static ivas_error renderSbaToBinaural( if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7964,7 +7901,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT sbaInput->rot_gains_prev[0], #else - sbaInput->rot_gains_prev, + sbaInput->rot_gains_prev, #endif tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -7998,7 +7935,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -8089,7 +8026,7 @@ static ivas_error renderInputSba( if ( ( sbaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); @@ -8502,7 +8439,7 @@ static ivas_error renderInputMasa( if ( ( masaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); @@ -8531,7 +8468,7 @@ static ivas_error renderInputMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT renderMasaToBinaural( masaInput, outAudio, 0 ); #else - renderMasaToBinaural( masaInput, outAudio ); + renderMasaToBinaural( masaInput, outAudio ); #endif break; /* ToDo */ @@ -8808,7 +8745,7 @@ static ivas_error getSamplesInternal( if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) #else - if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) + if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -8825,8 +8762,8 @@ static ivas_error getSamplesInternal( hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); @@ -8939,9 +8876,9 @@ static ivas_error getSamplesInternal( #ifndef DISABLE_LIMITER #ifdef DEBUGGING - hIvasRend->numClipping += + hIvasRend->numClipping += #endif - limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); + limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif #endif /* SPLIT_REND_WITH_HEAD_ROT */ @@ -8982,7 +8919,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, @@ -9023,7 +8960,7 @@ ivas_error IVAS_REND_GetSamples( return getSamplesInternal( hIvasRend, outAudio, NULL ); #else - return getSamplesInternal( hIvasRend, outAudio ); + return getSamplesInternal( hIvasRend, outAudio ); #endif } -- GitLab From a43903367cff013f3ba1d47762d5938662f63fb1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:15:36 +0200 Subject: [PATCH 04/14] accept FIX_812_DOUBLE_PREC_MCT --- lib_com/options.h | 1 - lib_dec/ivas_mct_dec.c | 8 -------- lib_enc/ivas_mct_enc.c | 4 ---- 3 files changed, 13 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 80ef681b18..cd3aa31ede 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,7 +159,6 @@ #define FIX_712_713_SPLIT_REND_MASA_MC /*Dlb : Fix for issue 712 and 713*/ #endif -#define FIX_812_DOUBLE_PREC_MCT /* FhG: Issue 812: Avoid double precision in MCT */ #define FIX_807_VARIABLE_SPEED_DECODING /* FhG: Issue 807: Resolve "Variable Speed Decoding broken" */ #define FIX_818_DOUBLE_PREC_KERNEN_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index bd8341d70d..d0397411e5 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -428,11 +428,7 @@ ivas_error create_mct_dec( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ -#ifdef FIX_812_DOUBLE_PREC_MCT hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); -#else - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); -#endif set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); @@ -589,11 +585,7 @@ ivas_error mct_dec_reconfigure( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ -#ifdef FIX_812_DOUBLE_PREC_MCT hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); -#else - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); -#endif set_s( hMCT->chBitRatios, 0, MCT_MAX_CHANNELS ); set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index d3862915ca..a664d4974d 100755 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -71,11 +71,7 @@ static void set_mct_enc_params( hMCT->currBlockDataCnt = 0; /*Initialize bits required to signal channel-pair index*/ -#ifdef FIX_812_DOUBLE_PREC_MCT hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floorf( ( logf( (float) hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) * INV_LOG_2 ) ) + 1 ) ); -#else - hMCT->bitsChannelPairIndex = max( 1, (int16_t) ( floor( ( log( hMCT->nchan_out_woLFE * ( hMCT->nchan_out_woLFE - 1 ) / 2 - 1 ) / log( 2. ) ) ) + 1 ) ); -#endif set_s( hMCT->lowE_ch, 0, MCT_MAX_CHANNELS ); -- GitLab From f498f6787c035bec979acd99d3f8fde65d59781b Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:16:24 +0200 Subject: [PATCH 05/14] accept FIX_807_VARIABLE_SPEED_DECODING --- apps/decoder.c | 5 ----- lib_com/options.h | 1 - 2 files changed, 6 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 243686a50b..f126cafb5d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1543,12 +1543,7 @@ static bool parseCmdlIVAS_dec( return false; } -#ifdef FIX_807_VARIABLE_SPEED_DECODING if ( ( !arg->enableHeadRotation ) && ( !arg->enableExternalOrientation ) && ( !arg->tsmEnabled ) ) -#else - if ( ( !arg->enableHeadRotation ) && ( !arg->enableExternalOrientation ) ) -#endif - { arg->enable5ms = false; } diff --git a/lib_com/options.h b/lib_com/options.h index cd3aa31ede..f0896092da 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,7 +159,6 @@ #define FIX_712_713_SPLIT_REND_MASA_MC /*Dlb : Fix for issue 712 and 713*/ #endif -#define FIX_807_VARIABLE_SPEED_DECODING /* FhG: Issue 807: Resolve "Variable Speed Decoding broken" */ #define FIX_818_DOUBLE_PREC_KERNEN_SW /* FhG: Issue 818: Avoid double precision in kernel switching */ -- GitLab From 8199a02eb54c6c1df58ab578b3a6e7bf11808fbe Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:21:33 +0200 Subject: [PATCH 06/14] clang-format --- lib_com/ivas_fb_mixer.c | 4 ++-- lib_rend/lib_rend.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index a8f5d23365..9772f2e8dd 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -785,8 +785,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3524045415..5420815121 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8919,7 +8919,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, -- GitLab From fea472fb56c2a1bc0ed5bc74133c13a370609c62 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:24:38 +0200 Subject: [PATCH 07/14] accept NONBE_FIX_774_OSBA_MONO_DEC_CRASH --- lib_com/options.h | 1 - lib_dec/ivas_mono_dmx_renderer.c | 23 +---------------------- lib_dec/ivas_sba_dec.c | 2 -- lib_rend/ivas_stat_rend.h | 5 ----- 4 files changed, 1 insertion(+), 30 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f0896092da..83b6d64cbf 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,7 +171,6 @@ #define NONBE_FIX_787_PARAM_UPMIX_LEVEL /* Dlb: issue 787: fix level of Mono/Stereo for ParamUpmix mode */ -#define NONBE_FIX_774_OSBA_MONO_DEC_CRASH /* FhG: issue 774: decoder crash for OSBA to mono */ #define NONBE_FIX_802_PARAMUPMIX_HIGHPASS /* Dlb: issue 802: Move HighPass filter operation for ParamUpmix */ #define NONBE_FIX_809_EXTERNAL_TARGET_INTERPOLATION /* FhG: issue 809: unify external target interpolation inter and intra frame behaviour */ #define NONBE_FIX_775_OSBA_BR_SWITCHING_CRASH /* FhG: issue 775: fix crash in OSBA with bitrate switching and output order lower than input order */ diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index 413a3d12b9..00566a5920 100644 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -68,13 +68,8 @@ ivas_error ivas_mono_dmx_renderer_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for downmixing\n" ) ); } -#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH hDownmix->inputEnergy = 0; hDownmix->protoEnergy = 0; -#else - set_zero( hDownmix->inputEnergy, CLDFB_NO_CHANNELS_MAX ); - set_zero( hDownmix->protoEnergy, CLDFB_NO_CHANNELS_MAX ); -#endif st_ivas->hMonoDmxRenderer = hDownmix; return IVAS_ERR_OK; @@ -125,36 +120,20 @@ void ivas_mono_downmix_render_passive( } /* compute the input energy, proto energy after smoothing */ -#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH hDownmix->inputEnergy *= DOWNMIX_ALPHA; hDownmix->protoEnergy *= DOWNMIX_ALPHA; -#else - hDownmix->inputEnergy[0] *= DOWNMIX_ALPHA; - hDownmix->protoEnergy[0] *= DOWNMIX_ALPHA; -#endif for ( i = 0; i < output_frame; i++ ) { -#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH hDownmix->protoEnergy += proto_signal[i] * proto_signal[i]; -#else - hDownmix->protoEnergy[0] += proto_signal[i] * proto_signal[i]; -#endif + for ( j = 0; j < numInputChannels; j++ ) { -#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH hDownmix->inputEnergy += ( output_f[j][i] * output_f[j][i] ); -#else - hDownmix->inputEnergy[0] += ( output_f[j][i] * output_f[j][i] ); -#endif } } /* compute the eq factor */ -#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH eq = min( DOWNMIX_MAX_GAIN, sqrtf( hDownmix->inputEnergy / ( EPSILON + hDownmix->protoEnergy ) ) ); -#else - eq = min( DOWNMIX_MAX_GAIN, sqrtf( hDownmix->inputEnergy[0] / ( EPSILON + hDownmix->protoEnergy[0] ) ) ); -#endif /* equalize the downmix */ v_multc( proto_signal, eq, output_f[0], output_frame ); diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 6860e2f8a1..a3ab583e0d 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -510,7 +510,6 @@ ivas_error ivas_sba_dec_reconfigure( } } -#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { if ( st_ivas->hMonoDmxRenderer == NULL ) @@ -529,7 +528,6 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hMonoDmxRenderer = NULL; } } -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index d1a19e6317..9733874d30 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1539,13 +1539,8 @@ typedef struct ivas_LS_setupconversion_mapping typedef struct ivas_mono_downmix_renderer_struct { -#ifdef NONBE_FIX_774_OSBA_MONO_DEC_CRASH float inputEnergy; float protoEnergy; -#else - float inputEnergy[CLDFB_NO_CHANNELS_MAX]; - float protoEnergy[CLDFB_NO_CHANNELS_MAX]; -#endif } MONO_DOWNMIX_RENDERER_STRUCT, *MONO_DOWNMIX_RENDERER_HANDLE; -- GitLab From 13478ae0d152d5e57cbdfbe0bf1463eebbd7d850 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:27:47 +0200 Subject: [PATCH 08/14] accept NONBE_FIX_809_EXTERNAL_TARGET_INTERPOLATION --- lib_com/options.h | 1 - lib_rend/ivas_rotation.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 83b6d64cbf..aba3454be3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,7 +172,6 @@ #define NONBE_FIX_787_PARAM_UPMIX_LEVEL /* Dlb: issue 787: fix level of Mono/Stereo for ParamUpmix mode */ #define NONBE_FIX_802_PARAMUPMIX_HIGHPASS /* Dlb: issue 802: Move HighPass filter operation for ParamUpmix */ -#define NONBE_FIX_809_EXTERNAL_TARGET_INTERPOLATION /* FhG: issue 809: unify external target interpolation inter and intra frame behaviour */ #define NONBE_FIX_775_OSBA_BR_SWITCHING_CRASH /* FhG: issue 775: fix crash in OSBA with bitrate switching and output order lower than input order */ #define NONBE_FIX_827_JBM_CREND_EARLY_REFLECTIONS /* FhG: issue #827: Resolve "JBM Crend early reflections are wrong" */ #define NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS /* Fhg: issue #833: Resolve "JBM OSBA: the gains for the discrete objects are not computed" */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 5263bd5fda..7e2ba93b9c 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -1357,12 +1357,12 @@ static void external_target_interpolation( /* Set the received orientation as the target */ hCombinedOrientationData->Quaternions_ext_interpolation_target = hExtOrientationData->Quaternions[i]; + /* Use the most recent external orientation as the starting orientation */ if ( hExtOrientationData->enableExternalOrientation[i] == 1 ) { if ( i > 0 ) { -#ifdef NONBE_FIX_809_EXTERNAL_TARGET_INTERPOLATION if ( hExtOrientationData->enableExternalOrientation[i - 1] == 0 ) { IVAS_QUATERNION identity; @@ -1375,7 +1375,6 @@ static void external_target_interpolation( hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_frozen_ext; } else -#endif { hCombinedOrientationData->Quaternions_ext_interpolation_start = hExtOrientationData->Quaternions[i - 1]; } -- GitLab From 1545e20e8f7cbc4832f986b427fa9998fd0a2a9e Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:31:19 +0200 Subject: [PATCH 09/14] accept NONBE_FIX_802_PARAMUPMIX_HIGHPASS --- lib_com/options.h | 1 - lib_dec/ivas_dec.c | 19 ++++--------------- lib_dec/ivas_jbm_dec.c | 35 ----------------------------------- 3 files changed, 4 insertions(+), 51 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index aba3454be3..13f903b706 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,7 +171,6 @@ #define NONBE_FIX_787_PARAM_UPMIX_LEVEL /* Dlb: issue 787: fix level of Mono/Stereo for ParamUpmix mode */ -#define NONBE_FIX_802_PARAMUPMIX_HIGHPASS /* Dlb: issue 802: Move HighPass filter operation for ParamUpmix */ #define NONBE_FIX_775_OSBA_BR_SWITCHING_CRASH /* FhG: issue 775: fix crash in OSBA with bitrate switching and output order lower than input order */ #define NONBE_FIX_827_JBM_CREND_EARLY_REFLECTIONS /* FhG: issue #827: Resolve "JBM Crend early reflections are wrong" */ #define NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS /* Fhg: issue #833: Resolve "JBM OSBA: the gains for the discrete objects are not computed" */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index b603b10b3a..8f928cdc29 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -860,7 +860,8 @@ ivas_error ivas_dec( { return error; } -#ifdef NONBE_FIX_802_PARAMUPMIX_HIGHPASS + + /* HP filtering */ for ( n = 0; n < st_ivas->nchan_transport; n++ ) { if ( n != LFE_CHANNEL ) @@ -868,21 +869,9 @@ ivas_error ivas_dec( hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } } -#endif + ivas_mc_paramupmix_dec( st_ivas, p_output ); -#ifndef NONBE_FIX_802_PARAMUPMIX_HIGHPASS - /* HP filtering */ - if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) - { - for ( n = 0; n < st_ivas->nchan_transport; n++ ) - { - if ( n != LFE_CHANNEL ) - { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); - } - } - } -#endif + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_FOA || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA3 ) ) { ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 9f1e4b5375..43bd76f6ea 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -578,7 +578,6 @@ ivas_error ivas_jbm_dec_tc( return error; } -#ifdef NONBE_FIX_802_PARAMUPMIX_HIGHPASS /* HP filtering */ for ( n = 0; n < st_ivas->nchan_transport; n++ ) { @@ -603,24 +602,6 @@ ivas_error ivas_jbm_dec_tc( ivas_ls_setup_conversion( st_ivas, audioCfg2channels( IVAS_AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); } } -#else - /* Rendering */ - if ( st_ivas->renderer_type == RENDERER_MC ) - { - if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) - { - /* HP filtering */ - for ( n = 0; n < st_ivas->nchan_transport; n++ ) - { - if ( n != LFE_CHANNEL ) - { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); - } - } - ivas_ls_setup_conversion( st_ivas, audioCfg2channels( IVAS_AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); - } - } -#endif } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { @@ -1326,22 +1307,6 @@ ivas_error ivas_jbm_dec_render( { ivas_mc_paramupmix_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_tc, p_output ); -#ifndef NONBE_FIX_802_PARAMUPMIX_HIGHPASS - /* HP filtering */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - /*no HPF when rendering is already done*/ - if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) -#endif - { - for ( n = 0; n < st_ivas->nchan_transport; n++ ) - { - if ( n != LFE_CHANNEL ) - { - hp20( p_output[n], *nSamplesRendered, st_ivas->mem_hp20_out[n], output_Fs ); - } - } - } -#endif if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_FOA || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA3 ) ) { ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, *nSamplesRendered, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); -- GitLab From 75afa4fb1bc2ed93f031b24c4f5c9093e0213a9f Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:35:24 +0200 Subject: [PATCH 10/14] accept NONBE_FIX_775_OSBA_BR_SWITCHING_CRASH --- lib_com/options.h | 1 - lib_dec/ivas_sba_dec.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 13f903b706..8d25ddbf6b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,7 +171,6 @@ #define NONBE_FIX_787_PARAM_UPMIX_LEVEL /* Dlb: issue 787: fix level of Mono/Stereo for ParamUpmix mode */ -#define NONBE_FIX_775_OSBA_BR_SWITCHING_CRASH /* FhG: issue 775: fix crash in OSBA with bitrate switching and output order lower than input order */ #define NONBE_FIX_827_JBM_CREND_EARLY_REFLECTIONS /* FhG: issue #827: Resolve "JBM Crend early reflections are wrong" */ #define NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS /* Fhg: issue #833: Resolve "JBM OSBA: the gains for the discrete objects are not computed" */ #define JBM_FOR_OSBA /* FhG: implement OSBA format in the JBM path */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index a3ab583e0d..7bdba95d8e 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -458,12 +458,11 @@ ivas_error ivas_sba_dec_reconfigure( ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); -#ifdef NONBE_FIX_775_OSBA_BR_SWITCHING_CRASH + if ( st_ivas->hDirAC ) { st_ivas->hDirAC->hConfig->enc_param_start_band = st_ivas->hSpar->enc_param_start_band; } -#endif } if ( st_ivas->renderer_type == RENDERER_DISABLE ) -- GitLab From 89d2a2f748838e543ba98f29c8b78b375aac3664 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:36:26 +0200 Subject: [PATCH 11/14] accept NONBE_FIX_787_PARAM_UPMIX_LEVEL --- lib_com/options.h | 1 - lib_dec/ivas_jbm_dec.c | 3 +-- lib_dec/ivas_mc_paramupmix_dec.c | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8d25ddbf6b..2a81f836b8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,6 @@ /* all switches in this category should start with "NONBE_" */ -#define NONBE_FIX_787_PARAM_UPMIX_LEVEL /* Dlb: issue 787: fix level of Mono/Stereo for ParamUpmix mode */ #define NONBE_FIX_827_JBM_CREND_EARLY_REFLECTIONS /* FhG: issue #827: Resolve "JBM Crend early reflections are wrong" */ #define NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS /* Fhg: issue #833: Resolve "JBM OSBA: the gains for the discrete objects are not computed" */ #define JBM_FOR_OSBA /* FhG: implement OSBA format in the JBM path */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 43bd76f6ea..548c719e41 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -590,13 +590,12 @@ ivas_error ivas_jbm_dec_tc( /* Rendering */ if ( ( st_ivas->renderer_type == RENDERER_MC ) && ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) ) { -#ifdef NONBE_FIX_787_PARAM_UPMIX_LEVEL /* Compensate loudness for not doing full upmix */ for ( n = 4; n < 8; n++ ) { v_multc( p_output[n], 2.0f, p_output[n], output_frame ); } -#endif + if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) { ivas_ls_setup_conversion( st_ivas, audioCfg2channels( IVAS_AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 7f6926402a..9cc415b39e 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -218,13 +218,12 @@ void ivas_mc_paramupmix_dec( if ( ( output_config == IVAS_AUDIO_CONFIG_STEREO ) || ( output_config == IVAS_AUDIO_CONFIG_MONO ) ) { first_empty_channel = 8; /* Don't upmix */ -#ifdef NONBE_FIX_787_PARAM_UPMIX_LEVEL + /* Compensate loudness for not doing full upmix */ for ( i = 4; i < 8; i++ ) { v_multc( output_f[i], 2.0f, output_f[i], L_FRAME48k ); } -#endif } else { -- GitLab From 847dfb9e471bedf6d173d158b9cca068d310c4d1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:37:06 +0200 Subject: [PATCH 12/14] accept NONBE_FIX_827_JBM_CREND_EARLY_REFLECTIONS --- lib_com/options.h | 2 -- lib_rend/ivas_crend.c | 4 ---- 2 files changed, 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2a81f836b8..ea25ec0f65 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,8 +169,6 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ - -#define NONBE_FIX_827_JBM_CREND_EARLY_REFLECTIONS /* FhG: issue #827: Resolve "JBM Crend early reflections are wrong" */ #define NONBE_FIX_833_OSBA_JBM_OBJECT_GAINS /* Fhg: issue #833: Resolve "JBM OSBA: the gains for the discrete objects are not computed" */ #define JBM_FOR_OSBA /* FhG: implement OSBA format in the JBM path */ #ifdef JBM_FOR_OSBA diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 6582fecbac..6741c8a88a 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1968,11 +1968,7 @@ ivas_error ivas_rend_crendProcessSubframe( { if ( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 ) { -#ifdef NONBE_FIX_827_JBM_CREND_EARLY_REFLECTIONS if ( ( error = ivas_er_process( hCrend->reflections, subframe_len, 0, tc_local, inConfig ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output, inConfig ) ) != IVAS_ERR_OK ) -#endif { return error; } -- GitLab From 0dc355b5ece35014c93606b18aec01aa04a7ec93 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:43:44 +0200 Subject: [PATCH 13/14] accept NONBE_FIX_730_DPID_NOT_SET_CORRECTLY --- apps/decoder.c | 4 ---- apps/renderer.c | 4 ---- lib_com/options.h | 1 - lib_util/render_config_reader.c | 21 +++------------------ 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index f126cafb5d..84281854b4 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -632,11 +632,7 @@ int main( if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK ) { -#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); -#else - fprintf( stderr, "Failed to get directivity for objects: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); -#endif goto cleanup; } diff --git a/apps/renderer.c b/apps/renderer.c index 1b11cde72a..cbb3b860ca 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -2636,11 +2636,7 @@ static CmdlnArgs defaultArgs( for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { -#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY args.directivityPatternId[i] = 65535; -#else - args.directivityPatternId[i] = 0; -#endif } args.acousticEnvironmentId = 65535; diff --git a/lib_com/options.h b/lib_com/options.h index ea25ec0f65..b4af066bd9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,7 +174,6 @@ #ifdef JBM_FOR_OSBA #define OSBA_ROOM_IR #endif -#define NONBE_FIX_730_DPID_NOT_SET_CORRECTLY /* Eri: issue 730: write dpid read from file in correct index, print informative error message when DPID specified is not found. */ #define NONBE_FIX_825_SBA_JBM_MONO_STEREO_OUTPUT /* FhG: issue #825: Resolve "JBM SBA: AGC and PCA run twice for MONO and STEREO output" */ #define NONBE_FIX_808_JBM_PARAMUPMIX_RS /* FhG: Issue 808: fix JBM MC rate switching */ #define NONBE_FIX_846_JBM_MASA_SIDSTART /* FhG: Issue #846: fix JBM for MASA DTX when the first frame is a SID frame */ diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 867282e6b2..727225a398 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2617,9 +2617,6 @@ ivas_error RenderConfigReader_read( return IVAS_ERR_INVALID_RENDER_CONFIG; } idx = strtol( strtok( NULL, ":" ), NULL, 0 ); -#ifndef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY - pRenderConfigReader->pDP->id = idx; -#endif params_idx = 0; pValue = (char *) calloc( strlen( pParams ), sizeof( char ) ); @@ -2627,20 +2624,16 @@ ivas_error RenderConfigReader_read( { params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); #ifdef DEBUGGING -#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY fprintf( stderr, " PARAM: %s -> %s, DIRECTIVITYPATTERN -> %u\n", item, pValue, idx ); -#else - fprintf( stderr, " PARAM: %s -> %s\n", item, pValue ); -#endif #endif /* Allocate memory for directivity arrays*/ if ( ( pRenderConfigReader->pDP[accDPIdx].pDirectivity = (float *) malloc( 3 * sizeof( float ) ) ) == NULL ) { return IVAS_ERR_FAILED_ALLOC; } -#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY + pRenderConfigReader->pDP[accDPIdx].id = idx; -#endif + if ( strcmp( item, "DIRECTIVITY" ) == 0 ) { if ( read_txt_vector( pValue, 3, pRenderConfigReader->pDP[accDPIdx].pDirectivity ) ) @@ -2841,12 +2834,9 @@ ivas_error RenderConfigReader_getDirectivity( ) { uint16_t n, m; -#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY uint16_t last_specified_id; -#endif bool idExists; - if ( pRenderConfigReader == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -2862,7 +2852,6 @@ ivas_error RenderConfigReader_getDirectivity( } else { -#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY last_specified_id = id[0]; /* set unpspecified Directivity Patterns ID to last specified ID */ @@ -2884,7 +2873,7 @@ ivas_error RenderConfigReader_getDirectivity( { id[n] = last_specified_id; } -#endif + for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) { idExists = false; @@ -2893,11 +2882,7 @@ ivas_error RenderConfigReader_getDirectivity( if ( id[n] == pRenderConfigReader->pDP[m].id ) { idExists = true; -#ifdef NONBE_FIX_730_DPID_NOT_SET_CORRECTLY mvr2r( pRenderConfigReader->pDP[m].pDirectivity, directivity + ( n * 3 ), 3 ); -#else - mvr2r( pRenderConfigReader->pDP[id[n]].pDirectivity, directivity + ( n * 3 ), 3 ); -#endif break; } } -- GitLab From 7f0e2fba352895836896f609f7ee52b79c9dc2eb Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 4 Oct 2023 16:45:51 +0200 Subject: [PATCH 14/14] accept NONBE_FIX_825_SBA_JBM_MONO_STEREO_OUTPUT --- lib_com/options.h | 1 - lib_dec/ivas_jbm_dec.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b4af066bd9..ae0fc10140 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,7 +174,6 @@ #ifdef JBM_FOR_OSBA #define OSBA_ROOM_IR #endif -#define NONBE_FIX_825_SBA_JBM_MONO_STEREO_OUTPUT /* FhG: issue #825: Resolve "JBM SBA: AGC and PCA run twice for MONO and STEREO output" */ #define NONBE_FIX_808_JBM_PARAMUPMIX_RS /* FhG: Issue 808: fix JBM MC rate switching */ #define NONBE_FIX_846_JBM_MASA_SIDSTART /* FhG: Issue #846: fix JBM for MASA DTX when the first frame is a SID frame */ #define NONBE_FIX_841_MC_RS_TDOBJ_RENDERER /* FhG: Issue #841: [Non-BE] Resolve "MC RS HRFT handle not set to NULL" */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 548c719e41..a937aaeeab 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -296,11 +296,7 @@ ivas_error ivas_jbm_dec_tc( num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, ivas_total_brate, st_ivas->last_active_ivas_total_brate ); ivas_sba_mix_matrix_determiner( st_ivas->hSpar, p_output, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); } -#ifdef NONBE_FIX_825_SBA_JBM_MONO_STEREO_OUTPUT else if ( st_ivas->renderer_type != RENDERER_DISABLE ) -#else - else -#endif { ivas_spar_dec_agc_pca( st_ivas, p_output, output_frame ); } -- GitLab