Commit 0740eaaf authored by vaclav's avatar vaclav
Browse files

harmonize GenShapedWBExcitation_fx()

parent e88aa742
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2905,6 +2905,7 @@ void flip_spectrum_and_decimby4_fx(
);
void GenShapedWBExcitation_fx(
#ifndef HARMONIZE_TBE2
    Word16 *excSHB,                   /* o   : synthesized shaped shb exctiation      */
    const Word16 *lpc_shb,            /* i   : lpc coefficients                       */
    Word16 *exc4kWhtnd,               /* o   : whitened synthesized shb excitation    */
@@ -2922,8 +2923,8 @@ void GenShapedWBExcitation_fx(
    const Word16 signal_type,
    const Word16 igf_flag );
#ifdef HARMONIZE_TBE
void GenShapedWBExcitation_ivas_fx(
#endif
    Word16 *excSHB,                   /* o  : synthesized shaped shb exctiation   Q_bwe_exc*/
    const Word16 *lpc_shb,            /* i  : lpc coefficients Q12                         */
    Word16 *exc4kWhtnd,               /* o  : whitened synthesized shb excitation Q_bwe_exc*/
@@ -2942,7 +2943,6 @@ void GenShapedWBExcitation_ivas_fx(
    const Word16 igf_flag             /* i  : IGF flag                                     */
);
#endif
void GenWBSynth_fx(
    const Word16 *input_synspeech, /* i  : i   synthesized speech                  */
    Word16 *shb_syn_speech_16k,    /* o  : output highband compnent                */
+27 −18
Original line number Diff line number Diff line
@@ -1341,7 +1341,11 @@ void flip_spectrum_and_decimby4_fx(
/* CALLED FROM : */
/*==========================================================================*/

#ifdef HARMONIZE_TBE2
void GenShapedWBExcitation_fx(
#else
void GenShapedWBExcitation_ivas_fx(
#endif
    Word16 *excSHB,                   /* o  : synthesized shaped shb exctiation   Q_bwe_exc*/
    const Word16 *lpc_shb,            /* i  : lpc coefficients Q12                         */
    Word16 *exc4kWhtnd,               /* o  : whitened synthesized shb excitation Q_bwe_exc*/
@@ -1447,6 +1451,15 @@ void GenShapedWBExcitation_ivas_fx(
        fir_fx( exc4k, lpc_whtn, exc4kWhtnd, wht_fil_mem, L_FRAME16k / 4, LPC_WHTN_ORDER_WB, 0, 3 );

        /* Ensure pow1 is greater than zero when computing normalization */
#ifdef HARMONIZE_TBE2
        Word16 Q_pow = Q10;
        move16();
        if ( element_mode == EVS_MONO )
        {
            Q_pow = Q7;
            move16();
        }
#endif
        max_val = 0;
        move16();
        FOR( i = 0; i < L_FRAME16k / 4; i++ )
@@ -1478,7 +1491,11 @@ void GenShapedWBExcitation_ivas_fx(
            FOR( i = 0; i < L_FRAME16k / 4; i++ )
            {
                L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16
#ifdef HARMONIZE_TBE2
                pow1 = L_add_sat( pow1, L_shr( L_tmp, Q_pow ) ); /* Q22 */
#else
                pow1 = L_add_sat( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */
#endif
            }
        }

@@ -1521,23 +1538,14 @@ void GenShapedWBExcitation_ivas_fx(
            n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) );
            pow22 = 1;
            move32();
#ifdef HARMONIZE_TBE2
            IF( element_mode == EVS_MONO )
            {
                FOR( i = 0; i < L_FRAME16k / 4; i++ )
                {
                    L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */
                    pow22 = L_add( pow22, L_shr( L_tmp, 7 ) );          /* Q22 */
                }
            }
            ELSE
#endif
            {
            FOR( i = 0; i < L_FRAME16k / 4; i++ )
            {
                L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */
#ifdef HARMONIZE_TBE2
                pow22 = L_add( pow22, L_shr( L_tmp, Q_pow ) ); /* Q22 */
#else
                pow22 = L_add( pow22, L_shr( L_tmp, 10 ) );   /* Q22 */
                }
#endif
            }
        }

@@ -1628,6 +1636,7 @@ void GenShapedWBExcitation_ivas_fx(
    return;
}

#ifndef HARMONIZE_TBE2
void GenShapedWBExcitation_fx(
    Word16 *excSHB,                   /* o : synthesized shaped shb exctiation   Q(Q_bwe_exc) */
    const Word16 *lpc_shb,            /* i : lpc coefficients                             Q12 */
@@ -1873,7 +1882,7 @@ void GenShapedWBExcitation_fx(

    return;
}

#endif

/*-------------------------------------------------------------------*
 * GenWBSynth()
+5 −5
Original line number Diff line number Diff line
@@ -977,8 +977,8 @@ void ivas_wb_tbe_dec_fx(

        Q_bwe_exc_ext = sub( Q_bwe_exc, 16 );

#ifdef HARMONIZE_TBE2aa
        GenShapedWBExcitation_ivas_fx( shaped_wb_excitation + L_SHB_LAHEAD / 4, lpc_wb, exc4kWhtnd, hBWE_TD->mem_csfilt_fx,
#ifdef HARMONIZE_TBE2
        GenShapedWBExcitation_fx( shaped_wb_excitation + L_SHB_LAHEAD / 4, lpc_wb, exc4kWhtnd, hBWE_TD->mem_csfilt_fx,
                                  hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->mem_genSHBexc_filt_down_wb2_fx,
                                  hBWE_TD->mem_genSHBexc_filt_down_wb3_fx, hBWE_TD->state_lpc_syn_fx, coder_type, st_fx->element_mode,
                                  bwe_exc_extended_16, Q_bwe_exc_ext, hBWE_TD->bwe_seed, vf_modified, uv_flag, st_fx->igf );
+5 −5
Original line number Diff line number Diff line
@@ -1712,8 +1712,8 @@ void wb_tbe_enc_ivas_fx(
    Copy( hBWE_TD->state_syn_shbexc_fx, shaped_wb_excitation, L_SHB_LAHEAD / 4 );
    Q_bwe_exc_ext = sub( Q_bwe_exc, 16 );

#ifdef HARMONIZE_TBE2aa
    GenShapedWBExcitation_ivas_fx( shaped_wb_excitation + L_SHB_LAHEAD / 4, lpc_wb, exc4kWhtnd, hBWE_TD->mem_csfilt_fx,
#ifdef HARMONIZE_TBE2
    GenShapedWBExcitation_fx( shaped_wb_excitation + L_SHB_LAHEAD / 4, lpc_wb, exc4kWhtnd, hBWE_TD->mem_csfilt_fx,
                              hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->mem_genSHBexc_filt_down_wb2_fx,
                              hBWE_TD->mem_genSHBexc_filt_down_wb3_fx, hBWE_TD->state_lpc_syn_fx, st_fx->coder_type, st_fx->element_mode,
                              bwe_exc_extended_16, Q_bwe_exc_ext, hBWE_TD->bwe_seed, vf_modified_fx, uv_flag, st_fx->igf );