Commit 4d598116 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Fix BASOP issue 1765 by improving improving accuracy in FD CNG noise estimation.

parent e1206992
Loading
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -2727,18 +2727,28 @@ Word32 dotWord32_16_Mant32Exp( const Word32 *bufX32, /* i: 32-bit buffer with un


    shift = getScaleFactor32( bufX32, len ); /* current available headroom */
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
    shift = sub( shift, sub( 15, norm_s( len ) ) ); /* reduced required headroom  */
#else
    shift = sub( shift, sub( 14, norm_s( len ) ) ); /* reduced required headroom  */
#endif
    L_sum = 0; /* Clear accu                 */
    move32();
    FOR( i = 0; i < len; i++ )
    {
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
        L_sum = L_add( L_sum, Mpy_32_16_1( L_shl( bufX32[i], shift ), bufY16[i] ) );
#else
        L_sum = L_mac0( L_sum, round_fx( L_shl( bufX32[i], shift ) ), bufY16[i] );
#endif
    }
    shift1 = norm_l( L_sum );
    L_sum = L_shl( L_sum, shift1 ); /* return value */

    shift = sub( add( bufX32_exp, bufY16_exp ), add( shift, shift1 ) );
#ifndef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
    shift = add( shift, 1 ); /* compensate for factor of 2 introduced by L_mac0 */
#endif
    /* In case of NULL result, we want to have a 0 exponent too */
    if ( L_sum == 0 )
        shift = 0;
+1 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@
#define FIX_BASOP_2599_TCA_OVERFLOW                     /* VA: issue 2599, Fix TCA overflow */
#define FIX_2588_MISSING_CONDITIONS                     /* VA: Proposed fix to 2588, addition of a condition in lsf_dec */
#define FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI         /* Nokia: BASOP issue 2442: Increase accuracy of computations and add additional gain clamp for low energy decorrelated signal rendering. */
#define FIX_BASOP_1765_MASA1TC_CNG_MISMATCH             /* Nokia: BASOP issue 1765: Improve accuracy of FD CNG noise estimation */

/* ##################### End NON-BE switches ########################### */

+8 −0
Original line number Diff line number Diff line
@@ -1481,7 +1481,11 @@ void perform_noise_estimation_dec_ivas_fx(
                    FOR( p = 0; p < npart; p++ )
                    {
                        temp = L_shl( msPeriodog[p], q_shift );
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
                        msNoiseEst[p] = Madd_32_16( Mpy_32_16_r( msNoiseEst[p], add( sub( MAX_16, alpha ), 1 ) ), temp, alpha ); /*Q31 - hFdCngDec->msNoiseEst_exp*/ /* add one to alpha comp to get ONE_IN_Q15 - alpha */
#else
                        msNoiseEst[p] = Madd_32_16( Mpy_32_16_r( msNoiseEst[p], sub( MAX_16, alpha ) ), temp, alpha ); /*Q31 - hFdCngDec->msNoiseEst_exp*/
#endif
                        move32();
                    }
                }
@@ -1681,7 +1685,11 @@ void perform_noise_estimation_dec_ivas_fx(
                            move16();
                        }
                    }
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
                    *ptr_per = Madd_32_16( ( *ptr_per ), enr, add( sub( MAX_16, alpha ), 1 ) ); /*Q31 - enr_e*/ /* add one to alpha comp to get ONE_IN_Q15 - alpha */
#else
                    *ptr_per = Madd_32_16( ( *ptr_per ), enr, sub( MAX_16, alpha ) ); /*Q31 - enr_e*/
#endif
                    move32();
                    ptr_per++;
                }