diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 4a13837b151bce5b3e77ce71572c0beae06e53ca..df0da51374392777a1a74645351a7d1cd88a824b 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -4479,7 +4479,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( move16(); } - randGaussExp = CNG_RAND_GAUSS_SHIFT; + randGaussExp = add( CNG_RAND_GAUSS_SHIFT, 1 ); move16(); /* @@ -4503,16 +4503,16 @@ void generate_comfort_noise_dec_hf_ivas_fx( IF( cng_coh_flag ) { - tmp1 = rand_gauss( seed ); - tmp2 = rand_gauss( seed2 ); + rand_gauss_fx( &tmp1, seed, Q28 ); + rand_gauss_fx( &tmp2, seed2, Q28 ); bufferReal[i][j] = L_add( Mpy_32_16_1( tmp1, c1 ), Mpy_32_16_1( tmp2, c2 ) ); move32(); bufferReal[i][j] = L_shl( Mpy_32_32( bufferReal[i][j], sqrtNoiseLevel ), s ); move32(); - tmp1 = rand_gauss( seed ); - tmp2 = rand_gauss( seed2 ); + rand_gauss_fx( &tmp1, seed, Q28 ); + rand_gauss_fx( &tmp2, seed2, Q28 ); bufferImag[i][j] = L_add( Mpy_32_16_1( tmp1, c1 ), Mpy_32_16_1( tmp2, c2 ) ); move32(); @@ -4522,11 +4522,11 @@ void generate_comfort_noise_dec_hf_ivas_fx( ELSE { /* Real part in CLDFB band */ - bufferReal[i][j] = L_shl( Mpy_32_32( rand_gauss( seed ), sqrtNoiseLevel ), s ); + bufferReal[i][j] = L_shl( Mpy_32_32( L_shr( rand_gauss( seed ), 1 ), sqrtNoiseLevel ), s ); move32(); /* Imaginary part in CLDFB band */ - bufferImag[i][j] = L_shl( Mpy_32_32( rand_gauss( seed ), sqrtNoiseLevel ), s ); + bufferImag[i][j] = L_shl( Mpy_32_32( L_shr( rand_gauss( seed ), 1 ), sqrtNoiseLevel ), s ); move32(); } } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 3f1cfbd1fffb171c46f7b880c415b0378330d5b0..e6d2085b38304f49c8e7ba058df22cebdda49b08 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -2591,11 +2591,20 @@ void ivas_ism_param_dec_tc_gain_ajust_fx( } ELSE { - /*handling denominator equals to zero*/ - gain_fx = 1; - move16(); - tmp_e1 = -32767; - move16(); + IF( ene_tc_fx == 0 ) /*handling numerator equals to zero*/ + { + gain_fx = 0; + move16(); + tmp_e1 = 31; + move16(); + } + ELSE + { /*handling denominator equals to zero*/ + gain_fx = 1; + move16(); + tmp_e1 = -32767; + move16(); + } } tmp_e1 = add( tmp_e1, sub( ene_tc_e, ene_sum_e ) ); /* tmp_e1 + (ene_tc_e - ene_sum_e)*/ gain_fx = Sqrt16( gain_fx, &tmp_e1 );