Commit ea24b53a authored by vaclav's avatar vaclav
Browse files

HARM_LEV_DURBIN

parent f4896dcb
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ Word16 get_next_coeff_unmapped(
    return *idx;
}

Word16 update_mixed_context(
Word16 update_mixed_context_fx(
    Word16 ctx, /* Q0 */
    Word16 a    /* Q0 */
)
@@ -78,7 +78,7 @@ Word16 update_mixed_context(
    return add( shl( s_and( ctx, 0xf ), 4 ), add( t, 13 ) );
}

Word32 update_mixed_context_ivas_fx(
Word32 update_mixed_context_fx_32(
    Word32 ctx, /* Q0 */
    Word16 a    /* Q0 */
)
+1 −1
Original line number Diff line number Diff line
@@ -2995,7 +2995,7 @@ void lpc_from_spectrum(

    /* LPC */

    E_LPC_lev_dur( r_h, r_l, A, NULL, lpcorder, NULL );
    E_LPC_lev_dur_fx( r_h, r_l, A, NULL, lpcorder, NULL );
}

/*
+52 −16
Original line number Diff line number Diff line
@@ -446,12 +446,18 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word
 * Returns:
 *    void
 */
Word16 E_LPC_lev_dur( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/ )
{
    return ( E_LPC_lev_dur_stab( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
}

Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/, Word16 k_max /*Q15*/ )
static Word16 E_LPC_lev_dur_stab(
#ifdef HARM_LEV_DURBIN
    const Word16 element_mode,
#endif
    const Word16 Rh[] /*QR -16*/,
    const Word16 Rl[] /*QR -1*/,
    Word16 A[] /*Qx*/,
    Word32 epsP[] /*QR*/,
    const Word16 order,
    Word16 *mem /*Qx*/,
    Word16 k_max /*Q15*/ )
{
    Word16 i, j, k;
    Word16 hi, lo;
@@ -608,7 +614,19 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
        t0 = L_Comp( Ah[i], Al[i] );
        t1 = L_max( t1, L_abs( t0 ) );
    }

#ifdef HARM_LEV_DURBIN
    IF( element_mode == EVS_MONO )
    {
        k = s_min( norm_l( t1 ), 3 );
    }
    ELSE
    {
        k = s_min( sub( norm_l( t1 ), 1 ), 3 );
    }
#else
    k = s_min( norm_l( t1 ), 3 );
#endif
    A[0] = shl( 2048, k );
    move16();
    FOR( i = 1; i <= order; i++ )
@@ -632,16 +650,20 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
        }
    }


    return ( flag );
}

Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem )
Word16 E_LPC_lev_dur_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/ )
{
    return ( E_LPC_lev_dur_stab_ivas_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#ifdef HARM_LEV_DURBIN
    return ( E_LPC_lev_dur_stab( EVS_MONO, Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#else
    return ( E_LPC_lev_dur_stab( Rh, Rl, A, epsP, order, mem, 32750 ) );         /* 0.99945 in Q15 */
#endif
}

Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem, Word16 k_max )
#ifndef HARM_LEV_DURBIN
static Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem, Word16 k_max )
{
    Word16 i, j, k;
    Word16 hi, lo;
@@ -822,16 +844,27 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
        }
    }


    return ( flag );
}

Word16 E_LPC_lev_dur_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/ )
#endif
Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem )
{
    return ( E_LPC_lev_dur_stab_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#ifdef HARM_LEV_DURBIN
    return ( E_LPC_lev_dur_stab( IVAS_SCE /* just to differentiate from EVS_MONO */, Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#else
    return ( E_LPC_lev_dur_stab_ivas_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#endif
}

Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/, Word16 k_max /*Q15*/ )

static Word16 E_LPC_lev_dur_stab_fx_32(
    const Word16 Rh[] /*QR -16*/,
    const Word16 Rl[] /*QR -1*/,
    Word32 A[] /*QA*/,
    Word32 epsP[] /*QR*/,
    const Word16 order,
    Word32 *mem /*QA*/,
    Word16 k_max /*Q15*/ )
{
    Word16 i, j, k;
    Word16 hi, lo;
@@ -965,7 +998,6 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
        lo = L_Extract_lc( t0, &hi );           /* DPF format      */
        t0 = Mpy_32( alp_h, alp_l, hi, lo );    /* Alpha in Q31    */


        /* store denormalized alpha in epsP */
        t1 = L_shr( t0, alp_exp );
        if ( epsP != NULL )
@@ -1012,10 +1044,14 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
        }
    }


    return ( flag );
}

Word16 E_LPC_lev_dur_fx_32( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/ )
{
    return ( E_LPC_lev_dur_stab_fx_32( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
}


/*
 * E_LPC_a_add_tilt
+3 −3
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ Word16 lsp_convert_poly_fx(
        powerspect_fx( grid50_fx, N50, R, S, G, DOWNCONV );
        spectautocorr_fx( grid40_fx, N40, G, rh, rl );
    }

    /*---------------------------------------------------------------------*
     * Conversion from 12.8 kHz up to 16.0 kHz.
     * Compute the power spectrum of the LP filter, extrapolate the
@@ -125,14 +126,13 @@ Word16 lsp_convert_poly_fx(
        spectautocorr_fx( grid50_fx, N50, G, rh, rl );
    }


    /*---------------------------------------------------------------------*
     * Compute the linear prediction coefficients from the autocorrelation
     * and convert to line spectrum pairs.
     *---------------------------------------------------------------------*/
    flag = E_LPC_lev_dur( rh, rl, A, epsP, M, oldA );
    E_LPC_a_lsp_conversion( A, w, stable_LSP_fx, M );

    flag = E_LPC_lev_dur_fx( rh, rl, A, epsP, M, oldA );
    E_LPC_a_lsp_conversion( A, w, stable_LSP_fx, M );

    return ( flag );
}
+2 −2
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q

        /* Levinson-Durbin */
        set16_fx( mem_lev_fx, 0, 18 );
        E_LPC_lev_dur( r_fx_h, r_fx_l, A_fx, LepsP, M, NULL );
        E_LPC_lev_dur_fx( r_fx_h, r_fx_l, A_fx, LepsP, M, NULL );

        Copy_Scale_sig( A_fx, A_fx, M + 1, sub( norm_s( A_fx[0] ), 2 ) );

@@ -472,7 +472,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */

        /* Levinson-Durbin */
        set16_fx( mem_lev_fx, 0, 18 );
        E_LPC_lev_dur( r_fx_h, r_fx_l, A_fx, LepsP, M, NULL );
        E_LPC_lev_dur_fx( r_fx_h, r_fx_l, A_fx, LepsP, M, NULL );

        Copy_Scale_sig( A_fx, A_fx, M + 1, sub( norm_s( A_fx[0] ), 2 ) );

Loading