Commit d14ae710 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

Merge branch 'ivas-float-update' into ivas-float-update-core_coder_in_debug

parents e1450424 311956f3
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -170,7 +170,9 @@
#define NONBE_FIX_1205_TD_STEREO_MOD_CT                 /* VA: fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder */
#define NONBE_FIX_1213_SBA_DET_MAT_INV_3BY3             /*Dolby: issue 1213: fix for inverse of det < 0*/
#define NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING    /* FhG: fixes for decoder-side noise level estimation in MDCT-Stereo to prevent noise bursts in stereo switching */
#define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO            /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */

#define NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* DLB: adjust prerendering and mixing gain in OSBA encoder. This is fix to float codes*/
/* #################### End FIXES switches ############################ */

#define BASOP_NOGLOB                                    /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */
+55 −0
Original line number Diff line number Diff line
@@ -573,6 +573,16 @@ static int16_t hf_spectrum_sparseness(
        inv_rms = 0.0f;
        crest_mod = 0.0f;
        maximum( A, L_SPEC_HB, &Amax );
#ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO
        if ( Amax == 0 )
        {
            /* For all-zero input the crest is 1.0 */
            crest = 1.0f;
            crest_mod = 1.0f;
            low_count = 0;
        }
        else
        {
            thr = Amax * PEAK_THRESHOLD;
            movmean = 0.0f;                        /* avoid uninitialized warning */
            p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */
@@ -615,6 +625,51 @@ static int16_t hf_spectrum_sparseness(
            inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB );
            crest = Amax * inv_rms;
            crest_mod = crest_mod * inv_rms;
        }
#else
        thr = Amax * PEAK_THRESHOLD;
        movmean = 0.0f;                        /* avoid uninitialized warning */
        p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */
        for ( i = 0; i < L_SPEC_HB; i++ )
        {
            inv_rms += A[i] * A[i];
            if ( A[i] < thr )
            {
                low_count += 1;
            }
            if ( i <= HALF_WIN_LENGTH )
            {
                if ( i == 0 )
                {
                    movmean = sum_f( &A[0], i + HALF_WIN_LENGTH + 1 ) * ( *p_num );
                }
                else
                {
                    p_num++;
                    movmean = movmean + ( A[i + HALF_WIN_LENGTH] - movmean ) * ( *p_num );
                }
            }
            else
            {
                if ( L_SPEC_HB <= i + HALF_WIN_LENGTH )
                {
                    p_num--;
                    movmean = movmean + ( movmean - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num );
                }
                else
                {
                    movmean = movmean + ( A[i + HALF_WIN_LENGTH] - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num );
                }
            }
            if ( crest_mod < movmean )
            {
                crest_mod = movmean;
            }
        }
        inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB );
        crest = Amax * inv_rms;
        crest_mod = crest_mod * inv_rms;
#endif
        *crest_lp = HQ_CREST_FAC_SM * ( *crest_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest;
        *crest_mod_lp = HQ_CREST_FAC_SM * ( *crest_mod_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest_mod;

+6 −0
Original line number Diff line number Diff line
@@ -72,7 +72,11 @@ static void ivas_merge_sba_transports(
    {
        for ( j = 0; j < input_frame; j++ )
        {
#ifdef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS
            data_out_f[i][j] = 0.5f * ( data_in_f1[i][j] + data_in_f2[i][j] );
#else
            data_out_f[i][j] = ( data_in_f1[i][j] + data_in_f2[i][j] );
#endif
        }
    }

@@ -477,6 +481,7 @@ static void ivas_osba_render_ism_to_sba(
        }
    }

#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS
    /* Gain with loudness-matching gains */
    output_gain = 0.7499f;
    for ( j = 0; j < nchan_sba; j++ )
@@ -486,6 +491,7 @@ static void ivas_osba_render_ism_to_sba(
            data_out_f[j][k] *= output_gain;
        }
    }
#endif

    return;
}