Commit d1ea23bf authored by Jiaquan Huo's avatar Jiaquan Huo
Browse files

further code cleanup

parent cc42669c
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ static int16_t lfeplc_lev_dur(
    err = r[0] + r[1] * rc[0];

    memcpy(a_out, a, sizeof(a));
    memset(epsP, 0, sizeof(*epsP) * LFE_PLC_LPCORD);

    if ( epsP != NULL )
    {
@@ -112,7 +113,7 @@ static int16_t lfeplc_lev_dur(
        }

        rc[i - 1] = ( -s ) / err;
        if ( fabs( rc[i - 1] ) > 0.99945f )
        if ( fabsf( rc[i - 1] ) > 0.99945f )
        {
            flag = 1; /* Test for unstable filter. If unstable keep old A(z) */
            return flag;
@@ -283,22 +284,22 @@ static float find_max_delta(

        if ( !stable )
        {
            if ( fabs( eps ) > EPS_STOP )
            if ( fabsf( eps ) > EPS_STOP )
            {
                eps = -fabs( eps ) * fac;
                eps = -fabsf( eps ) * fac;
            }
            else
            {
                eps = -fabs( eps );
                eps = -fabsf( eps );
            }
        }
        else
        {
            if ( fabs( eps ) < EPS_STOP )
            if ( fabsf( eps ) < EPS_STOP )
            {
                break;
            }
            eps = fabs( eps ) * fac;
            eps = fabsf( eps ) * fac;
        }
    }

@@ -341,11 +342,20 @@ static void recover_samples(
        fac *= att;
    }

    printf("LPC filter coefs: %.10f", a[0]);
    for ( i = 1; i <= LFE_PLC_LPCORD; i++ )
    {
        a[i] = a[i] * fac;
        fac *= att * ( 1.0f + delta );
        printf(", %.10f", a[i]);
    }
    printf("\n");
    printf("Pred erros: %.10f", pee[0]);
    for ( i = 1; i <= LFE_PLC_LPCORD; i++ )
    {
        printf(", %.10f", pee[i]);
    }
    printf("\n");

    set_zero( zeroes, LFE_PLC_RECLEN );
    syn_filt( a, LFE_PLC_LPCORD, zeroes, rec_frame, LFE_PLC_RECLEN, outbuf + LFE_PLC_BUFLEN - LFE_PLC_LPCORD, 0 );