Loading lib_com/prot_fx.h +1 −1 Original line number Diff line number Diff line Loading @@ -8247,7 +8247,7 @@ void stat_noise_uv_mod_ivas_fx( const Word16 *lsp_mid, /* i : LSP vector at 2nd sfr Q=15*/ Word16 *Aq, /* o : A(z) quantized for the 4 subframes Q=12*/ Word16 *exc2, /* i/o: excitation buffer Q=Q_exc*/ Word16 Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ Word16 *Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ const Word16 bfi, /* i : Bad frame indicator */ Word32 *ge_sm, /* i/o: smoothed excitation gain Q=Q_stat_noise_ge (6)*/ Word16 *uv_count, /* i/o: unvoiced counter */ Loading lib_com/stat_noise_uv_mod_fx.c +32 −26 Original line number Diff line number Diff line Loading @@ -330,7 +330,6 @@ void stat_noise_uv_mod_fx( } } } /*--------------------------------------------------------------------* * stat_noise_uv_mod() * Loading @@ -345,7 +344,7 @@ void stat_noise_uv_mod_ivas_fx( const Word16 *lsp_mid, /* i : LSP vector at 2nd sfr Q=15*/ Word16 *Aq, /* o : A(z) quantized for the 4 subframes Q=12*/ Word16 *exc2, /* i/o: excitation buffer Q=Q_exc*/ Word16 Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ Word16 *Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ const Word16 bfi, /* i : Bad frame indicator */ Word32 *ge_sm, /* i/o: smoothed excitation gain Q=Q_stat_noise_ge (6)*/ Word16 *uv_count, /* i/o: unvoiced counter */ Loading @@ -372,6 +371,7 @@ void stat_noise_uv_mod_ivas_fx( Word16 newlsp_mix[M]; Word16 beta; /* Q15 */ Word16 Noimix_fract; /* (noimix_fac - 1.0) in Q15 */ Word32 L_Noimix_fract; /* (noimix_fac - 1.0) in Q15 */ /* noimix_fax * x <-> x + Noimix_fract * x */ Word16 i_subfr; Word16 i, k; Loading @@ -383,6 +383,7 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -437,9 +438,9 @@ void stat_noise_uv_mod_ivas_fx( Copy( exc2, Exc2_local, L_FRAME ); /* bound Q for internal use, optimization possible */ Q_local = s_min( 11, s_max( -1, Q_exc ) ); Q_local = s_min( 11, s_max( -1, *Q_exc ) ); /* local excitation Q and incoming excitation Q*/ Qdiff = sub( Q_local, Q_exc ); Qdiff = sub( Q_local, *Q_exc ); /* only shift if incoming Q is outside [11..-1] shift is done in energy calculations aswell */ Scale_sig( Exc2_local, L_FRAME, Qdiff ); /* current excitation Q and previous stat_noise states Q */ Loading Loading @@ -539,14 +540,11 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_mac( 0, alpha, alpha ); L_tmp_res = L_mac( L_tmp_res, alpha_m1, alpha_m1 ); tmp_den = round_fx( L_Frac_sqrtQ31( L_tmp_res ) ); tmp_nom = sub( 32767, tmp_den ); tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); Noimix_fract = shr( tmp_res, tmp_shift ); /* float value is in range 0.0 to 0.42 */ Word16 exp_sqr = 0; move16(); tmp_res = BASOP_Util_Divide1616_Scale( 32767, tmp_den, &exp_sqr ); // 15-exp_sqr Noimix_fract = tmp_res; // 15-exp_sqr move16(); /* L_Ge might be 0 in unvoiced WB */ L_Ge = L_max( L_Ge, 1 ); tmp_shift = norm_l( L_Ge ); Loading @@ -555,9 +553,7 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ L_Noimix_fract = Mult_32_16( L_tmp_res, Noimix_fract ); /*15+15-exp_sqr-15 =15-exp_sqr */ FOR( i = 0; i < L_FRAME; i++ ) { Loading @@ -575,16 +571,25 @@ void stat_noise_uv_mod_ivas_fx( L_tmp = L_mult( Exc2_local[i], alpha ); /* Q_local + 16 */ L_tmp = L_mac( L_tmp, randval, alpha_m1 ); /* Q_local + 16 */ L_tmp3 = Mult_32_16( L_tmp, Noimix_fract ); /* Q_local+16+15-15 */ L_tmp = L_add_sat( L_tmp3, L_shl_sat( Mult_32_16( L_tmp, tmp_res ), 1 ) ); /* Q_local+16+14-15+1 */ Exc2_local[i] = extract_h( L_tmp ); /*Q_local */ L_tmp3 = Mult_32_32( L_tmp, L_Noimix_fract ); /* Q_local+16+15-exp_sqr-15 =Q_local +1 */ L_Exc2_local[i] = L_add( L_shr( L_tmp3, 1 ), Mpy_32_32( L_tmp, L_tmp_res ) ); // Q_local + 16 +15 -31 = Q_local move32(); } Word32 max_val; maximum_abs_32_fx( L_Exc2_local, L_FRAME, &max_val ); Word16 shift = 0; move16(); IF( GT_32( max_val, ONE_IN_Q15 ) ) { shift = norm_l( max_val ); shift = sub( Q31 - Q15, shift ); *Q_exc = sub( Q_local, shift ); // Q_exc = Q_local -shift move16(); } *Q_stat_noise = Q_local; /* update for next call, routine can only be called once every frame */ move16(); Qdiff = sub( Q_exc, Q_local ); /* local excitation and incoming excitation */ Scale_sig( Exc2_local, L_FRAME, Qdiff ); Copy( Exc2_local, exc2, L_FRAME ); Copy_Scale_sig_32_16( L_Exc2_local, exc2, L_FRAME, negate( shift ) ); // Q_exc /*--------------------------------------------------------------------* * Generate low-pass filtered version of ISP coefficients Loading Loading @@ -635,6 +640,7 @@ void stat_noise_uv_mod_ivas_fx( } } } /*---------------------------------------------------------------------------* * calc_tilt() * Loading lib_dec/stat_noise_uv_dec_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ void stat_noise_uv_dec_fx( IF( !st_fx->Opt_AMR_WB ) { stat_noise_uv_mod_fx( coder_type, noisiness, st_fx->lsp_old_fx, lsp_new, lsp_mid, Aq, exc2, st_fx->Q_exc, 0, &st_fx->ge_sm_fx, &st_fx->uv_count, &st_fx->act_count, stat_noise_uv_mod_ivas_fx( coder_type, noisiness, st_fx->lsp_old_fx, lsp_new, lsp_mid, Aq, exc2, &st_fx->Q_exc, 0, &st_fx->ge_sm_fx, &st_fx->uv_count, &st_fx->act_count, st_fx->lspold_s_fx, &st_fx->noimix_seed, &st_fx->min_alpha_fx, &st_fx->exc_pe_fx, st_fx->core_brate, st_fx->bwidth, &st_fx->Q_stat_noise, &st_fx->Q_stat_noise_ge ); Loading lib_enc/acelp_core_enc_fx.c +3 −2 Original line number Diff line number Diff line Loading @@ -1449,8 +1449,9 @@ ivas_error acelp_core_enc_ivas_fx( { /* exc2 buffer is needed only for updating of Aq[] which is needed for core switching */ Copy( exc_fx, exc2_fx, st->L_frame ); // Q_new stat_noise_uv_enc_ivas_fx( st, epsP, lsp_new, lsp_mid, Aq, exc2_fx, uc_two_stage_flag, Q_new ); Word16 q_exc2 = Q_new; move16(); stat_noise_uv_enc_ivas_fx( st, epsP, lsp_new, lsp_mid, Aq, exc2_fx, uc_two_stage_flag, &q_exc2 ); } /*-----------------------------------------------------------------* Loading lib_enc/prot_fx_enc.h +1 −1 Original line number Diff line number Diff line Loading @@ -2189,7 +2189,7 @@ void stat_noise_uv_enc_ivas_fx( Word16 *Aq, /* i : A(z) quantized for the 4 subframes Q=12 */ Word16 *exc2, /* i/o: excitation buffer Q=Q_stat_noise */ const Word16 uc_two_stage_flag, /* o : flag undicating two-stage UC */ Word16 Q_new ); Word16 *Q_new ); void analy_sp_fx( const Word16 element_mode, /* i : element mode */ Loading Loading
lib_com/prot_fx.h +1 −1 Original line number Diff line number Diff line Loading @@ -8247,7 +8247,7 @@ void stat_noise_uv_mod_ivas_fx( const Word16 *lsp_mid, /* i : LSP vector at 2nd sfr Q=15*/ Word16 *Aq, /* o : A(z) quantized for the 4 subframes Q=12*/ Word16 *exc2, /* i/o: excitation buffer Q=Q_exc*/ Word16 Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ Word16 *Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ const Word16 bfi, /* i : Bad frame indicator */ Word32 *ge_sm, /* i/o: smoothed excitation gain Q=Q_stat_noise_ge (6)*/ Word16 *uv_count, /* i/o: unvoiced counter */ Loading
lib_com/stat_noise_uv_mod_fx.c +32 −26 Original line number Diff line number Diff line Loading @@ -330,7 +330,6 @@ void stat_noise_uv_mod_fx( } } } /*--------------------------------------------------------------------* * stat_noise_uv_mod() * Loading @@ -345,7 +344,7 @@ void stat_noise_uv_mod_ivas_fx( const Word16 *lsp_mid, /* i : LSP vector at 2nd sfr Q=15*/ Word16 *Aq, /* o : A(z) quantized for the 4 subframes Q=12*/ Word16 *exc2, /* i/o: excitation buffer Q=Q_exc*/ Word16 Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ Word16 *Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ const Word16 bfi, /* i : Bad frame indicator */ Word32 *ge_sm, /* i/o: smoothed excitation gain Q=Q_stat_noise_ge (6)*/ Word16 *uv_count, /* i/o: unvoiced counter */ Loading @@ -372,6 +371,7 @@ void stat_noise_uv_mod_ivas_fx( Word16 newlsp_mix[M]; Word16 beta; /* Q15 */ Word16 Noimix_fract; /* (noimix_fac - 1.0) in Q15 */ Word32 L_Noimix_fract; /* (noimix_fac - 1.0) in Q15 */ /* noimix_fax * x <-> x + Noimix_fract * x */ Word16 i_subfr; Word16 i, k; Loading @@ -383,6 +383,7 @@ void stat_noise_uv_mod_ivas_fx( Word16 En_shift, Tmp; Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/ #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); Loading Loading @@ -437,9 +438,9 @@ void stat_noise_uv_mod_ivas_fx( Copy( exc2, Exc2_local, L_FRAME ); /* bound Q for internal use, optimization possible */ Q_local = s_min( 11, s_max( -1, Q_exc ) ); Q_local = s_min( 11, s_max( -1, *Q_exc ) ); /* local excitation Q and incoming excitation Q*/ Qdiff = sub( Q_local, Q_exc ); Qdiff = sub( Q_local, *Q_exc ); /* only shift if incoming Q is outside [11..-1] shift is done in energy calculations aswell */ Scale_sig( Exc2_local, L_FRAME, Qdiff ); /* current excitation Q and previous stat_noise states Q */ Loading Loading @@ -539,14 +540,11 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = L_mac( 0, alpha, alpha ); L_tmp_res = L_mac( L_tmp_res, alpha_m1, alpha_m1 ); tmp_den = round_fx( L_Frac_sqrtQ31( L_tmp_res ) ); tmp_nom = sub( 32767, tmp_den ); tmp_shift = norm_s( tmp_den ); tmp_den = shl( tmp_den, tmp_shift ); tmp_res = div_s( tmp_nom, tmp_den ); Noimix_fract = shr( tmp_res, tmp_shift ); /* float value is in range 0.0 to 0.42 */ Word16 exp_sqr = 0; move16(); tmp_res = BASOP_Util_Divide1616_Scale( 32767, tmp_den, &exp_sqr ); // 15-exp_sqr Noimix_fract = tmp_res; // 15-exp_sqr move16(); /* L_Ge might be 0 in unvoiced WB */ L_Ge = L_max( L_Ge, 1 ); tmp_shift = norm_l( L_Ge ); Loading @@ -555,9 +553,7 @@ void stat_noise_uv_mod_ivas_fx( L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */ L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */ L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */ tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */ Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */ L_Noimix_fract = Mult_32_16( L_tmp_res, Noimix_fract ); /*15+15-exp_sqr-15 =15-exp_sqr */ FOR( i = 0; i < L_FRAME; i++ ) { Loading @@ -575,16 +571,25 @@ void stat_noise_uv_mod_ivas_fx( L_tmp = L_mult( Exc2_local[i], alpha ); /* Q_local + 16 */ L_tmp = L_mac( L_tmp, randval, alpha_m1 ); /* Q_local + 16 */ L_tmp3 = Mult_32_16( L_tmp, Noimix_fract ); /* Q_local+16+15-15 */ L_tmp = L_add_sat( L_tmp3, L_shl_sat( Mult_32_16( L_tmp, tmp_res ), 1 ) ); /* Q_local+16+14-15+1 */ Exc2_local[i] = extract_h( L_tmp ); /*Q_local */ L_tmp3 = Mult_32_32( L_tmp, L_Noimix_fract ); /* Q_local+16+15-exp_sqr-15 =Q_local +1 */ L_Exc2_local[i] = L_add( L_shr( L_tmp3, 1 ), Mpy_32_32( L_tmp, L_tmp_res ) ); // Q_local + 16 +15 -31 = Q_local move32(); } Word32 max_val; maximum_abs_32_fx( L_Exc2_local, L_FRAME, &max_val ); Word16 shift = 0; move16(); IF( GT_32( max_val, ONE_IN_Q15 ) ) { shift = norm_l( max_val ); shift = sub( Q31 - Q15, shift ); *Q_exc = sub( Q_local, shift ); // Q_exc = Q_local -shift move16(); } *Q_stat_noise = Q_local; /* update for next call, routine can only be called once every frame */ move16(); Qdiff = sub( Q_exc, Q_local ); /* local excitation and incoming excitation */ Scale_sig( Exc2_local, L_FRAME, Qdiff ); Copy( Exc2_local, exc2, L_FRAME ); Copy_Scale_sig_32_16( L_Exc2_local, exc2, L_FRAME, negate( shift ) ); // Q_exc /*--------------------------------------------------------------------* * Generate low-pass filtered version of ISP coefficients Loading Loading @@ -635,6 +640,7 @@ void stat_noise_uv_mod_ivas_fx( } } } /*---------------------------------------------------------------------------* * calc_tilt() * Loading
lib_dec/stat_noise_uv_dec_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ void stat_noise_uv_dec_fx( IF( !st_fx->Opt_AMR_WB ) { stat_noise_uv_mod_fx( coder_type, noisiness, st_fx->lsp_old_fx, lsp_new, lsp_mid, Aq, exc2, st_fx->Q_exc, 0, &st_fx->ge_sm_fx, &st_fx->uv_count, &st_fx->act_count, stat_noise_uv_mod_ivas_fx( coder_type, noisiness, st_fx->lsp_old_fx, lsp_new, lsp_mid, Aq, exc2, &st_fx->Q_exc, 0, &st_fx->ge_sm_fx, &st_fx->uv_count, &st_fx->act_count, st_fx->lspold_s_fx, &st_fx->noimix_seed, &st_fx->min_alpha_fx, &st_fx->exc_pe_fx, st_fx->core_brate, st_fx->bwidth, &st_fx->Q_stat_noise, &st_fx->Q_stat_noise_ge ); Loading
lib_enc/acelp_core_enc_fx.c +3 −2 Original line number Diff line number Diff line Loading @@ -1449,8 +1449,9 @@ ivas_error acelp_core_enc_ivas_fx( { /* exc2 buffer is needed only for updating of Aq[] which is needed for core switching */ Copy( exc_fx, exc2_fx, st->L_frame ); // Q_new stat_noise_uv_enc_ivas_fx( st, epsP, lsp_new, lsp_mid, Aq, exc2_fx, uc_two_stage_flag, Q_new ); Word16 q_exc2 = Q_new; move16(); stat_noise_uv_enc_ivas_fx( st, epsP, lsp_new, lsp_mid, Aq, exc2_fx, uc_two_stage_flag, &q_exc2 ); } /*-----------------------------------------------------------------* Loading
lib_enc/prot_fx_enc.h +1 −1 Original line number Diff line number Diff line Loading @@ -2189,7 +2189,7 @@ void stat_noise_uv_enc_ivas_fx( Word16 *Aq, /* i : A(z) quantized for the 4 subframes Q=12 */ Word16 *exc2, /* i/o: excitation buffer Q=Q_stat_noise */ const Word16 uc_two_stage_flag, /* o : flag undicating two-stage UC */ Word16 Q_new ); Word16 *Q_new ); void analy_sp_fx( const Word16 element_mode, /* i : element mode */ Loading