From c5572e6d73140e5e095a0815008e870573c02317 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 21 Jul 2022 14:28:03 +0200 Subject: [PATCH 01/17] formatting + editorial improvements --- lib_com/ivas_prot.h | 4 ++-- lib_dec/acelp_core_dec.c | 9 ++++---- lib_dec/dec_gen_voic.c | 8 +++---- lib_dec/ivas_reverb.c | 27 +++++++++++++++++++++--- lib_dec/ivas_reverb_utils.c | 37 +++++++++++++++------------------ lib_enc/ivas_core_enc.c | 6 +----- lib_util/render_config_reader.c | 3 +++ 7 files changed, 54 insertions(+), 40 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4bb7546b24..5b34c29fc0 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5361,8 +5361,8 @@ void ivas_reverb_calc_color_levels( void ivas_reverb_prepare_cldfb_params( ivas_roomAcoustics_t *pInput_params, - AUDIO_CONFIG renderer_config, - int16_t use_brir, + const AUDIO_CONFIG renderer_config, + const int16_t use_brir, const int32_t output_Fs, float *pOutput_t60, float *pOutput_ene ); diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 3b9efaa316..686de7381f 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -105,7 +105,7 @@ ivas_error acelp_core_dec( float exc_buffer[DCT_L_POST]; float dct_exc_tmp[L_FRAME16k]; float bpf_error_signal[L_FRAME16k]; - int16_t nb_bits; /* number of bits */ + int16_t nb_bits; /* number of bits */ int16_t indice; /* parameter indices to write */ float gain_buf[NB_SUBFR16k]; float q_env[20]; @@ -123,15 +123,15 @@ ivas_error acelp_core_dec( int16_t local_element_mode; ivas_error error; + wmops_sub_start( "acelp_core_dec" ); + error = IVAS_ERR_OK; if ( st->element_mode == IVAS_CPE_MDCT && nchan_out == 1 && st->idchan == 1 && last_element_brate <= IVAS_SID_4k4 ) { /* In MDCT-Stereo DTX with mono output, we can skip CNG for the second channel, except for the first inactive frame following an active period */ return error; - } - - wmops_sub_start( "acelp_core_dec" ); + } output_frame = (int16_t) ( st->output_Fs / FRAMES_PER_SEC ); @@ -801,7 +801,6 @@ ivas_error acelp_core_dec( return error; } - if ( st->element_mode == IVAS_CPE_TD ) { tmp_noise = st->lp_gainc; diff --git a/lib_dec/dec_gen_voic.c b/lib_dec/dec_gen_voic.c index 97fba943df..ba8f0424ea 100644 --- a/lib_dec/dec_gen_voic.c +++ b/lib_dec/dec_gen_voic.c @@ -64,11 +64,11 @@ ivas_error decod_gen_voic( float *bwe_exc, /* o : excitation for SWB TBE */ int16_t *unbits, /* number of unused bits */ float *gain_buf, /* o : floating pitch gain for each subframe */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const float tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */ + const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ + const float tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */ ) { - int16_t T0 = PIT_MIN, T0_frac = 0, T0_min, T0_max; /* integer pitch variables */ + int16_t T0 = PIT_MIN, T0_frac = 0, T0_min, T0_max; /* integer pitch variables */ float gain_pit = 0.0f; /* pitch gain */ float gain_code = 0.0f; /* gain/normalized gain of the algebraic excitation */ float norm_gain_code = 0.0f; /* normalized gain of the algebraic excitation */ @@ -264,7 +264,6 @@ ivas_error decod_gen_voic( return error; } - DTFS_to_fs( st->hWIDec->old_exc2 + shft_prev, (int16_t) rint_new( st->bfi_pitch ), PREVP, (int16_t) st->output_Fs, do_WI ); DTFS_to_fs( exc2 + shft_curr, (int16_t) rint_new( pitch_buf[NB_SUBFR16k - 1] ), CURRP, (int16_t) st->output_Fs, do_WI ); @@ -274,7 +273,6 @@ ivas_error decod_gen_voic( return error; } - mvr2r( out, exc2, st->L_frame ); mvr2r( exc2, exc, st->L_frame ); diff --git a/lib_dec/ivas_reverb.c b/lib_dec/ivas_reverb.c index 4affe6a8dc..3d18a6a39e 100644 --- a/lib_dec/ivas_reverb.c +++ b/lib_dec/ivas_reverb.c @@ -2217,7 +2217,9 @@ static void clear_buffers( * Sets frame size and fft-filter related sizes *-----------------------------------------------------------------------------------------*/ -static void set_fft_and_datablock_sizes( REVERB_HANDLE pState, int16_t subframe_len ) +static void set_fft_and_datablock_sizes( + REVERB_HANDLE pState, + const int16_t subframe_len ) { pState->full_block_size = subframe_len; if ( subframe_len == L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES ) @@ -2239,7 +2241,10 @@ static void set_fft_and_datablock_sizes( REVERB_HANDLE pState, int16_t subframe_ { assert( 0 ); /* unsupported block size */ } + pState->fft_subblock_size = subframe_len / pState->num_fft_subblocks; + + return; } @@ -2249,7 +2254,13 @@ static void set_fft_and_datablock_sizes( REVERB_HANDLE pState, int16_t subframe_ * Sets reverb acoustic data (room acoustics and HRTF), interpolating it to the filter grid *-----------------------------------------------------------------------------------------*/ -static void set_reverb_acoustic_data( ivas_reverb_params_t *pParams, const HRTFS_HANDLE hHrtf, ivas_roomAcoustics_t *pRoomAcoustics, int16_t subframe_len, int16_t nr_fc_input, int16_t nr_fc_fft_filter ) +static void set_reverb_acoustic_data( + ivas_reverb_params_t *pParams, + const HRTFS_HANDLE hHrtf, + ivas_roomAcoustics_t *pRoomAcoustics, + const int16_t subframe_len, + const int16_t nr_fc_input, + const int16_t nr_fc_fft_filter ) { int16_t nr_out_ch, hrtf_idx, offset, iter_idx, bin_idx; float ln_1e6_inverted, delay_diff, exp_argument; @@ -2316,6 +2327,8 @@ static void set_reverb_acoustic_data( ivas_reverb_params_t *pParams, const HRTFS exp_argument = max( exp_argument, -23.0f ); pParams->pDsr[bin_idx] *= expf( exp_argument ); } + + return; } @@ -2325,7 +2338,9 @@ static void set_reverb_acoustic_data( ivas_reverb_params_t *pParams, const HRTFS * Sets up feedback delay network system *-----------------------------------------------------------------------------------------*/ -static ivas_error setup_FDN_branches( REVERB_HANDLE pState, ivas_reverb_params_t *pParams ) +static ivas_error setup_FDN_branches( + REVERB_HANDLE pState, + ivas_reverb_params_t *pParams ) { int16_t nr_coefs, branch_idx, channel_idx; ivas_error error; @@ -2382,6 +2397,7 @@ static ivas_error setup_FDN_branches( REVERB_HANDLE pState, ivas_reverb_params_t return error; } + /*------------------------------------------------------------------------- * ivas_reverb_open() * @@ -2544,6 +2560,7 @@ ivas_error ivas_reverb_open( } *hReverb = pState; + return error; } @@ -2649,6 +2666,7 @@ static void reverb_block( { ppOutput[branch_idx] = (float *) Output + branch_idx * inner_bsize; } + for ( k = 0; k < bsize; k += inner_bsize ) { float *pO0 = &pOut0[k]; @@ -2679,10 +2697,12 @@ static void reverb_block( for ( i = 0; i < nr_branches; i++ ) { float *pIn = &pInput[k]; + for ( ns = 0; ns < inner_bsize; ns++ ) { pFeedback_input[ns] = pIn[ns]; } + for ( j = 0; j < nr_branches; j++ ) { float gain_matrix_j_i = pState->gain_matrix[j][i]; @@ -2692,6 +2712,7 @@ static void reverb_block( pFeedback_input[ns] += gain_matrix_j_i * pOutput[ns]; } } + ivas_rev_delay_line_feed_sample_blk( &( pState->delay_line[i] ), inner_bsize, pFeedback_input ); } } diff --git a/lib_dec/ivas_reverb_utils.c b/lib_dec/ivas_reverb_utils.c index 760ddc199f..ee09d86a91 100644 --- a/lib_dec/ivas_reverb_utils.c +++ b/lib_dec/ivas_reverb_utils.c @@ -67,12 +67,7 @@ typedef struct cldfb_convolver_state float filter_states_im[BINAURAL_CONVBANDS][CLDFB_CONVOLVER_NTAPS_MAX]; } cldfb_convolver_state; -static void ivas_reverb_get_fastconv_hrtf_set_energies( - AUDIO_CONFIG input_config, - int16_t use_brir, - int32_t sampling_rate, - float *avg_pwr_left, - float *avg_pwr_right ); +static void ivas_reverb_get_fastconv_hrtf_set_energies( const AUDIO_CONFIG input_config, const int16_t use_brir, const int32_t sampling_rate, float *avg_pwr_left, float *avg_pwr_right ); /*-----------------------------------------------------------------------------------------* @@ -83,8 +78,8 @@ static void ivas_reverb_get_fastconv_hrtf_set_energies( void ivas_reverb_prepare_cldfb_params( ivas_roomAcoustics_t *pInput_params, - AUDIO_CONFIG renderer_config, - int16_t use_brir, + const AUDIO_CONFIG renderer_config, + const int16_t use_brir, const int32_t output_Fs, float *pOutput_t60, float *pOutput_ene ) @@ -128,6 +123,7 @@ void ivas_reverb_prepare_cldfb_params( } ivas_reverb_get_fastconv_hrtf_set_energies( renderer_config, use_brir, output_Fs, avg_pwr_left, avg_pwr_right ); + for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { pOutput_ene[idx] *= 0.5f * ( avg_pwr_left[idx] + avg_pwr_right[idx] ) * dmx_gain_2; @@ -149,8 +145,9 @@ static void ivas_cldfb_convolver( float out_CLDFB_imag[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* o : imag part of binaural signals */ float in_CLDFB_real[CLDFB_NO_CHANNELS_MAX], /* i : real part of input signals */ float in_CLDFB_imag[CLDFB_NO_CHANNELS_MAX], /* i : imag part of input signals */ - int16_t num_conv_bands, /* i : number of convolution bands */ - int16_t num_taps ) /* i : number of filter taps */ + const int16_t num_conv_bands, /* i : number of convolution bands */ + const int16_t num_taps /* i : number of filter taps */ +) { int16_t band_idx, tap_idx; float *filter_states_real_ptr, *filter_states_imag_ptr; @@ -209,11 +206,11 @@ static void ivas_cldfb_convolver( *-----------------------------------------------------------------------------------------*/ static void get_IR_from_filter_taps( - int16_t hrtf_idx, - AUDIO_CONFIG input_config, - int16_t use_brir, - int32_t sampling_rate, - int16_t pulse_length, + const int16_t hrtf_idx, + const AUDIO_CONFIG input_config, + const int16_t use_brir, + const int32_t sampling_rate, + const int16_t pulse_length, float *pOut_l, float *pOut_r ) { @@ -375,8 +372,8 @@ static void get_IR_from_filter_taps( static void ivas_reverb_get_cldfb_hrtf_set_properties( AUDIO_CONFIG input_config, - int16_t use_brir, - int32_t sampling_rate, + const int16_t use_brir, + const int32_t sampling_rate, float *avg_pwr_left, float *avg_pwr_right ) { @@ -467,9 +464,9 @@ static void ivas_reverb_get_cldfb_hrtf_set_properties( *-----------------------------------------------------------------------------------------*/ static void ivas_reverb_get_fastconv_hrtf_set_energies( - AUDIO_CONFIG input_config, - int16_t use_brir, - int32_t sampling_rate, + const AUDIO_CONFIG input_config, + const int16_t use_brir, + const int32_t sampling_rate, float *avg_pwr_left, float *avg_pwr_right ) { diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 65830e014e..f1a10d1936 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -104,8 +104,6 @@ ivas_error ivas_core_enc( int32_t element_brate, input_Fs; ivas_error error; - error = IVAS_ERR_OK; - wmops_sub_start( "ivas_core_enc" ); error = IVAS_ERR_OK; @@ -114,7 +112,6 @@ ivas_error ivas_core_enc( * General initialization *-----------------------------------------------------------------*/ - if ( hSCE != NULL ) { cpe_id = -1; @@ -177,8 +174,7 @@ ivas_error ivas_core_enc( * Pre-processing, incl. Decision matrix *---------------------------------------------------------------------*/ - if ( ( error = pre_proc_ivas( st, last_element_mode, element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], is_MCT, vad_hover_flag[n], - flag_16k_smc ) ) != IVAS_ERR_OK ) + if ( ( error = pre_proc_ivas( st, last_element_mode, element_brate, input_frame, old_inp_12k8[n], old_inp_16k[n], &inp[n], &ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], new_inp_resamp16k[n], &Voicing_flag[n], old_wsp[n], loc_harm[n], cor_map_sum[n], vad_flag_dtx[n], enerBuffer[n], fft_buff[n], is_MCT, vad_hover_flag[n], flag_16k_smc ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 25195f890c..1bcde51f66 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -223,12 +223,14 @@ static int32_t errorHandler( return numErrors; } + #ifdef REFACTOR_REVERB_INIT_ADD_CFG_CHECKS /*------------------------------------------------------------------------------------------* * RenderConfigReader_checkValues() * * Verifies if the configuration parameters lie within acceptable limits *------------------------------------------------------------------------------------------*/ + static ivas_error RenderConfigReader_checkValues( IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o : Renderer configuration handle */ ) @@ -316,6 +318,7 @@ static ivas_error RenderConfigReader_checkValues( } #endif /* REFACTOR_REVERB_INIT_ADD_CFG_CHECKS */ + /*------------------------------------------------------------------------------------------* * RenderConfigReader_open() * -- GitLab From fd999d98fe33735ba99b371ac2d26838a52ecbf1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 21 Jul 2022 14:29:17 +0200 Subject: [PATCH 02/17] remove unnecessary condition before ivas_render_config_close() --- lib_dec/lib_dec.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 8f963664fb..7671be5e85 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -257,10 +257,7 @@ void IVAS_DEC_Close( } #ifdef REFACTOR_REVERB_INIT_ADD_CFG_CHECKS - if ( ( *phIvasDec )->st_ivas->hRenderConfig != NULL ) - { - ivas_render_config_close( &( ( *phIvasDec )->st_ivas->hRenderConfig ) ); - } + ivas_render_config_close( &( ( *phIvasDec )->st_ivas->hRenderConfig ) ); #endif /* REFACTOR_REVERB_INIT_ADD_CFG_CHECKS */ ivas_HRTF_binary_close( &( *phIvasDec )->st_ivas->hHrtfTD ); -- GitLab From 908029976b4faf10fd8082184362da1b4ad45c67 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 21 Jul 2022 14:36:23 +0200 Subject: [PATCH 03/17] formatting + comments --- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_dirac_dec.c | 8 ++------ lib_dec/ivas_sba_dec.c | 9 +++++---- lib_dec/ivas_spar_decoder.c | 4 +--- lib_enc/ivas_cpe_enc.c | 2 +- lib_enc/ivas_mct_core_enc.c | 2 +- lib_enc/transition_enc.c | 6 ++---- 7 files changed, 13 insertions(+), 20 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 5b34c29fc0..b0ace3f377 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -2590,7 +2590,7 @@ void ivas_mct_core_enc( const SBA_MODE sba_mode /* i : SBA mode */ #ifdef FIX_I1_113 , - const int16_t sba_order + const int16_t sba_order /* i : Ambisonic (SBA) order */ #endif ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 8a614d087e..647d9a31f3 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1985,9 +1985,7 @@ void ivas_dirac_dec( reference_power, slot_idx, nchan_transport, hDirAC->num_outputs_diff, hDirAC->num_freq_bands, - p_Rmat - - ); + p_Rmat ); } else { @@ -1997,9 +1995,7 @@ void ivas_dirac_dec( reference_power, slot_idx, nchan_transport, hDirAC->num_outputs_diff, hDirAC->num_freq_bands, - 0 - - ); + 0 ); } } else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 26c6cff50d..52ecc69e27 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -236,7 +236,7 @@ int16_t ivas_sba_remapTCs( nchan_remapped++; if ( st_ivas->sba_mode != SBA_MODE_SPAR ) { - assert( ( ( st_ivas->nchan_transport == 3 ) || ( st_ivas->nchan_transport == 5 ) || ( st_ivas->nchan_transport == 7 ) ) && "Number of channels must be odd for sba planar!" ); + assert( ( ( st_ivas->nchan_transport == 3 ) || ( st_ivas->nchan_transport == 5 ) || ( st_ivas->nchan_transport == 7 ) ) && "Number of channels must be odd for SBA planar!" ); } if ( nchan_remapped == 4 ) @@ -275,6 +275,7 @@ int16_t ivas_sba_remapTCs( { ivas_sba_zero_vert_comp( sba_data, st_ivas->sba_order, st_ivas->sba_planar, output_frame ); } + return ( nchan_remapped ); } @@ -721,7 +722,7 @@ ivas_error ivas_sba_dec_reconfigure( if ( nchan_transport > nchan_transport_old ) { - /* create additional hp20 mems */ + /* create additional hp20 memories */ float **old_mem_hp20_out; uint16_t n_old; @@ -763,7 +764,7 @@ ivas_error ivas_sba_dec_reconfigure( } else if ( nchan_transport < nchan_transport_old ) { - /* remove superfluous hp20 mems */ + /* remove superfluous hp20 memories */ float **old_mem_hp20_out; if ( st_ivas->sba_dirac_stereo_flag ) @@ -892,7 +893,7 @@ ivas_error ivas_sba_dec_reconfigure( } } - /* special case, if the decoder goes from 1TC DTX to 2TC active frame (in case the bitstream started with an SBA SID frame), allocate DTX mems */ + /* special case, if the decoder goes from 1TC DTX to 2TC active frame (in case the bitstream started with an SBA SID frame), allocate DTX memories */ if ( last_ivas_total_brate <= IVAS_SID_4k4 && st_ivas->nCPE >= 1 ) { if ( ( error = initMdctStereoDtxData( st_ivas->hCPE[0] ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7dbb546760..7cf4b8c224 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1222,9 +1222,7 @@ void ivas_spar_dec_upmixer( &cldfb_in_ts_im[out_ch][ts], &output[out_ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], num_cldfb_bands, - st_ivas->cldfbSynDec[out_ch] - - ); + st_ivas->cldfbSynDec[out_ch] ); } } #ifdef DEBUG_SBA_AUDIO_DUMP diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 96f8680fa5..7b3c77a6b8 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -569,7 +569,7 @@ ivas_error ivas_cpe_enc( stereo_dft_enc_update( hCPE->hStereoDft, min( SWB, sts[0]->max_bwidth ) #ifdef DEBUG_MODE_DFT - , + , 0 #endif ); diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index de513c770e..1b41d0e93c 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -204,7 +204,7 @@ void ivas_mct_core_enc( const SBA_MODE sba_mode /* i : SBA mode */ #ifdef FIX_I1_113 , - const int16_t sba_order + const int16_t sba_order /* i : Ambisonic (SBA) order */ #endif ) { diff --git a/lib_enc/transition_enc.c b/lib_enc/transition_enc.c index 9b3acee612..ef291f23c2 100644 --- a/lib_enc/transition_enc.c +++ b/lib_enc/transition_enc.c @@ -178,8 +178,7 @@ void transition_enc( if ( *tc_subfr == TC_0_0 ) { /* this is called only to compute unused bits */ - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ - ); + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } *clip_gain = gp_clip( st->element_mode, st->core_brate, st->voicing, i_subfr, TRANSITION, xn, gp_cl ); @@ -275,8 +274,7 @@ void transition_enc( if ( i_subfr - *tc_subfr <= L_SUBFR ) { - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ - ); + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } /*-----------------------------------------------------------------* -- GitLab From 96345c339e1fd842315d199bd0939ec323f64f55 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 21 Jul 2022 14:42:16 +0200 Subject: [PATCH 04/17] remove "foa" from few function names --- lib_dec/ivas_spar_decoder.c | 2 +- lib_dec/ivas_spar_md_dec.c | 37 ++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7cf4b8c224..48f784d1e1 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -880,7 +880,7 @@ static void ivas_spar_get_skip_mat( /*-------------------------------------------------------------------* - * ivas_spar_foa_dec_upmixer() + * ivas_spar_dec_upmixer() * * IVAS SPAR upmixer *-------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 412da7d5db..987c332b4f 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -88,7 +88,7 @@ static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decode static ivas_error ivas_deindex_real_index( int16_t **index, const int16_t q_levels, const float min_value, const float max_value, float **quant, const int16_t num_ch, const int16_t dim2 ); -static void ivas_spar_foa_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode ); +static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t use_planar_coeff, const int16_t sba_inactive_mode ); /*------------------------------------------------------------------------- @@ -286,12 +286,12 @@ ivas_error ivas_spar_md_dec_open( /*------------------------------------------------------------------------- - * ivas_spar_foa_md_dec_matrix_close() + * ivas_spar_md_dec_matrix_close() * * Deallocate SPAR MD decoder matrices *------------------------------------------------------------------------*/ -static void ivas_spar_foa_md_dec_matrix_close( +static void ivas_spar_md_dec_matrix_close( ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ const int16_t num_channels /* i : number of internal channels */ ) @@ -414,7 +414,7 @@ void ivas_spar_md_dec_close( hMdDecoder = *hMdDec; num_channels = hMdDecoder->spar_md_cfg.num_umx_chs; - ivas_spar_foa_md_dec_matrix_close( hMdDecoder, num_channels ); + ivas_spar_md_dec_matrix_close( hMdDecoder, num_channels ); if ( *hMdDec != NULL ) { @@ -603,24 +603,23 @@ static ivas_error ivas_spar_set_dec_config( /*-----------------------------------------------------------------------------------------* - * Function ivas_spar_foa_md_dec_process() + * Function ivas_spar_md_dec_process() * * SPAR Meta Data decoder process *-----------------------------------------------------------------------------------------*/ void ivas_spar_md_dec_process( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ - const int16_t num_bands_out, /* i : number of output bands */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling */ + const int16_t num_bands_out, /* i : number of output bands */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ ) { int16_t j, b, bw, dtx_vad, nB, i_ts; ivas_spar_md_dec_state_t *hMdDec = st_ivas->hSpar->hMdDec; - ivas_spar_foa_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, - ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, - st_ivas->hQMetaData->sba_inactive_mode ); + ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, + ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode ); #ifdef DEBUG_SBA_MD_DUMP { @@ -736,7 +735,7 @@ void ivas_spar_md_dec_process( /*-----------------------------------------------------------------------------------------* - * Function ivas_spar_foa_smooth_md_dtx() + * Function ivas_spar_smooth_md_dtx() * * Smooth MD during no data frame during DTX *-----------------------------------------------------------------------------------------*/ @@ -1424,12 +1423,12 @@ void ivas_spar_dec_gen_umx_mat( /*-----------------------------------------------------------------------------------------* - * Function ivas_spar_foa_dec_parse_md_bs() + * Function ivas_spar_dec_parse_md_bs() * - * Parses MD bitstream + * Parses SPAR MD bitstream *-----------------------------------------------------------------------------------------*/ -static void ivas_spar_foa_dec_parse_md_bs( +static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st0, int16_t *nB, @@ -2316,7 +2315,7 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix( /*-----------------------------------------------------------------------------------------* - * Function ivas_spar_foa_unquant_dtx_indicies() + * Function ivas_spar_unquant_dtx_indicies() * * Unquantize spar md DYX indices *-----------------------------------------------------------------------------------------*/ @@ -2324,7 +2323,7 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix( #ifdef SPAR_HOA_DBG /* NOTE: No changes here as DTX only operates below 160kbps */ #endif -static void ivas_spar_foa_unquant_dtx_indicies( +static void ivas_spar_unquant_dtx_indicies( ivas_spar_md_t *pSpar_md, const int16_t nB, const int16_t bw, @@ -2490,7 +2489,7 @@ static void ivas_parse_parameter_bitstream_dtx( get_next_indice( st0, 1 ); } - ivas_spar_foa_unquant_dtx_indicies( pSpar_md, num_bands, bw, num_dmx_per_band ); + ivas_spar_unquant_dtx_indicies( pSpar_md, num_bands, bw, num_dmx_per_band ); return; } -- GitLab From f6538be91bae15949636cdfdc59ea6a47ea9e556 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 21 Jul 2022 14:48:25 +0200 Subject: [PATCH 05/17] formatting - white spaces --- lib_com/ivas_prot.h | 75 +++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b0ace3f377..9da35e5a2c 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -984,7 +984,7 @@ void stereo_dft_dec_analyze( const int16_t chan, /* i : channel number */ const int16_t input_frame, /* i : input frame size */ const int16_t output_frame, /* i : output frame size */ - const DFT_STEREO_DEC_ANA_TYPE ana_type, /* i : signal type to analyze */ + const DFT_STEREO_DEC_ANA_TYPE ana_type, /* i : signal type to analyze */ const int16_t k_offset, /* i : offset of DFT */ const int16_t delay /* i : delay in samples for input signal */ ); @@ -1044,9 +1044,9 @@ void stereo_dft_res_ecu_burst_att( /*! r: total energy of downmix with maximum swb bandwidth max */ float stereo_dft_dmx_swb_nrg( - const float *dmx_k0, /* i : first subframe spectrum */ - const float *dmx_k1, /* i : second subframe spectrum */ - const int16_t frame_length /* i : frame lanegth */ + const float *dmx_k0, /* i : first subframe spectrum */ + const float *dmx_k1, /* i : second subframe spectrum */ + const int16_t frame_length /* i : frame lanegth */ ); int16_t stereo_dft_sg_recovery( @@ -1067,8 +1067,8 @@ int16_t res_bpf_adapt( ); void bpf_pitch_coherence( - Decoder_State *st, /* i/o: decoder state structure */ - const float pitch_buf[] /* i : pitch for each subframe [0,1,2,3] */ + Decoder_State *st, /* i/o: decoder state structure */ + const float pitch_buf[] /* i : pitch for each subframe [0,1,2,3] */ ); void stereo_dft_dec_read_BS( @@ -1580,10 +1580,11 @@ ivas_error stereo_set_tdm( CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const int16_t input_frame /* i : input frame length per channel */ ); + void stereo_tdm_prep_dwnmx ( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const float *input1, /* i : right channel input */ - const int16_t input_frame /* i : frame lenght */ + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const float *input1, /* i : right channel input */ + const int16_t input_frame /* i : frame lenght */ ); int16_t stereo_tdm_ener_analysis( CPE_ENC_HANDLE hCPE, /* i : CPE structure */ @@ -2124,7 +2125,7 @@ void stereo_coder_tcx( float *mdst_spectrum[CPE_CHANNELS][NB_DIV], /* i/o: MDST spectrum */ float *inv_spectrum[CPE_CHANNELS][NB_DIV], /* i/o: inverse spectrum */ float *inv_mdst_spectrum[CPE_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum */ - const int16_t mct_on /* i : flag mct block (1) or stereo (0) */ + const int16_t mct_on /* i : flag mct block (1) or stereo (0) */ ); void stereo_decoder_tcx( @@ -2138,9 +2139,9 @@ void stereo_decoder_tcx( const int16_t core_r, /* i : core for right channel (TCX20/TCX10) */ const int16_t igf, /* i : flag for IGF activity */ const int16_t L_frame, /* i : TCX frame length */ - const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ - const int16_t last_core_l, /* i : last core for left channel */ - const int16_t last_core_r, /* i : last core for right channel */ + const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ + const int16_t last_core_l, /* i : last core for left channel */ + const int16_t last_core_r, /* i : last core for right channel */ const int16_t tmp_plc_upmix /* i : indicates temp upmix for PLC decision */ ); @@ -2152,10 +2153,10 @@ void stereo_mdct_core_dec( ); void splitAvailableBits( - const int16_t total_bits, /* i : total available bits for TCX coding */ - const int16_t split_ratio, /* i : split ratio */ - int16_t *bits_ch0, /* o : bits for channel 0 */ - int16_t *bits_ch1 /* o : bits for channel 1 */ + const int16_t total_bits, /* i : total available bits for TCX coding */ + const int16_t split_ratio, /* i : split ratio */ + int16_t *bits_ch0, /* o : bits for channel 0 */ + int16_t *bits_ch1 /* o : bits for channel 1 */ ); int16_t write_stereo_to_bitstream @@ -2163,14 +2164,14 @@ int16_t write_stereo_to_bitstream STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: Stereo MDCT encoder structure */ Encoder_State **sts, /* i/o: Encoder state structure */ int16_t ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ - const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ + const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */ ); void parse_stereo_from_bitstream( STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo decoder structure */ Decoder_State **sts, /* i/o: decoder state structure */ - const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ + const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ Decoder_State *st0, /* i/o: decoder state structure for Bstr */ int16_t ms_mask[NB_DIV][MAX_SFB] /* o : bandwise MS mask */ ); @@ -2963,7 +2964,7 @@ uint16_t ivas_qmetadata_reorder_generic( ); int16_t ivas_qmetadata_dereorder_generic( - const uint16_t uns_value /* i : unsigned value to reorder */ + const uint16_t uns_value /* i : unsigned value to reorder */ ); /*! r: projected azimuth index */ @@ -3339,16 +3340,16 @@ void ivas_dirac_dec_output_synthesis_process_slot( ); void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ const float *onset_filter ); void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ float *reference_power_smooth , float qualityBasedSmFactor @@ -3806,7 +3807,7 @@ int16_t ivas_get_spar_num_TCs( ); void ivas_spar_set_bitrate_config( - ivas_spar_md_com_cfg *pSpar_md_cfg, /* i/o: SPAR MD config. handle */ + ivas_spar_md_com_cfg *pSpar_md_cfg, /* i/o: SPAR MD config. handle */ const int16_t table_idx, /* i : config. table index */ const int16_t num_bands /* i : number of bands */ ); @@ -4350,10 +4351,10 @@ void ivas_masa_set_coding_config( /*! r: Surround coherence significant flag */ uint8_t ivas_masa_surrcoh_signicant( - float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Surround coherence */ - float diffuse_to_total_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Diffuse to total ratio */ - const int16_t nSubFrames, /* i : Number of sub frames */ - const int16_t nBands /* i : Number of frequency bands */ + float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Surround coherence */ + float diffuse_to_total_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Diffuse to total ratio */ + const int16_t nSubFrames, /* i : Number of sub frames */ + const int16_t nBands /* i : Number of frequency bands */ ); void masa_compensate_two_dir_energy_ratio_index( @@ -4428,11 +4429,11 @@ void ivas_output_init( *-----------------------------------------------------------------------------------*/ ivas_error ivas_binRenderer_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_binRenderer_close( - BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ + BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ ); void ivas_binaural_cldfb( @@ -4441,12 +4442,12 @@ void ivas_binaural_cldfb( ); void ivas_binRenderer( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ - float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ + float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ ); void ivas_binaural_add_LFE( -- GitLab From bb4b1d0015204a8971b3d26d14b1f7b1a4ddfc9c Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 22 Jul 2022 09:48:00 +0200 Subject: [PATCH 06/17] add white spaces --- lib_com/ivas_dirac_com.c | 2 ++ lib_dec/ivas_dec.c | 1 + lib_dec/ivas_init_dec.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 09b01ee229..46759c2912 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -335,7 +335,9 @@ ivas_error ivas_dirac_sba_config( sba_total_brate = ACELP_48k; } } + ivas_set_qmetadata_maxbit_req( hQMetaData, SBA_FORMAT ); + if ( sba_total_brate <= IVAS_16k4 ) { hQMetaData->useLowerRes = 1; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 9acc451ea0..144eeb4eaa 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -611,6 +611,7 @@ ivas_error ivas_dec( { st_ivas->ini_frame++; } + if ( st_ivas->ini_active_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) && ivas_total_brate > IVAS_SID_4k4 ) // VE: looks strange: ini_frame -> ini_frame_active ? { st_ivas->ini_active_frame++; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index fcacf77e9b..3ca5b9310f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -131,7 +131,7 @@ ivas_error ivas_dec_setup( st_ivas->sba_order = 1; } - if ( st_ivas->ini_frame > 0 && ( ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) && ( ivas_total_brate > IVAS_SID_4k4 ) ) + if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate && ivas_total_brate > IVAS_SID_4k4 ) { if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { -- GitLab From 6adb3df6093dba20d7d1a7cdaaae3b7530ed6335 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 1 Aug 2022 14:10:01 +0200 Subject: [PATCH 07/17] unify 'pState' and 'hSpar' handle names; use the proper handle name as much as possible --- lib_com/ivas_cov_smooth.c | 11 ++-- lib_dec/ivas_crend.c | 12 ++--- lib_dec/ivas_reverb_utils.c | 26 +++++----- lib_dec/ivas_sba_rendering.c | 15 +++--- lib_dec/ivas_spar_decoder.c | 91 +++++++++++++++++----------------- lib_enc/ivas_enc_cov_handler.c | 37 ++++++++------ lib_enc/ivas_spar_encoder.c | 73 +++++++++++++-------------- 7 files changed, 136 insertions(+), 129 deletions(-) diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index a01b35d26b..507b7cf0cd 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -47,7 +47,7 @@ *-----------------------------------------------------------------------------------------*/ static void ivas_set_up_cov_smoothing( - ivas_cov_smooth_state_t *pState, + ivas_cov_smooth_state_t *hCovState, ivas_filterbank_t *pFb, const float max_update_rate, const int16_t min_pool_size ) @@ -63,15 +63,16 @@ static void ivas_set_up_cov_smoothing( update_factor += pFb->fb_bin_to_band.pFb_bin_to_band[j][k]; } - pState->pSmoothing_factor[j] = update_factor / min_pool_size; + hCovState->pSmoothing_factor[j] = update_factor / min_pool_size; - if ( pState->pSmoothing_factor[j] > max_update_rate ) + if ( hCovState->pSmoothing_factor[j] > max_update_rate ) { - pState->pSmoothing_factor[j] = max_update_rate; + hCovState->pSmoothing_factor[j] = max_update_rate; } } - pState->prior_bank_idx = -1; + hCovState->prior_bank_idx = -1; + return; } diff --git a/lib_dec/ivas_crend.c b/lib_dec/ivas_crend.c index abf1269373..771ea758db 100644 --- a/lib_dec/ivas_crend.c +++ b/lib_dec/ivas_crend.c @@ -99,21 +99,21 @@ static ivas_error ivas_hrtf_init( *------------------------------------------------------------------------*/ static ivas_error ivas_hrtf_open( - HRTFS_HANDLE *hHrtf /* o : HRTF handle */ + HRTFS_HANDLE *hHrtf_out /* o : HRTF handle */ ) { - HRTFS_HANDLE pState; + HRTFS_HANDLE hHrtf; - if ( *hHrtf == NULL ) + if ( *hHrtf_out == NULL ) { - if ( ( pState = (HRTFS_HANDLE) count_malloc( sizeof( HRTFS_DATA ) ) ) == NULL ) + if ( ( hHrtf = (HRTFS_HANDLE) count_malloc( sizeof( HRTFS_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder\n" ); } - ivas_hrtf_init( pState ); + ivas_hrtf_init( hHrtf ); - *hHrtf = pState; + *hHrtf_out = hHrtf; } else { diff --git a/lib_dec/ivas_reverb_utils.c b/lib_dec/ivas_reverb_utils.c index ee09d86a91..46f18cba52 100644 --- a/lib_dec/ivas_reverb_utils.c +++ b/lib_dec/ivas_reverb_utils.c @@ -140,13 +140,13 @@ void ivas_reverb_prepare_cldfb_params( *-----------------------------------------------------------------------------------------*/ static void ivas_cldfb_convolver( - cldfb_convolver_state *pState, /* pointer to convolver state structure */ - float out_CLDFB_real[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* o : real part of binaural signals */ - float out_CLDFB_imag[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* o : imag part of binaural signals */ - float in_CLDFB_real[CLDFB_NO_CHANNELS_MAX], /* i : real part of input signals */ - float in_CLDFB_imag[CLDFB_NO_CHANNELS_MAX], /* i : imag part of input signals */ - const int16_t num_conv_bands, /* i : number of convolution bands */ - const int16_t num_taps /* i : number of filter taps */ + cldfb_convolver_state *convolver_state, /* i/o: pointer to convolver state structure */ + float out_CLDFB_real[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* o : real part of binaural signals */ + float out_CLDFB_imag[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* o : imag part of binaural signals */ + float in_CLDFB_real[CLDFB_NO_CHANNELS_MAX], /* i : real part of input signals */ + float in_CLDFB_imag[CLDFB_NO_CHANNELS_MAX], /* i : imag part of input signals */ + const int16_t num_conv_bands, /* i : number of convolution bands */ + const int16_t num_taps /* i : number of filter taps */ ) { int16_t band_idx, tap_idx; @@ -161,13 +161,13 @@ static void ivas_cldfb_convolver( out_imag_left = 0.0f; out_imag_right = 0.0f; - filter_states_real_ptr = (float *) &( pState->filter_states_re[band_idx][0] ); - filter_states_imag_ptr = (float *) &( pState->filter_states_im[band_idx][0] ); + filter_states_real_ptr = (float *) &( convolver_state->filter_states_re[band_idx][0] ); + filter_states_imag_ptr = (float *) &( convolver_state->filter_states_im[band_idx][0] ); - filter_taps_left_re_ptr = pState->filter_taps_left_re[band_idx]; - filter_taps_left_im_ptr = pState->filter_taps_left_im[band_idx]; - filter_taps_right_re_ptr = pState->filter_taps_right_re[band_idx]; - filter_taps_right_im_ptr = pState->filter_taps_right_im[band_idx]; + filter_taps_left_re_ptr = convolver_state->filter_taps_left_re[band_idx]; + filter_taps_left_im_ptr = convolver_state->filter_taps_left_im[band_idx]; + filter_taps_right_re_ptr = convolver_state->filter_taps_right_re[band_idx]; + filter_taps_right_im_ptr = convolver_state->filter_taps_right_im[band_idx]; for ( tap_idx = num_taps - 1; tap_idx > 0; tap_idx-- ) { diff --git a/lib_dec/ivas_sba_rendering.c b/lib_dec/ivas_sba_rendering.c index dde5d0abd5..1b8572b6fc 100644 --- a/lib_dec/ivas_sba_rendering.c +++ b/lib_dec/ivas_sba_rendering.c @@ -316,9 +316,11 @@ void ivas_sba_mix_matrix_determiner( { int16_t i, ch; float temp; - SPAR_DEC_HANDLE pState; + SPAR_DEC_HANDLE hSpar; int16_t num_bands_out, nchan_transport, nchan_out; + hSpar = st_ivas->hSpar; + /* Convert numeric range */ for ( ch = 0; ch < nchan_remapped; ch++ ) { @@ -340,11 +342,10 @@ void ivas_sba_mix_matrix_determiner( } } - /* AGC */ - pState = st_ivas->hSpar; - nchan_transport = pState->hMdDec->spar_md_cfg.nchan_transport; + /* AGC */ + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; - ivas_agc_dec_process( pState->hAgcDec, output, output, nchan_transport, output_frame ); + ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); /* Convert numeric range back */ for ( ch = 0; ch < nchan_out; ch++ ) @@ -356,8 +357,8 @@ void ivas_sba_mix_matrix_determiner( } /* Mixing matrix determiner */ - num_bands_out = pState->hFbMixer->pFb->filterbank_num_bands; - ivas_spar_dec_gen_umx_mat( pState->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi ); + num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi ); wmops_sub_end(); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 48f784d1e1..7661bda1e2 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -202,7 +202,6 @@ void ivas_spar_dec_close( /* Covar. State handle */ ivas_spar_td_decorr_dec_close( &hSpar->hTdDecorr ); - /* FB mixer handle */ ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs ); @@ -215,6 +214,7 @@ void ivas_spar_dec_close( count_free( hSpar->hPCA ); hSpar->hPCA = NULL; } + count_free( hSpar ); hSpar = NULL; } @@ -622,7 +622,7 @@ static void ivas_spar_dec_MD( int16_t num_channels, table_idx, num_bands_out, bfi, sba_order; int32_t ivas_total_brate; DECODER_CONFIG_HANDLE hDecoderConfig = st_ivas->hDecoderConfig; - SPAR_DEC_HANDLE pState = st_ivas->hSpar; + SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; wmops_sub_start( "ivas_spar_dec_MD" ); @@ -634,7 +634,7 @@ static void ivas_spar_dec_MD( bfi = st_ivas->bfi; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; num_channels = ivas_sba_get_nchan_metadata( sba_order ); - num_bands_out = pState->hFbMixer->pFb->filterbank_num_bands; + num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; if ( ivas_total_brate > FRAME_NO_DATA && !bfi ) { @@ -642,14 +642,14 @@ static void ivas_spar_dec_MD( { ivas_parse_spar_header( hDecoderConfig->ivas_total_brate, sba_order, st0, &table_idx ); - pState->hMdDec->spar_md.num_bands = min( SPAR_DIRAC_SPLIT_START_BAND, IVAS_MAX_NUM_BANDS ); + hSpar->hMdDec->spar_md.num_bands = min( SPAR_DIRAC_SPLIT_START_BAND, IVAS_MAX_NUM_BANDS ); - if ( pState->hMdDec->table_idx != table_idx ) + if ( hSpar->hMdDec->table_idx != table_idx ) { - pState->hMdDec->table_idx = table_idx; - pState->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[table_idx].td_ducking; + hSpar->hMdDec->table_idx = table_idx; + hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[table_idx].td_ducking; - ivas_spar_md_dec_init( pState->hMdDec, hDecoderConfig, num_channels ); + ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels ); } } @@ -664,17 +664,17 @@ static void ivas_spar_dec_MD( *---------------------------------------------------------------------*/ #ifdef SBA_CLEANING - if ( pState->hPCA != NULL ) + if ( hSpar->hPCA != NULL ) #else if ( hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order == 1 ) #endif { - ivas_pca_read_bits( st0, pState->hPCA ); + ivas_pca_read_bits( st0, hSpar->hPCA ); } #ifndef SBA_CLEANING else { - pState->hPCA->pca_bypass = PCA_MODE_INACTIVE; + hSpar->hPCA->pca_bypass = PCA_MODE_INACTIVE; } #endif @@ -682,34 +682,34 @@ static void ivas_spar_dec_MD( * Read AGC bits *---------------------------------------------------------------------*/ - if ( ivas_total_brate > IVAS_SID_5k && !bfi && pState->hMdDec->dtx_vad ) + if ( ivas_total_brate > IVAS_SID_5k && !bfi && hSpar->hMdDec->dtx_vad ) { - pState->AGC_flag = get_next_indice( st0, 1 ); + hSpar->AGC_flag = get_next_indice( st0, 1 ); - ivas_agc_read_bits( pState->hAgcDec, st0, pState->hMdDec->spar_md_cfg.nchan_transport, pState->AGC_flag ); + ivas_agc_read_bits( hSpar->hAgcDec, st0, hSpar->hMdDec->spar_md_cfg.nchan_transport, hSpar->AGC_flag ); } /*---------------------------------------------------------------------* * MD smoothing *---------------------------------------------------------------------*/ - if ( st0->m_old_frame_type == ZERO_FRAME && ivas_total_brate == IVAS_SID_5k && st0->prev_bfi == 0 && pState->hMdDec->spar_md_cfg.nchan_transport == 1 ) + if ( st0->m_old_frame_type == ZERO_FRAME && ivas_total_brate == IVAS_SID_5k && st0->prev_bfi == 0 && hSpar->hMdDec->spar_md_cfg.nchan_transport == 1 ) { - ivas_spar_setup_md_smoothing( pState->hMdDec, num_bands_out ); + ivas_spar_setup_md_smoothing( hSpar->hMdDec, num_bands_out ); } else { - ivas_spar_update_md_hist( pState->hMdDec ); + ivas_spar_update_md_hist( hSpar->hMdDec ); } } else { if ( !bfi ) { - ivas_spar_smooth_md_dtx( pState->hMdDec, num_bands_out ); + ivas_spar_smooth_md_dtx( hSpar->hMdDec, num_bands_out ); } - set_s( pState->hMdDec->valid_bands, 0, IVAS_MAX_NUM_BANDS ); + set_s( hSpar->hMdDec->valid_bands, 0, IVAS_MAX_NUM_BANDS ); } wmops_sub_end(); @@ -731,7 +731,6 @@ static float ivas_spar_get_cldfb_slot_gain( int16_t *time_slot_idx1, float *weight_lowfreq ) { - SPAR_DEC_HANDLE pState = hSpar; float weight; float output_Fs, encfb_delay, decfb_delay; float xfade_start_ns; @@ -739,12 +738,12 @@ static float ivas_spar_get_cldfb_slot_gain( int16_t i_hist; int16_t split_band; - *weight_lowfreq = pState->hFbMixer->cldfb_cross_fade[time_slot_idx]; + *weight_lowfreq = hSpar->hFbMixer->cldfb_cross_fade[time_slot_idx]; output_Fs = (float) hDecoderConfig->output_Fs; encfb_delay = IVAS_FB_ENC_DELAY_NS; decfb_delay = IVAS_FB_DEC_DELAY_NS; - xfade_start_ns = pState->hFbMixer->cross_fade_start_offset / output_Fs * 1000000000.f - encfb_delay + decfb_delay * 0.5f; + xfade_start_ns = hSpar->hFbMixer->cross_fade_start_offset / output_Fs * 1000000000.f - encfb_delay + decfb_delay * 0.5f; xfade_delay_subframes = (int16_t) ( xfade_start_ns / ( FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) ); i_hist = 4 - xfade_delay_subframes; @@ -766,8 +765,8 @@ static float ivas_spar_get_cldfb_slot_gain( else { /* determine cross-fade gain for current frame Parameters*/ - *time_slot_idx0 = pState->hFbMixer->cldfb_cross_fade_start; - *time_slot_idx1 = pState->hFbMixer->cldfb_cross_fade_end; + *time_slot_idx0 = hSpar->hFbMixer->cldfb_cross_fade_start; + *time_slot_idx1 = hSpar->hFbMixer->cldfb_cross_fade_end; weight = *weight_lowfreq; } @@ -904,15 +903,14 @@ void ivas_spar_dec_upmixer( float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; int16_t b_skip_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; DECODER_CONFIG_HANDLE hDecoderConfig; - SPAR_DEC_HANDLE pState, hSpar; + SPAR_DEC_HANDLE hSpar; wmops_sub_start( "ivas_spar_dec_upmixer" ); hSpar = st_ivas->hSpar; - pState = hSpar; hDecoderConfig = st_ivas->hDecoderConfig; - num_bands_out = pState->hFbMixer->pFb->filterbank_num_bands; - nchan_transport = pState->hMdDec->spar_md_cfg.nchan_transport; + num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; @@ -958,7 +956,8 @@ void ivas_spar_dec_upmixer( * AGC *---------------------------------------------------------------------*/ - ivas_agc_dec_process( pState->hAgcDec, output, output, nchan_transport, output_frame ); + ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); + #ifdef DEBUG_SBA_AUDIO_DUMP int16_t l; float largest_value; @@ -982,7 +981,7 @@ void ivas_spar_dec_upmixer( * TD Decorr and pcm ingest *---------------------------------------------------------------------*/ - if ( pState->hMdDec->td_decorr_flag ) + if ( hSpar->hMdDec->td_decorr_flag ) { num_in_ingest = nchan_internal; } @@ -1001,10 +1000,10 @@ void ivas_spar_dec_upmixer( *---------------------------------------------------------------------*/ #ifdef SBA_CLEANING - if ( pState->hPCA != NULL ) + if ( hSpar->hPCA != NULL ) #endif { - ivas_pca_dec( pState->hPCA, output_frame, num_in_ingest, hDecoderConfig->ivas_total_brate, hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); + ivas_pca_dec( hSpar->hPCA, output_frame, num_in_ingest, hDecoderConfig->ivas_total_brate, hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); #ifdef DEBUG_SBA_AUDIO_DUMP pca_ingest_channels = num_in_ingest; /* Dump audio signal after ivas_pca_dec */ @@ -1027,20 +1026,20 @@ void ivas_spar_dec_upmixer( * TD decorrelation *---------------------------------------------------------------------*/ - if ( pState->hMdDec->td_decorr_flag ) + if ( hSpar->hMdDec->td_decorr_flag ) { - ivas_td_decorr_process( pState->hTdDecorr, output, pPcm_tmp, output_frame ); + ivas_td_decorr_process( hSpar->hTdDecorr, output, pPcm_tmp, output_frame ); for ( i = 0; i < nchan_internal - nchan_transport; i++ ) { - mvr2r( pPcm_tmp[pState->hTdDecorr->num_apd_outputs - 1 - i], output[nchan_internal - 1 - i], output_frame ); + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], output[nchan_internal - 1 - i], output_frame ); } - pState->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; + hSpar->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; } else { - pState->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; + hSpar->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; } /*---------------------------------------------------------------------* @@ -1076,7 +1075,7 @@ void ivas_spar_dec_upmixer( * Gen umx mat *---------------------------------------------------------------------*/ - ivas_spar_dec_gen_umx_mat( pState->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi ); + ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi ); /*---------------------------------------------------------------------* @@ -1117,7 +1116,7 @@ void ivas_spar_dec_upmixer( float out_re[IVAS_SPAR_MAX_CH]; float out_im[IVAS_SPAR_MAX_CH]; float cldfb_par; - ivas_fb_bin_to_band_data_t *bin2band = &pState->hFbMixer->pFb->fb_bin_to_band; + ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; for ( out_ch = 0; out_ch < numch_out; out_ch++ ) { @@ -1248,12 +1247,12 @@ void ivas_spar_dec_upmixer( split_band = SPAR_DIRAC_SPLIT_START_BAND; if ( split_band < IVAS_MAX_NUM_BANDS ) { - pState->i_subframe++; - pState->i_subframe = min( pState->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( pState->hMdDec->mixer_mat_prev[1][0][0], pState->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( pState->hMdDec->mixer_mat_prev[2][0][0], pState->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( pState->hMdDec->mixer_mat_prev[3][0][0], pState->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( pState->hMdDec->mixer_mat_prev[4][0][0], pState->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + hSpar->i_subframe++; + hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); for ( out_ch = 0; out_ch < numch_out; out_ch++ ) { @@ -1261,7 +1260,7 @@ void ivas_spar_dec_upmixer( { for ( b = 0; b < num_spar_bands; b++ ) { - pState->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = pState->hMdDec->mixer_mat[out_ch][in_ch][b + i_sf * IVAS_MAX_NUM_BANDS]; + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + i_sf * IVAS_MAX_NUM_BANDS]; } } } diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 1db9825ebc..1cc9e404d9 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -48,11 +48,14 @@ #define MIN_POOL_SIZE_DTX 40 #define MAX_UPDATE_RATE_DTX 0.4f + /*------------------------------------------------------------------------------------------* * Local functions declarations *------------------------------------------------------------------------------------------*/ + static void ivas_band_cov( float **ppIn_FR_real, float **ppIn_FR_imag, const int16_t num_chans, const int16_t num_bins, int16_t stride, float **pFb_bin_to_band, const int16_t *pFb_start_bin_per_band, const int16_t *pFb_active_bins_per_band, const int16_t start_band, const int16_t end_band, float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ); + /*------------------------------------------------------------------------- * ivas_spar_covar_enc_open() * @@ -149,17 +152,17 @@ void ivas_enc_cov_handler_process( int16_t i, j; ivas_cov_smooth_in_buf_t pCov_in_buf; int16_t num_ch = pIn_buf->num_ch; - ivas_enc_cov_handler_state_t *pState = hCovEnc; pCov_in_buf.num_ch = num_ch; - ivas_band_cov( pIn_buf->ppIn_FR_real, pIn_buf->ppIn_FR_imag, pIn_buf->num_ch, pState->num_bins, + ivas_band_cov( pIn_buf->ppIn_FR_real, pIn_buf->ppIn_FR_imag, pIn_buf->num_ch, hCovEnc->num_bins, pFb->fb_bin_to_band.short_stride, pFb->fb_bin_to_band.pp_short_stride_bin_to_band, pFb->fb_bin_to_band.p_short_stride_start_bin_per_band, pFb->fb_bin_to_band.p_short_stride_num_bins_per_band, start_band, end_band, cov_real ); + #ifdef DEBUG_SPAR_WRITE_OUT_COV { static FILE *fid = 0; @@ -199,8 +202,7 @@ void ivas_enc_cov_handler_process( pCov_in_buf.reset_cov = 1; } - ivas_cov_smooth_process( pState->pCov_state, &pCov_in_buf, pFb, - start_band, end_band ); + ivas_cov_smooth_process( hCovEnc->pCov_state, &pCov_in_buf, pFb, start_band, end_band ); if ( pIn_buf->dtx_cov_flag == 0 ) { @@ -208,12 +210,12 @@ void ivas_enc_cov_handler_process( { for ( j = 0; j < num_ch; j++ ) { - mvr2r( pCov_in_buf.cov_real[i][j], pState->pCov_dtx_state->pPrior_cov_real[i][j], pFb->filterbank_num_bands ); + mvr2r( pCov_in_buf.cov_real[i][j], hCovEnc->pCov_dtx_state->pPrior_cov_real[i][j], pFb->filterbank_num_bands ); mvr2r( pCov_in_buf.cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); } } - pState->prior_dtx_present = 1; + hCovEnc->prior_dtx_present = 1; } else { @@ -229,13 +231,12 @@ void ivas_enc_cov_handler_process( } pCov_in_buf.reset_cov = 0; - ivas_cov_smooth_process( pState->pCov_dtx_state, &pCov_in_buf, pFb, - start_band, end_band ); - pState->prior_dtx_present = 1; + ivas_cov_smooth_process( hCovEnc->pCov_dtx_state, &pCov_in_buf, pFb, start_band, end_band ); + hCovEnc->prior_dtx_present = 1; } else { - if ( pState->prior_dtx_present == 0 ) + if ( hCovEnc->prior_dtx_present == 0 ) { for ( i = 0; i < num_ch; i++ ) { @@ -246,9 +247,8 @@ void ivas_enc_cov_handler_process( } pCov_in_buf.reset_cov = 1; - ivas_cov_smooth_process( pState->pCov_dtx_state, &pCov_in_buf, pFb, - start_band, end_band ); - pState->prior_dtx_present = 1; + ivas_cov_smooth_process( hCovEnc->pCov_dtx_state, &pCov_in_buf, pFb, start_band, end_band ); + hCovEnc->prior_dtx_present = 1; } else { @@ -256,11 +256,11 @@ void ivas_enc_cov_handler_process( { for ( j = 0; j < num_ch; j++ ) { - mvr2r( pState->pCov_dtx_state->pPrior_cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); + mvr2r( hCovEnc->pCov_dtx_state->pPrior_cov_real[i][j], cov_dtx_real[i][j], pFb->filterbank_num_bands ); } } - pState->prior_dtx_present = 1; + hCovEnc->prior_dtx_present = 1; } } } @@ -268,6 +268,7 @@ void ivas_enc_cov_handler_process( return; } + static void ivas_band_cov( float **ppIn_FR_real, float **ppIn_FR_imag, @@ -293,14 +294,18 @@ static void ivas_band_cov( { pV_re[k] = ppIn_FR_real[i][k] * ppIn_FR_real[j][k] + ppIn_FR_imag[i][k] * ppIn_FR_imag[j][k]; } + for ( k = start_band; k < end_band; k++ ) { float temp = 0.0f; const float *p_bin_to_band = pFb_bin_to_band[k]; float *cov_ptr = pV_re; - int16_t num_blocks = num_bins / stride; + int16_t num_blocks; + + num_blocks = num_bins / stride; start_bin = pFb_start_bin_per_band[k]; active_bins = pFb_active_bins_per_band[k]; + for ( int16_t blk = 0; blk < num_blocks; blk++ ) { /* optional: add temporal weight here */ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index ae95d02d24..81009eaefa 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -94,7 +94,7 @@ ivas_error ivas_spar_enc_open( // bw = ivas_get_bw_idx_from_sample_rate(pCfg->input_Fs); table_idx = ivas_get_spar_table_idx( ivas_total_brate, sba_order_internal, SPAR_CONFIG_BW, NULL, NULL ); - // ivas_set_bitrate_config(&pState->hMdEnc->spar_md_cfg, table_idx); + // ivas_set_bitrate_config(&hSpar->hMdEnc->spar_md_cfg, table_idx); /* MD handle */ if ( ( error = ivas_spar_md_enc_open( &( hSpar->hMdEnc ), hEncoderConfig ) ) != IVAS_ERR_OK ) @@ -423,7 +423,7 @@ static ivas_error ivas_spar_enc_process( int16_t in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]; ivas_error error; const int16_t *order; - SPAR_ENC_HANDLE pState = st_ivas->hSpar; + SPAR_ENC_HANDLE hSpar = st_ivas->hSpar; IVAS_QMETADATA_HANDLE hQMetaData = st_ivas->hQMetaData; int16_t ts, l_ts, orig_dirac_bands, num_del_samples; float *ppIn_FR_real[IVAS_SPAR_MAX_CH], *ppIn_FR_imag[IVAS_SPAR_MAX_CH]; @@ -441,7 +441,7 @@ static ivas_error ivas_spar_enc_process( input_Fs = hEncoderConfig->input_Fs; ivas_total_brate = hEncoderConfig->ivas_total_brate; - num_del_samples = pState->hFbMixer->fb_cfg->fb_latency; + num_del_samples = hSpar->hFbMixer->fb_cfg->fb_latency; input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); sba_order = min( hEncoderConfig->sba_order, IVAS_MAX_SBA_ORDER ); @@ -459,11 +459,11 @@ static ivas_error ivas_spar_enc_process( * Transient detector *-----------------------------------------------------------------------------------------*/ - cov_in_buf.transient_det = ivas_transient_det_process( pState->hTranDet, data_f[0], input_frame ); + cov_in_buf.transient_det = ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame ); /* store previous input samples for W in local buffer */ assert( num_del_samples <= IVAS_FB_1MS_48K_SAMP ); - mvr2r( &pState->hFbMixer->ppFilterbank_prior_input[0][pState->hFbMixer->fb_cfg->prior_input_length - num_del_samples], w_del_buf, num_del_samples ); + mvr2r( &hSpar->hFbMixer->ppFilterbank_prior_input[0][hSpar->hFbMixer->fb_cfg->prior_input_length - num_del_samples], w_del_buf, num_del_samples ); /*-----------------------------------------------------------------------------------------* * FB mixer ingest @@ -475,7 +475,7 @@ static ivas_error ivas_spar_enc_process( } /* run Filter Bank overlapping MDFT analysis first, then we can use the temporary buffer for Parameter MDFT analysis*/ - ivas_fb_mixer_pcm_ingest( pState->hFbMixer, data_f, p_pcm_tmp, input_frame ); + ivas_fb_mixer_pcm_ingest( hSpar->hFbMixer, data_f, p_pcm_tmp, input_frame ); /* prepare Parameter MDFT analysis */ for ( i = 0; i < nchan_inp; i++ ) @@ -495,8 +495,8 @@ static ivas_error ivas_spar_enc_process( for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) { - ivas_fb_mixer_get_windowed_fr( pState->hFbMixer, p_pcm_tmp, ppIn_FR_real, ppIn_FR_imag, l_ts, l_ts ); - ivas_fb_mixer_update_prior_input( pState->hFbMixer, p_pcm_tmp, l_ts ); + ivas_fb_mixer_get_windowed_fr( hSpar->hFbMixer, p_pcm_tmp, ppIn_FR_real, ppIn_FR_imag, l_ts, l_ts ); + ivas_fb_mixer_update_prior_input( hSpar->hFbMixer, p_pcm_tmp, l_ts ); for ( i = 0; i < nchan_inp; i++ ) { @@ -628,21 +628,21 @@ static ivas_error ivas_spar_enc_process( { for ( j = 0; j < nchan_inp; j++ ) { - cov_real[i][j] = pState->hMdEnc->cov_real[i][j]; - cov_dtx_real[i][j] = pState->hMdEnc->cov_dtx_real[i][j]; + cov_real[i][j] = hSpar->hMdEnc->cov_real[i][j]; + cov_dtx_real[i][j] = hSpar->hMdEnc->cov_dtx_real[i][j]; } } cov_in_buf.dtx_cov_flag = dtx_cov_flag; - ivas_enc_cov_handler_process( pState->hCovEnc, &cov_in_buf, cov_real, cov_dtx_real, pState->hFbMixer->pFb, 0, pState->hFbMixer->pFb->filterbank_num_bands ); + ivas_enc_cov_handler_process( hSpar->hCovEnc, &cov_in_buf, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands ); - if ( pState->hMdEnc->table_idx != table_idx ) + if ( hSpar->hMdEnc->table_idx != table_idx ) { - pState->hMdEnc->table_idx = table_idx; - ivas_spar_set_bitrate_config( &pState->hMdEnc->spar_md_cfg, table_idx, SPAR_DIRAC_SPLIT_START_BAND ); + hSpar->hMdEnc->table_idx = table_idx; + ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, SPAR_DIRAC_SPLIT_START_BAND ); } - nchan_transport = pState->hMdEnc->spar_md_cfg.nchan_transport; + nchan_transport = hSpar->hMdEnc->spar_md_cfg.nchan_transport; /*-----------------------------------------------------------------------------------------* * MetaData encoder @@ -684,7 +684,7 @@ static ivas_error ivas_spar_enc_process( md_in_buf.dtx_vad = dtx_vad; - ivas_spar_md_enc_process( pState->hMdEnc, hEncoderConfig, &md_in_buf, hMetaData, dtx_silence_mode ); + ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, &md_in_buf, hMetaData, dtx_silence_mode ); if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { @@ -695,12 +695,12 @@ static ivas_error ivas_spar_enc_process( int16_t d_start_band, d_end_band; int16_t dirac_band_idx; - d_start_band = st_ivas->hSpar->enc_param_start_band; + d_start_band = hSpar->enc_param_start_band; d_end_band = IVAS_MAX_NUM_BANDS; for ( b = d_start_band; b < d_end_band; b++ ) { - dirac_band_idx = st_ivas->hSpar->dirac_to_spar_md_bands[b] - d_start_band; + dirac_band_idx = hSpar->dirac_to_spar_md_bands[b] - d_start_band; for ( i_ts = 0; i_ts < hQMetaData->q_direction->cfg.nblocks; i_ts++ ) { azi_dirac[b][i_ts] = hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[i_ts]; @@ -713,8 +713,8 @@ static ivas_error ivas_spar_enc_process( { for ( i = 0; i < IVAS_SPAR_MAX_CH - 1; i++ ) { - pState->hMdEnc->spar_md.band_coeffs[d_start_band - 1].P_re[i] = - pState->hMdEnc->spar_md.band_coeffs[d_start_band - 1].P_quant_re[i]; + hSpar->hMdEnc->spar_md.band_coeffs[d_start_band - 1].P_re[i] = + hSpar->hMdEnc->spar_md.band_coeffs[d_start_band - 1].P_quant_re[i]; } } @@ -730,7 +730,7 @@ static ivas_error ivas_spar_enc_process( Wscale_d[b] = min( 2.0f, max( Wscale_d[b], 1.0f ) ); } - ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, pState->hMdEnc->mixer_mat, &pState->hMdEnc->spar_md, &pState->hMdEnc->spar_md_cfg, + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, hSpar->hMdEnc->mixer_mat, &hSpar->hMdEnc->spar_md, &hSpar->hMdEnc->spar_md_cfg, d_start_band, d_end_band, sba_order, dtx_vad, Wscale_d ); } @@ -739,7 +739,7 @@ static ivas_error ivas_spar_enc_process( * FB mixer *-----------------------------------------------------------------------------------------*/ - ivas_fb_mixer_get_in_out_mapping( pState->hFbMixer->fb_cfg, nchan_transport, ENC, remix_order_set[pState->hMdEnc->spar_md_cfg.remix_unmix_order], in_out_mixer_map ); + ivas_fb_mixer_get_in_out_mapping( hSpar->hFbMixer->fb_cfg, nchan_transport, ENC, remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order], in_out_mixer_map ); #ifdef DEBUG_SBA_MD_DUMP { @@ -748,15 +748,15 @@ static ivas_error ivas_spar_enc_process( if ( f_mat == 0 ) f_mat = fopen( "mixer_mat_enc", "w" ); - for ( i = 0; i < pState->hFbMixer->fb_cfg->num_out_chans; i++ ) + for ( i = 0; i < hSpar->hFbMixer->fb_cfg->num_out_chans; i++ ) { - for ( j = 0; j < pState->hFbMixer->fb_cfg->num_in_chans; j++ ) + for ( j = 0; j < hSpar->hFbMixer->fb_cfg->num_in_chans; j++ ) { - for ( k = 0; k < pState->hFbMixer->pFb->filterbank_num_bands; k++ ) + for ( k = 0; k < hSpar->hFbMixer->pFb->filterbank_num_bands; k++ ) { - fprintf( f_mat, "%f\n", pState->hMdEnc->mixer_mat[i][j][k] ); + fprintf( f_mat, "%f\n", hSpar->hMdEnc->mixer_mat[i][j][k] ); - if ( ( in_out_mixer_map[i][j] == 0 ) && ( fabs( pState->hMdEnc->mixer_mat[i][j][k] ) > 1e-20 ) ) + if ( ( in_out_mixer_map[i][j] == 0 ) && ( fabs( hSpar->hMdEnc->mixer_mat[i][j][k] ) > 1e-20 ) ) { assert( 0 && "Non zero value in unexpected mixer map!!!" ); } @@ -773,11 +773,12 @@ static ivas_error ivas_spar_enc_process( { fid = fopen( "pred_coeffs_enc.txt", "wt" ); } - fprintf( fid, "%.6f\n", pState->hMdEnc->mixer_mat[1][0][band] ); + fprintf( fid, "%.6f\n", hSpar->hMdEnc->mixer_mat[1][0][band] ); } #endif - ivas_fb_mixer_process( pState->hFbMixer, pState->hMdEnc->mixer_mat, p_pcm_tmp, input_frame, in_out_mixer_map ); + ivas_fb_mixer_process( hSpar->hFbMixer, hSpar->hMdEnc->mixer_mat, p_pcm_tmp, input_frame, in_out_mixer_map ); + #ifdef DEBUG_SBA_AUDIO_DUMP float largest_value; for ( i = 0; i < nchan_transport; i++ ) @@ -795,7 +796,7 @@ static ivas_error ivas_spar_enc_process( #endif /* move delayed W into output buffer unless activeW operation*/ - if ( pState->hFbMixer->fb_cfg->active_w_mixing == 0 ) + if ( hSpar->hFbMixer->fb_cfg->active_w_mixing == 0 ) { mvr2r( w_del_buf, p_pcm_tmp[0], num_del_samples ); mvr2r( data_f[0], p_pcm_tmp[0] + num_del_samples, input_frame - num_del_samples ); @@ -805,9 +806,9 @@ static ivas_error ivas_spar_enc_process( * PCA encoder *-----------------------------------------------------------------------------------------*/ - if ( pState->hPCA != NULL ) + if ( hSpar->hPCA != NULL ) { - ivas_pca_enc( hEncoderConfig, pState->hPCA, hMetaData, p_pcm_tmp, input_frame, FOA_CHANNELS ); + ivas_pca_enc( hEncoderConfig, hSpar->hPCA, hMetaData, p_pcm_tmp, input_frame, FOA_CHANNELS ); } else { @@ -837,11 +838,11 @@ static ivas_error ivas_spar_enc_process( /*FILE *fp = fopen("int_enc_dmx.raw", "ab"); for (int16_t t = 0; t < 960; t++) { - for (int16_t c = 0; c < pState->hFbMixer->filterbank_num_out_chans; c++) + for (int16_t c = 0; c < hSpar->hFbMixer->filterbank_num_out_chans; c++) { for ( k = 0; k < 2; k++ ) { - fb_mixer_in_buf.ppMixer[i][j][k] = pState->hMdEnc->mixer_mat[i][j]; + fb_mixer_in_buf.ppMixer[i][j][k] = hSpar->hMdEnc->mixer_mat[i][j]; } } } @@ -855,7 +856,7 @@ static ivas_error ivas_spar_enc_process( { if ( hEncoderConfig->Opt_AGC_ON > 0 ) { - ivas_agc_enc_process( pState->hAgcEnc, hMetaData, p_pcm_tmp, p_pcm_tmp, pState->hFbMixer->fb_cfg->num_out_chans, hEncoderConfig ); + ivas_agc_enc_process( hSpar->hAgcEnc, hMetaData, p_pcm_tmp, p_pcm_tmp, hSpar->hFbMixer->fb_cfg->num_out_chans, hEncoderConfig ); } else { @@ -918,7 +919,7 @@ static ivas_error ivas_spar_enc_process( * Re-order the dmx back to ACN/SN3D format *-----------------------------------------------------------------------------------------*/ - order = remix_order_set[pState->hMdEnc->spar_md_cfg.remix_unmix_order]; + order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; for ( i = 0; i < input_frame; i++ ) { -- GitLab From 0cc776b5ab90e693dcda222664e118b5895479c2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 1 Aug 2022 14:23:40 +0200 Subject: [PATCH 08/17] maintenance: - replace parameter name 'codec_mode' by 'enc_dec' where appropriate - add spaces --- lib_com/ivas_entropy_coder_common.c | 87 ++++++++++++++++------------- lib_com/ivas_prot.h | 4 +- 2 files changed, 49 insertions(+), 42 deletions(-) diff --git a/lib_com/ivas_entropy_coder_common.c b/lib_com/ivas_entropy_coder_common.c index 5f23b0637d..ef3dc1dab8 100644 --- a/lib_com/ivas_entropy_coder_common.c +++ b/lib_com/ivas_entropy_coder_common.c @@ -95,13 +95,16 @@ void ivas_get_cum_freq_model( return; } + /*-----------------------------------------------------------------------------------------* * Function ivas_map_num_pred_r_to_idx() * * Map the ivas_arith_pred_r_consts and ivas_huff_pred_r_consts tables *-----------------------------------------------------------------------------------------*/ -int16_t ivas_map_num_pred_r_to_idx( const int16_t num_quant_points_pred_r, const int16_t active_w_flag ) +int16_t ivas_map_num_pred_r_to_idx( + const int16_t num_quant_points_pred_r, + const int16_t active_w_flag ) { int16_t pred_r_to_idx = -1; if ( active_w_flag == 0 ) @@ -146,16 +149,19 @@ int16_t ivas_map_num_pred_r_to_idx( const int16_t num_quant_points_pred_r, const break; } } + return pred_r_to_idx; } + /*-----------------------------------------------------------------------------------------* * Function ivas_map_num_drct_r_to_idx() * * Map the ivas_arith_drct_r_consts and ivas_huff_drct_r_consts tables *-----------------------------------------------------------------------------------------*/ -int16_t ivas_map_num_drct_r_to_idx( const int16_t num_quant_points_drct_r ) +int16_t ivas_map_num_drct_r_to_idx( + const int16_t num_quant_points_drct_r ) { int16_t drct_r_to_idx = -1; switch ( num_quant_points_drct_r ) @@ -179,13 +185,15 @@ int16_t ivas_map_num_drct_r_to_idx( const int16_t num_quant_points_drct_r ) return drct_r_to_idx; } + /*-----------------------------------------------------------------------------------------* * Function ivas_map_num_decd_r_to_idx() * * Map the ivas_arith_decd_r_consts and ivas_huff_decd_r_consts tables *-----------------------------------------------------------------------------------------*/ -int16_t ivas_map_num_decd_r_to_idx( const int16_t num_quant_points_decd_r ) +int16_t ivas_map_num_decd_r_to_idx( + const int16_t num_quant_points_decd_r ) { int16_t decd_r_to_idx = -1; switch ( num_quant_points_decd_r ) @@ -212,9 +220,11 @@ int16_t ivas_map_num_decd_r_to_idx( const int16_t num_quant_points_decd_r ) assert( "Forbidden value for DECD quantization strategy index" ); break; } + return decd_r_to_idx; } + /*---------------------------------------------------------------------------------------- - * * Function ivas_spar_arith_com_init() * @@ -226,15 +236,17 @@ static void ivas_spar_arith_com_init( const ivas_freq_models_t *pFreq_models, ivas_arith_t *pArith_diff, const int16_t q_levels, - int16_t codec_mode ) + const int16_t enc_dec ) { int16_t i, j; + float sum; pArith->vals = pFreq_models->vals; pArith->range = q_levels; pArith->num_models = pFreq_models->num_models; pArith->dyn_model_bits = ivas_get_bits_to_encode( pArith->num_models - 1 ); pArith->pFreq_model = pFreq_models->freq_model[0]; + ivas_get_cum_freq_model( pArith->pFreq_model, pArith->range, pArith->cum_freq[0] ); for ( i = 0; i < pArith->num_models - 1; i++ ) @@ -243,9 +255,9 @@ static void ivas_spar_arith_com_init( ivas_get_cum_freq_model( pArith->pAlt_freq_models[i], pArith->range, pArith->cum_freq[i + 1] ); } - if ( codec_mode == ENC ) + if ( enc_dec == ENC ) { - float sum = 0; + sum = 0; for ( i = 1; i < pArith->range + 1; i++ ) { sum += pArith->pFreq_model[i]; @@ -260,7 +272,6 @@ static void ivas_spar_arith_com_init( for ( j = 0; j < pArith->num_models - 1; j++ ) { sum = 0; - for ( i = 1; i < pArith->range + 1; i++ ) { sum += pArith->pAlt_freq_models[j][i]; @@ -279,6 +290,7 @@ static void ivas_spar_arith_com_init( pArith_diff->num_models = pFreq_models->diff_num_models; pArith_diff->dyn_model_bits = ivas_get_bits_to_encode( pArith_diff->num_models - 1 ); pArith_diff->pFreq_model = pFreq_models->diff_freq_model[0]; + ivas_get_cum_freq_model( pArith_diff->pFreq_model, pArith_diff->range, pArith_diff->cum_freq[0] ); for ( i = 0; i < pArith_diff->num_models - 1; i++ ) @@ -287,9 +299,9 @@ static void ivas_spar_arith_com_init( ivas_get_cum_freq_model( pArith_diff->pAlt_freq_models[i], pArith_diff->range, pArith_diff->cum_freq[i + 1] ); } - if ( codec_mode == ENC ) + if ( enc_dec == ENC ) { - float sum = 0; + sum = 0; for ( i = 1; i < pArith_diff->range + 1; i++ ) { sum += pArith_diff->pFreq_model[i]; @@ -304,7 +316,6 @@ static void ivas_spar_arith_com_init( for ( j = 0; j < pArith_diff->num_models - 1; j++ ) { sum = 0; - for ( i = 1; i < pArith_diff->range + 1; i++ ) { sum += pArith_diff->pAlt_freq_models[j][i]; @@ -321,53 +332,50 @@ static void ivas_spar_arith_com_init( return; } + /*-----------------------------------------------------------------------------------------* * Function ivas_spar_arith_coeffs_com_init() * * Init for Arithm. coding *-----------------------------------------------------------------------------------------*/ + void ivas_spar_arith_coeffs_com_init( ivas_arith_coeffs_t *pArith_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, - int16_t codec_mode ) + const int16_t enc_dec ) { - int16_t i; - int16_t pred_r_index, drct_r_index, decd_r_index; - int16_t num_quant_points_pred_r; - int16_t num_quant_points_drct_r; - int16_t num_quant_points_decd_r; + int16_t i, pred_r_index, drct_r_index, decd_r_index; + int16_t num_quant_points_pred_r, num_quant_points_drct_r, num_quant_points_decd_r; for ( i = 0; i < MAX_QUANT_STRATS; i++ ) { - num_quant_points_pred_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][0]; // 0: pred_r - pred_r_index = ivas_map_num_pred_r_to_idx( num_quant_points_pred_r, - ivas_spar_br_table_consts[table_idx].active_w ); + num_quant_points_pred_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][0]; /* 0: pred_r */ + pred_r_index = ivas_map_num_pred_r_to_idx( num_quant_points_pred_r, ivas_spar_br_table_consts[table_idx].active_w ); ivas_spar_arith_com_init( &pArith_coeffs->pred_arith_re[i], &ivas_arith_pred_r_consts[pred_r_index], - &pArith_coeffs->pred_arith_re_diff[i], pSpar_cfg->quant_strat[i].PR.q_levels[0], - codec_mode ); + &pArith_coeffs->pred_arith_re_diff[i], pSpar_cfg->quant_strat[i].PR.q_levels[0], enc_dec ); - num_quant_points_drct_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][1]; // 1: drct_r + num_quant_points_drct_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][1]; /* 1: drct_r */ drct_r_index = ivas_map_num_drct_r_to_idx( num_quant_points_drct_r ); ivas_spar_arith_com_init( &pArith_coeffs->drct_arith_re[i], &ivas_arith_drct_r_consts[drct_r_index], - &pArith_coeffs->drct_arith_re_diff[i], pSpar_cfg->quant_strat[i].C.q_levels[0], - codec_mode ); + &pArith_coeffs->drct_arith_re_diff[i], pSpar_cfg->quant_strat[i].C.q_levels[0], enc_dec ); - num_quant_points_decd_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][2]; // 2: decd_r + num_quant_points_decd_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][2]; /* 2: decd_r */ decd_r_index = ivas_map_num_decd_r_to_idx( num_quant_points_decd_r ); ivas_spar_arith_com_init( &pArith_coeffs->decd_arith_re[i], &ivas_arith_decd_r_consts[decd_r_index], - &pArith_coeffs->decd_arith_re_diff[i], pSpar_cfg->quant_strat[i].P_r.q_levels[0], - codec_mode ); + &pArith_coeffs->decd_arith_re_diff[i], pSpar_cfg->quant_strat[i].P_r.q_levels[0], enc_dec ); } return; } + /*-----------------------------------------------------------------------------------------* * Function ivas_huffman_dec_init_min_max_len() * * Find min and max length in codebook and finalize initialization of ivas_huffman_cfg_t. *-----------------------------------------------------------------------------------------*/ + static void ivas_huffman_dec_init_min_max_len( ivas_huffman_cfg_t *p_huff_cfg ) { @@ -396,51 +404,50 @@ static void ivas_huffman_dec_init_min_max_len( return; } + /*-----------------------------------------------------------------------------------------* * Function ivas_spar_huff_coeffs_com_init() * * Init for Huffman decoding *-----------------------------------------------------------------------------------------*/ + void ivas_spar_huff_coeffs_com_init( ivas_huff_coeffs_t *pHuff_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, - int16_t codec_mode ) + const int16_t enc_dec ) { - int16_t i; - int16_t pred_r_index, drct_r_index, decd_r_index; - int16_t num_quant_points_pred_r; - int16_t num_quant_points_drct_r; - int16_t num_quant_points_decd_r; - + int16_t i, pred_r_index, drct_r_index, decd_r_index; + int16_t num_quant_points_pred_r, num_quant_points_drct_r, num_quant_points_decd_r; ivas_huffman_cfg_t *p_huff_cfg; + for ( i = 0; i < MAX_QUANT_STRATS; i++ ) { p_huff_cfg = &pHuff_coeffs->pred_huff_re[i]; - num_quant_points_pred_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][0]; // 0: pred_r + num_quant_points_pred_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][0]; /* 0: pred_r */ pred_r_index = ivas_map_num_pred_r_to_idx( num_quant_points_pred_r, 0 ); p_huff_cfg->codebook = &ivas_huff_pred_r_consts[pred_r_index].code_book[0][0]; - if ( codec_mode == DEC ) + if ( enc_dec == DEC ) { p_huff_cfg->sym_len = pSpar_cfg->quant_strat[i].PR.q_levels[0]; ivas_huffman_dec_init_min_max_len( p_huff_cfg ); } p_huff_cfg = &pHuff_coeffs->drct_huff_re[i]; - num_quant_points_drct_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][1]; // 1: drct_r + num_quant_points_drct_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][1]; /* 1: drct_r */ drct_r_index = ivas_map_num_drct_r_to_idx( num_quant_points_drct_r ); p_huff_cfg->codebook = &ivas_huff_drct_r_consts[drct_r_index].code_book[0][0]; - if ( codec_mode == DEC ) + if ( enc_dec == DEC ) { p_huff_cfg->sym_len = pSpar_cfg->quant_strat[i].C.q_levels[0]; ivas_huffman_dec_init_min_max_len( p_huff_cfg ); } p_huff_cfg = &pHuff_coeffs->decd_huff_re[i]; - num_quant_points_decd_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][2]; // 2: decd_r + num_quant_points_decd_r = ivas_spar_br_table_consts[table_idx].q_lvls[i][2]; /* 2: decd_r */ decd_r_index = ivas_map_num_decd_r_to_idx( num_quant_points_decd_r ); p_huff_cfg->codebook = &ivas_huff_decd_r_consts[decd_r_index].code_book[0][0]; - if ( codec_mode == DEC ) + if ( enc_dec == DEC ) { p_huff_cfg->sym_len = pSpar_cfg->quant_strat[i].P_r.q_levels[0]; ivas_huffman_dec_init_min_max_len( p_huff_cfg ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9da35e5a2c..b543d9827e 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4201,8 +4201,8 @@ int16_t ivas_get_bits_to_encode( ); void ivas_huffman_encode( ivas_huffman_cfg_t *huff_cfg, int16_t in, int16_t *hcode, int16_t *hlen ); -void ivas_spar_huff_coeffs_com_init( ivas_huff_coeffs_t *pHuff_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, int16_t codec_mode ); -void ivas_spar_arith_coeffs_com_init( ivas_arith_coeffs_t *pArith_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, int16_t codec_mode ); +void ivas_spar_huff_coeffs_com_init( ivas_huff_coeffs_t *pHuff_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, const int16_t enc_dec ); +void ivas_spar_arith_coeffs_com_init( ivas_arith_coeffs_t *pArith_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, const int16_t enc_dec ); void ivas_arith_encode_cmplx_cell_array(ivas_arith_t *pArith_re, ivas_arith_t *pArith_re_diff, const int16_t *pDo_diff, const int16_t nB, int16_t *pSymbol_re, int16_t *pSymbol_old_re, ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, const int16_t any_diff); ivas_error ivas_huffman_decode( ivas_huffman_cfg_t *huff_cfg, Decoder_State *st0, int16_t *dec_out ); void ivas_arith_decode_cmplx_cell_array( ivas_arith_t *pArith_re, ivas_arith_t *pArith_re_diff, Decoder_State *st0, ivas_cell_dim_t *pCell_dims, int16_t *pDo_diff, const int16_t nB, int16_t *pSymbol_re, int16_t *pSymbol_re_old ); -- GitLab From 236c7b49d26726990328f9a939b6d86056699423 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 3 Aug 2022 10:32:45 +0200 Subject: [PATCH 09/17] - add debug file 'res/ivas_total_brate.dec'; under DEBUG_MODE_INFO --- lib_dec/ivas_dec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 3b5ffe3f80..0aae2d8b84 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -600,6 +600,10 @@ ivas_error ivas_dec( #ifdef DEBUG_MODE_INFO dbgwrite( &st_ivas->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" ); dbgwrite( &st_ivas->BER_detect, sizeof( int16_t ), 1, output_frame, "res/BER_detect" ); + { + float tmpF = ivas_total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, "res/ivas_total_brate.dec" ); + } #endif wmops_sub_end(); -- GitLab From 4ca335c9d14896753273ba282c2094660e2b8f7c Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 3 Aug 2022 10:39:24 +0200 Subject: [PATCH 10/17] harmonize comments: use consistently "signaling" instead of "signaling/signalling" --- lib_com/bits_alloc.c | 28 ++++++++++---------- lib_com/bitstream.c | 30 ++++++++++----------- lib_com/ivas_cnst.h | 4 +-- lib_com/ivas_ism_config.c | 2 +- lib_com/ivas_prot.h | 10 +++---- lib_com/ivas_qspherical_com.c | 2 +- lib_com/prot.h | 22 ++++++++-------- lib_com/rom_com.c | 2 +- lib_dec/decision_matrix_dec.c | 16 ++++++------ lib_dec/hq_core_dec.c | 2 +- lib_dec/ivas_cpe_dec.c | 2 +- lib_dec/ivas_dec.c | 2 +- lib_dec/ivas_decision_matrix_dec.c | 10 +++---- lib_dec/ivas_dirac_dec.c | 2 +- lib_dec/ivas_init_dec.c | 4 +-- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/ivas_qmetadata_dec.c | 6 ++--- lib_dec/ivas_stereo_td_dec.c | 4 +-- lib_dec/lp_exc_d.c | 2 +- lib_dec/updt_dec.c | 2 +- lib_enc/core_enc_ol.c | 4 +-- lib_enc/decision_matrix_enc.c | 36 ++++++++++++------------- lib_enc/dtx.c | 2 +- lib_enc/enc_ppp.c | 4 +-- lib_enc/enc_prm.c | 18 ++++++------- lib_enc/evs_enc.c | 6 ++--- lib_enc/hq_classifier_enc.c | 4 +-- lib_enc/hq_core_enc.c | 4 +-- lib_enc/ivas_core_enc.c | 6 ++--- lib_enc/ivas_core_pre_proc.c | 4 +-- lib_enc/ivas_core_pre_proc_front.c | 2 +- lib_enc/ivas_cpe_enc.c | 2 +- lib_enc/ivas_decision_matrix_enc.c | 12 ++++----- lib_enc/ivas_dirac_enc.c | 2 +- lib_enc/ivas_init_enc.c | 2 +- lib_enc/ivas_ism_enc.c | 2 +- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_mc_param_enc.c | 2 +- lib_enc/ivas_qmetadata_enc.c | 42 +++++++++++++++--------------- lib_enc/ivas_sce_enc.c | 2 +- lib_enc/ivas_stereo_td_enc.c | 4 +-- lib_enc/ivas_tcx_core_enc.c | 2 +- lib_enc/mslvq_enc.c | 2 +- lib_enc/pre_proc.c | 2 +- lib_enc/updt_enc.c | 2 +- 45 files changed, 162 insertions(+), 162 deletions(-) diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index 3673a4f5fe..e9f9878853 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -525,7 +525,7 @@ ivas_error config_acelp1( const int16_t L_frame, /* i : frame length at internal Fs */ const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const int16_t signalling_bits, /* i : number of signalling bits */ + const int16_t signaling_bits, /* i : number of signaling bits */ const int16_t coder_type, /* i : coder type */ const int16_t tc_subfr, /* i : TC subfr ID */ const int16_t tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ @@ -663,7 +663,7 @@ ivas_error config_acelp1( bits += *nBits_es_Pred; /* equalize for 4th signaling bit estimated at the encoder in TC_0_192 */ } - /* Subtract signalling bits */ + /* Subtract signaling bits */ if ( enc_dec == DEC && idchan == 1 && element_mode > EVS_MONO ) { bits -= TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS; @@ -681,13 +681,13 @@ ivas_error config_acelp1( } else { - /* Subtract signalling bits */ - bits -= signalling_bits; + /* Subtract signaling bits */ + bits -= signaling_bits; } if ( extl_brate > 0 && ( extl == WB_TBE || extl == SWB_TBE || extl == FB_TBE || extl == WB_BWE || extl == SWB_BWE || extl == FB_BWE ) ) { - /* extension layer signalling bit is counted in the extension layer bitbudget */ + /* extension layer signaling bit is counted in the extension layer bitbudget */ bits++; } @@ -896,14 +896,14 @@ ivas_error config_acelp1( fix_first = 1; } - /* TC signalling */ + /* TC signaling */ if ( L_frame == L_FRAME ) { if ( tc_subfr == TC_0_0 ) { if ( enc_dec == ENC ) { - bits -= 1; /* TC signalling */ + bits -= 1; /* TC signaling */ } if ( acelp_cfg->ltf_mode == NORMAL_OPERATION ) @@ -915,7 +915,7 @@ ivas_error config_acelp1( { if ( enc_dec == ENC ) { - bits -= 4; /* TC signalling */ + bits -= 4; /* TC signaling */ } if ( acelp_cfg->ltf_mode == NORMAL_OPERATION ) @@ -927,7 +927,7 @@ ivas_error config_acelp1( { if ( enc_dec == ENC ) { - bits -= 4; /* TC signalling */ + bits -= 4; /* TC signaling */ } if ( acelp_cfg->ltf_mode == NORMAL_OPERATION ) @@ -939,7 +939,7 @@ ivas_error config_acelp1( { if ( enc_dec == ENC ) { - bits -= 3; /* TC signalling */ + bits -= 3; /* TC signaling */ } if ( acelp_cfg->ltf_mode == NORMAL_OPERATION ) @@ -951,7 +951,7 @@ ivas_error config_acelp1( { if ( enc_dec == ENC ) { - bits -= 3; /* TC signalling */ + bits -= 3; /* TC signaling */ } if ( acelp_cfg->ltf_mode == NORMAL_OPERATION ) @@ -963,7 +963,7 @@ ivas_error config_acelp1( { if ( enc_dec == ENC ) { - bits -= 4; /* TC signalling */ + bits -= 4; /* TC signaling */ } if ( acelp_cfg->ltf_mode == NORMAL_OPERATION ) @@ -978,11 +978,11 @@ ivas_error config_acelp1( { if ( tc_subfr <= 2 * L_SUBFR ) { - bits -= 2; /* TC signalling */ + bits -= 2; /* TC signaling */ } else { - bits -= 3; /* TC signalling */ + bits -= 3; /* TC signaling */ } } diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 1e36dbb535..76c8842bef 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1244,7 +1244,7 @@ static void dec_prm_core( /*-----------------------------------------------------------------* * decision_matrix_core_dec() * - * Read core signalling bits from the bitstream + * Read core signaling bits from the bitstream * Set st->core, and st->bwidth if signalled together with the core. *-----------------------------------------------------------------*/ @@ -1291,12 +1291,12 @@ static void decision_matrix_core_dec( } /*-----------------------------------------------------------------* - * Read ACELP signalling bits from the bitstream + * Read ACELP signaling bits from the bitstream *-----------------------------------------------------------------*/ if ( st->core == ACELP_CORE ) { - /* find the section in the ACELP signalling table corresponding to bitrate */ + /* find the section in the ACELP signaling table corresponding to bitrate */ start_idx = 0; while ( acelp_sig_tbl[start_idx] != st->total_brate ) { @@ -1312,11 +1312,11 @@ static void decision_matrix_core_dec( /* retrieve the number of bits */ nBits = (int16_t) acelp_sig_tbl[start_idx++]; - /* retrieve the signalling indice */ + /* retrieve the signaling indice */ ind = acelp_sig_tbl[start_idx + get_next_indice( st, nBits )]; st->bwidth = ( ind >> 3 ) & 0x7; - /* convert signalling indice into signalling information */ + /* convert signaling indice into signaling information */ if ( ( ind & 0x7 ) == LR_MDCT ) { st->core = HQ_CORE; @@ -1324,7 +1324,7 @@ static void decision_matrix_core_dec( } /*-----------------------------------------------------------------* - * Read HQ signalling bits from the bitstream + * Read HQ signaling bits from the bitstream * Set HQ core type *-----------------------------------------------------------------*/ @@ -1849,7 +1849,7 @@ ivas_error preview_indices( break; case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; - /* temporary hack to make mode signalling work with the current 1-object ISM DTX: read padding bits */ + /* temporary hack to make mode signaling work with the current 1-object ISM DTX: read padding bits */ /* Todo: how to apply this here? maybe pt_stream += ... would work? */ /* st->bit_stream += ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; */ break; @@ -2504,7 +2504,7 @@ static void get_rfFlag( /* check for rf_flag in the packet and extract the rf_frame_type and rf_fec_offset */ if ( st->total_brate == ACELP_13k20 && ( st->bfi == FRAMEMODE_NORMAL || st->bfi == FRAMEMODE_FUTURE ) ) { - /* find the section in the ACELP signalling table corresponding to bitrate */ + /* find the section in the ACELP signaling table corresponding to bitrate */ start_idx = 0; while ( acelp_sig_tbl[start_idx] != st->total_brate ) { @@ -2518,10 +2518,10 @@ static void get_rfFlag( /* retrieve the number of bits */ nBits_tmp = (int16_t) acelp_sig_tbl[start_idx++]; - /* retrieve the signalling indice */ + /* retrieve the signaling indice */ ind_tmp = acelp_sig_tbl[start_idx + get_indice( st, 0, nBits_tmp )]; - /* convert signalling indice into RF flag. */ + /* convert signaling indice into RF flag. */ *rf_flag = ( ind_tmp >> 7 ) & 0x1; if ( ind ) @@ -2624,7 +2624,7 @@ static void get_rfTargetBits( /*-------------------------------------------------------------------* * berCheck() * - * Check for bit errors in channel aware signalling. + * Check for bit errors in channel aware signaling. *-------------------------------------------------------------------*/ static void berCheck( @@ -2747,7 +2747,7 @@ void get_NextCoderType( tmp += bit_stream[k]; } - /* retrieve the signalling indice */ + /* retrieve the signaling indice */ *next_coder_type = acelp_sig_tbl[start_idx + tmp] & 0x7; return; @@ -2923,7 +2923,7 @@ void evs_dec_previewFrame( if ( total_brate == ACELP_13k20 ) { - /* find the section in the ACELP signalling table corresponding to bitrate */ + /* find the section in the ACELP signaling table corresponding to bitrate */ start_idx = 0; while ( acelp_sig_tbl[start_idx] != total_brate ) { @@ -2936,10 +2936,10 @@ void evs_dec_previewFrame( /* retrieve the number of bits */ nBits = (int16_t) acelp_sig_tbl[start_idx++]; - /* retrieve the signalling indice */ + /* retrieve the signaling indice */ ind = acelp_sig_tbl[start_idx + get_indice_preview( bitstream, bitstreamSize, 0, nBits )]; - /* convert signalling indice into RF flag. */ + /* convert signaling indice into RF flag. */ rf_flag = ( ind >> 7 ) & 0x1; if ( rf_flag != 0 ) { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index e573688459..332b586b01 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -235,7 +235,7 @@ typedef enum #define NBITS_ELEMENT_MODE 1 /* number of bits to encode the stereo element mode */ #define NBITS_BWIDTH 2 /* number of bits to encode all audio bandwidths */ -/* format signalling in SID frames */ +/* format signaling in SID frames */ #define SID_FORMAT_NBITS 3 /* Bit 0 | Bit 1 | Bit 2 */ /*-------|-------|------ */ #define SID_DFT_STEREO 0x0 /* 0| 0| 0 */ @@ -755,7 +755,7 @@ enum fea_names #define TDM_L_NOVA_NS 5000000L /* mixing overlap length */ -#define TDM_SECONDARY_SIGNALLING 3 /* number of bits to code the signalling for secondary channel */ +#define TDM_SECONDARY_SIGNALLING 3 /* number of bits to code the signaling for secondary channel */ #define TDM_RATIO_BITS 5 /* number of bits to code the correlation ratio */ #define TDM_LP_REUSE_BITS 1 /* number of bits to code LP reuse flag for secondary channel */ #define TDM_LR_CONTENT_BITS 1 /* number of bits to code flag when the content is LR or not */ diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index abd955ce18..fc4be3127e 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -128,7 +128,7 @@ ivas_error ivas_ism_config( bits_element[n_ISms - 1] += bits_ism % n_ISms; bitbudget_to_brate( bits_element, element_brate, n_ISms ); - /* count ISm common signalling bits */ + /* count ISm common signaling bits */ if ( hIsmMeta != NULL ) { nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + num_obj; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b543d9827e..8b6791b668 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -161,7 +161,7 @@ ivas_error pre_proc_front_ivas( float lsp_new[M], /* o : LSPs at the end of the frame */ float lsp_mid[M], /* o : LSPs in the middle of the frame */ int16_t *vad_hover_flag, /* o : VAD hangover flag */ - int16_t *attack_flag, /* o : flag signalling attack */ + int16_t *attack_flag, /* o : flag signaling attack */ float realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer */ float imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer */ float old_wsp[], /* o : weighted input signal buffer */ @@ -521,7 +521,7 @@ void ivas_decision_matrix_enc( const int16_t last_element_mode /* i : last element mode */ ); -void ivas_signalling_enc( +void ivas_signaling_enc( Encoder_State *st, /* i/o: encoder state structure */ const int16_t is_MCT, /* i : MCT enabled */ const int32_t element_brate, /* i : element bitrate */ @@ -1666,7 +1666,7 @@ void tdm_configure_enc( const int16_t nb_bits_metadata /* i : number of metadata bits */ ); -ivas_error signalling_enc_secondary( +ivas_error signaling_enc_secondary( Encoder_State *st, /* i/o: Encoder structure */ const int16_t tdm_SM_flag, /* i : channel combination scheme flag */ const int16_t tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag */ @@ -2900,7 +2900,7 @@ int16_t quantize_phi_chan_compand( float phi, /* i : azimuth value */ float *phi_hat, /* o : quantized azimuth */ const int16_t n, /* i : azimuth codebook size */ - const int16_t theta_flag, /* i : flag signalling high elevation */ + const int16_t theta_flag, /* i : flag signaling high elevation */ const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); @@ -3118,7 +3118,7 @@ void ivas_dirac_enc( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ int16_t *nb_bits_metadata, /* o : number of metadata bits written */ - const int16_t Opt_DTX_ON, /* i : flag signalling DTX on */ + const int16_t Opt_DTX_ON, /* i : flag signaling DTX on */ float data_f[][L_FRAME48k], /* i/o: input: ACN/SN3D, output: omni, stereo DMX or FOA */ const int16_t input_frame, /* i : input frame length */ const int16_t sba_planar /* i : SBA planar flag */ diff --git a/lib_com/ivas_qspherical_com.c b/lib_com/ivas_qspherical_com.c index cd12fd8dc8..cf88d4da30 100644 --- a/lib_com/ivas_qspherical_com.c +++ b/lib_com/ivas_qspherical_com.c @@ -450,7 +450,7 @@ int16_t quantize_phi_chan_compand( float phi, /* i : azimuth value */ float *phi_hat, /* o : quantized azimuth */ const int16_t n, /* i : azimuth codebook size */ - const int16_t theta_flag, /* i : flag signalling high elevation */ + const int16_t theta_flag, /* i : flag signaling high elevation */ const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ) { diff --git a/lib_com/prot.h b/lib_com/prot.h index d7e42cec54..9057623cde 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -726,11 +726,11 @@ void decision_matrix_enc( int16_t *hq_core_type /* o : HQ core type */ ); -void signalling_enc( +void signaling_enc( Encoder_State *st /* i : encoder state structure */ ); -int16_t signalling_mode1_tcx20_enc( +int16_t signaling_mode1_tcx20_enc( Encoder_State *st, /* i/o: encoder state structure */ const int16_t push /* i : flag to push indice */ ); @@ -1239,12 +1239,12 @@ int16_t vq_dec_lvq( ); void index_lvq( - float *quant, /* i : codevector to be indexed (2 8-dim subvectors)*/ - int16_t *idx_lead, /* i : leader class index for each subvector */ - int16_t *idx_scale, /* i : scale index for each subvector */ - const int16_t mode, /* i : integer signalling the quantizer structure for the current bitrate */ - int16_t *index, /* o : encoded index (represented on 3 short each with 15 bits ) */ - const int16_t prediction_flag /* i : predictive mode or not */ + float *quant, /* i : codevector to be indexed (2 8-dim subvectors) */ + int16_t *idx_lead, /* i : leader class index for each subvector */ + int16_t *idx_scale, /* i : scale index for each subvector */ + const int16_t mode, /* i : integer signaling the quantizer structure for the current bitrate */ + int16_t *index, /* o : encoded index (represented on 3 short each with 15 bits ) */ + const int16_t prediction_flag /* i : predictive mode or not */ ); int16_t qlsf_ARSN_tcvq_Dec_16k( @@ -4503,7 +4503,7 @@ void reset_rf_indices( const int16_t L_frame, /* i : frame length */ int16_t *rf_target_bits_write ); -void signalling_enc_rf( +void signaling_enc_rf( Encoder_State *st /* i/o: encoder state structure */ ); @@ -4769,7 +4769,7 @@ void lp_filt_exc_dec( const int16_t i_subfr, /* i : subframe index */ const int16_t L_subfr, /* i : subframe size */ const int16_t L_Frame, /* i : frame size */ - int16_t lp_flag, /* i : operation mode signalling */ + int16_t lp_flag, /* i : operation mode signaling */ float *exc /* i/o: pointer to the excitation signal frame */ ); @@ -9020,7 +9020,7 @@ ivas_error config_acelp1( const int16_t L_frame, /* i : frame length at internal Fs */ const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const int16_t signalling_bits, /* i : number of signalling bits */ + const int16_t signaling_bits, /* i : number of signaling bits */ const int16_t coder_type, /* i : coder type */ const int16_t tc_subfr, /* i : TC subfr ID */ const int16_t tc_call, /* i : TC call number (0,1,2) */ diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 30ae3c0a47..e5f2b7ce0b 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -88,7 +88,7 @@ const FrameSizeParams FrameSizeConfig[FRAME_SIZE_NB] = /*----------------------------------------------------------------------------------* - * Conversion of ACELP signalling parameters (ACELP internal Fs, coder type, bandwidth, sharpening flag) to index + * Conversion of ACELP signaling parameters (ACELP internal Fs, coder type, bandwidth, sharpening flag) to index * (to be consulted with the decision matrix) * * - in order to retrieve the index, each section in this table starts with the bitrate diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index 348e57a3e4..cb604dc5f7 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -48,7 +48,7 @@ * decision_matrix_dec() * * ACELP/HQ core selection - * Read ACELP signalling bits from the bitstream + * Read ACELP signaling bits from the bitstream * Set extension layers *-----------------------------------------------------------------*/ @@ -208,12 +208,12 @@ void decision_matrix_dec( } /*-----------------------------------------------------------------* - * Read ACELP signalling bits from the bitstream + * Read ACELP signaling bits from the bitstream *-----------------------------------------------------------------*/ if ( st->core == ACELP_CORE ) { - /* find the section in the ACELP signalling table corresponding to bitrate */ + /* find the section in the ACELP signaling table corresponding to bitrate */ start_idx = 0; while ( acelp_sig_tbl[start_idx] != st->total_brate ) { @@ -240,10 +240,10 @@ void decision_matrix_dec( } else { - /* retrieve the signalling indice */ + /* retrieve the signaling indice */ ind = acelp_sig_tbl[start_idx]; - /* convert signalling indice into signalling information */ + /* convert signaling indice into signaling information */ st->coder_type = ind & 0x7; if ( st->coder_type == LR_MDCT ) { @@ -257,7 +257,7 @@ void decision_matrix_dec( } } - /* detect corrupted signalling (due to bit errors) */ + /* detect corrupted signaling (due to bit errors) */ if ( ( st->BER_detect ) || ( ind >= 1 << 7 ) || ( st->total_brate <= ACELP_13k20 && st->bwidth == FB ) || @@ -408,7 +408,7 @@ void decision_matrix_dec( /*-----------------------------------------------------------------* - * Read HQ signalling bits from the bitstream + * Read HQ signaling bits from the bitstream * Set HQ core type *-----------------------------------------------------------------*/ @@ -464,7 +464,7 @@ void decision_matrix_dec( } } - /* detect bit errors in signalling */ + /* detect bit errors in signaling */ if ( ( ( st->total_brate >= ACELP_24k40 && st->bwidth == NB ) || ( st->core == HQ_CORE && st->total_brate <= LRMDCT_CROSSOVER_POINT && st->bwidth == FB ) ) ) { diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index 507d80596e..547354eddc 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -153,7 +153,7 @@ void hq_core_dec( acelp_plc_mdct_transition( st ); } - /* subtract signalling bits */ + /* subtract signaling bits */ num_bits -= st->next_bit_pos; /* set FEC parameters */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 62daa625e4..2d2e4dc214 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -167,7 +167,7 @@ ivas_error ivas_cpe_dec( } else { - /* Note: This only works for stereo operation. If DTX would be applied for multiple CPEs a different bitrate signalling is needed */ + /* Note: This only works for stereo operation. If DTX would be applied for multiple CPEs a different bitrate signaling is needed */ if ( ivas_total_brate <= IVAS_SID_4k4 ) { stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 0aae2d8b84..69ca90a79a 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -72,7 +72,7 @@ ivas_error ivas_dec( /*----------------------------------------------------------------* * IVAS decoder setup * - read IVAS format signaling - * - read IVAS format specific signalling + * - read IVAS format specific signaling * - initialize decoder in the first frame based on IVAS format and number of transport channels * - reconfigure the decoder when the number of TC or IVAS total bitrate change *----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index dbd4aef78a..a62e1d29eb 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -46,7 +46,7 @@ * ivas_decision_matrix_dec() * * ACELP/TCX/HQ core selection - * Read ACELP signalling bits from the bitstream + * Read ACELP signaling bits from the bitstream * Set extension layers *-----------------------------------------------------------------*/ @@ -73,7 +73,7 @@ void ivas_decision_matrix_dec( st->vbr_hw_BWE_disable_dec = 0; /*-----------------------------------------------------------------* - * Read SID signalling bits from the bitstream + * Read SID signaling bits from the bitstream *-----------------------------------------------------------------*/ if ( ( st->idchan == 0 && ( st->total_brate == FRAME_NO_DATA || st->total_brate == SID_2k40 ) ) || ( st->element_mode == IVAS_CPE_MDCT && st->total_brate <= SID_2k40 ) ) @@ -129,7 +129,7 @@ void ivas_decision_matrix_dec( if ( st->element_mode == IVAS_CPE_TD && st->idchan == 1 ) { - /* minimal signalling for the secondary channel, most of the parameters are deduced from the primary channel */ + /* minimal signaling for the secondary channel, most of the parameters are deduced from the primary channel */ st->core = ACELP_CORE; } else if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) @@ -160,7 +160,7 @@ void ivas_decision_matrix_dec( } /*-----------------------------------------------------------------* - * Read ACELP signalling bits from the bitstream + * Read ACELP signaling bits from the bitstream *-----------------------------------------------------------------*/ if ( st->core == ACELP_CORE ) @@ -354,7 +354,7 @@ void ivas_decision_matrix_dec( st->core_brate = st->total_brate - st->extl_brate - icbwe_brate; /*-----------------------------------------------------------------* - * Read transform core (TCX vs. HQ) signalling bit from the bitstream + * Read transform core (TCX vs. HQ) signaling bit from the bitstream *-----------------------------------------------------------------*/ if ( st->element_mode != IVAS_CPE_MDCT && !( st->idchan == 1 && st->element_mode == IVAS_CPE_TD ) && st->core == HQ_CORE ) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 647d9a31f3..91dc6f2f12 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1387,7 +1387,7 @@ void ivas_dirac_dec_read_BS( { next_bit_pos_orig = st->next_bit_pos; - /* subtract mode signalling bits, since bitstream was moved after mode reading */ + /* subtract mode signaling bits, since bitstream was moved after mode reading */ st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); /* if we start with a SID frame, we need to init the azi/ele arrays.*/ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 3ca5b9310f..86d7b570ac 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -87,7 +87,7 @@ ivas_error ivas_dec_setup( if ( is_DTXrate( ivas_total_brate ) == 0 ) { /*-------------------------------------------------------------------* - * Read IVAS format related signalling: + * Read IVAS format related signaling: * - in ISM : read number of objects * - in SBA : read SBA planar flag and SBA order * - in MASA : read number of TC @@ -297,7 +297,7 @@ ivas_error ivas_dec_setup( static ivas_error ivas_read_format( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - int16_t *num_bits_read /* o : number of IVAS signalling bits read from the bitstream */ + int16_t *num_bits_read /* o : number of IVAS signaling bits read from the bitstream */ ) { int16_t k, idx; diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 6b36447e30..9d940705f3 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -122,7 +122,7 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { /*----------------------------------------------------------------* - * Read ISm common signalling + * Read ISm common signaling *----------------------------------------------------------------*/ /* read number of objects */ diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 2d5a8b4703..628e4ca6b8 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -406,11 +406,11 @@ int16_t ivas_qmetadata_dec_decode( } } - /* Read 2D signalling*/ + /* Read 2D signaling*/ q_direction->not_in_2D = bitstream[( *index )--]; signal_bits = 1; - /* Read EC signalling */ + /* Read EC signaling */ ec_flag = 0; if ( total_bits_1dir + bits_sur_coherence <= hQMetaData->qmetadata_max_bit_req ) { @@ -765,7 +765,7 @@ int16_t ivas_qmetadata_dec_sid_decode( nblocks = q_direction->cfg.nblocks; /* only 1 block transmitted but up to 4 blocks re-generated */ start_band = 0; /* start from band 0 */ - /* Read 2D signalling*/ + /* Read 2D signaling*/ if ( sba_mode != SBA_MODE_SPAR ) { q_direction->not_in_2D = bitstream[( *index )--]; diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index fbfcc5e825..f3bd292a8b 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -99,10 +99,10 @@ void tdm_configure_dec( sts = hCPE->hCoreCoder; /*----------------------------------------------------------------* - * Decode CoreCoder signalling + * Decode CoreCoder signaling *----------------------------------------------------------------*/ - /* temporarily decode PCh signalling */ + /* temporarily decode PCh signaling */ bits_offset = sts[0]->next_bit_pos; core = get_indice_st( sts[0], hCPE->element_brate, bits_offset, 1 ); bits_offset += 1; diff --git a/lib_dec/lp_exc_d.c b/lib_dec/lp_exc_d.c index 7036638de0..046523105f 100644 --- a/lib_dec/lp_exc_d.c +++ b/lib_dec/lp_exc_d.c @@ -55,7 +55,7 @@ void lp_filt_exc_dec( const int16_t i_subfr, /* i : subframe index */ const int16_t L_subfr, /* i : subframe size */ const int16_t L_frame, /* i : frame size */ - int16_t lp_flag, /* i : operation mode signalling */ + int16_t lp_flag, /* i : operation mode signaling */ float *exc /* i/o: pointer to the excitation signal frame */ ) { diff --git a/lib_dec/updt_dec.c b/lib_dec/updt_dec.c index 2241e919df..2c3eed80e3 100644 --- a/lib_dec/updt_dec.c +++ b/lib_dec/updt_dec.c @@ -326,7 +326,7 @@ void updt_IO_switch_dec( hf_synth_amr_wb_reset( st->hAmrwb_IO, st->hBWE_zero ); - /* reset VBR signalling */ + /* reset VBR signaling */ st->last_ppp_mode_dec = 0; st->last_nelp_mode_dec = 0; st->ppp_mode_dec = 0; diff --git a/lib_enc/core_enc_ol.c b/lib_enc/core_enc_ol.c index b5fa43ae61..a761893653 100644 --- a/lib_enc/core_enc_ol.c +++ b/lib_enc/core_enc_ol.c @@ -356,8 +356,8 @@ void core_encode_openloop( if ( st->mdct_sw == MODE1 ) { - /* Account for core signalling bits difference: bandwidth and ACELP/TCX signaling bit are replaced */ - target_bits += ( FrameSizeConfig[st->frame_size_index].bandwidth_bits + 1 ) - signalling_mode1_tcx20_enc( st, 0 ); + /* Account for core signaling bits difference: bandwidth and ACELP/TCX signaling bit are replaced */ + target_bits += ( FrameSizeConfig[st->frame_size_index].bandwidth_bits + 1 ) - signaling_mode1_tcx20_enc( st, 0 ); } else if ( st->mdct_sw_enable == MODE2 ) { diff --git a/lib_enc/decision_matrix_enc.c b/lib_enc/decision_matrix_enc.c index 1683f8fe48..3433bdf1b4 100644 --- a/lib_enc/decision_matrix_enc.c +++ b/lib_enc/decision_matrix_enc.c @@ -331,12 +331,12 @@ void decision_matrix_enc( } /*---------------------------------------------------------------------* - * signalling_mode1_tcx20_enc() + * signaling_mode1_tcx20_enc() * - * write MODE1 TCX20 signalling information into the bitstream + * write MODE1 TCX20 signaling information into the bitstream *---------------------------------------------------------------------*/ -int16_t signalling_mode1_tcx20_enc( +int16_t signaling_mode1_tcx20_enc( Encoder_State *st, /* i/o: encoder state structure */ const int16_t push /* i : flag to push indice */ ) @@ -352,17 +352,17 @@ int16_t signalling_mode1_tcx20_enc( /* Use ACELP signaling for LR MDCT */ if ( st->total_brate <= ACELP_16k40 ) { - /* find the section in the ACELP signalling table corresponding to bitrate */ + /* find the section in the ACELP signaling table corresponding to bitrate */ idx = 0; while ( acelp_sig_tbl[idx] != st->total_brate ) { idx++; } - /* retrieve the number of bits for signalling */ + /* retrieve the number of bits for signaling */ nBits = (int16_t) acelp_sig_tbl[++idx]; - /* retrieve the signalling index */ + /* retrieve the signaling index */ start_idx = ++idx; while ( acelp_sig_tbl[idx] != SIG2IND( LR_MDCT, st->bwidth, 0, 0 ) ) { @@ -429,12 +429,12 @@ int16_t signalling_mode1_tcx20_enc( /*---------------------------------------------------------------------* - * signalling_enc() + * signaling_enc() * - * write signalling information into the bitstream + * write signaling information into the bitstream *---------------------------------------------------------------------*/ -void signalling_enc( +void signaling_enc( Encoder_State *st /* i : encoder state structure */ ) { @@ -521,7 +521,7 @@ void signalling_enc( push_indice( hBstr, IND_CORE, 0, 1 ); } - /* find the section in the ACELP signalling table corresponding to bitrate */ + /* find the section in the ACELP signaling table corresponding to bitrate */ idx = 0; while ( idx < MAX_ACELP_SIG ) { @@ -539,10 +539,10 @@ void signalling_enc( idx++; } - /* retrieve the number of bits for signalling */ + /* retrieve the number of bits for signaling */ nBits = (int16_t) acelp_sig_tbl[++idx]; - /* retrieve the signalling index */ + /* retrieve the signaling index */ start_idx = ++idx; if ( st->element_mode == IVAS_CPE_TD && st->bwidth == SWB && st->total_brate <= ACELP_9k60 ) { @@ -603,17 +603,17 @@ void signalling_enc( /* Use ACELP signaling for LR MDCT */ if ( st->total_brate <= ACELP_16k40 ) { - /* find the section in the ACELP signalling table corresponding to bitrate */ + /* find the section in the ACELP signaling table corresponding to bitrate */ idx = 0; while ( acelp_sig_tbl[idx] != st->total_brate ) { idx++; } - /* retrieve the number of bits for signalling */ + /* retrieve the number of bits for signaling */ nBits = (int16_t) acelp_sig_tbl[++idx]; - /* retrieve the signalling index */ + /* retrieve the signaling index */ start_idx = ++idx; while ( acelp_sig_tbl[idx] != SIG2IND( LR_MDCT, st->bwidth, 0, 0 ) ) { @@ -654,12 +654,12 @@ void signalling_enc( } /*---------------------------------------------------------------------* - * signalling_enc_rf() + * signaling_enc_rf() * - * write channel-aware signalling information into the bitstream + * write channel-aware signaling information into the bitstream *---------------------------------------------------------------------*/ -void signalling_enc_rf( +void signaling_enc_rf( Encoder_State *st /* i/o: encoder state structure */ ) { diff --git a/lib_enc/dtx.c b/lib_enc/dtx.c index fdfac29703..41a1f6af43 100644 --- a/lib_enc/dtx.c +++ b/lib_enc/dtx.c @@ -253,7 +253,7 @@ void dtx( } } - /* reset the bitstream (IVAS format signalling was already written) */ + /* reset the bitstream (IVAS format signaling was already written) */ if ( st->element_mode != IVAS_CPE_MDCT && st->hBstr != NULL ) { reset_indices_enc( st->hBstr, MAX_NUM_INDICES ); diff --git a/lib_enc/enc_ppp.c b/lib_enc/enc_ppp.c index c7abd135ce..b7668bfb01 100644 --- a/lib_enc/enc_ppp.c +++ b/lib_enc/enc_ppp.c @@ -171,8 +171,8 @@ ivas_error encod_ppp( /* delete previous indices */ reset_indices_enc( hBstr, MAX_NUM_INDICES ); - /* signalling matrix (writing of signalling bits) */ - signalling_enc( st ); + /* signaling matrix (writing of signaling bits) */ + signaling_enc( st ); } else { diff --git a/lib_enc/enc_prm.c b/lib_enc/enc_prm.c index c48e171517..062069ceee 100644 --- a/lib_enc/enc_prm.c +++ b/lib_enc/enc_prm.c @@ -99,20 +99,20 @@ void writeTCXMode( { if ( st->core == ACELP_CORE ) { - /* write the RF signalling information */ + /* write the RF signaling information */ if ( st->rf_mode == 1 ) { - /* find the section in the ACELP signalling table corresponding to bitrate */ + /* find the section in the ACELP signaling table corresponding to bitrate */ idx = 0; while ( acelp_sig_tbl[idx] != st->total_brate ) /* total bitrate is kept at 13.2kbps */ { idx++; } - /* retrieve the number of bits for signalling */ + /* retrieve the number of bits for signaling */ nBits = (int16_t) acelp_sig_tbl[++idx]; - /* retrieve the signalling index */ + /* retrieve the signaling index */ start_idx = ++idx; while ( acelp_sig_tbl[idx] != SIG2IND( st->coder_type, st->bwidth, st->sharpFlag, st->rf_mode ) ) { @@ -144,17 +144,17 @@ void writeTCXMode( } else { - /*write the RF signalling information*/ + /*write the RF signaling information*/ if ( st->rf_mode == 1 ) { - /* find the section in the ACELP signalling table corresponding to bitrate */ + /* find the section in the ACELP signaling table corresponding to bitrate */ idx = 0; while ( acelp_sig_tbl[idx] != st->total_brate ) { idx++; } - /* retrieve the number of bits for signalling */ + /* retrieve the number of bits for signaling */ nBits = (int16_t) acelp_sig_tbl[++idx]; if ( st->hTcxCfg->coder_type == VOICED || st->hTcxCfg->coder_type == GENERIC || st->hTcxCfg->coder_type == TRANSITION ) @@ -166,7 +166,7 @@ void writeTCXMode( st->sharpFlag = 0; } - /* retrieve the signalling index */ + /* retrieve the signaling index */ start_idx = ++idx; while ( acelp_sig_tbl[idx] != SIG2IND( st->hTcxCfg->coder_type, st->bwidth, st->sharpFlag, st->rf_mode ) ) { @@ -787,7 +787,7 @@ void enc_prm( st->bits_frame_core += FrameSizeConfig[st->frame_size_index].bandwidth_bits; /* Write MODE1 core & coder_type signaling */ - signalling_mode1_tcx20_enc( st, 1 ); + signaling_mode1_tcx20_enc( st, 1 ); } /* EVS header */ diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index 060352246e..29b610db79 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -238,8 +238,8 @@ ivas_error evs_enc( if ( st->codec_mode == MODE1 ) { - /* write signalling info into the bitstream */ - signalling_enc( st ); + /* write signaling info into the bitstream */ + signaling_enc( st ); /*---------------------------------------------------------------------* * Preprocessing (preparing) for ACELP/HQ core switching @@ -502,7 +502,7 @@ ivas_error evs_enc( * Channel-aware mode - write signaling information into the bitstream *---------------------------------------------------------------------*/ - signalling_enc_rf( st ); + signaling_enc_rf( st ); /*---------------------------------------------------------------------* diff --git a/lib_enc/hq_classifier_enc.c b/lib_enc/hq_classifier_enc.c index 895f7ac2e0..f604939d21 100644 --- a/lib_enc/hq_classifier_enc.c +++ b/lib_enc/hq_classifier_enc.c @@ -128,10 +128,10 @@ int16_t hq_classifier_enc( } else if ( length == L_SPEC16k_EXT || length == L_SPEC48k_EXT ) { - bits = 0; /* HQ_NORMAL only -- no signalling needed */ + bits = 0; /* HQ_NORMAL only -- no signaling needed */ } - /* write signalling info to the bitstream */ + /* write signaling info to the bitstream */ push_indice( st->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); if ( st->core_brate <= HQ_32k && *hqswb_clas == HQ_NORMAL ) diff --git a/lib_enc/hq_core_enc.c b/lib_enc/hq_core_enc.c index 250d36c5a4..bb66182d3d 100644 --- a/lib_enc/hq_core_enc.c +++ b/lib_enc/hq_core_enc.c @@ -94,7 +94,7 @@ void hq_core_enc( /*-------------------------------------------------------------------------- * Preprocessing in the first HQ frame after ACELP frame * Find the number of bits for PVQ coding - * Write signalling information + * Write signaling information *--------------------------------------------------------------------------*/ num_bits = (int16_t) ( st->total_brate / FRAMES_PER_SEC ); @@ -177,7 +177,7 @@ void hq_core_enc( } } - /* subtract signalling bits */ + /* subtract signaling bits */ num_bits -= hBstr->nb_bits_tot; /*-------------------------------------------------------------------------- diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index f1a10d1936..42a17cb9cb 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -194,12 +194,12 @@ ivas_error ivas_core_enc( st = sts[n]; /*---------------------------------------------------------------------* - * Write signalling info into the bitstream + * Write signaling info into the bitstream *---------------------------------------------------------------------*/ if ( !is_MCT || ( is_MCT && cpe_id == 0 ) ) { - ivas_signalling_enc( st, is_MCT, element_brate, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag ); + ivas_signaling_enc( st, is_MCT, element_brate, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag ); } /*---------------------------------------------------------------------* @@ -400,7 +400,7 @@ ivas_error ivas_core_enc( * Channel-aware mode - write signaling information into the bitstream *---------------------------------------------------------------------*/ - signalling_enc_rf( st ); + signaling_enc_rf( st ); /*---------------------------------------------------------------------* * Common updates diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index a380ee917f..4ae384d5ff 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -335,13 +335,13 @@ ivas_error pre_proc_ivas( } } - /* channel-aware mode - due to lack of signalling bit, sharpFlag is 1 always in RF mode */ + /* channel-aware mode - due to lack of signaling bit, sharpFlag is 1 always in RF mode */ if ( st->rf_mode && ( st->coder_type == VOICED || st->coder_type == GENERIC ) ) { st->sharpFlag = 1; } - /* TD stereo, secondary channel - due to lack of signalling bits, sharpFlag is always 1 */ + /* TD stereo, secondary channel - due to lack of signaling bits, sharpFlag is always 1 */ if ( element_mode == IVAS_CPE_TD && st->idchan == 1 ) { st->sharpFlag = 0; diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index ea2694a888..51a549505f 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -77,7 +77,7 @@ ivas_error pre_proc_front_ivas( float lsp_new[M], /* o : LSPs at the end of the frame */ float lsp_mid[M], /* o : LSPs in the middle of the frame */ int16_t *vad_hover_flag, /* o : VAD hangover flag */ - int16_t *attack_flag, /* o : flag signalling attack */ + int16_t *attack_flag, /* o : flag signaling attack */ float realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer */ float imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer */ float old_wsp[], /* o : weighted input signal buffer */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 7b3c77a6b8..03a911d69f 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -536,7 +536,7 @@ ivas_error ivas_cpe_enc( } /*----------------------------------------------------------------* - * Write IVAS format signalling in SID frames + * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ if ( sts[0]->core_brate == SID_2k40 && ( ivas_format != SBA_FORMAT || st_ivas->sba_mode != SBA_MODE_SPAR ) ) diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 7b9dccaec9..49bb62e469 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -368,12 +368,12 @@ void ivas_decision_matrix_enc( /*---------------------------------------------------------------------* - * ivas_signalling_enc() + * ivas_signaling_enc() * - * write signalling information of SCE/CPE mode into the bitstream + * write signaling information of SCE/CPE mode into the bitstream *---------------------------------------------------------------------*/ -void ivas_signalling_enc( +void ivas_signaling_enc( Encoder_State *st, /* i/o: encoder state structure */ const int16_t is_MCT, /* i : MCT enabled */ const int32_t element_brate, /* i : element bitrate */ @@ -386,8 +386,8 @@ void ivas_signalling_enc( if ( st->element_mode == IVAS_CPE_TD && st->idchan == 1 ) { - /* minimal signalling for the secondary channel, most of the parameters are deduced from the primary channel */ - signalling_enc_secondary( st, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag ); + /* minimal signaling for the secondary channel, most of the parameters are deduced from the primary channel */ + signaling_enc_secondary( st, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag ); } else if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) { @@ -451,7 +451,7 @@ void ivas_signalling_enc( } /*-------------------------------------------------------------------------- - * Write core dependent signalling + * Write core dependent signaling *--------------------------------------------------------------------------*/ if ( st->core == ACELP_CORE ) diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 73789414d4..86257df522 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -307,7 +307,7 @@ void ivas_dirac_enc( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ int16_t *nb_bits_metadata, /* o : number of metadata bits written */ - const int16_t Opt_DTX_ON, /* i : flag signalling DTX on */ + const int16_t Opt_DTX_ON, /* i : flag signaling DTX on */ float data_f[][L_FRAME48k], /* i/o: input: ACN/SN3D, output: omni, stereo DMX or FOA*/ const int16_t input_frame, /* i : input frame length */ const int16_t sba_planar /* i : SBA planar flag */ diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index c78bce4b85..21a7eb839f 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -123,7 +123,7 @@ void ivas_write_format_sid( } else { - assert( !"Wrong stereo mode for SID format signalling" ); + assert( !"Wrong stereo mode for SID format signaling" ); } break; case ISM_FORMAT: diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index e363b7f9c3..2653829d13 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -204,7 +204,7 @@ ivas_error ivas_ism_enc( } /*----------------------------------------------------------------* - * Write IVAS format signalling in SID frames + * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ st = st_ivas->hSCE[0]->hCoreCoder[0]; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index a3bfac4ba2..60550bca0b 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -247,7 +247,7 @@ ivas_error ivas_ism_metadata_enc( } /*----------------------------------------------------------------* - * Write ISm common signalling + * Write ISm common signaling *----------------------------------------------------------------*/ /* write number of objects - unary coding */ diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index fce9a85f71..af7a48a80b 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -1518,7 +1518,7 @@ static void ivas_param_mc_encode_parameter( dbgwrite( seq, sizeof( int16_t ), sz_seq, 1, "./res/param_mc_quant_param_idx_enc.dat" ); #endif - bit_cnt_uni = sz_seq * hParameterCodingInfo->uni_bits - 1; /* -1 for the additional diff/direct signalling bit for the range encoder*/ + bit_cnt_uni = sz_seq * hParameterCodingInfo->uni_bits - 1; /* -1 for the additional diff/direct signaling bit for the range encoder*/ /* code the direct index sequence */ ivas_param_mc_range_encoder( seq, sz_seq, hParameterCodingInfo->cum_freq, hParameterCodingInfo->sym_freq, PARAM_MC_RANGE_CODER_TOT_SHIFT, bit_cnt_uni, &tmp_bit_buffer[0], &bit_cnt_range ); diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index d73763ceef..f62b61e4ef 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -144,7 +144,7 @@ ivas_error ivas_qmetadata_enc_encode( float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t all_coherence_zero; int16_t bit_pos_0, total_bits_1dir, bits_no_dirs_coh; - int16_t bits_signalling[QMETADATA_MAX_NO_DIRECTIONS]; + int16_t bits_signaling[QMETADATA_MAX_NO_DIRECTIONS]; int16_t indice_coherence; int16_t bits_dir_bands[MASA_MAXIMUM_CODING_SUBBANDS], raw_flag[MASA_MAXIMUM_CODING_SUBBANDS]; int16_t diff_bits, bits_ec, next_ind_raw_flag; @@ -375,7 +375,7 @@ ivas_error ivas_qmetadata_enc_encode( } #endif - bits_signalling[d] = 0; + bits_signaling[d] = 0; /*Coherence */ bits_coherence[d] = 0; @@ -399,7 +399,7 @@ ivas_error ivas_qmetadata_enc_encode( /* Signalling 2D*/ push_next_indice( hMetaData, ( q_direction->not_in_2D > 0 ), 1 ); /*2D flag*/ - bits_signalling[d] = 1; + bits_signaling[d] = 1; /* Save state of metadata bitstream buffer after writing energy ratios, number of dirs and save space for coherence*/ bit_pos_start = hMetaData->nb_bits_tot; @@ -410,7 +410,7 @@ ivas_error ivas_qmetadata_enc_encode( if ( total_bits_1dir + bits_surround_coh <= hQMetaData->qmetadata_max_bit_req ) { push_next_indice( hMetaData, 0, 1 ); /*Write 1 bit to signal EC frame-wise (EC1)*/ - bits_signalling[d]++; + bits_signaling[d]++; } next_ind_raw_flag = hMetaData->next_ind; @@ -418,7 +418,7 @@ ivas_error ivas_qmetadata_enc_encode( bits_dir_bands[0] = ivas_qmetadata_raw_encode_dir( NULL, q_direction, q_direction->cfg.nbands, q_direction->cfg.start_band ); - reduce_bits = hQMetaData->is_masa_ivas_format ? ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signalling[d] ) - 1 ) : MASA_MAX_BITS; + reduce_bits = hQMetaData->is_masa_ivas_format ? ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) - 1 ) : MASA_MAX_BITS; bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits ); @@ -432,25 +432,25 @@ ivas_error ivas_qmetadata_enc_encode( } bits_dir[d] = bits_ec + 1; #ifdef DEBUG_MODE_QMETADATA - tmp = bits_dir[d] - ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signalling[d] ) ); + tmp = bits_dir[d] - ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) ); #endif extra_bits = hQMetaData->metadata_max_bits - ( hMetaData->nb_bits_tot - bit_pos_0 ); #ifdef DEBUGGING - assert( bit_pos_start + bits_signalling[d] - 1 + bits_dir[d] == hMetaData->nb_bits_tot ); + assert( bit_pos_start + bits_signaling[d] - 1 + bits_dir[d] == hMetaData->nb_bits_tot ); #endif #ifdef DEBUG_MODE_QMETADATA ec_flag = 0; #endif /* Encode quantized directions with EC band-wise */ - if ( ( total_bits_1dir + bits_surround_coh <= hQMetaData->qmetadata_max_bit_req ) && ( bits_dir[d] + bits_diff[d] + bits_coherence[d] + bits_signalling[d] > total_bits_1dir ) && q_direction->cfg.nblocks > 1 ) + if ( ( total_bits_1dir + bits_surround_coh <= hQMetaData->qmetadata_max_bit_req ) && ( bits_dir[d] + bits_diff[d] + bits_coherence[d] + bits_signaling[d] > total_bits_1dir ) && q_direction->cfg.nblocks > 1 ) { restore_metadata_buffer( hMetaData, next_ind_start, last_ind_start, bit_pos_start ); - /* Write signalling */ + /* Write signaling */ push_next_indice( hMetaData, 1, 1 ); /*Write 1 bit to signal no EC frame-wise (EC1)*/ push_next_indice( hMetaData, 0, 1 ); /*Write 1 bit to signal EC band-wise (EC2)*/ - bits_signalling[d] = 3; + bits_signaling[d] = 3; /* Write raw flags */ next_ind_raw_flag = hMetaData->next_ind; @@ -460,7 +460,7 @@ ivas_error ivas_qmetadata_enc_encode( } bits_dir[d] = 0; - diff_bits = bits_diff[d] + bits_coherence[d] + bits_signalling[d] - total_bits_1dir; + diff_bits = bits_diff[d] + bits_coherence[d] + bits_signaling[d] - total_bits_1dir; for ( i = start_band; i < nbands; i++ ) { bits_dir_bands[i] = ivas_qmetadata_raw_encode_dir( NULL, q_direction, i + 1, i ); @@ -501,14 +501,14 @@ ivas_error ivas_qmetadata_enc_encode( extra_bits = hQMetaData->metadata_max_bits - ( hMetaData->nb_bits_tot - bit_pos_0 ); #ifdef DEBUGGING - if ( ( diff_bits <= 0 ) && ( bits_dir[d] + bits_diff[d] + bits_coherence[d] + bits_signalling[d] > total_bits_1dir ) ) + if ( ( diff_bits <= 0 ) && ( bits_dir[d] + bits_diff[d] + bits_coherence[d] + bits_signaling[d] > total_bits_1dir ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "not possible!!" ); } #endif #ifdef DEBUGGING - assert( bit_pos_start + bits_signalling[d] - 1 + bits_dir[d] == hMetaData->nb_bits_tot ); + assert( bit_pos_start + bits_signaling[d] - 1 + bits_dir[d] == hMetaData->nb_bits_tot ); #endif #ifdef DEBUG_MODE_QMETADATA ec_flag = 1; @@ -516,7 +516,7 @@ ivas_error ivas_qmetadata_enc_encode( } /* Requantized directions */ - if ( ( total_bits_1dir + bits_surround_coh <= hQMetaData->qmetadata_max_bit_req ) && ( bits_dir[d] + bits_diff[d] + bits_coherence[d] + bits_signalling[d] > total_bits_1dir ) ) + if ( ( total_bits_1dir + bits_surround_coh <= hQMetaData->qmetadata_max_bit_req ) && ( bits_dir[d] + bits_diff[d] + bits_coherence[d] + bits_signaling[d] > total_bits_1dir ) ) { /*Bit budget exceeded, bit reduction strategy?*/ @@ -528,22 +528,22 @@ ivas_error ivas_qmetadata_enc_encode( if ( nblocks > 1 ) { push_next_indice( hMetaData, 1, 1 ); /*Write 1 bit to signal requantization stage (EC3)*/ - bits_signalling[d] = 3; + bits_signaling[d] = 3; } else { - bits_signalling[d] = 2; + bits_signaling[d] = 2; } if ( hQMetaData->is_masa_ivas_format == 0 ) { - reduce_bits = bits_dir_raw - ( total_bits_1dir - bits_diff[d] - bits_coherence[d] - bits_signalling[d] ); + reduce_bits = bits_dir_raw - ( total_bits_1dir - bits_diff[d] - bits_coherence[d] - bits_signaling[d] ); ind_order[0] = -1; } else { ind_order[0] = 0; - reduce_bits = min( nbands * nblocks + MASA_BIT_REDUCT_PARAM, bits_dir_raw - ( total_bits_1dir - bits_diff[d] - bits_coherence[d] - bits_signalling[d] ) ); + reduce_bits = min( nbands * nblocks + MASA_BIT_REDUCT_PARAM, bits_dir_raw - ( total_bits_1dir - bits_diff[d] - bits_coherence[d] - bits_signaling[d] ) ); if ( reduce_bits > bits_dir_raw - nbands * nblocks ) { @@ -1255,7 +1255,7 @@ static int16_t ivas_qmetadata_entropy_encode_diffuseness( if ( nbands == 1 ) { - /* If there is only one band, diffuseness should be coded directly as raw with no signalling. */ + /* If there is only one band, diffuseness should be coded directly as raw with no signaling. */ push_next_indice( hMetaData, q_direction->band_data[0].energy_ratio_index[0], MASA_BITS_ER ); *diffuseness_index_max_ec_frame = 5; return ( hMetaData->nb_bits_tot - start_bit_pos ); @@ -1392,7 +1392,7 @@ static int16_t ivas_qmetadata_entropy_encode_df_ratio( if ( nbands == 1 ) { - /* If there is only one band, ratio should be coded directly as raw with no signalling. */ + /* If there is only one band, ratio should be coded directly as raw with no signaling. */ push_next_indice( hMetaData, q_direction->band_data[0].energy_ratio_index[0], df_ratio_bits[0] ); return ( hMetaData->nb_bits_tot - start_bit_pos ); @@ -1442,7 +1442,7 @@ static int16_t ivas_qmetadata_entropy_encode_df_ratio( push_next_indice( hMetaData, 0, 1 ); /* Signal between EC and raw */ if ( ec_mode > 1 ) { - /* Only use bit for signalling if necessary */ + /* Only use bit for signaling if necessary */ push_next_indice( hMetaData, 0, 1 ); /* Signal between one value or bandwise diff mode */ } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 388e7b4875..942dd14c99 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -203,7 +203,7 @@ ivas_error ivas_sce_enc( IVAS_SCE ); /*----------------------------------------------------------------* - * Write IVAS format signalling in SID frames + * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ if ( st->core_brate == SID_2k40 && ( ivas_format != SBA_FORMAT || st_ivas->sba_mode != SBA_MODE_SPAR ) ) diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index 164ad86875..1e7fe30bd1 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -538,12 +538,12 @@ void tdm_configure_enc( /*-------------------------------------------------------------------* - * signalling_enc_secondary() + * signaling_enc_secondary() * * Signalling of the secondary channel *-------------------------------------------------------------------*/ -ivas_error signalling_enc_secondary( +ivas_error signaling_enc_secondary( Encoder_State *st, /* i/o: Encoder structure */ const int16_t tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag OR LRTD primary channel */ const int16_t tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag*/ diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index 2cd7a66b04..79bb2f04a7 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -264,7 +264,7 @@ void stereo_tcx_core_enc( nbits_start = hBstr->nb_bits_tot; /*--------------------------------------------------------------------------------* - * Write TCX signalling + * Write TCX signaling *--------------------------------------------------------------------------------*/ /* TCX20/TCX10 and coder type */ diff --git a/lib_enc/mslvq_enc.c b/lib_enc/mslvq_enc.c index 3f7c0715ff..3c910cbf06 100644 --- a/lib_enc/mslvq_enc.c +++ b/lib_enc/mslvq_enc.c @@ -537,7 +537,7 @@ void index_lvq( float *quant, /* i : codevector to be indexed (2 8-dim subvectors) */ int16_t *idx_lead, /* i : leader class index for each subvector */ int16_t *idx_scale, /* i : scale index for each subvector */ - const int16_t mode, /* i : integer signalling the quantizer structure for the current bitrate */ + const int16_t mode, /* i : integer signaling the quantizer structure for the current bitrate */ int16_t *index, /* o : encoded index (represented on 3 short each with 15 bits ) */ const int16_t prediction_flag ) { diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 6b25d86df3..a17612290f 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -707,7 +707,7 @@ void pre_proc( } } - /* channel-aware mode - due to lack of signalling bit, sharpFlag is 1 always in RF mode */ + /* channel-aware mode - due to lack of signaling bit, sharpFlag is 1 always in RF mode */ if ( st->rf_mode && ( st->coder_type == VOICED || st->coder_type == GENERIC ) ) { st->sharpFlag = 1; diff --git a/lib_enc/updt_enc.c b/lib_enc/updt_enc.c index cb573fd07b..c6663895e0 100644 --- a/lib_enc/updt_enc.c +++ b/lib_enc/updt_enc.c @@ -258,7 +258,7 @@ void updt_IO_switch_enc( /* gain quantization memory */ set_f( st->hAmrwb_IO->past_qua_en, -14.0f, GAIN_PRED_ORDER ); - /* reset VBR signalling */ + /* reset VBR signaling */ if ( st->Opt_SC_VBR ) { st->hSC_VBR->ppp_mode = 0; -- GitLab From f8c1706df973f4ff0ebdaf41741d0a978dfc9c75 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 3 Aug 2022 13:30:27 +0200 Subject: [PATCH 11/17] replace 'const uint16_t t_design_11_size' by '#define SBA_T_DESIGN_11_SIZE' --- lib_com/ivas_cnst.h | 1 + lib_dec/ivas_allrad_dec.c | 3 +-- lib_dec/ivas_rom_dec.c | 6 ++---- lib_dec/ivas_rom_dec.h | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 332b586b01..97811d671c 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -832,6 +832,7 @@ typedef enum { #define SBA_PLANAR_BITS 1 #define SBA_ORDER_BITS 2 #define SBA_NHARM_HOA3 16 +#define SBA_T_DESIGN_11_SIZE 70 typedef enum { diff --git a/lib_dec/ivas_allrad_dec.c b/lib_dec/ivas_allrad_dec.c index 72a1983d3e..f0ec96ec25 100644 --- a/lib_dec/ivas_allrad_dec.c +++ b/lib_dec/ivas_allrad_dec.c @@ -144,11 +144,10 @@ ivas_error ivas_sba_get_hoa_dec_matrix( return error; } - num_harm = ( ambisonics_order + 1 ) * ( ambisonics_order + 1 ); /* Get t-design values */ - num_td = t_design_11_size; + num_td = SBA_T_DESIGN_11_SIZE; t_design_azi = t_design_11_azimuth; t_design_ele = t_design_11_elevation; diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index c442da1c75..5206bf5a7b 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -1130,9 +1130,7 @@ const float norm_sn3d_hoa3[16] = }; /* Order 11 t-design */ -const uint16_t t_design_11_size = 70; - -const float t_design_11_azimuth[70] = +const float t_design_11_azimuth[SBA_T_DESIGN_11_SIZE] = { 1.329273e+02f, -8.393495e+01f, 8.474100e+00f, -1.133408e+02f, -1.032659e+02f, -3.323704e+01f, 2.185643e+01f, -1.565395e+02f, -6.426475e+01f, 1.657795e+02f, -2.520283e+01f, -9.700380e+01f, 2.785464e+01f, 1.532142e+02f, -1.550616e+02f, -1.184214e+01f, @@ -1145,7 +1143,7 @@ const float t_design_11_azimuth[70] = -1.362968e+02f, 9.356446e+01f, -9.708401e+01f, -1.691583e+02f, -4.413238e+01f, 8.147954e+01f }; -const float t_design_11_elevation[70] = +const float t_design_11_elevation[SBA_T_DESIGN_11_SIZE] = { 7.692547e+00f, -2.373007e+01f, 2.351276e+01f, 7.042259e+01f, -9.896944e+00f, -7.075133e+01f, -2.646185e+01f, 4.777649e+01f, -7.720470e+00f, 4.453436e+01f, 2.638979e+01f, -4.465789e+01f, 9.767035e+00f, -4.770533e+01f, 7.453029e+00f, -2.359012e+01f, diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index a445f1e2cf..a92aad2533 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -195,8 +195,8 @@ extern const float norm_sn3d_hoa3[16]; /* Order 11 t-design */ extern const uint16_t t_design_11_size; -extern const float t_design_11_azimuth[70]; -extern const float t_design_11_elevation[70]; +extern const float t_design_11_azimuth[SBA_T_DESIGN_11_SIZE]; +extern const float t_design_11_elevation[SBA_T_DESIGN_11_SIZE]; /*----------------------------------------------------------------------* -- GitLab From 32d3ff79e482c815d8b70f9dc7d3199cce975715 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 3 Aug 2022 13:38:47 +0200 Subject: [PATCH 12/17] use existing function ivas_sba_get_nchan() wherever possible --- lib_com/ivas_spar_com.c | 6 ++++-- lib_dec/ivas_allrad_dec.c | 2 +- lib_dec/ivas_dirac_dec.c | 26 +++++++++++++------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 88f39f713b..6593039cda 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -1763,8 +1763,10 @@ void ivas_get_spar_md_from_dirac( /* average responses in all subframes*/ { float norm; - int16_t num_ch_order = ( order + 1 ) * ( order + 1 ); - int16_t hoa2_ch_order = 9; + int16_t num_ch_order, hoa2_ch_order; + + num_ch_order = ivas_sba_get_nchan( order, 0 ); + hoa2_ch_order = 9; for ( ch = 0; ch < num_ch_order; ch++ ) { diff --git a/lib_dec/ivas_allrad_dec.c b/lib_dec/ivas_allrad_dec.c index f0ec96ec25..d4301c07ac 100644 --- a/lib_dec/ivas_allrad_dec.c +++ b/lib_dec/ivas_allrad_dec.c @@ -144,7 +144,7 @@ ivas_error ivas_sba_get_hoa_dec_matrix( return error; } - num_harm = ( ambisonics_order + 1 ) * ( ambisonics_order + 1 ); + num_harm = ivas_sba_get_nchan( ambisonics_order, 0 ); /* Get t-design values */ num_td = SBA_T_DESIGN_11_SIZE; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 91dc6f2f12..02fa8c02e6 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -260,8 +260,8 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { - hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); - hDirAC->subframe_nbslots = (int16_t) ( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); + hDirAC->slot_size = ( int16_t )( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); + hDirAC->subframe_nbslots = ( int16_t )( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); hDirAC->nb_subframes = CLDFB_NO_COL_MAX / hDirAC->subframe_nbslots; assert( hDirAC->nb_subframes <= MAX_PARAM_SPATIAL_SUBFRAMES ); } @@ -309,7 +309,7 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { - hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + hDirAC->num_freq_bands = ( int16_t )( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hDirAC->frequency_axis = (float *) count_malloc( hDirAC->num_freq_bands * sizeof( float ) ); set_f( hDirAC->frequency_axis, 0.0f, hDirAC->num_freq_bands ); @@ -368,7 +368,7 @@ ivas_error ivas_dirac_dec_config( hDirAC->num_outputs_diff += 2; /* Add 2nd-order planar components for HRs */ } - hDirAC->num_outputs_dir = ( hDirAC->hOutSetup.ambisonics_order + 1 ) * ( hDirAC->hOutSetup.ambisonics_order + 1 ); + hDirAC->num_outputs_dir = ivas_sba_get_nchan( hDirAC->hOutSetup.ambisonics_order, 0 ); } else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { @@ -1282,7 +1282,7 @@ void ivas_dirac_dec_read_BS( if ( !st->bfi && ivas_total_brate > IVAS_SID_4k4 ) { next_bit_pos_orig = st->next_bit_pos; - st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); + st->next_bit_pos = ( int16_t )( ivas_total_brate / FRAMES_PER_SEC - 1 ); /* 1 bit flag for signaling metadata to read */ b = st->bit_stream[( st->next_bit_pos )--]; @@ -1388,7 +1388,7 @@ void ivas_dirac_dec_read_BS( next_bit_pos_orig = st->next_bit_pos; /* subtract mode signaling bits, since bitstream was moved after mode reading */ - st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); + st->next_bit_pos = ( int16_t )( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); /* if we start with a SID frame, we need to init the azi/ele arrays.*/ if ( st->ini_frame == 0 ) @@ -1616,8 +1616,8 @@ void ivas_qmetadata_to_dirac( for ( b = band_start; b < band_end; b++ ) { tmp_write_idx_band = tmp_write_idx_param_band; - azi = (int16_t) ( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); - ele = (int16_t) ( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); + azi = ( int16_t )( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); + ele = ( int16_t )( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); /* limit the elevation to [-90, 90] */ ele = min( 90, ele ); ele = max( -90, ele ); @@ -1794,10 +1794,10 @@ void ivas_dirac_dec( { for ( i = 0; i < output_frame; i++ ) { - tmp[nchan_transport * i + n] = (int16_t) ( output_f[n][i] + 0.5f ); + tmp[nchan_transport * i + n] = ( int16_t )( output_f[n][i] + 0.5f ); } } - sprintf( file_name, "./res/ivas_dirac_dec_DMX%d.%d.pcm", nchan_transport, (int16_t) ( output_frame * 0.05 ) ); + sprintf( file_name, "./res/ivas_dirac_dec_DMX%d.%d.pcm", nchan_transport, ( int16_t )( output_frame * 0.05 ) ); dbgwrite( tmp, sizeof( int16_t ), nchan_transport * output_frame, 1, file_name ); } #endif @@ -2457,7 +2457,7 @@ void compute_hoa_encoder_mtx( { int16_t k, num_sh; - num_sh = ( ambisonics_order + 1 ) * ( ambisonics_order + 1 ); + num_sh = ivas_sba_get_nchan( ambisonics_order, 0 ); for ( k = 0; k < num_responses; k++ ) { @@ -3294,8 +3294,8 @@ static void computeDirectionAngles( z = *( intensity_real_z++ ) * intensityNorm; } radius = sqrtf( x * x + y * y ); - azimuth[k] = (int16_t) ( max( -180.0f, min( 180.0f, atan2f( y, x ) / EVS_PI * 180.0f ) ) + 0.5f ); - elevation[k] = (int16_t) ( max( -90.0f, min( 180.0f, atan2f( z, radius ) / EVS_PI * 180.0f ) ) + 0.5f ); + azimuth[k] = ( int16_t )( max( -180.0f, min( 180.0f, atan2f( y, x ) / EVS_PI * 180.0f ) ) + 0.5f ); + elevation[k] = ( int16_t )( max( -90.0f, min( 180.0f, atan2f( z, radius ) / EVS_PI * 180.0f ) ) + 0.5f ); } return; -- GitLab From ba21ab6ceecb1a575861630efb597913bd2b17e6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 3 Aug 2022 14:04:00 +0200 Subject: [PATCH 13/17] formatting + comments --- lib_dec/ivas_reverb_filter_design.c | 78 +++++++++++++++++++++++------ lib_dec/ivas_rom_dec.c | 38 ++++++++++---- lib_dec/ivas_spar_md_dec.c | 1 - 3 files changed, 91 insertions(+), 26 deletions(-) diff --git a/lib_dec/ivas_reverb_filter_design.c b/lib_dec/ivas_reverb_filter_design.c index 19c056d8f7..89a10017d4 100644 --- a/lib_dec/ivas_reverb_filter_design.c +++ b/lib_dec/ivas_reverb_filter_design.c @@ -57,8 +57,13 @@ * Function definitions *------------------------------------------------------------------------------------------*/ -/* getMinPhase computes the minimum phase spectrum that can be derived from the - amplitude spectrum of the input. */ +/*-------------------------------------------------------------------* + * calc_min_phase() + * + * Compute the minimum phase spectrum that can be derived + * from the amplitude spectrum of the input. + *-------------------------------------------------------------------*/ + static void calc_min_phase( rv_fftwf_type_complex *pSpectrum, const int16_t fft_size, @@ -186,8 +191,13 @@ static void calc_min_phase( } -/* Converts FFT-domain pFilter pH_flt into a minimum-phase pFilter. -This function expects only the positive frequency bins up to Nyquist/2 */ +/*-------------------------------------------------------------------* + * calc_min_phase_filter() + * + * Convert FFT-domain pFilter pH_flt into a minimum-phase pFilter. + * This function expects only the positive frequency bins up to Nyquist/2 + *-------------------------------------------------------------------*/ + static void calc_min_phase_filter( rv_fftwf_type_complex *pH_flt, const int16_t fft_size, @@ -220,7 +230,12 @@ static void calc_min_phase_filter( } -/* Applies the smoothing (anti-aliasing) window in the time domain */ +/*-------------------------------------------------------------------* + * apply_window_fft() + * + * Apply the smoothing (anti-aliasing) window in the time domain + *-------------------------------------------------------------------*/ + static void apply_window_fft( rv_fftwf_type_complex *pH_flt, const float *pWindow, @@ -270,7 +285,12 @@ static void apply_window_fft( } -/* Limits the gain vs frequency slope to T db per bin */ +/*-------------------------------------------------------------------* + * response_step_limit() + * + * Limit the gain vs frequency slope to T db per bin + *-------------------------------------------------------------------*/ + static void response_step_limit( float *X, const int16_t dim_x, @@ -333,7 +353,12 @@ static void response_step_limit( } -/* This function computes a smoothing window used later to avoid aliasing in FFT filters */ +/*-------------------------------------------------------------------* + * ivas_reverb_define_window_fft() + * + * Compute a smoothing window used later to avoid aliasing in FFT filters + *-------------------------------------------------------------------*/ + void ivas_reverb_define_window_fft( float *pWindow, const int16_t transitionStart, @@ -373,6 +398,11 @@ void ivas_reverb_define_window_fft( return; } +/*-------------------------------------------------------------------* + * apply_window_fft() + * + * Applies the smoothing (anti-aliasing) window in the time domain + *-------------------------------------------------------------------*/ /* Computes colorations filters for the target frequency responses */ int16_t ivas_reverb_calc_color_filters( @@ -415,7 +445,12 @@ int16_t ivas_reverb_calc_color_filters( } -/* Computes correlation filters for the target frequency response */ +/*-------------------------------------------------------------------* + * ivas_reverb_calc_correl_filters() + * + * Compute correlation filters for the target frequency response + *-------------------------------------------------------------------*/ + int16_t ivas_reverb_calc_correl_filters( const float *pTargetICC, const float *pWindow, @@ -455,7 +490,12 @@ int16_t ivas_reverb_calc_correl_filters( } -/* Computes the target levels (gains) for the coloration filters */ +/*-------------------------------------------------------------------* + * ivas_reverb_calc_color_levels() + * + * Compute the target levels (gains) for the coloration filters + *-------------------------------------------------------------------*/ + void ivas_reverb_calc_color_levels( const int32_t output_Fs, const int16_t freq_count, @@ -557,11 +597,12 @@ void ivas_reverb_calc_color_levels( } -/*-----------------------------------------------------------------------------------------* - * Function description : Interpolates data from the input T60 and DSR tables - * to the FFT pFilter uniform grid +/*-------------------------------------------------------------------* + * ivas_reverb_interpolate_acoustic_data() + * + * Interpolates data from the input T60 and DSR tables to the FFT pFilter uniform grid * Note: the fc frequencies both for the input and the output must be in the ascending order - *-----------------------------------------------------------------------------------------*/ + *-------------------------------------------------------------------*/ void ivas_reverb_interpolate_acoustic_data( const int16_t input_table_size, @@ -614,8 +655,13 @@ void ivas_reverb_interpolate_acoustic_data( } -/* Function analyses the HRTF set and computes avarage left/right power spectrum - and frequency-dependent IA coherence. Expects frequency-domain HRTF input */ +/*-------------------------------------------------------------------* + * ivas_reverb_get_hrtf_set_properties() + * + * Function analyses the HRTF set and computes avarage left/right power spectrum + * and frequency-dependent IA coherence. Expects frequency-domain HRTF input + *-------------------------------------------------------------------*/ + void ivas_reverb_get_hrtf_set_properties( float **ppHrtf_set_L_re, float **ppHrtf_set_L_im, @@ -787,4 +833,6 @@ void ivas_reverb_get_hrtf_set_properties( pOut_avg_pwr_R[out_bin_idx] = weight_1st * avg_pwr_right[0] + relative_pos * avg_pwr_right[1]; out_i_a_coherence[out_bin_idx] = weight_1st * IA_coherence[0] + relative_pos * IA_coherence[1]; } + + return; } diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 5206bf5a7b..baf77c1984 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -924,23 +924,38 @@ const int16_t channelIndex_CICP14[7] = { 0, 1, 2, 5, 6, 9, 10 }; const int16_t channelIndex_CICP16[9] = { 0, 1, 2, 5, 6, 9, 10, 11, 12 }; const int16_t channelIndex_CICP19[11] = { 0, 1, 2, 3, 4, 7, 8, 9, 10, 13, 14 }; -const float surCohEne[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = { 3.0903f, 2.0053f, 1.0860f, 0.8072f, 0.7079f }; +const float surCohEne[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = +{ + 3.0903f, 2.0053f, 1.0860f, 0.8072f, 0.7079f +}; -const float spreadCohEne05[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = { 2.3988f, 1.7783f, 1.1220f, 1.1220f, 1.1220f }; +const float spreadCohEne05[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = +{ + 2.3988f, 1.7783f, 1.1220f, 1.1220f, 1.1220f +}; -const float spreadCohEne1[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = { 1.5975f, 1.1220f, 1.1220f, 1.1220f, 1.1220f }; +const float spreadCohEne1[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = +{ + 1.5975f, 1.1220f, 1.1220f, 1.1220f, 1.1220f +}; -const float lowBitRateBinauralEQ[LOW_BIT_RATE_BINAURAL_EQ_BINS] = { 0.979f, 0.893f, 0.762f, 0.615f, 0.52f, 0.48f, 0.477f, 0.477f, 0.48f, 0.501f, 0.546f, 0.602f, 0.652f, 0.664f, 0.652f, 0.639f, 0.635f }; +const float lowBitRateBinauralEQ[LOW_BIT_RATE_BINAURAL_EQ_BINS] = +{ + 0.979f, 0.893f, 0.762f, 0.615f, 0.52f, 0.48f, 0.477f, 0.477f, 0.48f, 0.501f, 0.546f, 0.602f, 0.652f, 0.664f, 0.652f, 0.639f, 0.635f +}; -const float diffuseFieldCoherenceDifferenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS] = { +const float diffuseFieldCoherenceDifferenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS] = +{ 0.047421f, 0.19773f, 0.22582f, 0.10637f, 0.0087111f, 0.012028f, 0.031972f, 0.019668f, 0.0079928f }; -const float diffuseFieldCoherenceDifferenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS] = { +const float diffuseFieldCoherenceDifferenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS] = +{ -0.095628f, -0.30569f, -0.34427f, -0.15425f, -0.044628f, -0.057224f, -0.050835f, -0.035214f, -0.02215f }; -const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS] = { +const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS] = +{ 0.048207f, 0.10796f, 0.11845f, 0.047886f, 0.035917f, 0.045196f, 0.018863f, 0.015547f, 0.014157f }; @@ -1022,7 +1037,8 @@ const float SincTable[321] = 0.00000000f }; -const float orange53_left_avg_power[257] = { +const float orange53_left_avg_power[257] = /* 257 == IVAS_REVERB_FFT_SIZE_48K/2 + 1 */ +{ 0.999231100f, 0.992580175f, 0.969233215f, 0.925614893f, 0.871408045f, 0.826101780f, 0.803222895f, 0.800087631f, 0.802672029f, 0.801490188f, 0.796555817f, 0.790879488f, 0.784882724f, 0.777585745f, 0.769326210f, 0.761789441f, 0.756145239f, 0.752754092f, 0.751703024f, 0.752594173f, 0.754317880f, 0.755515277f, 0.754378498f, 0.748860359f, 0.738919020f, 0.727488697f, 0.718792558f, @@ -1054,7 +1070,8 @@ const float orange53_left_avg_power[257] = { 0.266522497f, 0.266185820f, 0.266298562f, 0.266692907f, 0.266907692f }; -const float orange53_right_avg_power[257] = { +const float orange53_right_avg_power[257] = +{ 0.999231100f, 0.992580175f, 0.969233215f, 0.925614893f, 0.871408045f, 0.826101780f, 0.803222895f, 0.800087631f, 0.802672029f, 0.801490188f, 0.796555817f, 0.790879488f, 0.784882724f, 0.777585745f, 0.769326210f, 0.761789441f, 0.756145239f, 0.752754092f, 0.751703024f, 0.752594173f, 0.754317880f, 0.755515277f, 0.754378498f, 0.748860359f, 0.738919020f, 0.727488697f, 0.718792558f, @@ -1086,7 +1103,8 @@ const float orange53_right_avg_power[257] = { 0.266522497f, 0.266185820f, 0.266298562f, 0.266692907f, 0.266907692f }; -const float orange53_coherence[257] = { +const float orange53_coherence[257] = +{ 0.929530263f, 0.921171963f, 0.900268972f, 0.876067519f, 0.855227590f, 0.837884128f, 0.823401272f, 0.818804145f, 0.835025251f, 0.871971071f, 0.911253273f, 0.929330528f, 0.921199203f, 0.900894165f, 0.882577479f, 0.867001534f, 0.849280477f, 0.832460761f, 0.824062645f, 0.823441386f, 0.820908070f, 0.811902404f, 0.802339375f, 0.798648477f, 0.797345281f, 0.791158736f, 0.779512227f, diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 322c039c8d..21c244292a 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -1004,7 +1004,6 @@ static void ivas_get_spar_matrices( { for ( j = 0; j < numch_out; j++ ) { - set_zero( &pState->spar_coeffs.C_re[i][j][i_ts * IVAS_MAX_NUM_BANDS], IVAS_MAX_NUM_BANDS ); set_zero( &pState->spar_coeffs.P_re[i][j][i_ts * IVAS_MAX_NUM_BANDS], IVAS_MAX_NUM_BANDS ); } -- GitLab From b0f0872643d7d40605e7fef893fc781b32d812bd Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 3 Aug 2022 14:09:09 +0200 Subject: [PATCH 14/17] simplification within FIX_I68_MC_REVERB_FOR_514 --- lib_com/ivas_prot.h | 29 +++++------------------------ lib_dec/ivas_reverb.c | 24 +++++++++++------------- 2 files changed, 16 insertions(+), 37 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 44cfa6e909..2d9a8b008f 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5201,22 +5201,15 @@ ivas_error ivas_render_config_init_from_rom( * Reverberator *----------------------------------------------------------------------------------*/ -#ifdef FIX_I68_MC_REVERB_FOR_514 ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ +#ifdef FIX_I68_MC_REVERB_FOR_514 const AUDIO_CONFIG transport_config, /* i : reverb. input audio configuration */ +#endif const HRTFS_HANDLE hHrtf, /* i : HRTF handle */ RENDER_CONFIG_DATA *pConfig, /* i : Reverb configuration */ const int32_t output_Fs /* i : output sampling rate */ ); -#else /* FIX_I68_MC_REVERB_FOR_514 */ -ivas_error ivas_reverb_open( - REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ - const HRTFS_HANDLE hHrtf, /* i : HRTF handle */ - RENDER_CONFIG_DATA *pConfig, /* i : Reverb configuration */ - const int32_t output_Fs /* i : output sampling rate */ -); -#endif /* FIX_I68_MC_REVERB_FOR_514 */ void ivas_reverb_close( REVERB_HANDLE *hReverb /* i/o: Reverberator handle */ @@ -5389,13 +5382,14 @@ void ivas_reverb_interpolate_acoustic_data( float *pOutput_dsr ); -#ifdef FIX_I68_MC_REVERB_FOR_514 void ivas_reverb_get_hrtf_set_properties( float **ppHrtf_set_L_re, float **ppHrtf_set_L_im, float **ppHrtf_set_R_re, float **ppHrtf_set_R_im, +#ifdef FIX_I68_MC_REVERB_FOR_514 const AUDIO_CONFIG inp_audio_format, +#endif const int16_t hrtf_count, const int16_t in_freq_count, const int16_t out_freq_count, @@ -5403,20 +5397,7 @@ void ivas_reverb_get_hrtf_set_properties( float *pOut_avg_pwr_R, float *pOut_i_a_coherence ); -#else /* FIX_I68_MC_REVERB_FOR_514 */ -void ivas_reverb_get_hrtf_set_properties( - float **ppHrtf_set_L_re, - float **ppHrtf_set_L_im, - float **ppHrtf_set_R_re, - float **ppHrtf_set_R_im, - const int16_t hrtf_count, - const int16_t in_freq_count, - const int16_t out_freq_count, - float *pOut_avg_pwr_L, - float *pOut_avg_pwr_R, - float *pOut_i_a_coherence -); -#endif /* FIX_I68_MC_REVERB_FOR_514 */ + /* Orientation tracking */ void ivas_orient_trk_Init( diff --git a/lib_dec/ivas_reverb.c b/lib_dec/ivas_reverb.c index 6074e7d3ac..425d6ddcf1 100644 --- a/lib_dec/ivas_reverb.c +++ b/lib_dec/ivas_reverb.c @@ -783,11 +783,16 @@ static void set_fft_and_datablock_sizes( * Sets reverb acoustic data (room acoustics and HRTF), interpolating it to the filter grid *-----------------------------------------------------------------------------------------*/ +static void set_reverb_acoustic_data( + ivas_reverb_params_t *pParams, #ifdef FIX_I68_MC_REVERB_FOR_514 -static void set_reverb_acoustic_data( ivas_reverb_params_t *pParams, const AUDIO_CONFIG inp_audio_config, const HRTFS_HANDLE hHrtf, ivas_roomAcoustics_t *pRoomAcoustics, int16_t subframe_len, int16_t nr_fc_input, int16_t nr_fc_fft_filter ) -#else /* FIX_I68_MC_REVERB_FOR_514 */ -static void set_reverb_acoustic_data( ivas_reverb_params_t *pParams, const HRTFS_HANDLE hHrtf, ivas_roomAcoustics_t *pRoomAcoustics, int16_t subframe_len, int16_t nr_fc_input, int16_t nr_fc_fft_filter ) -#endif /* FIX_I68_MC_REVERB_FOR_514 */ + const AUDIO_CONFIG inp_audio_config, +#endif + const HRTFS_HANDLE hHrtf, + ivas_roomAcoustics_t *pRoomAcoustics, + const int16_t subframe_len, + const int16_t nr_fc_input, + const int16_t nr_fc_fft_filter ) { int16_t nr_out_ch, hrtf_idx, offset, iter_idx, bin_idx; float ln_1e6_inverted, delay_diff, exp_argument; @@ -936,22 +941,15 @@ static ivas_error setup_FDN_branches( * Allocate and initialize Crend reverberation handle *------------------------------------------------------------------------*/ -#ifdef FIX_I68_MC_REVERB_FOR_514 ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ +#ifdef FIX_I68_MC_REVERB_FOR_514 const AUDIO_CONFIG transport_config,/* i : reverb. input audio configuration */ +#endif const HRTFS_HANDLE hHrtf, /* i : HRTF handle */ RENDER_CONFIG_HANDLE hRenderConfig, /* i : Renderer configuration handle */ const int32_t output_Fs /* i : output sampling rate */ ) -#else /* FIX_I68_MC_REVERB_FOR_514 */ -ivas_error ivas_reverb_open( - REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ - const HRTFS_HANDLE hHrtf, /* i : HRTF handle */ - RENDER_CONFIG_HANDLE hRenderConfig, /* i : Renderer configuration handle */ - const int32_t output_Fs /* i : output sampling rate */ -) -#endif /* FIX_I68_MC_REVERB_FOR_514 */ { ivas_error error; REVERB_HANDLE pState = NULL; -- GitLab From 5aba3cdc4cf63e70eb64c9e31cd3eee701aedb83 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Aug 2022 09:51:46 +0200 Subject: [PATCH 15/17] - rename "EVS channel" to "core-coder channel" - rename "fs" to "Fs" - empty lines --- lib_com/basop_proto_func.h | 2 +- lib_com/cnst.h | 2 +- lib_com/core_com_config.c | 4 ++-- lib_com/ivas_cnst.h | 2 +- lib_com/ivas_dirac_com.c | 9 ++++----- lib_com/ivas_rom_com.c | 4 ++-- lib_com/wi.c | 4 ++-- lib_dec/dec_prm.c | 2 +- lib_dec/fd_cng_dec.c | 2 +- lib_dec/ivas_crend.c | 1 + lib_dec/ivas_spar_decoder.c | 2 +- lib_enc/ivas_dirac_enc.c | 1 + 12 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib_com/basop_proto_func.h b/lib_com/basop_proto_func.h index 19337e9a52..a9a64ac4c2 100644 --- a/lib_com/basop_proto_func.h +++ b/lib_com/basop_proto_func.h @@ -57,7 +57,7 @@ void basop_lsf2lsp( const Word16 lsf[], Word16 lsp[] ); void basop_weight_a( const Word16 *a, Word16 *ap, const Word16 gamma ); void basop_weight_a_inv( const Word16 *a, Word16 *ap, const Word16 inv_gamma ); void basop_E_LPC_a_add_tilt( const Word16 *a, Word16 *ap, Word16 gamma ); -void basop_reorder_lsf( Word16 *lsf, const Word16 min_dist, const Word16 n, const Word32 fs ); +void basop_reorder_lsf( Word16 *lsf, const Word16 min_dist, const Word16 n, const Word32 Fs ); void basop_E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ); /* tcx_utils.c */ diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 17a437bef7..8e4c7c9908 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -550,7 +550,7 @@ enum #define L_MDCT_OVLP_MAX_CORE_FS L_NEXT_MAX_32k /* 280, 2/3 * L_MDCT_OVLP_MAX */ #define L_MDCT_HALF_OVLP_MAX_CORE_FS 2 * ( L_MDCT_HALF_OVLP_MAX ) / 3 /* 2/3 * L_MDCT_HALF_OVLP_MAX */ #define L_MDCT_MIN_OVLP_MAX_CORE_FS 2 * ( L_MDCT_MIN_OVLP_MAX ) / 3 /* 2/3 * L_MDCT_MIN_OVLP_MAX */ -#define L_ALDO_WIN1_MAX_CORE_FS 460 /* ALDO1 maximum window length for max core fs */ +#define L_ALDO_WIN1_MAX_CORE_FS 460 /* ALDO1 maximum window length for max core Fs */ #define L_ALDO_WIN1_FB_MAX 690 /* ALDO1 maximum window length */ /*----------------------------------------------------------------------------------* diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 5f5103a03f..295eca6233 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -54,8 +54,8 @@ /*! r: flag indicating a valid bitrate */ int16_t is_EVS_bitrate( - const int32_t ivas_total_brate, /* i : EVS total bitrate */ - int16_t *Opt_AMR_WB /* i : AMR-WB IO flag */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + int16_t *Opt_AMR_WB /* i : AMR-WB IO flag */ ) { int16_t j; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 97811d671c..dedc434312 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -969,7 +969,7 @@ typedef enum #define IVAS_SPAR_BR_TABLE_LEN 18 -/* TD decorr */ +/* TD decorr */ // VE: not all 16CH are currently supported -> t be revisited later enum { IVAS_TD_DECORR_OUT_1CH = 1, diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 46759c2912..8cade5dee4 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -178,20 +178,18 @@ ivas_error ivas_dirac_config( if ( sba_mode == SBA_MODE_SPAR ) { ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), - dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, - hFbMdft ); + dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft ); } else { ivas_dirac_config_bands( band_grouping, hConfig->nbands, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), - NULL, 0, 0, - hFbMdft ); + NULL, 0, 0, hFbMdft ); } - return error; } + /*------------------------------------------------------------------------- * ivas_dirac_sba_config_bands() * @@ -294,6 +292,7 @@ void ivas_dirac_config_bands( return; } + /*------------------------------------------------------------------------- * ivas_dirac_sba_config() * diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index b6a4f15889..7198c19120 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -901,8 +901,8 @@ const int16_t DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1] = const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] = { -/* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each EVS channel - so minimum EVS bitrate per channel can be min EVS bitrates as per the table - AGC_BITS_PER_CH */ +/* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel + so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */ { 24400, 0, 1, FB, 24000, 1, WYXZ, 1, 0,{ { 16400, 15200, 24350 } }, { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, diff --git a/lib_com/wi.c b/lib_com/wi.c index 6cf3c1d2b1..e63c0a4b92 100644 --- a/lib_com/wi.c +++ b/lib_com/wi.c @@ -399,7 +399,7 @@ void DTFS_zeroPadd( /*-------------------------------------------------------------------* * DTFS_to_fs() * - * DTFS to fs conversion. + * DTFS to Fs conversion. *-------------------------------------------------------------------*/ void DTFS_to_fs( @@ -407,7 +407,7 @@ void DTFS_to_fs( const int16_t N, /* i : Length of input vector */ DTFS_STRUCTURE *X, /* o : DTFS structure with a, b, lag */ const int32_t sampling_rate, /* i : sampling rate */ - const int16_t FR_flag /* i : FR flag */ + const int16_t FR_flag /* i : FR flag */ ) { int16_t n; diff --git a/lib_dec/dec_prm.c b/lib_dec/dec_prm.c index d004091f48..37c64f18a3 100644 --- a/lib_dec/dec_prm.c +++ b/lib_dec/dec_prm.c @@ -789,7 +789,7 @@ void dec_prm( } /*--------------------------------------------------------------------------------* - * EVS header + * core-coder header *--------------------------------------------------------------------------------*/ /* Modes (ACE_GC, ACE_UC, TCX20, TCX10...) */ diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 39fbf2a66c..4f0e8574f0 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -390,7 +390,7 @@ void ApplyFdCng( wmops_sub_start( "ApplyFdCng" ); - /* limit L_frame and core fs values for MDCT-Stereo modes which can have higher core sampling than 16kHz, but use a downsampled buffer */ + /* limit L_frame and core Fs values for MDCT-Stereo modes which can have higher core sampling than 16kHz, but use a downsampled buffer */ L_frame = min( st->L_frame, L_FRAME16k ); last_L_frame = min( st->last_L_frame, L_FRAME16k ); sr_core = min( st->sr_core, INT_FS_16k ); diff --git a/lib_dec/ivas_crend.c b/lib_dec/ivas_crend.c index 4631017ed5..26f559ca82 100644 --- a/lib_dec/ivas_crend.c +++ b/lib_dec/ivas_crend.c @@ -875,6 +875,7 @@ ivas_error ivas_crend_close( st_ivas->hCrend->hTrack = NULL; } } + ivas_reverb_close( &st_ivas->hCrend->hReverb ); count_free( st_ivas->hCrend ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index ca20e5f609..9a0cb68ab5 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -908,8 +908,8 @@ void ivas_spar_dec_upmixer( numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; - /* by-pass EVS */ #ifdef DEBUG_SPAR_BYPASS_EVS_CODEC + /* by-pass core-coder */ /*write the core coder output to a file for debugging*/ { float tmp; diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 86257df522..557cb109ca 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -139,6 +139,7 @@ ivas_error ivas_dirac_enc_open( hDirAC->sba_synchro_buffer[i] = NULL; } } + /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { -- GitLab From 8d89bc424bdd964d7ceb9b78859ce538d922209e Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 5 Aug 2022 10:07:13 +0200 Subject: [PATCH 16/17] - improve a comment --- lib_com/ivas_cnst.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index dedc434312..fde64164c9 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -159,8 +159,8 @@ typedef enum * IVAS general constants *----------------------------------------------------------------------------------*/ -#define MAX_INPUT_CHANNELS 16 /* Maximum number of input channels */ -#define MAX_TRANSPORT_CHANNELS 12 /* Maximum number of transport channels */ +#define MAX_INPUT_CHANNELS 16 /* Maximum number of input channels (HOA 3rd order) */ +#define MAX_TRANSPORT_CHANNELS 12 /* Maximum number of transport channels */ #define MAX_INTERN_CHANNELS 16 /* Maximum number of intern channels (HOA 3rd order) */ #define HEAD_ROTATION_HOA_ORDER 3 /* HOA 3rd order */ #define MAX_CICP_CHANNELS 16 /* max channels for loudspeaker layouts (16 for custom layouts)*/ -- GitLab From abe854e8be6e740454277c4fc36c893608569c57 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 8 Aug 2022 10:06:42 +0200 Subject: [PATCH 17/17] revert move of wmops_sub_start() at the beginning of acelp_core_dec() which would otherwise cause errors in case of running instrumented code in MDCT stereo --- lib_dec/acelp_core_dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 686de7381f..b102e302e4 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -121,9 +121,7 @@ ivas_error acelp_core_dec( float *old_exc_s; /* Start of last excitation frame */ float *p_tdm_Pri_pitch_buf; int16_t local_element_mode; - ivas_error error; - - wmops_sub_start( "acelp_core_dec" ); + ivas_error error; error = IVAS_ERR_OK; @@ -133,6 +131,8 @@ ivas_error acelp_core_dec( return error; } + wmops_sub_start( "acelp_core_dec" ); + output_frame = (int16_t) ( st->output_Fs / FRAMES_PER_SEC ); /*----------------------------------------------------------------* -- GitLab