Commit 2b1596d8 authored by vaclav's avatar vaclav
Browse files

finish WB_BWE_encoding_fx()

parent f519fd34
Loading
Loading
Loading
Loading
+10 −29
Original line number Diff line number Diff line
@@ -14,9 +14,13 @@
 * Local functions declarations
 *---------------------------------------------------------------------*/

#ifdef HARM_FD_BWE
static Word16 WB_BWE_encoding_fx( Encoder_State *st_fx, const Word32 *yos_fx, Word16 *WB_fenv_fx, Word16 Q_synth, const Word16 Q_synth_lf );
#else
static Word16 WB_BWE_encoding_fx( const Word16 coder_type, const Word16 *yos_fx, Word16 *WB_fenv_fx, Encoder_State *st_fx, const Word16 Q_synth, const Word16 Q_synth_lf );

static Word16 WB_BWE_encoding_fx_32( Encoder_State *st_fx, const Word32 *yos_fx, Word16 *WB_fenv_fx, Word16 Q_synth, const Word16 Q_synth_lf );
#endif

static Word16 SWB_BWE_encoding_fx( Encoder_State *st_fx, Word16 *insig_fx, const Word16 *insig_lp_fx, const Word16 *insig_hp_fx, const Word16 *synth_fx, const Word16 *yos_fx, Word16 *SWB_fenv_fx, const Word16 tilt_nb_fx, const Word16 st_offset, const Word16 coder_type, const Word16 Q_insig_lp, const Word16 Q_shb, const Word16 Q_synth, const Word16 Q_synth_lf );

@@ -238,35 +242,11 @@ void wb_bwe_enc_ivas_fx(
        /* DCT of the ACELP core synthesis */
        direct_transform_fx( L_wtda_synth_fx, yorig_32, 0, L_FRAME16k, &new_input_fx_exp, st_fx->element_mode );

#ifdef HARM_FD_BWEaa
        IF( st_fx->element_mode == EVS_MONO )
        {
            Word16 scl, Q_synth;
            Word16 yorig_fx[L_FRAME16k];

            /* Convert to 16 Bits (Calc Shift Required to Stay within MAX_Q_NEW_INPUT) */
            scl = sub( 16 + 8 /*MAX_Q_NEW_INPUT*/, new_input_fx_exp );

            /* Possible to Upscale? */
            IF( scl > 0 )
            {
                /* Yes */
                /* Calc Room to Upscale */
                Q_synth = Find_Max_Norm32( yorig_32, L_FRAME16k );

                /* Stay within MAX_Q_NEW_INPUT */
                scl = s_min( Q_synth, scl );
            }
            Copy_Scale_sig32_16( yorig_32, yorig_fx, L_FRAME16k, scl );
            Q_synth = sub( add( sub( new_input_fx_exp, 16 ), scl ), 1 );

            mode = WB_BWE_encoding_fx( st_fx->coder_type, yorig_fx, WB_fenv_fx, st_fx, Q_synth, Q_synth );
        }
        ELSE
#endif
        {
#ifdef HARM_FD_BWE
        mode = WB_BWE_encoding_fx( st_fx, yorig_32, WB_fenv_fx, new_input_fx_exp, new_input_fx_exp );
#else
        mode = WB_BWE_encoding_fx_32( st_fx, yorig_32, WB_fenv_fx, new_input_fx_exp, new_input_fx_exp );
        }
#endif
        move16();

        push_indice( st_fx->hBstr, IND_WB_CLASS, sub( mode, 2 ), 1 );
@@ -2508,6 +2488,7 @@ static void energy_control_ivas_fx(

/* o  : classification of wb signal  */
static Word16 WB_BWE_encoding_fx(
#ifndef HARM_FD_BWE
    const Word16 coder_type, /* i  : coder type                             */
    const Word16 *yos_fx,    /* i  : MDCT coefficients of weighted original */
    Word16 *WB_fenv_fx,      /* i/o: energy of WB envelope                  */
@@ -2580,6 +2561,7 @@ static Word16 WB_BWE_encoding_fx(

/* o  : classification of wb signal */
static Word16 WB_BWE_encoding_fx_32(
#endif
    Encoder_State *st_fx, /* i/o: Encoder structure                      */
    const Word32 *yos_fx, /* i  : MDCT coefficients of weighted original */
    Word16 *WB_fenv_fx,   /* i/o: energy of WB envelope                  */
@@ -2700,7 +2682,6 @@ static Word16 WB_BWE_encoding_fx_32(
            exp = norm_l( L_tmp );
            tmp = Log2_norm_lc( L_shl( L_tmp, exp ) );
            /* exp = 30-exp-(2*Q_synth-2 / exp = 30-exp-(q_WB_fenv[i]+4) */
            mode = FD_BWE_class_fx( yos_fx_16, 0, 0, sub( add( Q_synth, scale ), Q16 ), 0, st_fx );
#ifdef HARM_FD_BWE
            exp = sub( sub( 30, exp ), Q_fenv );
#else