Loading lib_enc/cod_tcx_fx.c +16 −1 Original line number Diff line number Diff line Loading @@ -1671,6 +1671,12 @@ void QuantizeSpectrum_ivas_fx( QuantizeTCXSpectrum_fx( st, frame_cnt, hTcxEnc->spectrum_fx[frame_cnt], hTcxEnc->spectrum_e[frame_cnt], gainlpc_fx, gainlpc_e, Aqind, tnsSize, nb_bits, vad_hover_flag, &L_frameTCX, &L_frame, &L_spec, &tcx_offset, &noiseFillingBorder, quantized_spectrum_fx, &quantized_spectrum_e, hm_cfg, &hm_active, lf_deemph_fact_fx, &nf_seed, &ener_fx, &ener_e, &gain_tcx_fx, &gain_tcx_e, prm ); if ( hTcxEnc->spectrum_e[frame_cnt] < 0 ) { /*buffer is already scaled inside QuantizeTCXSpectrum_fx*/ hTcxEnc->spectrum_e[frame_cnt] = 0; move16(); } Word16 s1 = sub( getScaleFactor32( st->hTcxEnc->spectrum_fx[frame_cnt], L_frame ), 6 ); Word16 s2 = getScaleFactor32( quantized_spectrum_fx, s_max( L_frame, L_spec ) ); Loading Loading @@ -3553,7 +3559,7 @@ void QuantizeTCXSpectrum_fx( Encoder_State *st, /* i : state handle */ const Word16 frame_cnt, /* i : frame counter in the super_frame Q0 */ Word32 *x_orig_fx, /* i : shaped MDCT spectrum */ const Word16 x_orig_e, /* i : exp of shaped MDCT spectrum */ Word16 x_orig_e, /* i : exp of shaped MDCT spectrum */ Word16 *gainlpc_fx, /* i : FDNS gains */ Word16 *gainlpc_e, /* i : exp of FDNS gains */ const Word16 *Aqind, /* i : frame-independent quantized coefficients (M+1) Q0 */ Loading Loading @@ -3708,6 +3714,15 @@ void QuantizeTCXSpectrum_fx( } /* Start with the pre-shaped spectrum*/ /*scaling buffer to Q31 if exp < 0 to avoid overflow while scaling constants*/ IF( x_orig_e < 0 ) { scale_sig32( x_orig_fx, L_spec, x_orig_e ); x_orig_e = 0; move16(); } Copy32( x_orig_fx, spectrum_fx, L_spec ); *spectrum_e = x_orig_e; move16(); Loading lib_enc/ivas_cpe_enc.c +5 −3 Original line number Diff line number Diff line Loading @@ -402,10 +402,12 @@ ivas_error ivas_cpe_enc_fx( stereo_tca_enc_fx( hCPE, input_frame ); Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, 0 ), sts[0]->q_inp32 ) ); Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, 0 ), sts[1]->q_inp32 ) ); shift = s_min( 0, sub( add( L_norm_arr( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sts[0]->q_inp32 ), 16 ) ); shift = s_min( shift, sub( add( L_norm_arr( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sts[0]->q_inp32 ), 16 ) ); Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, shift ), sts[0]->q_inp32 ) ); Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, shift ), sts[1]->q_inp32 ) ); sts[0]->q_inp = sts[1]->q_inp = sts[0]->q_old_inp = sts[1]->q_old_inp = 0; sts[0]->q_inp = sts[1]->q_inp = sts[0]->q_old_inp = sts[1]->q_old_inp = shift; move16(); move16(); move16(); Loading lib_enc/prot_fx_enc.h +1 −1 Original line number Diff line number Diff line Loading @@ -2525,7 +2525,7 @@ void QuantizeTCXSpectrum_fx( Encoder_State *st, /* i : state handle */ const Word16 frame_cnt, /* i : frame counter in the super_frame Q0 */ Word32 *x_orig_fx, /* i : shaped MDCT spectrum */ const Word16 x_orig_e, /* i : exp of shaped MDCT spectrum */ Word16 x_orig_e, /* i : exp of shaped MDCT spectrum */ Word16 *gainlpc_fx, /* i : FDNS gains */ Word16 *gainlpc_e, /* i : exp of FDNS gains */ const Word16 *Aqind, /* i : frame-independent quantized coefficients (M+1) Q0 */ Loading lib_enc/tcx_utils_enc_fx.c +7 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,13 @@ void AnalyzePowerSpectrum_ivas_fx( tmp32 = L_shl( mdctSpectrum[i], shift ); powerSpec[i] = BASOP_Util_Add_Mant32Exp( powerSpec[i], shl( powerSpec_e[i], 1 ), Mpy_32_32( tmp32, tmp32 ), shl( sub( mdctSpectrum_e, shift ), 1 ), &powerSpec_e[i] ); move32(); IF( LT_16( powerSpec_e[i], -31 ) ) { powerSpec[i] = L_shl( powerSpec[i], sub( powerSpec_e[i], -31 ) ); move32(); powerSpec_e[i] = -31; move16(); } temp_powerSpec_e = s_max( temp_powerSpec_e, powerSpec_e[i] ); } Loading lib_rend/ivas_dirac_output_synthesis_dec.c +4 −4 Original line number Diff line number Diff line Loading @@ -838,8 +838,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { IF( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] == 0 ) { b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], 232831 /* EPSILON in exp 63 */, &b_exp ); b_exp = add( b_exp, sub( sub( 31, q_reference_power ), 63 ) ); b = MAX_16; b_exp = 0; } ELSE { Loading Loading @@ -918,8 +918,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { IF( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] == 0 ) { b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], 232831 /* EPSILON in exp 63 */, &b_exp ); b_exp = add( b_exp, sub( sub( 31, q_reference_power ), 63 ) ); b = MAX_16; b_exp = 0; } ELSE { Loading Loading
lib_enc/cod_tcx_fx.c +16 −1 Original line number Diff line number Diff line Loading @@ -1671,6 +1671,12 @@ void QuantizeSpectrum_ivas_fx( QuantizeTCXSpectrum_fx( st, frame_cnt, hTcxEnc->spectrum_fx[frame_cnt], hTcxEnc->spectrum_e[frame_cnt], gainlpc_fx, gainlpc_e, Aqind, tnsSize, nb_bits, vad_hover_flag, &L_frameTCX, &L_frame, &L_spec, &tcx_offset, &noiseFillingBorder, quantized_spectrum_fx, &quantized_spectrum_e, hm_cfg, &hm_active, lf_deemph_fact_fx, &nf_seed, &ener_fx, &ener_e, &gain_tcx_fx, &gain_tcx_e, prm ); if ( hTcxEnc->spectrum_e[frame_cnt] < 0 ) { /*buffer is already scaled inside QuantizeTCXSpectrum_fx*/ hTcxEnc->spectrum_e[frame_cnt] = 0; move16(); } Word16 s1 = sub( getScaleFactor32( st->hTcxEnc->spectrum_fx[frame_cnt], L_frame ), 6 ); Word16 s2 = getScaleFactor32( quantized_spectrum_fx, s_max( L_frame, L_spec ) ); Loading Loading @@ -3553,7 +3559,7 @@ void QuantizeTCXSpectrum_fx( Encoder_State *st, /* i : state handle */ const Word16 frame_cnt, /* i : frame counter in the super_frame Q0 */ Word32 *x_orig_fx, /* i : shaped MDCT spectrum */ const Word16 x_orig_e, /* i : exp of shaped MDCT spectrum */ Word16 x_orig_e, /* i : exp of shaped MDCT spectrum */ Word16 *gainlpc_fx, /* i : FDNS gains */ Word16 *gainlpc_e, /* i : exp of FDNS gains */ const Word16 *Aqind, /* i : frame-independent quantized coefficients (M+1) Q0 */ Loading Loading @@ -3708,6 +3714,15 @@ void QuantizeTCXSpectrum_fx( } /* Start with the pre-shaped spectrum*/ /*scaling buffer to Q31 if exp < 0 to avoid overflow while scaling constants*/ IF( x_orig_e < 0 ) { scale_sig32( x_orig_fx, L_spec, x_orig_e ); x_orig_e = 0; move16(); } Copy32( x_orig_fx, spectrum_fx, L_spec ); *spectrum_e = x_orig_e; move16(); Loading
lib_enc/ivas_cpe_enc.c +5 −3 Original line number Diff line number Diff line Loading @@ -402,10 +402,12 @@ ivas_error ivas_cpe_enc_fx( stereo_tca_enc_fx( hCPE, input_frame ); Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, 0 ), sts[0]->q_inp32 ) ); Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, 0 ), sts[1]->q_inp32 ) ); shift = s_min( 0, sub( add( L_norm_arr( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sts[0]->q_inp32 ), 16 ) ); shift = s_min( shift, sub( add( L_norm_arr( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), sts[0]->q_inp32 ), 16 ) ); Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, shift ), sts[0]->q_inp32 ) ); Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( add( Q16, shift ), sts[1]->q_inp32 ) ); sts[0]->q_inp = sts[1]->q_inp = sts[0]->q_old_inp = sts[1]->q_old_inp = 0; sts[0]->q_inp = sts[1]->q_inp = sts[0]->q_old_inp = sts[1]->q_old_inp = shift; move16(); move16(); move16(); Loading
lib_enc/prot_fx_enc.h +1 −1 Original line number Diff line number Diff line Loading @@ -2525,7 +2525,7 @@ void QuantizeTCXSpectrum_fx( Encoder_State *st, /* i : state handle */ const Word16 frame_cnt, /* i : frame counter in the super_frame Q0 */ Word32 *x_orig_fx, /* i : shaped MDCT spectrum */ const Word16 x_orig_e, /* i : exp of shaped MDCT spectrum */ Word16 x_orig_e, /* i : exp of shaped MDCT spectrum */ Word16 *gainlpc_fx, /* i : FDNS gains */ Word16 *gainlpc_e, /* i : exp of FDNS gains */ const Word16 *Aqind, /* i : frame-independent quantized coefficients (M+1) Q0 */ Loading
lib_enc/tcx_utils_enc_fx.c +7 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,13 @@ void AnalyzePowerSpectrum_ivas_fx( tmp32 = L_shl( mdctSpectrum[i], shift ); powerSpec[i] = BASOP_Util_Add_Mant32Exp( powerSpec[i], shl( powerSpec_e[i], 1 ), Mpy_32_32( tmp32, tmp32 ), shl( sub( mdctSpectrum_e, shift ), 1 ), &powerSpec_e[i] ); move32(); IF( LT_16( powerSpec_e[i], -31 ) ) { powerSpec[i] = L_shl( powerSpec[i], sub( powerSpec_e[i], -31 ) ); move32(); powerSpec_e[i] = -31; move16(); } temp_powerSpec_e = s_max( temp_powerSpec_e, powerSpec_e[i] ); } Loading
lib_rend/ivas_dirac_output_synthesis_dec.c +4 −4 Original line number Diff line number Diff line Loading @@ -838,8 +838,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { IF( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] == 0 ) { b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], 232831 /* EPSILON in exp 63 */, &b_exp ); b_exp = add( b_exp, sub( sub( 31, q_reference_power ), 63 ) ); b = MAX_16; b_exp = 0; } ELSE { Loading Loading @@ -918,8 +918,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { IF( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] == 0 ) { b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], 232831 /* EPSILON in exp 63 */, &b_exp ); b_exp = add( b_exp, sub( sub( 31, q_reference_power ), 63 ) ); b = MAX_16; b_exp = 0; } ELSE { Loading