Commit 63822801 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Q fix for noise_est, find_tilt related buffers

parent eb54b19f
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -514,7 +514,7 @@ Word16 find_uv_ivas_fx( /* o : coding typ
        test();
#ifdef BASOP_NOGLOB
        if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22774, mean_voi3_offset ) ) ) && /* normalized correlation low  */
               ( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 ) ) &&               /* normalized correlation low on look-ahead - onset detection */
               /*( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 ) ) && */          /* normalized correlation low on look-ahead - onset detection */
               ( LT_32( ee[0], 397 ) ) && ( GT_32( hp_E[0], E_min_th ) ) &&                              /* energy concentrated in high frequencies provided that some energy is present in HF...  */
               ( LT_32( ee[1], 397 ) ) && ( GT_32( hp_E[1], E_min_th ) ) &&                              /* ... biased towards look-ahead to detect onsets  */
               ( tmp_offset_flag == 0 ) &&                                                               /* Take care of voiced offsets */
@@ -525,7 +525,7 @@ Word16 find_uv_ivas_fx( /* o : coding typ
             || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 ) ) ) )                            /* low relative frame energy (only for SC-VBR) */
#else
        if ( ( ( LT_16( add( mean_voi3, corr_shift ), add( 22774, mean_voi3_offset ) ) ) && /* normalized correlation low  */
               ( LT_16( add( st_fx->voicing_fx[2], corr_shift ), 25887 ) ) &&               /* normalized correlation low on look-ahead - onset detection */
               /* ( LT_16( add( st_fx->voicing_fx[2], corr_shift ), 25887 ) ) && */         /* normalized correlation low on look-ahead - onset detection */
               ( LT_32( ee[0], 397 ) ) && ( GT_32( hp_E[0], E_min_th ) ) &&                 /* energy concentrated in high frequencies provided that some energy is present in HF...  */
               ( LT_32( ee[1], 397 ) ) && ( GT_32( hp_E[1], E_min_th ) ) &&                 /* ... biased towards look-ahead to detect onsets  */
               ( tmp_offset_flag == 0 ) &&                                                  /* Take care of voiced offsets */
+60 −58
Original line number Diff line number Diff line
@@ -1266,22 +1266,6 @@ ivas_error pre_proc_front_ivas_fx(
    st->old_pitch_la = st->pitch[2];
    move16();

    test();
    IF( lr_vad_enabled && st->idchan == 0 )
    {
        FOR( i = 0; i < 2; i++ )
        {
            shift = getScaleFactor32( tmpN_LR_fx[i], NB_BANDS );
            scale_sig32( tmpN_LR_fx[i], NB_BANDS, shift );
            q_tmpN_LR[i] = add( q_tmpN_LR[i], shift );
            move16();

            shift = getScaleFactor32( tmpE_LR_fx[i], NB_BANDS );
            scale_sig32( tmpE_LR_fx[i], NB_BANDS, shift );
            q_tmpE_LR[i] = add( q_tmpE_LR[i], shift );
            move16();
        }
    }
    shift = getScaleFactor32( tmpN_fx, NB_BANDS );
    scale_sig32( tmpN_fx, NB_BANDS, shift );
    q_tmpN = add( q_tmpN, shift );
@@ -1297,6 +1281,66 @@ ivas_error pre_proc_front_ivas_fx(
    Scale_sig( old_wsp_fx, L_WSP, shift );
    *q_old_wsp = add( *q_old_wsp, shift );
    move16();

    /*Scaling to avoid 0 values*/
    shift = L_norm_arr( fr_bands_fx, 2 * NB_BANDS );
    scale_sig32( fr_bands_fx, 2 * NB_BANDS, shift );
    fr_bands_fx_q = add( fr_bands_fx_q, shift );
    shift = s_min( L_norm_arr( st->hNoiseEst->fr_bands1_fx, NB_BANDS ), L_norm_arr( st->hNoiseEst->fr_bands2_fx, NB_BANDS ) );
    scale_sig32( st->hNoiseEst->fr_bands1_fx, NB_BANDS, shift );
    scale_sig32( st->hNoiseEst->fr_bands2_fx, NB_BANDS, shift );
    st->hNoiseEst->fr_bands_fx_q = add( st->hNoiseEst->fr_bands_fx_q, shift );
    move16();
    shift = s_min( L_norm_arr( st->hNoiseEst->ave_enr_fx, NB_BANDS ), L_norm_arr( st->hNoiseEst->ave_enr2_fx, NB_BANDS ) );
    scale_sig32( st->hNoiseEst->ave_enr_fx, NB_BANDS, shift );
    scale_sig32( st->hNoiseEst->ave_enr2_fx, NB_BANDS, shift );
    st->hNoiseEst->ave_enr_q = add( st->hNoiseEst->ave_enr_q, shift );
    move16();
    shift = L_norm_arr( st->hNoiseEst->bckr_fx, NB_BANDS );
    scale_sig32( st->hNoiseEst->bckr_fx, NB_BANDS, shift );
    st->hNoiseEst->q_bckr = add( st->hNoiseEst->q_bckr, shift );
    move16();
    shift = L_norm_arr( st->hNoiseEst->enrO_fx, NB_BANDS );
    scale_sig32( st->hNoiseEst->enrO_fx, NB_BANDS, shift );
    st->hNoiseEst->q_enrO = add( st->hNoiseEst->q_enrO, shift );
    move16();

    test();
    IF( lr_vad_enabled && st->idchan == 0 )
    {
        /*Scaling to avoid 0 values*/
        FOR( Word16 j = 0; j < 2; j++ )
        {
            shift = getScaleFactor32( tmpN_LR_fx[j], NB_BANDS );
            scale_sig32( tmpN_LR_fx[j], NB_BANDS, shift );
            q_tmpN_LR[j] = add( q_tmpN_LR[j], shift );
            move16();

            shift = getScaleFactor32( tmpE_LR_fx[j], NB_BANDS );
            scale_sig32( tmpE_LR_fx[j], NB_BANDS, shift );
            q_tmpE_LR[j] = add( q_tmpE_LR[j], shift );
            move16();

            shift = s_min( L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->fr_bands1_fx, NB_BANDS ), L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->fr_bands2_fx, NB_BANDS ) );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->fr_bands1_fx, NB_BANDS, shift );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->fr_bands2_fx, NB_BANDS, shift );
            hCPE->hFrontVad[j]->hNoiseEst->fr_bands_fx_q = add( hCPE->hFrontVad[j]->hNoiseEst->fr_bands_fx_q, shift );
            shift = s_min( L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->ave_enr_fx, NB_BANDS ), L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->ave_enr2_fx, NB_BANDS ) );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->ave_enr_fx, NB_BANDS, shift );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->ave_enr2_fx, NB_BANDS, shift );
            hCPE->hFrontVad[j]->hNoiseEst->ave_enr_q = add( hCPE->hFrontVad[j]->hNoiseEst->ave_enr_q, shift );

            shift = L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->bckr_fx, NB_BANDS );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->bckr_fx, NB_BANDS, shift );
            hCPE->hFrontVad[j]->hNoiseEst->q_bckr = add( hCPE->hFrontVad[j]->hNoiseEst->q_bckr, shift );
            move16();
            shift = L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->enrO_fx, NB_BANDS );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->enrO_fx, NB_BANDS, shift );
            hCPE->hFrontVad[j]->hNoiseEst->q_enrO = add( hCPE->hFrontVad[j]->hNoiseEst->q_enrO, shift );
            move16();
        }
    }

    Q_wsp = *q_old_wsp;
    move16();
    Word16 q_fr_bands = Q30;
@@ -1411,26 +1455,6 @@ ivas_error pre_proc_front_ivas_fx(
    noise_est_ivas_fx( st, old_pitch1, tmpN_fx, epsP_h, epsP_l, Etot_fx, *relE_fx, corr_shift_fx, tmpE_fx, fr_bands_fx, cor_map_sum_fx, &ncharX_fx, &sp_div_fx, &q_sp_div,
                       &non_staX_fx, loc_harm, lf_E_fx, &st->hNoiseEst->harm_cor_cnt, st->hNoiseEst->Etot_l_lp_fx, st->hNoiseEst->Etot_v_h2_fx, &st->hNoiseEst->bg_cnt, st->lgBin_E_fx, sub( q_fr_bands, QSCALE ), L_shl( E_MIN_IVAS_FX, sub( q_fr_bands, Q19 ) ), &dummy_fx, S_map_fx, hStereoClassif, NULL, st->ini_frame );

    /*Scaling to avoid 0 values*/
    shift = s_min( L_norm_arr( st->hNoiseEst->fr_bands1_fx, NB_BANDS ), L_norm_arr( st->hNoiseEst->fr_bands2_fx, NB_BANDS ) );
    scale_sig32( st->hNoiseEst->fr_bands1_fx, NB_BANDS, shift );
    scale_sig32( st->hNoiseEst->fr_bands2_fx, NB_BANDS, shift );
    st->hNoiseEst->fr_bands_fx_q = add( st->hNoiseEst->fr_bands_fx_q, shift );
    move16();
    shift = s_min( L_norm_arr( st->hNoiseEst->ave_enr_fx, NB_BANDS ), L_norm_arr( st->hNoiseEst->ave_enr2_fx, NB_BANDS ) );
    scale_sig32( st->hNoiseEst->ave_enr_fx, NB_BANDS, shift );
    scale_sig32( st->hNoiseEst->ave_enr2_fx, NB_BANDS, shift );
    st->hNoiseEst->ave_enr_q = add( st->hNoiseEst->ave_enr_q, shift );
    move16();
    shift = L_norm_arr( st->hNoiseEst->bckr_fx, NB_BANDS );
    scale_sig32( st->hNoiseEst->bckr_fx, NB_BANDS, shift );
    st->hNoiseEst->q_bckr = add( st->hNoiseEst->q_bckr, shift );
    move16();
    shift = L_norm_arr( st->hNoiseEst->enrO_fx, NB_BANDS );
    scale_sig32( st->hNoiseEst->enrO_fx, NB_BANDS, shift );
    st->hNoiseEst->q_enrO = add( st->hNoiseEst->q_enrO, shift );
    move16();

    test();
    IF( lr_vad_enabled && st->idchan == 0 )
    {
@@ -1447,14 +1471,6 @@ ivas_error pre_proc_front_ivas_fx(
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->ave_enr2_fx, NB_BANDS, sub( q_fr_bands, hCPE->hFrontVad[j]->hNoiseEst->ave_enr_q ) );
            hCPE->hFrontVad[j]->hNoiseEst->ave_enr_q = q_fr_bands;
            move16();
            shift = L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->bckr_fx, NB_BANDS );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->bckr_fx, NB_BANDS, shift );
            hCPE->hFrontVad[j]->hNoiseEst->q_bckr = add( hCPE->hFrontVad[j]->hNoiseEst->q_bckr, shift );
            move16();
            shift = L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->enrO_fx, NB_BANDS );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->enrO_fx, NB_BANDS, shift );
            hCPE->hFrontVad[j]->hNoiseEst->q_enrO = add( hCPE->hFrontVad[j]->hNoiseEst->q_enrO, shift );
            move16();

            FOR( Word16 k = 0; k < NB_BANDS; k++ )
            {
@@ -1473,20 +1489,6 @@ ivas_error pre_proc_front_ivas_fx(
        /* Note: the index [0] in the last argument is intended, the ini_frame counter is only maintained in the zero-th channel's VAD handle */
        noise_est_ivas_fx( st, old_pitch1, tmpN_LR_fx[1], epsP_h, epsP_l, Etot_LR_fx[1], sub( Etot_LR_fx[1], hCPE->hFrontVad[1]->lp_speech_fx ), corr_shiftR_fx, tmpE_LR_fx[1], fr_bands_LR_fx[1], &cor_map_sum_LR_fx[1], &ncharX_LR_fx, &sp_div_LR_fx, &q_sp_div_LR,
                           &non_staX_LR_fx, loc_harmLR_fx, lf_E_LR_fx[1], &hCPE->hFrontVad[1]->hNoiseEst->harm_cor_cnt, hCPE->hFrontVad[1]->hNoiseEst->Etot_l_lp_fx, hCPE->hFrontVad[1]->hNoiseEst->Etot_v_h2_fx, &hCPE->hFrontVad[1]->hNoiseEst->bg_cnt, st->lgBin_E_fx, sub( q_fr_bands, QSCALE ), L_shl( E_MIN_IVAS_FX, sub( q_fr_bands, Q19 ) ), &dummy_fx, S_map_LR_fx, NULL, hCPE->hFrontVad[1], hCPE->hFrontVad[0]->ini_frame );


        /*Scaling to avoid 0 values*/
        FOR( Word16 j = 0; j < 2; j++ )
        {
            shift = s_min( L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->fr_bands1_fx, NB_BANDS ), L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->fr_bands2_fx, NB_BANDS ) );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->fr_bands1_fx, NB_BANDS, shift );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->fr_bands2_fx, NB_BANDS, shift );
            hCPE->hFrontVad[j]->hNoiseEst->fr_bands_fx_q = add( hCPE->hFrontVad[j]->hNoiseEst->fr_bands_fx_q, shift );
            shift = s_min( L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->ave_enr_fx, NB_BANDS ), L_norm_arr( hCPE->hFrontVad[j]->hNoiseEst->ave_enr2_fx, NB_BANDS ) );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->ave_enr_fx, NB_BANDS, shift );
            scale_sig32( hCPE->hFrontVad[j]->hNoiseEst->ave_enr2_fx, NB_BANDS, shift );
            hCPE->hFrontVad[j]->hNoiseEst->ave_enr_q = add( hCPE->hFrontVad[j]->hNoiseEst->ave_enr_q, shift );
        }
    }

    /*------------------------------------------------------------------*