Commit 7e061fca authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'basop_instrumentation_dec_renderer_5' into 'main'

BASOP and instrumentation changes in lib_com, lib_dec and lib_rend files

See merge request !421
parents a2498d04 be1157fe
Loading
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -352,13 +352,15 @@ void ivas_fill_spectrum_fx(
    IF( EQ_16( HQ_mode, HQ_HARMONIC ) )
    {
        /*high_sfm = (core_brate == HQ_BWE_CROSSOVER_BRATE) ? HVQ_THRES_SFM_24k-1 : HVQ_THRES_SFM_32k-3; */
        high_sfm = sub( HVQ_THRES_SFM_32k, 1 );
        IF( LT_32( L_core_brate, HQ_BWE_CROSSOVER_BRATE ) )
        high_sfm = HVQ_THRES_SFM_32k - 1;
        move16();
        if ( LT_32( L_core_brate, HQ_BWE_CROSSOVER_BRATE ) )
        {
            high_sfm = sub( HVQ_THRES_SFM_24k, 1 );
            high_sfm = HVQ_THRES_SFM_24k - 1;
            move16();
        }

        IF( LT_16( last_sfm, high_sfm ) )
        if ( LT_16( last_sfm, high_sfm ) )
        {
            last_sfm = high_sfm;
            move16();
@@ -381,7 +383,7 @@ void ivas_fill_spectrum_fx(
    test();
    test();
    IF( EQ_16( length, L_FRAME16k ) ||
        ( ( EQ_16( length, L_FRAME32k ) && NE_16( HQ_mode, HQ_HARMONIC ) && NE_16( HQ_mode, HQ_HVQ ) ) && EQ_16( *no_att_hangover, 0 ) ) )
        ( ( EQ_16( length, L_FRAME32k ) && NE_16( HQ_mode, HQ_HARMONIC ) && NE_16( HQ_mode, HQ_HVQ ) ) && ( *no_att_hangover == 0 ) ) )
    {
        /* Norm adjustment function */
        env_adj_fx( npulses, length, last_sfm, norm_adj, env_stab, sfmsize );
@@ -393,7 +395,7 @@ void ivas_fill_spectrum_fx(
    test();
    test();
    test();
    IF( EQ_16( length, L_FRAME32k ) && ( ( LT_16( env_stab, 16384 ) && *no_att_hangover == 0 ) || EQ_16( HQ_mode, HQ_HVQ ) ) )
    if ( EQ_16( length, L_FRAME32k ) && ( ( LT_16( env_stab, 16384 ) && *no_att_hangover == 0 ) || EQ_16( HQ_mode, HQ_HVQ ) ) )
    {
        flag_32K_env_hangover = 1;
        move16();
@@ -426,7 +428,7 @@ void ivas_fill_spectrum_fx(
     *----------------------------------------------------------------*/

    test();
    IF( NE_16( HQ_mode, HQ_HVQ ) && GT_16( cb_size, 0 ) )
    IF( NE_16( HQ_mode, HQ_HVQ ) && ( cb_size > 0 ) )
    {
        apply_noisefill_HQ_fx( R, length, flag_32K_env_hangover, L_core_brate, last_sfm, CodeBook,
                               CodeBook_mod, cb_size, sfm_start, sfm_end, sfmsize, coeff );
@@ -436,7 +438,7 @@ void ivas_fill_spectrum_fx(
     * Normal mode BWE
     *----------------------------------------------------------------*/

    IF( EQ_16( HQ_mode, HQ_NORMAL ) )
    IF( HQ_mode == HQ_NORMAL )
    {
        hq_fold_bwe_fx( last_sfm, sfm_end, num_sfm, coeff );
    }
@@ -524,6 +526,7 @@ void ivas_fill_spectrum_fx(
    IF( EQ_16( length, L_FRAME32k ) && LE_32( L_core_brate, HQ_32k ) )
    {
        *prev_R = R[SFM_N_WB - 1];
        move16();
        Copy32( L_coeff_out + L_FRAME16k - L_HQ_WB_BWE, prev_coeff_out, L_HQ_WB_BWE );
    }

@@ -784,6 +787,7 @@ void fill_spectrum_fx(
    IF( EQ_16( length, L_FRAME32k ) && LE_32( L_core_brate, HQ_32k ) )
    {
        *prev_R = R[SFM_N_WB - 1];
        move16();
        Copy32( L_coeff_out + L_FRAME16k - L_HQ_WB_BWE, prev_coeff_out, L_HQ_WB_BWE );
    }

+0 −1
Original line number Diff line number Diff line
@@ -185,7 +185,6 @@ Word16 findpulse_fx( /* o : pulse position
         *------------------------------------------------------------------------*/

        ptr = resf + L_frame - 1;
        move16();
        maxi = 0;
        move16();

+3 −4
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ Word16 assign_gain_bits_fx( /* o : Number of assigned
    }

    /* Re-adjust bit budget for gain quantization */
    move16();
    gain_bits_tot = 0;
    move16();
    *Rcalc = 0;
@@ -125,7 +124,7 @@ static void ivas_subband_gain_bits_fx(
    {
        /*bps = (short)(Rk[i]*((word16)min(32767, ceil(32767.0f/sfmsize[i]);  inexact C-integer division approx. */
        bps = extract_l( L_shr( L_mult0( Rk[i], fg_inv_tbl_fx[sfmsize[i] >> 3] ), 18 ) ); /* 3+15 */
        IF( EQ_32( L_shl( L_mult0( sfmsize[i], add( bps, 1 ) ), 3 ), Rk[i] ) )
        if ( EQ_32( L_shl( L_mult0( sfmsize[i], add( bps, 1 ) ), 3 ), Rk[i] ) )
        {
            bps = add( bps, 1 );
        }
@@ -138,7 +137,7 @@ static void ivas_subband_gain_bits_fx(
        tot = add( tot, b );
    }

    IF( EQ_16( tot, 0 ) )
    if ( tot == 0 )
    {
        /* If no gain bits were assigned, use one bit anyway for potential PVQ overage */
        bits[0] = 1;
@@ -177,7 +176,7 @@ Word16 ivas_assign_gain_bits_fx( /* o : Number of ass
    move16();
    FOR( i = 0; i < BANDS; i++ )
    {
        IF( GT_16( Rk[i], 0 ) )
        IF( Rk[i] > 0 )
        {
            Rk[i] = sub( Rk[i], shl( gain_bits_array[i], 3 ) );
            move16();
+13 −5
Original line number Diff line number Diff line
@@ -107,11 +107,12 @@ void fer_energy_fx(
    IF( EQ_16( clas, VOICED_CLAS ) || EQ_16( clas, ONSET ) || EQ_16( clas, SIN_ONSET ) ) /* Voiced or Onset current frame */
    {
        len = ( pitch ); /* pitch value */
        move16();

        pt_synth = synth;
        IF( NE_16( offset, 0 ) )
        IF( offset != 0 )
        {
            pt_synth = synth + L_frame - len;
            pt_synth = synth + sub( L_frame, len );
        }

        emaximum_32fx( q_synth, pt_synth, len, enr ); /* pitch synchronous E */
@@ -119,22 +120,25 @@ void fer_energy_fx(
    ELSE
    {
        pt_synth = synth;
        IF( NE_16( offset, 0 ) )
        IF( offset != 0 )
        {
            pt_synth = synth + shr( L_frame, 1 );
        }

        W_tmp = 0;
        for ( int i = 0; i < shr( L_frame, 1 ); i++ )
        move64();
        FOR( int i = 0; i < L_frame / 2; i++ )
        {
            W_tmp = W_add( W_tmp, W_mult0_32_32( pt_synth[i], pt_synth[i] ) ); // Q = q_synth * 2
        }
        shift = W_norm( W_tmp );
        W_tmp = W_shl( W_tmp, shift ); // Q = q_synth * 2 + shift
        *enr = W_extract_h( W_tmp );   // Q = q_synth * 2 + shift - 32
        move32();

        enr_tmp = BASOP_Util_Divide3216_Scale( *enr, shr( L_frame, 1 ) /*Q0*/, &exp );
        *enr = L_shr( L_deposit_l( enr_tmp ), ( shift - 32 - exp - 1 ) );
        *enr = L_shr( L_deposit_l( enr_tmp ), sub( sub( sub( shift, 32 ), exp ), 1 ) );
        move32();
    }
    return;
}
@@ -291,8 +295,10 @@ Word16 frame_ener_fx(
            IF( EQ_16( L_frame, 320 ) )
            {
                *enr_q = Mult_32_16( *enr_q, 26214 ); /*x 0.8 to get /160*/
                move32();
                i = norm_l( *enr_q );
                *enr_q = L_shl( *enr_q, i );
                move32();
                exp_enrq = add( i, exp_enrq );
            }
        }
@@ -301,6 +307,7 @@ Word16 frame_ener_fx(
            exp_enrq = sub( exp_enrq, add( Q_new, Q_new ) );
            enr_q_tmp /*Q30 exp2+exp_enrq*/ = BASOP_Util_Divide3216_Scale( *enr_q /*Q31*/, L_frame2 /*Q0*/, &exp2 );
            *enr_q = L_shr( L_deposit_l( enr_q_tmp ), sub( 30, add( exp2, exp_enrq ) ) ); /*Q0*/
            move32();
            *enr_q = L_add( *enr_q, 1 );
            move32();
            exp_enrq = 0;
@@ -331,6 +338,7 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8
    Word16 len, enern;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif


+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed)
    Word16 exp_c, exp_e, exp, tmp;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif


@@ -122,6 +123,7 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed)
    Word16 m_corr, m_ener, negative, Q_corr, Q_ener;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif

    negative = 0;
Loading