Commit 5997c7b2 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

port fix for issue 1985 to characterization branch

parent a751273d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@
#define FIX_1942_ASSERTION_LOWSHELF                          /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */
#define FIX_1944_CRASH_FOR_STEREO                            /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */
#define FIX_1970_SBA_CRASH                                   /* Dlb: Fix for issue 1970, SBA crash */
#define FIX_1985_SBA_714_HF_LOSS                             /* Dlb: Fix for issue 1985, improved dirac ref pow precision*/

/* #################### Start BASOP porting switches ############################ */

+60 −0
Original line number Diff line number Diff line
@@ -2632,10 +2632,56 @@ void protoSignalComputation4_fx(
    Word32 sq_tmp_fx;
    Word32 *p_proto_buffer_fx;
    Word16 min_q_shift, q_shift;
#ifndef FIX_1985_SBA_714_HF_LOSS
    Word16 min_q_shift2, q_shift2;
#endif
    Word32 re, im;
    Word16 proto_power_smooth_fx_q, sq_tmp_q;
#ifdef FIX_1985_SBA_714_HF_LOSS
    Word64 ref_pow64[CLDFB_NO_CHANNELS_MAX], re64;
    Word16 sf1, sf2;
#endif

#ifdef FIX_1985_SBA_714_HF_LOSS
    sf1 = 63;
    sf2 = 63;
    FOR( l = 0; l < num_freq_bands; l++ )
    {
        re64 = W_mult_32_32( RealBuffer_fx[0][0][l], RealBuffer_fx[0][0][l] );
        re64 = W_mac_32_32( re64, ImagBuffer_fx[0][0][l], ImagBuffer_fx[0][0][l] );
        ref_pow64[l] = W_shr( re64, 1 ); // 2*q_cldfb +1
        move64();
    }
    FOR( k = 1; k < 4; k++ )
    {
        FOR( l = 0; l < num_freq_bands; l++ )
        {
            re64 = W_mult_32_32( RealBuffer_fx[k][0][l], RealBuffer_fx[k][0][l] );
            re64 = W_mac_32_32( re64, ImagBuffer_fx[k][0][l], ImagBuffer_fx[k][0][l] );
            ref_pow64[l] = W_add( ref_pow64[l], W_shr( re64, 1 ) ); // 2*q_cldfb +1
            move64();
        }
    }
    FOR( l = 0; l < s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ); l++ )
    {
        sf1 = s_min( sf1, W_norm( ref_pow64[l] ) );
    }
    FOR( l = 0; l < s_min( CLDFB_NO_CHANNELS_HALF, num_freq_bands ); l++ )
    {
        reference_power_fx[l] = W_extract_h( W_shl( ref_pow64[l], sf1 ) );
    }
    reference_power_q[0] = sub( add( shl( q_cldfb, 1 ), sf1 ), 31 );

    FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ )
    {
        sf2 = s_min( sf2, W_norm( ref_pow64[l] ) );
    }
    FOR( l = CLDFB_NO_CHANNELS_HALF; l < num_freq_bands; l++ )
    {
        reference_power_fx[l] = W_extract_h( W_shl( ref_pow64[l], sf2 ) );
    }
    reference_power_q[1] = sub( add( shl( q_cldfb, 1 ), sf2 ), 31 );
#else
    min_q_shift = Q31;
    move16();
    q_shift = Q31;
@@ -2695,8 +2741,22 @@ void protoSignalComputation4_fx(
    sq_tmp_q = sub( add( add( q_cldfb, min_q_shift2 ), add( q_cldfb, min_q_shift2 ) ), 31 );
    reference_power_q[1] = sq_tmp_q;
    move16();
#endif

#ifdef FIX_1985_SBA_714_HF_LOSS
    min_q_shift = Q31;
    /* calculate the shift possible for both RealBuffer_fx and ImagBuffer_fx buffers*/
    FOR( k = 0; k < s_max( 4, nchan_transport ); k++ )
    {
        q_shift = L_norm_arr( RealBuffer_fx[k][0], num_freq_bands );
        min_q_shift = s_min( q_shift, min_q_shift );
        q_shift = L_norm_arr( ImagBuffer_fx[k][0], num_freq_bands );
        min_q_shift = s_min( q_shift, min_q_shift );
    }
    min_q_shift = sub( min_q_shift, find_guarded_bits_fx( 2 ) );
#else
    min_q_shift = sub( s_min( q_shift, q_shift2 ), find_guarded_bits_fx( 2 ) );
#endif

    /*For decorrelated diffuseness*/
    FOR( l = 0; l < num_outputs_diff; l++ )