Commit f1c2dc9a authored by Nishant S Kulgod's avatar Nishant S Kulgod
Browse files

rebase #3

parent 801471dd
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -80,4 +80,6 @@
#define CR_2109_to_2112_cd0_ce0  /* This is related to the CRs include in the 26.444 package of 21-12. Concerns lead_deindexing and  */
#define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */
#define FIX_1013_CRASH_HQ_CORE_DEC /* Ittiam: Saturation added on the lines of EVS */
#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*/
#define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO            /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */
#endif
+77 −55
Original line number Diff line number Diff line
@@ -57,9 +57,12 @@ static Word16 hf_spectrum_sparseness_fx(
    Word32 crest_mod_fx;
    const Word16 *p_num_fx;
    Word32 A_fx[960];
    int16_t result;
    Word16 result;
    Word32 *crest_lp_fx;
    Word32 *crest_mod_lp_fx;
    Word32 hq_crest_threshold, hq_crest_mod_threshold;
    Word16 inv_rms32_e = 0;
    move16();

    crest_lp_fx = &st->hHQ_core->crest_lp_fx;
    crest_mod_lp_fx = &st->hHQ_core->crest_mod_lp_fx;
@@ -81,6 +84,18 @@ static Word16 hf_spectrum_sparseness_fx(
        crest_mod_fx = 0;
        move32();
        maximum_l( A_fx, L_SPEC_HB, &Amax_fx );
#ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO
        IF( Amax_fx == 0 )
        {
            /* For all-zero input the crest is 1.0 */
            crest_fx = L_shl( 1, st->hHQ_core->crest_lp_q );
            crest_mod_fx = L_shl( 1, st->hHQ_core->crest_mod_lp_q );
            low_count_fx = 0;
            move16();
        }
        ELSE
        {
#endif
            thr_fx = Mpy_32_32( Amax_fx, PEAK_THRESHOLD_FX );
            movmean_fx = 0;                              /* avoid uninitialized warning */
                                                         // p_num = &inv_tbl[HALF_WIN_LENGTH + 1];       /* Table for division 1./(11:21) */
@@ -130,8 +145,6 @@ static Word16 hf_spectrum_sparseness_fx(
            Word16 l_shift = W_norm( inv_rms_fx );
            inv_rms32_fx = W_extract_h( W_shl( inv_rms_fx, l_shift ) ); // Q15+l_shift-32
            Word16 q_rms = sub( add( Q15, l_shift ), 32 );              // q_rms
        Word16 inv_rms32_e = 0;
        move16();
            inv_rms32_div_fx = BASOP_Util_Divide3232_Scale_cadence( inv_rms32_fx, L_SPEC_HB, &inv_rms32_e );
            inv_rms32_e = sub( 31, add( sub( Q31, inv_rms32_e ), q_rms ) );
            // inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB );
@@ -142,12 +155,21 @@ static Word16 hf_spectrum_sparseness_fx(
            *crest_lp_fx = L_shr( *crest_lp_fx, sub( st->hHQ_core->crest_lp_q, sub( Q12, inv_rms32_e ) ) );
            move32();
            st->hHQ_core->crest_lp_q = sub( Q12, inv_rms32_e );
        *crest_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_lp_fx ) ), Mpy_32_32( ONE_IN_Q31 - HQ_CREST_FAC_SM_FX, crest_fx ) ); // Q12 - inv_rms32_e
            move16();
            *crest_mod_lp_fx = L_shr( *crest_mod_lp_fx, sub( st->hHQ_core->crest_mod_lp_q, sub( Q12, inv_rms32_e ) ) );
            move32();
            st->hHQ_core->crest_mod_lp_q = sub( Q12, inv_rms32_e );
        *crest_mod_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_mod_lp_fx ) ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), crest_mod_fx ) ); // Q12 - inv_rms32_e
        Word32 hq_crest_threshold = L_shr( HQ_CREST_THRESHOLD_FX, sub( Q28, sub( Q12, inv_rms32_e ) ) );
        Word32 hq_crest_mod_threshold = L_shr( HQ_CREST_MOD_THRESHOLD_FX, sub( Q29, sub( Q12, inv_rms32_e ) ) );
            move16();
#ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO
        }
#endif
        *crest_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_lp_fx ) ), Mpy_32_32( ONE_IN_Q31 - HQ_CREST_FAC_SM_FX, crest_fx ) ); /* Q(st->hHQ_core->crest_lp_q) */
        move32();
        *crest_mod_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_mod_lp_fx ) ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), crest_mod_fx ) ); /* Q(st->hHQ_core->crest_mod_lp_q) */
        move32();

        hq_crest_threshold = L_shr( HQ_CREST_THRESHOLD_FX, sub( Q28, st->hHQ_core->crest_lp_q ) );             /* Q(st->hHQ_core->crest_lp_q) */
        hq_crest_mod_threshold = L_shr( HQ_CREST_MOD_THRESHOLD_FX, sub( Q29, st->hHQ_core->crest_mod_lp_q ) ); /* Q(st->hHQ_core->crest_mod_lp_q) */
        test();
        test();
        if ( GT_32( ( *crest_lp_fx ), hq_crest_threshold ) && GT_32( ( *crest_mod_lp_fx ), hq_crest_mod_threshold ) && GT_16( low_count_fx, LOW_COUNT_THRESHOLD ) )
+4 −4
Original line number Diff line number Diff line
@@ -2255,15 +2255,15 @@ static void computeLfeEnergy_fx(
        Copy32( &( hMcMasa->delay_buffer_lfe[1][0] ), &( delayedInputSignal[1][0] ), hMcMasa->num_slots_delay_comp * l_ts );
        Copy32( data_fx[separateChannelIndex] + hMcMasa->offset_comp, &( delayedInputSignal[1][hMcMasa->num_slots_delay_comp * l_ts] ), ( MDFT_NO_COL_MAX - hMcMasa->num_slots_delay_comp ) * l_ts );

        lowpassCoef = L_shl( div_w( 1, (Word32) hMcMasa->ringBufferSize ), Q7 ); // Q.38
        lowpassCoef = L_shl( div_w( 1, (Word32) hMcMasa->ringBufferSize ), Q6 ); // Q.37(31+6)

        FOR( i = 0; i < input_frame; i++ )
        {
            FOR( j = 0; j < 2; j++ )
            {
                Word32 temp1, temp2;
                temp1 = Mpy_32_32( delayedInputSignal[j][i], lowpassCoef );                                 // Q(q_inp+7-gb)
                temp2 = Mpy_32_32( hMcMasa->lfeAnaRingBuffer[j][hMcMasa->ringBufferPointer], lowpassCoef ); // Q(q_inp+7-gb)
                temp1 = Mpy_32_32( delayedInputSignal[j][i], lowpassCoef );                                 // Q(q_inp+6)
                temp2 = Mpy_32_32( hMcMasa->lfeAnaRingBuffer[j][hMcMasa->ringBufferPointer], lowpassCoef ); // Q(q_inp+6)
                hMcMasa->lowpassSum[j] = L_add( hMcMasa->lowpassSum[j], L_sub( temp1, temp2 ) );
                move32();
                lowPassSignal[j][i] = hMcMasa->lowpassSum[j];
@@ -2279,7 +2279,7 @@ static void computeLfeEnergy_fx(
                hMcMasa->ringBufferPointer = sub( hMcMasa->ringBufferSize, 1 );
            }
        }
        lowPassSignal_q = add( q_inp, Q7 );
        lowPassSignal_q = add( q_inp, Q6 );
        FOR( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ )
        {
            mrange[0] = i_mult( hMcMasa->block_grouping[block_m_idx], l_ts );
+3 −0
Original line number Diff line number Diff line
@@ -1347,6 +1347,9 @@ static void ivas_omasa_energy_and_ratio_est_fx(
            {
                q_cldfb = q_data;
                move16();
                scale_sig32( hOMasa->cldfbAnaEnc[i]->cldfb_state_fx, hOMasa->cldfbAnaEnc[i]->cldfb_state_length, sub( q_cldfb, hOMasa->cldfbAnaEnc[i]->Q_cldfb_state ) );
                hOMasa->cldfbAnaEnc[i]->Q_cldfb_state = q_cldfb;
                move16();
                cldfbAnalysis_ts_fx_fixed_q( &( data_fx[i][l_ts * ts] ), Chnl_RealBuffer_fx[i], Chnl_ImagBuffer_fx[i], l_ts, hOMasa->cldfbAnaEnc[i], &q_cldfb );
                norm_Chnl = s_min( norm_Chnl, L_norm_arr( Chnl_ImagBuffer_fx[i], 60 ) );
                norm_Chnl = s_min( norm_Chnl, L_norm_arr( Chnl_RealBuffer_fx[i], 60 ) );
+9 −0
Original line number Diff line number Diff line
@@ -79,7 +79,11 @@ static void ivas_merge_sba_transports_fx(
    {
        FOR( j = 0; j < input_frame; j++ )
        {
#ifdef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS
            data_out_f[i][j] = L_shr( L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) ), Q1 );
#else
            data_out_f[i][j] = L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) );
#endif
            move32();
        }
    }
@@ -477,7 +481,9 @@ static void ivas_osba_render_ism_to_sba_fx(
    Word16 azimuth_fx, elevation_fx;
    Word32 gains_fx[MAX_INPUT_CHANNELS];
    Word32 g1_fx, g2_fx;
#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS
    Word32 output_gain_fx;
#endif
    Word16 nchan_sba;
    nchan_sba = imult1616( add( sba_analysis_order, 1 ), add( sba_analysis_order, 1 ) );

@@ -518,6 +524,8 @@ static void ivas_osba_render_ism_to_sba_fx(
        }
    }
    *Q_data = sub( *Q_data, 2 );

#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS
    /* Gain with loudness-matching gains */
    // output_gain = 0.7499f;
    output_gain_fx = 1610397988; // 0.7499f in Q31
@@ -531,6 +539,7 @@ static void ivas_osba_render_ism_to_sba_fx(
            move32();
        }
    }
#endif

    return;
}