Commit 173a8ac5 authored by vaclav's avatar vaclav
Browse files

fix

parent 2e42b7ff
Loading
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2686,7 +2686,9 @@ void time_envelop_shaping_fx(
    Word16 *Q_synth );
void time_envelop_shaping_ivas_fx(
#ifdef HARM_FD_BWE
    const Word16 element_mode, /* i  : element mode                   */
#endif
    Word16 werr[],     /* i/o: SHB synthesis           Q_synth*/
    Word32 SWB_tenv[], /* i/o: frequency envelope          Q15*/
    const Word16 L,    /* i  : frame length                   */
+43 −10
Original line number Diff line number Diff line
@@ -368,7 +368,11 @@ void swb_bwe_enc_ivas_fx(
    TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD;

#ifdef HARM_FD_BWE
    IF( st_fx->element_mode > EVS_MONO )
    IF( st_fx->element_mode == EVS_MONO )
    {
        Copy( shb_speech_fx_Q0, shb_speech_fx, L_FRAME16k );
    }
    ELSE
#endif
    {
        Q_shb_speech = getScaleFactor16( shb_speech_fx_Q0, L_FRAME16k );
@@ -2047,6 +2051,9 @@ static void msvq_interpol_2_fx(
 *-------------------------------------------------------------------*/

static void calculate_Tonality_fx(
#ifdef HARM_FD_BWE
    const Word16 element_mode, /* i  : element mode                               */
#endif
    const Word16 *org,  /* i  : MDCT coefficients of original         Q_new*/
    const Word16 *gen,  /* i  : MDCT coefficients of generated signal   Q15*/
    Word16 *SFM_org,    /* o  : Spectral Flatness results               Q12*/
@@ -2088,8 +2095,12 @@ static void calculate_Tonality_fx(
        }
    }

#ifdef HARM_FD_BWE
    max = 0;
    move16();
    IF( element_mode == EVS_MONO )
    {
#endif
        FOR( n_coeff = 0; n_coeff < length; n_coeff++ )
        {
            gen_spec[n_coeff] = abs_s( gen[n_coeff] );
@@ -2101,6 +2112,23 @@ static void calculate_Tonality_fx(
            }*/
            max = s_max( max, org_spec[n_coeff] );
        }
#ifdef HARM_FD_BWE
    }
    ELSE
    {
        FOR( n_coeff = 0; n_coeff < length; n_coeff++ )
        {
            gen_spec[n_coeff] = abs_s( gen[n_coeff] );
            move16(); /*Q15 */
            /*test();
            if( sub(max,gen_spec[n_coeff]) < 0)
            {
                max = gen_spec[n_coeff];move16();
            }*/
            max = s_max( max, gen_spec[n_coeff] );
        }
    }
#endif
    l_shift = norm_s( max );
    FOR( n_coeff = 0; n_coeff < length; n_coeff++ )
    {
@@ -2420,8 +2448,13 @@ static void energy_control_fx(

    FOR( n_band = 0; n_band < max_band; )
    {
#ifdef HARM_FD_BWE
        calculate_Tonality_fx( st_fx->element_mode, org_fx + swb_bwe_subband[n_band] + offset, SWB_signal_fx + swb_bwe_subband[n_band] + offset,
                               &SFM_org_fx[n_band], &SFM_gen_fx[n_band], swb_bwe_subband[n_band + band_step] - swb_bwe_subband[n_band] );
#else
                calculate_Tonality_fx( org_fx + swb_bwe_subband[n_band] + offset, SWB_signal_fx + swb_bwe_subband[n_band] + offset,
                                       &SFM_org_fx[n_band], &SFM_gen_fx[n_band], swb_bwe_subband[n_band + band_step] - swb_bwe_subband[n_band] );
#endif

        IF( LT_16( SFM_gen_fx[n_band], mult_r( 24576, SFM_org_fx[n_band] ) ) )
        {