Commit 03b62ac8 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch...

Merge branch 'basop-1765-difference-in-probably-comfort-noise-of-masa-1-tc-ltv-signal-rendering-to-binaural' into 'main'

[non-BE][split-non-BE][allow-regression] Resolve "Difference in probably comfort noise of MASA 1 TC LTV signal rendering to binaural"

Closes #1765

See merge request !3058
parents 39b3bae1 beb19e5b
Loading
Loading
Loading
Loading
Loading
+37 −3
Original line number Diff line number Diff line
@@ -2720,25 +2720,59 @@ Word32 dotWord32_16_Mant32Exp( const Word32 *bufX32, /* i: 32-bit buffer with un
                               const Word16 *bufY16, /* i: 16-bit buffer quite right-aligned   */
                               Word16 bufY16_exp,    /* i: exponent of buffer bufY16           */
                               Word16 len,           /* i: buffer len to process               */
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
                               Word16 *exp,           /* o: result exponent                     */
                               const Word16 is_ivas ) /* i: flag indicating IVAS to maintain EVS BE */
#else
                               Word16 *exp ) /* o: result exponent                     */
#endif
{
    Word32 L_sum;
    Word16 shift, shift1, i;


    shift = getScaleFactor32( bufX32, len ); /* current available headroom */
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
    IF( EQ_16( is_ivas, 1 ) )
    {
        shift = sub( shift, sub( 15, norm_s( len ) ) ); /* reduced required headroom  */
    }
    ELSE
    {
        shift = sub( shift, sub( 14, 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
        IF( EQ_16( is_ivas, 1 ) )
        {
            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] );
        }
#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 ) );
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
    IF( EQ_16( is_ivas, 0 ) )
    {
        shift = add( shift, 1 ); /* compensate for factor of 2 introduced by L_mac0 */
    }
#else
    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;
+6 −1
Original line number Diff line number Diff line
@@ -864,7 +864,12 @@ Word32 dotWord32_16_Mant32Exp( const Word32 *bufX32, /* i: 32-bit buffer with un
                               const Word16 *bufY16, /* i: 16-bit buffer quite right-aligned   */
                               Word16 bufY16_exp,    /* i: exponent of buffer bufY16           */
                               Word16 len,           /* i: buffer len to process               */
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
                               Word16 *exp,            /* o: result exponent                     */
                               const Word16 is_ivas ); /* i: flag indicating IVAS to maintain EVS BE */
#else
                               Word16 *exp ); /* o: result exponent                     */
#endif

/*!**********************************************************************
   \brief   Converts linear factor or energy to Decibel
+1 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@
#define FIX_ISSUE_2618_PLC_RES_ATT_SCALING              /* FhG: BASOP #2618: residual PLC burst attenuation, apply divide/Sqrt32 exponent so fac tracks exponent correctly */
#define NONBE_FIX2614_LP_CNG_ASSERT                     /* FhG: */
#define FIX_FLOAT_1600_OMASA_WRONG_RENDER_PATH          /* Nokia: float issue 1600: fix initialization condition of stereo type detection for OMASA */
#define FIX_BASOP_1765_MASA1TC_CNG_MISMATCH             /* Nokia: BASOP issue 1765: Improve accuracy of FD CNG noise estimation */

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

+5 −0
Original line number Diff line number Diff line
@@ -6420,7 +6420,12 @@ void noisy_speech_detection_fx(
    HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure            */
    const Word16 vad,            /* i  : VAD flag                    */
    const Word16 *syn,           /* i  : i   time-domain frame       */
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
    const Word16 Q,
    const Word16 is_ivas );
#else
    const Word16 Q );
#endif

void generate_comfort_noise_dec_fx(
    Word32 **bufferReal, /* o   : matrix to real part of i   bands */
+11 −0
Original line number Diff line number Diff line
@@ -1549,7 +1549,18 @@ ivas_error acelp_core_dec_fx(
            IF( st->idchan == 0 && ( st->flag_cna || ( EQ_16( st->cng_type, FD_CNG ) && LE_32( st->total_brate, ACELP_32k ) ) || ( st->cng_type == LP_CNG && LE_32( st->core_brate, SID_2k40 ) ) ) )
            {
                /*Noisy speech detector*/
#ifdef FIX_BASOP_1765_MASA1TC_CNG_MISMATCH
                IF( NE_16( st->element_mode, EVS_MONO ) )
                {
                    noisy_speech_detection_fx( st->hFdCngDec, st->VAD, psyn_fx, st->Q_syn, 1 );
                }
                ELSE
                {
                    noisy_speech_detection_fx( st->hFdCngDec, st->VAD, psyn_fx, st->Q_syn, 0 );
                }
#else
                noisy_speech_detection_fx( st->hFdCngDec, st->VAD, psyn_fx, st->Q_syn );
#endif

                st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = mult_r( st->hFdCngDec->hFdCngCom->likelihood_noisy_speech, 32440 /*0.99 Q15*/ );
                move16();
Loading