Commit 96b0d72e authored by Fabian Bauer's avatar Fabian Bauer
Browse files

some bugfixes in FIX_2485_HARMONIZE_minimum_statistics

parent c063c350
Loading
Loading
Loading
Loading
Loading
+20 −13
Original line number Diff line number Diff line
@@ -1714,7 +1714,8 @@ void minimum_statistics_fx(
    Word16 *msPeriodogBufPtr,      /* i/o: Counter                                                   */
    HANDLE_FD_CNG_COM hFdCngCom,   /* i/o: FD_CNG structure containing all buffers and variables */
    const Word16 enc_dec,          /* i  : encoder/decoder indicator */
    const Word16 element_mode      /* i  : IVAS element mode type    */
    const Word16 element_mode,     /* i  : IVAS element mode type    */
    const Word16 isIVAS
)
{
    Word16 i, j, k, s, s1, s2, s3;
@@ -1781,7 +1782,7 @@ void minimum_statistics_fx(
    IF( LT_16( hFdCngCom->msFrCnt_init_counter, hFdCngCom->msFrCnt_init_thresh ) )
    {
#ifdef FIX_2485_HARMONIZE_minimum_statistics
        IF( element_mode == 0 )
        IF( isIVAS == 0 )
        {
            Copy( msPeriodog, msPsd, len );                 /* 6Q9 */
            Copy( msPeriodog, msNoiseFloor_buffer16, len ); /* 6Q9 */
@@ -1922,7 +1923,7 @@ void minimum_statistics_fx(
            /* msPeriodogSum[cnt] with format 16Q15 */
            Word16 msNoiseFloor16tmp[NPART_SHAPING];
#ifdef FIX_2485_HARMONIZE_minimum_statistics
            IF( element_mode == 0 )
            IF( isIVAS == 0 )
            {
                snr = dotp_s_fx( msNoiseFloor_buffer16 + start, psize + start, current_len, CNG_HS );
            }
@@ -1970,7 +1971,10 @@ void minimum_statistics_fx(
                /* Compute optimal smoothing parameter for PSD estimation */
                test();
#ifdef FIX_2485_HARMONIZE_minimum_statistics
                IF( ( scalar == 0 ) || ( ( element_mode == 0 ? msNoiseFloor_buffer16[j] : msNoiseFloor_buffer32[j] ) == 0 ) )
                test();
                test();
                test();
                IF( ( scalar == 0 ) || ( ( isIVAS == 0 ) ? ( msNoiseFloor_buffer16[j] == 0 ) : ( msNoiseFloor_buffer32[j] == 0 ) ) )
#else
                IF( ( scalar == 0 ) || ( msNoiseFloor_buffer[j] == 0 ) )
#endif
@@ -1984,7 +1988,7 @@ void minimum_statistics_fx(
                    s1 = WORD16_BITS - 1;
                    move16();
#ifdef FIX_2485_HARMONIZE_minimum_statistics
                    IF( element_mode == 0 )
                    IF( isIVAS == 0 )
                    {
                        if ( msNoiseFloor_buffer16[j] != 0 )
                        {
@@ -2124,13 +2128,15 @@ void minimum_statistics_fx(
                QeqInv = MSQEQINVMAX;
                move16();
#ifdef FIX_2485_HARMONIZE_minimum_statistics
                IF( ( element_mode == 0 ? msNoiseFloor_buffer16[j] : msNoiseFloor_buffer32[j] ) != 0 )
                test();
                test();
                IF( ( isIVAS == 0 ) ? ( msNoiseFloor_buffer16[j] != 0 ) : ( msNoiseFloor_buffer32[j] != 0 ) )
#else
                IF( msNoiseFloor_buffer[j] != 0 /*0.0 Q15*/ )
#endif
                {
#ifdef FIX_2485_HARMONIZE_minimum_statistics
                    IF( element_mode == 0 )
                    IF( isIVAS == 0 )
                    {
                        tmp = L_mult( msNoiseFloor_buffer16[j], msNoiseFloor_buffer16[j] );
                    }
@@ -2260,7 +2266,7 @@ void minimum_statistics_fx(
            }
            /* Get the current noise floor */
#ifdef FIX_2485_HARMONIZE_minimum_statistics
            IF( element_mode == 0 )
            IF( isIVAS == 0 )
            {
                Copy_Scale_sig_32_16( msCurrentMinOut, msNoiseFloor_buffer16, len, -16 );
            }
@@ -2329,7 +2335,7 @@ void minimum_statistics_fx(

                /* Get the current noise floor */
#ifdef FIX_2485_HARMONIZE_minimum_statistics
                IF( element_mode == 0 )
                IF( isIVAS == 0 )
                {
                    Copy_Scale_sig_32_16( msCurrentMinOut, msNoiseFloor_buffer16, len, -16 );
                }
@@ -2399,7 +2405,7 @@ void minimum_statistics_fx(

        /* Smooth noise estimate during CNG phases */
#ifdef FIX_2485_HARMONIZE_minimum_statistics
        IF( element_mode == 0 )
        IF( isIVAS == 0 )
        {
            FOR( j = 0; j < len; j++ )
            {
@@ -2429,7 +2435,7 @@ void minimum_statistics_fx(
    }

#ifdef FIX_2485_HARMONIZE_minimum_statistics
    IF( element_mode > 0 )
    IF( isIVAS > 0 )
    {
        IF( EQ_16( enc_dec, DEC ) && EQ_16( element_mode, IVAS_CPE_TD ) )
        {
@@ -2465,7 +2471,7 @@ void minimum_statistics_fx(
            scalar = L_mac( scalar, msPeriodogBuf[i], 6554 /*1.0/MSBUFLEN Q15*/ );
        }
#ifdef FIX_2485_HARMONIZE_minimum_statistics
        IF( element_mode == 0 )
        IF( isIVAS == 0 )
        {
            scalar16 = round_fx( scalar );
            if ( GT_16( msNoiseEst_buffer16[j], scalar16 ) /*0.0 Q15*/ )
@@ -2482,14 +2488,15 @@ void minimum_statistics_fx(
                move32();
            }
        }
        assert( ( ( isIVAS == 0 ) ? ( msNoiseEst_buffer16[j] >= 0 ) : ( msNoiseEst_buffer32[j] >= 0 ) ) );
#else
        if ( GT_32( msNoiseEst_buffer[j], scalar ) /*0.0 Q15*/ )
        {
            msNoiseEst_buffer[j] = scalar;
            move32();
        }
        assert( msNoiseEst[j] >= 0 );
#endif
        assert( ( element_mode == 0 ? ( msNoiseEst_buffer16[j] ) : ( msNoiseEst_buffer32[j] ) ) >= 0 /*0.0 Q15*/ );
    }
}

+1 −3
Original line number Diff line number Diff line
@@ -92,9 +92,7 @@
#define FIX_2485_HARMONIZE_perform_noise_estimation_enc /* FhG: harmonize perform_noise_estimation_enc and perform_noise_estimation_enc_ivas */
#define FIX_2485_HARMONIZE_minimum_statistics           /* FhG: harmonize minimum_statistics and minimum_statistics_fx */
#define FIX_2485_HARMONIZE_minimum_statistics_EVSmode   /* FhG: harmonize... and use EVS-code for certain calculations, instead of IVAS code*/
#define FIX_2485_HARMONIZE_minimum_statistics_CHECK1    /*Check wheter EVS mode can be entered being in IVAS mode*/
#define FIX_2455_HARMONIZE_generate_comfort_noise_enc   /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */
#define FIX_2455_HARMONIZE_configureFdCngEnc            /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */



/* #################### End BE switches ################################## */
+2 −1
Original line number Diff line number Diff line
@@ -4609,7 +4609,8 @@ void minimum_statistics_fx(
    Word16 *msPeriodogBufPtr,      /* i/o: Counter                                                   */
    HANDLE_FD_CNG_COM hFdCngCom,   /* i/o: FD_CNG structure containing all buffers and variables */
    const Word16 enc_dec,          /* i  : encoder/decoder indicator */
    const Word16 element_mode      /* i  : IVAS element mode type    */
    const Word16 element_mode,     /* i  : IVAS element mode type    */
    const Word16 isIVAS
);
#else
void minimum_statistics(
+9 −5
Original line number Diff line number Diff line
@@ -1304,7 +1304,9 @@ void perform_noise_estimation_dec_fx(
            &( hFdCngDec->msPeriodogBufPtr ),
            hFdCngDec->hFdCngCom,
            0,
            0 );
            0,
            0
        );
#else
        minimum_statistics(
            npart,
@@ -2104,9 +2106,6 @@ void perform_noise_estimation_dec_ivas_fx(
        compress_range( hFdCngDec->msPeriodog, hFdCngDec->msPeriodog_exp, hFdCngDec->msLogPeriodog, npart );

        /* Call the minimum statistics routine for noise estimation */
#ifdef FIX_2485_HARMONIZE_minimum_statistics_CHECK1
        assert( element_mode != 0 );
#endif
        minimum_statistics_fx(
            npart,
            nFFTpart,
@@ -2129,7 +2128,12 @@ void perform_noise_estimation_dec_ivas_fx(
            hFdCngDec->msPeriodogBuf,
            &( hFdCngDec->msPeriodogBufPtr ),
            hFdCngDec->hFdCngCom,
            DEC, element_mode );
            DEC, element_mode
#ifdef FIX_2485_HARMONIZE_minimum_statistics 
            ,
            0
#endif
        );

        FOR( i = 0; i < hFdCngDec->npart_shaping; i++ )
        {
+3 −5
Original line number Diff line number Diff line
@@ -2666,9 +2666,6 @@ void perform_noise_estimation_enc_fx(

    /* Call the minimum statistics routine for noise estimation */
#ifdef FIX_2485_HARMONIZE_minimum_statistics
#ifdef FIX_2485_HARMONIZE_minimum_statistics_CHECK1
    assert( element_mode == hCPE->element_mode );
#endif
    minimum_statistics_fx(
        hFdCngEnc->hFdCngCom->npart,
        nFFTpart,
@@ -2691,8 +2688,9 @@ void perform_noise_estimation_enc_fx(
        hFdCngEnc->msPeriodogBuf_fx,
        &( hFdCngEnc->msPeriodogBufPtr ),
        hFdCngEnc->hFdCngCom,
        ( element_mode == 0 ) ? ( 0 ) : ( ENC ),
        ( element_mode == 0 ) ? ( 0 ) : ( ( hCPE == NULL ) ? 0 : hCPE->element_mode ) );
        ENC,
        ( hCPE == NULL ) ? 0 : hCPE->element_mode,
        element_mode );


    /* Expand MS outputs */