Commit a64339e0 authored by Manuel Jander's avatar Manuel Jander
Browse files

Merge remote-tracking branch 'origin' into 3gpp_issue_1348_fix

parents d674b7d8 858df806
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1418,7 +1418,8 @@ void highband_exc_dct_in_ivas_fx(
            envelop_modify_fx( exc_diffQ, seed_tcx, last_bin, Ener_per_bd_iQ, *Q_exc, &Q_hb_exc );
#ifdef REMOVE_EVS_DUPLICATES
            test();
            IF( GT_16( *Q_exc, Q_hb_exc ) && GT_16( element_mode, EVS_MONO ) )
            test();
            IF( GT_16( *Q_exc, Q_hb_exc ) && GT_16( element_mode, EVS_MONO ) && exc_wo_nf != NULL )
#else
            IF( GT_16( *Q_exc, Q_hb_exc ) )
#endif
+1 −1
Original line number Diff line number Diff line
@@ -1114,7 +1114,7 @@ static void lsp_reorder(
    {
        lsp[i] = s_max( lsp[i], lsp_min );
        move16();
        lsp_min = add( lsp[i], min_dist );
        lsp_min = add_sat( lsp[i], min_dist );
    }

    /* Reverify the LSF ordering and minimum GAP in the reverse order (security) */
+11 −32
Original line number Diff line number Diff line
@@ -450,17 +450,16 @@ void TonalMDCTConceal_SaveFreqSignal_ivas_fx(
    IF( ( nNewSamples > 0 ) && ( LE_16( nNewSamples, 2 * L_FRAME_MAX ) ) )
    {
        /* Store new data */
        hTonalMDCTConc->last_block_nrg = 0;
        move32();

        Word64 W_tmp = 0;
        move64();
        FOR( i = 0; i < infoIGFStartLine; i++ )
        {
            Word16 tmp = extract_h( mdctSpectrum[i] );
            hTonalMDCTConc->last_block_nrg = L_add( hTonalMDCTConc->last_block_nrg,
                                                    L_shr( L_mult0( tmp, tmp ), 16 ) ); // Q31-last_block_nrg_exp
            move32();
            W_tmp = W_mac_32_16( W_tmp, Mpy_32_32( mdctSpectrum[i], mdctSpectrum[i] ), 1 ); // exp: mdctSpectrum_exp + mdctSpectrum_exp - 1
        }
        hTonalMDCTConc->last_block_nrg_exp = sub( 31, sub( shl( sub( 15, mdctSpectrum_exp ), 1 ), 16 ) );
        s = W_norm( W_tmp );
        hTonalMDCTConc->last_block_nrg = W_extract_h( W_shl( W_tmp, s ) ); // exp:add( sub( shl( mdctSpectrum_exp, 1 ), s ), 31 )
        move32();
        hTonalMDCTConc->last_block_nrg_exp = add( sub( shl( mdctSpectrum_exp, 1 ), s ), 31 );
        move16();

        /* Store new data */
@@ -1765,32 +1764,12 @@ void TonalMDCTConceal_InsertNoise_ivas_fx(
        test();
        IF( GT_32( hTonalMDCTConc->faded_signal_nrg, 0 ) && flag )
        {
            Word16 num_exp, den_exp;
            Word32 num, den;
            Word16 num_exp;
            Word32 num;

            num = BASOP_Util_Add_Mant32Exp( hTonalMDCTConc->last_block_nrg, hTonalMDCTConc->last_block_nrg_exp, L_negate( last_block_nrg_correct ), last_block_nrg_correct_e, &num_exp ); // Q31-num_exp

            den = hTonalMDCTConc->faded_signal_nrg; // Q31 - hTonalMDCTConc->faded_signal_nrg_exp
            move32();
            den_exp = hTonalMDCTConc->faded_signal_nrg_exp;
            move16();

            ld = norm_l( num );
            num = L_shl( num, ld ); // Q31-num_exp + ld
            num_exp = sub( num_exp, ld );

            ld = norm_l( den );
            den = L_shl( den, ld ); // Q31-den_exp + ld
            den_exp = sub( den_exp, ld );

            exp = sub( num_exp, den_exp );

            IF( GT_32( num, den ) )
            {
                num = L_shr( num, 1 ); // Q31- exp -1
                exp = add( exp, 1 );
            }
            tmp = div_l( num, extract_h( den ) );
            tmp = BASOP_Util_Divide3232_Scale( num, hTonalMDCTConc->faded_signal_nrg, &exp );
            exp = add( exp, sub( num_exp, hTonalMDCTConc->faded_signal_nrg_exp ) );
            tmp = Sqrt16( tmp, &exp );

            FOR( i = 0; i < crossOverFreq; i++ )
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ ivas_error TDREND_REND_RenderSourceHRFilt_fx(
    TDREND_firfilt_fx( RightOutputFrame_fx, Src_p->hrf_right_prev_fx, right_filter_e, hrf_right_delta_fx, intp_count, Src_p->mem_hrf_right_fx, subframe_length, Src_p->filterlength, Src_p->Gain_fx, Src_p->prevGain_fx );

    Src_p->prevGain_fx = Src_p->Gain_fx;
    move16();
    move32();

    /* Copy to accumulative output frame */
    v_add_32( LeftOutputFrame_fx, output_buf_fx[0], output_buf_fx[0], subframe_length );  // Same Q as Src_p->InputFrame_p_fx Q11
+10 −10
Original line number Diff line number Diff line
@@ -278,8 +278,8 @@ void TDREND_firfilt_fx(
    Word32 *mem_fx,                /* i/o: filter memory                    Qx */
    const Word16 subframe_length,  /* i  : Length of signal                 Q0 */
    const Word16 filterlength,     /* i  : Filter length                    Q0 */
    const Word16 Gain_fx,          /* i  : Gain                            Q14 */
    const Word16 prevGain_fx       /* i  : Previous gain                   Q14 */
    const Word32 Gain_fx,          /* i  : Gain                            Q30 */
    const Word32 prevGain_fx       /* i  : Previous gain                   Q30 */
)
{
    /* NOTE: this function is implemented with the assumption that the exponent/Q-factor of input signal will not change. */
@@ -289,15 +289,15 @@ void TDREND_firfilt_fx(
    Word32 *p_filter_fx;                                                      // exp(filter_e)
    Word16 i, j;
    Word32 tmp_fx;
    Word16 step_fx /* Q15 */, gain_tmp_fx /* Q15 */, gain_delta_fx /* Q14 */;
    Word32 step_fx /* Q31 */, gain_tmp_fx /* Q31 */, gain_delta_fx /* Q30 */;
    Word16 tmp_e;
    Word64 tmp64_fx;

    gain_delta_fx = sub( Gain_fx, prevGain_fx );                                     // Q14
    step_fx = BASOP_Util_Divide1616_Scale( gain_delta_fx, subframe_length, &tmp_e ); // exp(tmp_e)
    tmp_e = sub( tmp_e, Q14 );
    step_fx = shl_sat( step_fx, tmp_e );     // Q15
    gain_tmp_fx = shl_sat( prevGain_fx, 1 ); // Q15
    gain_delta_fx = L_sub( Gain_fx, prevGain_fx );                                                  // Q30
    step_fx = L_deposit_h( BASOP_Util_Divide3232_Scale( gain_delta_fx, subframe_length, &tmp_e ) ); // exp(tmp_e)
    tmp_e = sub( tmp_e, Q30 );
    step_fx = L_shl_sat( step_fx, tmp_e );     // Q31
    gain_tmp_fx = L_shl_sat( prevGain_fx, 1 ); // Q31

    /* Handle memory */
    p_signal_fx = buffer_fx + sub( filterlength, 1 );                                                                                        // Qx
@@ -328,8 +328,8 @@ void TDREND_firfilt_fx(
        tmp_fx = W_extract_h( tmp64_fx );       // Qx

        /* Apply linear gain interpolation in case of abrupt gain changes */
        gain_tmp_fx = add( gain_tmp_fx, step_fx );         // Q15
        signal_fx[i] = Mpy_32_16_1( tmp_fx, gain_tmp_fx ); // Qx
        gain_tmp_fx = L_add_sat( gain_tmp_fx, step_fx ); /* Saturating values which just exceeds 1, Q31*/
        signal_fx[i] = Mpy_32_32( tmp_fx, gain_tmp_fx ); // Qx
        move32();
        IF( LT_16( i, intp_count ) )
        {
Loading