Commit fb569235 authored by vaclav's avatar vaclav
Browse files

HARM_HQ_CORE2

parent 0b782e03
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1654,6 +1654,7 @@ Word16 ivas_assign_gain_bits_fx(
    Word16 *Rcalc                                               /* o  : Bit budget for shape quantizer       Q3 */
);
#endif
#ifdef HARM_HQ_CORE2
void ivas_fine_gain_pred_fx(
    const Word16 *sfm_start,                                    /* i  : Sub band start indices                  */
    const Word16 *sfm_end,                                      /* i  : Sub band end indices                    */
@@ -1668,7 +1669,7 @@ void ivas_fine_gain_pred_fx(
    Word16 *fg_pred,                                            /* o  : Predicted fine gains                Q12 */
    const Word16 core                                           /* i  : Core                                    */
);

#endif
Word16 ivas_pvq_core_dec_fx(
    Decoder_State *st_fx,
    const Word16 *sfm_start,
+27 −6
Original line number Diff line number Diff line
@@ -14,7 +14,12 @@
 *
 * Fine gain prediction
 *--------------------------------------------------------------------------*/

#ifdef HARM_HQ_CORE2
void fine_gain_pred_fx(
#else
void ivas_fine_gain_pred_fx(
#endif
    const Word16 *sfm_start, /* i  : Sub band start indices          */
    const Word16 *sfm_end,   /* i  : Sub band end indices            */
    const Word16 *sfm_size,  /* i  : Sub band bandwidths             */
@@ -26,6 +31,9 @@ void ivas_fine_gain_pred_fx(
    Word16 *xq,              /* i/o: Quantized vector /quantized vector with finegain adj Q15*/
    Word16 *y,               /* i/o: Quantized vector (int)          Q0*/
    Word16 *fg_pred,         /* o  : Predicted fine gains        Q12 */
#ifdef HARM_HQ_CORE2
    const Word16 element_mode, /* i  : element mode                    */
#endif
    const Word16 core /* i  : Core                            */
)
{
@@ -71,11 +79,22 @@ void ivas_fine_gain_pred_fx(
                L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */
                exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) );
                L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */

#ifdef HARM_HQ_CORE2
                IF( element_mode == EVS_MONO )
                {
                    Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */
                    gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) );              /*27-exp+1+exp-16=12 */
                }
                ELSE
#endif
                {
                    Word16 norm = norm_s( bw );
                    Word16 tmp1, tmp_exp = sub( 15, norm );
                    tmp1 = Sqrt16( shl( bw, norm ), &tmp_exp );
                    tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) );
                    Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */
                }

                gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */
                test();
@@ -125,6 +144,7 @@ void ivas_fine_gain_pred_fx(
    return;
}

#ifndef HARM_HQ_CORE2
void fine_gain_pred_fx(
    const Word16 *sfm_start, /* i  : Sub band start indices          */
    const Word16 *sfm_end,   /* i  : Sub band end indices            */
@@ -228,6 +248,7 @@ void fine_gain_pred_fx(

    return;
}
#endif

/*--------------------------------------------------------------------------*
 * get_max_pulses()
+1 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@
#define FIX_2431_AVOID_CALLOC                           /* VA: basp issue 2431: avoid use of calloc() */
#define FIX_2424_REMOVE_GAUSS_L2_ENC                    /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */
#define HARM_HQ_CORE                                    /* harmonize HQ core functions */
#define HARM_HQ_CORE2

/* #################### End BE switches ################################## */

+4 −1
Original line number Diff line number Diff line
@@ -4674,6 +4674,9 @@ void fine_gain_pred_fx(
    Word16 *xq,              /* i/o: Quantized vector /quantized vector with finegain adj Q15*/
    Word16 *y,               /* i/o: Quantized vector (int)          */
    Word16 *fg_pred,         /* o  : Predicted fine gains        Q12 */
#ifdef HARM_HQ_CORE2
    const Word16 element_mode, /* i  : element mode                    */
#endif
    const Word16 core /* i  : Core                            */
);

+9 −0
Original line number Diff line number Diff line
@@ -5036,6 +5036,15 @@ void ivas_hq_ecu_fx(
                                                                   ( ph_ecu_HqVoicing || ( ( ( GT_16( hHQ_core->env_stab_plc_fx, 16384 ) /* 0.5 in Q15 */ ) && ( LT_16( corr, 19661 ) /* 0.6 in Q15 */ ) ) || ( LT_16( hHQ_core->env_stab_plc_fx, 16384 ) /* 0.5 in Q15 */ && ( GT_16( corr, 27853 ) /* 0.85 in Q15 */ ) ) ) ) ) ) ||
                         ( LT_32( st_fx->total_brate, 48000 ) && ( ( ph_ecu_HqVoicing || GT_16( corr, 27853 ) /* 0.85 in Q15 */ ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) );

#ifdef HARM_HQ_CORE
    // temp. hack to keep EVS BE
    IF( st_fx->element_mode == EVS_MONO )
    {
        evs_mode_selection = ( GE_32( st_fx->total_brate, 48000 ) && ( GE_16( output_frame, L_FRAME16k ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) && ( NE_16( ph_ecu_HqVoicing, 0 ) || ( ( ( NE_16( st_fx->hHQ_core->env_stab_plc_fx, 0 ) ) && ( LT_16( corr, 19661 ) ) ) || ( !( NE_16( st_fx->hHQ_core->env_stab_plc_fx, 0 ) ) && ( GT_16( corr, 27853 ) ) ) ) ) ) ) ||
                             ( LT_32( st_fx->total_brate, 48000 ) && ( ( ph_ecu_HqVoicing || GT_16( corr, 27853 ) ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) );
    }
#endif

    test();
    ivas_mode_selection = ( LT_16( N, PH_ECU_N_LIMIT ) ) || ( LT_16( corr, PH_ECU_CORR_LIMIT_Q15 ) );

Loading