Loading lib_dec/ivas_stereo_dft_dec_fx.c +2 −0 Original line number Diff line number Diff line Loading @@ -402,6 +402,8 @@ ivas_error stereo_dft_dec_create_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); } set_zero_fx( hStereoDft_loc->hb_nrg_subr_fx, STEREO_DFT_NBDIV ); /*Setting hb_nrg_subr_fx to zero*/ hStereoDft_loc->q_hb_nrg_subr = Q31; move16(); hStereoDft_loc->hConfig->force_mono_transmission = 0; move16(); Loading lib_enc/ivas_core_pre_proc_front_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -1425,7 +1425,7 @@ ivas_error pre_proc_front_ivas_fx( * TC frame selection *-----------------------------------------------------------------*/ st->clas = signal_clas_fx( st, inp_12k8_fx, ee_fx, *relE_fx, L_look, tdm_SM_last_clas ); /* Q0 */ st->clas = signal_clas_ivas_fx( st, inp_12k8_fx, ee_fx, *relE_fx, L_look, tdm_SM_last_clas ); /* Q0 */ move16(); select_TC_fx( MODE1, st->tc_cnt, &st->coder_type, st->localVAD ); Loading lib_enc/ivas_core_pre_proc_fx.c +1 −0 Original line number Diff line number Diff line Loading @@ -1138,6 +1138,7 @@ ivas_error ivas_compute_core_buffers_fx( Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /* Q15 */ } IF( Q_new ) { #ifdef REMOVE_EVS_DUPLICATES Loading lib_enc/ivas_corecoder_enc_reconfig_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -588,7 +588,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( IF( st_ivas->nSCE ) { Copy32( input_buff_fx[0], st_ivas->hSCE[0]->hCoreCoder[0]->input_buff32_fx, len_inp_memory ); /* q_input_buff */ st_ivas->hSCE[0]->hCoreCoder[0]->q_inp32 = q_input_buff[0]; // st_ivas->hSCE[0]->hCoreCoder[0]->q_inp32 = q_input_buff[0]; st_ivas->hSCE[0]->hCoreCoder[0]->q_old_inp32 = q_input_buff[0]; move16(); move16(); Loading @@ -599,7 +599,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { Copy32( input_buff_fx[n + 1], st_ivas->hCPE[0]->hCoreCoder[n]->input_buff32_fx, len_inp_memory ); /* q_input_buff */ st_ivas->hCPE[0]->hCoreCoder[n]->q_inp32 = q_input_buff[n + 1]; // st_ivas->hCPE[0]->hCoreCoder[n]->q_inp32 = q_input_buff[n + 1]; st_ivas->hCPE[0]->hCoreCoder[n]->q_old_inp32 = q_input_buff[n + 1]; move16(); move16(); Loading lib_enc/ivas_cpe_enc_fx.c +29 −27 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ ivas_error ivas_cpe_enc_fx( Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp; move16(); // Q_new move16(); // Q_new Word16 q_com, shift; Word16 q_com, shift, q_min, gb; error = IVAS_ERR_OK; move32(); Loading Loading @@ -238,7 +238,6 @@ ivas_error ivas_cpe_enc_fx( move16(); IF( data_fx_ch1 != NULL ) /*this may happen for cases with odd number of channels*/ { // Q_min = s_min( q_data_fx, add( sts[1]->q_inp32, L_norm_arr( sts[1]->input32_fx - input_frame, input_frame ) ) ); scale_sig32( sts[1]->input32_fx - input_frame, input_frame, sub( Q_min, sts[1]->q_old_inp32 ) ); sts[1]->q_old_inp32 = Q_min; move16(); Loading @@ -246,8 +245,6 @@ ivas_error ivas_cpe_enc_fx( sts[1]->q_inp32 = Q_min; move16(); // norm = L_norm_arr( sts[1]->input32_fx, input_frame ); Copy_Scale_sig32_16( sts[1]->input32_fx, sts[1]->input_fx, input_frame, norm ); sts[1]->q_inp = add( sub( sts[1]->q_inp32, Q16 ), norm ); move16(); Loading Loading @@ -389,16 +386,19 @@ ivas_error ivas_cpe_enc_fx( /*----------------------------------------------------------------* * Resets/updates in case of stereo switching *----------------------------------------------------------------*/ shift = L_norm_arr( sts[1]->old_input_signal32_fx, input_frame * 2 ); shift = s_min( shift, L_norm_arr( sts[0]->old_input_signal32_fx, input_frame * 2 ) ); IF( GT_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) { gb = find_guarded_bits_fx( sts[0]->encoderLookahead_FB ); shift = L_norm_arr( sts[1]->old_input_signal32_fx, shl( input_frame, 1 ) ); shift = s_min( shift, L_norm_arr( sts[0]->old_input_signal32_fx, shl( input_frame, 1 ) ) ); if ( shift < find_guarded_bits_fx( sts[0]->encoderLookahead_FB ) ) IF( LT_16( shift, gb ) ) { shift = sub( shift, find_guarded_bits_fx( sts[0]->encoderLookahead_FB ) ); scale_sig32( sts[1]->input32_fx, input_frame, shift ); /* q_inp */ scale_sig32( sts[0]->input32_fx, input_frame, shift ); /* q_inp */ scale_sig32( sts[1]->old_input_signal32_fx, input_frame, shift ); /* q_inp */ scale_sig32( sts[0]->old_input_signal32_fx, input_frame, shift ); /* q_inp */ shift = sub( shift, gb ); scale_sig32( sts[1]->input32_fx, input_frame, shift ); /* q_inp32 + shift */ scale_sig32( sts[0]->input32_fx, input_frame, shift ); /* q_inp32 + shift */ scale_sig32( sts[1]->old_input_signal32_fx, input_frame, shift ); /* q_old_inp32 + shift */ scale_sig32( sts[0]->old_input_signal32_fx, input_frame, shift ); /* q_old_inp32 + shift */ sts[1]->q_inp32 = add( sts[1]->q_inp32, shift ); sts[0]->q_inp32 = add( sts[0]->q_inp32, shift ); sts[1]->q_old_inp32 = add( sts[1]->q_old_inp32, shift ); Loading @@ -408,6 +408,7 @@ ivas_error ivas_cpe_enc_fx( move16(); move16(); } } stereo_switching_enc_fx( hCPE, sts[0]->old_input_signal32_fx, input_frame, sts[0]->q_old_inp32 ); Loading @@ -415,9 +416,9 @@ ivas_error ivas_cpe_enc_fx( * Temporal inter-channel alignment, stereo adjustment *----------------------------------------------------------------*/ shift = s_min( L_norm_arr( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), L_norm_arr( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ); Word16 q_min = sts[0]->q_inp32 + shift - find_guarded_bits_fx( input_frame ); scale_sig32( sts[1]->input_buff32_fx, shl( input_frame, 1 ), sub( q_min, sts[1]->q_inp32 ) ); /* q_inp */ scale_sig32( sts[0]->input_buff32_fx, shl( input_frame, 1 ), sub( q_min, sts[0]->q_inp32 ) ); /* q_inp */ q_min = add( sts[0]->q_inp32, sub( shift, find_guarded_bits_fx( input_frame ) ) ); scale_sig32( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( q_min, sts[1]->q_inp32 ) ); /* q_min */ scale_sig32( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( q_min, sts[0]->q_inp32 ) ); /* q_min */ sts[0]->q_inp32 = sts[1]->q_inp32 = sts[0]->q_old_inp32 = sts[1]->q_old_inp32 = q_min; move16(); move16(); Loading Loading @@ -774,7 +775,7 @@ ivas_error ivas_cpe_enc_fx( scale_sig( hCPE->input_mem_fx[0], hCPE->hStereoMdct->hDft_ana->dft_ovl, sub( q_min, hCPE->q_input_mem[0] ) ); /* q_min */ scale_sig( hCPE->input_mem_fx[1], hCPE->hStereoMdct->hDft_ana->dft_ovl, sub( q_min, hCPE->q_input_mem[1] ) ); /* q_min */ hCPE->q_input_mem[1] = q_min; hCPE->q_input_mem[1] = q_min; hCPE->q_input_mem[0] = q_min; sts[1]->q_old_inp = q_min; sts[0]->q_old_inp = q_min; sts[1]->q_inp = q_min; Loading Loading @@ -813,8 +814,9 @@ ivas_error ivas_cpe_enc_fx( Word16 out_16k_start_ind = 0, out_16k_end_ind = 0; move16(); move16(); stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, sts[0]->input32_fx, &out_start_ind, &out_end_ind, 0, input_Fs, input_Fs, 0, NULL ); // assert( sts[0]->q_inp32 == sts[0]->q_old_inp32 ); scale_sig32( sts[0]->input32_fx - input_frame, add( out_start_ind, input_frame ), sub( Q15, sts[0]->q_old_inp32 ) ); // scaling initial part of the input buffer scale_sig32( sts[0]->input32_fx + out_end_ind, sub( input_frame, out_end_ind ), sub( Q15, sts[0]->q_inp32 ) ); // scaling initial part of the input buffer sts[0]->q_inp32 = Q15; Loading Loading
lib_dec/ivas_stereo_dft_dec_fx.c +2 −0 Original line number Diff line number Diff line Loading @@ -402,6 +402,8 @@ ivas_error stereo_dft_dec_create_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TCX-LTP handle\n" ) ); } set_zero_fx( hStereoDft_loc->hb_nrg_subr_fx, STEREO_DFT_NBDIV ); /*Setting hb_nrg_subr_fx to zero*/ hStereoDft_loc->q_hb_nrg_subr = Q31; move16(); hStereoDft_loc->hConfig->force_mono_transmission = 0; move16(); Loading
lib_enc/ivas_core_pre_proc_front_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -1425,7 +1425,7 @@ ivas_error pre_proc_front_ivas_fx( * TC frame selection *-----------------------------------------------------------------*/ st->clas = signal_clas_fx( st, inp_12k8_fx, ee_fx, *relE_fx, L_look, tdm_SM_last_clas ); /* Q0 */ st->clas = signal_clas_ivas_fx( st, inp_12k8_fx, ee_fx, *relE_fx, L_look, tdm_SM_last_clas ); /* Q0 */ move16(); select_TC_fx( MODE1, st->tc_cnt, &st->coder_type, st->localVAD ); Loading
lib_enc/ivas_core_pre_proc_fx.c +1 −0 Original line number Diff line number Diff line Loading @@ -1138,6 +1138,7 @@ ivas_error ivas_compute_core_buffers_fx( Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /* Q15 */ } IF( Q_new ) { #ifdef REMOVE_EVS_DUPLICATES Loading
lib_enc/ivas_corecoder_enc_reconfig_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -588,7 +588,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( IF( st_ivas->nSCE ) { Copy32( input_buff_fx[0], st_ivas->hSCE[0]->hCoreCoder[0]->input_buff32_fx, len_inp_memory ); /* q_input_buff */ st_ivas->hSCE[0]->hCoreCoder[0]->q_inp32 = q_input_buff[0]; // st_ivas->hSCE[0]->hCoreCoder[0]->q_inp32 = q_input_buff[0]; st_ivas->hSCE[0]->hCoreCoder[0]->q_old_inp32 = q_input_buff[0]; move16(); move16(); Loading @@ -599,7 +599,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { Copy32( input_buff_fx[n + 1], st_ivas->hCPE[0]->hCoreCoder[n]->input_buff32_fx, len_inp_memory ); /* q_input_buff */ st_ivas->hCPE[0]->hCoreCoder[n]->q_inp32 = q_input_buff[n + 1]; // st_ivas->hCPE[0]->hCoreCoder[n]->q_inp32 = q_input_buff[n + 1]; st_ivas->hCPE[0]->hCoreCoder[n]->q_old_inp32 = q_input_buff[n + 1]; move16(); move16(); Loading
lib_enc/ivas_cpe_enc_fx.c +29 −27 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ ivas_error ivas_cpe_enc_fx( Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp; move16(); // Q_new move16(); // Q_new Word16 q_com, shift; Word16 q_com, shift, q_min, gb; error = IVAS_ERR_OK; move32(); Loading Loading @@ -238,7 +238,6 @@ ivas_error ivas_cpe_enc_fx( move16(); IF( data_fx_ch1 != NULL ) /*this may happen for cases with odd number of channels*/ { // Q_min = s_min( q_data_fx, add( sts[1]->q_inp32, L_norm_arr( sts[1]->input32_fx - input_frame, input_frame ) ) ); scale_sig32( sts[1]->input32_fx - input_frame, input_frame, sub( Q_min, sts[1]->q_old_inp32 ) ); sts[1]->q_old_inp32 = Q_min; move16(); Loading @@ -246,8 +245,6 @@ ivas_error ivas_cpe_enc_fx( sts[1]->q_inp32 = Q_min; move16(); // norm = L_norm_arr( sts[1]->input32_fx, input_frame ); Copy_Scale_sig32_16( sts[1]->input32_fx, sts[1]->input_fx, input_frame, norm ); sts[1]->q_inp = add( sub( sts[1]->q_inp32, Q16 ), norm ); move16(); Loading Loading @@ -389,16 +386,19 @@ ivas_error ivas_cpe_enc_fx( /*----------------------------------------------------------------* * Resets/updates in case of stereo switching *----------------------------------------------------------------*/ shift = L_norm_arr( sts[1]->old_input_signal32_fx, input_frame * 2 ); shift = s_min( shift, L_norm_arr( sts[0]->old_input_signal32_fx, input_frame * 2 ) ); IF( GT_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) ) { gb = find_guarded_bits_fx( sts[0]->encoderLookahead_FB ); shift = L_norm_arr( sts[1]->old_input_signal32_fx, shl( input_frame, 1 ) ); shift = s_min( shift, L_norm_arr( sts[0]->old_input_signal32_fx, shl( input_frame, 1 ) ) ); if ( shift < find_guarded_bits_fx( sts[0]->encoderLookahead_FB ) ) IF( LT_16( shift, gb ) ) { shift = sub( shift, find_guarded_bits_fx( sts[0]->encoderLookahead_FB ) ); scale_sig32( sts[1]->input32_fx, input_frame, shift ); /* q_inp */ scale_sig32( sts[0]->input32_fx, input_frame, shift ); /* q_inp */ scale_sig32( sts[1]->old_input_signal32_fx, input_frame, shift ); /* q_inp */ scale_sig32( sts[0]->old_input_signal32_fx, input_frame, shift ); /* q_inp */ shift = sub( shift, gb ); scale_sig32( sts[1]->input32_fx, input_frame, shift ); /* q_inp32 + shift */ scale_sig32( sts[0]->input32_fx, input_frame, shift ); /* q_inp32 + shift */ scale_sig32( sts[1]->old_input_signal32_fx, input_frame, shift ); /* q_old_inp32 + shift */ scale_sig32( sts[0]->old_input_signal32_fx, input_frame, shift ); /* q_old_inp32 + shift */ sts[1]->q_inp32 = add( sts[1]->q_inp32, shift ); sts[0]->q_inp32 = add( sts[0]->q_inp32, shift ); sts[1]->q_old_inp32 = add( sts[1]->q_old_inp32, shift ); Loading @@ -408,6 +408,7 @@ ivas_error ivas_cpe_enc_fx( move16(); move16(); } } stereo_switching_enc_fx( hCPE, sts[0]->old_input_signal32_fx, input_frame, sts[0]->q_old_inp32 ); Loading @@ -415,9 +416,9 @@ ivas_error ivas_cpe_enc_fx( * Temporal inter-channel alignment, stereo adjustment *----------------------------------------------------------------*/ shift = s_min( L_norm_arr( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), L_norm_arr( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) ); Word16 q_min = sts[0]->q_inp32 + shift - find_guarded_bits_fx( input_frame ); scale_sig32( sts[1]->input_buff32_fx, shl( input_frame, 1 ), sub( q_min, sts[1]->q_inp32 ) ); /* q_inp */ scale_sig32( sts[0]->input_buff32_fx, shl( input_frame, 1 ), sub( q_min, sts[0]->q_inp32 ) ); /* q_inp */ q_min = add( sts[0]->q_inp32, sub( shift, find_guarded_bits_fx( input_frame ) ) ); scale_sig32( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( q_min, sts[1]->q_inp32 ) ); /* q_min */ scale_sig32( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( q_min, sts[0]->q_inp32 ) ); /* q_min */ sts[0]->q_inp32 = sts[1]->q_inp32 = sts[0]->q_old_inp32 = sts[1]->q_old_inp32 = q_min; move16(); move16(); Loading Loading @@ -774,7 +775,7 @@ ivas_error ivas_cpe_enc_fx( scale_sig( hCPE->input_mem_fx[0], hCPE->hStereoMdct->hDft_ana->dft_ovl, sub( q_min, hCPE->q_input_mem[0] ) ); /* q_min */ scale_sig( hCPE->input_mem_fx[1], hCPE->hStereoMdct->hDft_ana->dft_ovl, sub( q_min, hCPE->q_input_mem[1] ) ); /* q_min */ hCPE->q_input_mem[1] = q_min; hCPE->q_input_mem[1] = q_min; hCPE->q_input_mem[0] = q_min; sts[1]->q_old_inp = q_min; sts[0]->q_old_inp = q_min; sts[1]->q_inp = q_min; Loading Loading @@ -813,8 +814,9 @@ ivas_error ivas_cpe_enc_fx( Word16 out_16k_start_ind = 0, out_16k_end_ind = 0; move16(); move16(); stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, sts[0]->input32_fx, &out_start_ind, &out_end_ind, 0, input_Fs, input_Fs, 0, NULL ); // assert( sts[0]->q_inp32 == sts[0]->q_old_inp32 ); scale_sig32( sts[0]->input32_fx - input_frame, add( out_start_ind, input_frame ), sub( Q15, sts[0]->q_old_inp32 ) ); // scaling initial part of the input buffer scale_sig32( sts[0]->input32_fx + out_end_ind, sub( input_frame, out_end_ind ), sub( Q15, sts[0]->q_inp32 ) ); // scaling initial part of the input buffer sts[0]->q_inp32 = Q15; Loading