亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lpc_lib.c

?? Melp Federal Vocoder 2.4 kbps low bit rate high qualitytexas instrument Melp encoder decoder c-code
?? C
字號:
/*

2.4 kbps MELP Proposed Federal Standard speech coder

version 1.2

Copyright (c) 1996, Texas Instruments, Inc.  

Texas Instruments has intellectual property rights on the MELP
algorithm.  The Texas Instruments contact for licensing issues for
commercial and non-government use is William Gordon, Director,
Government Contracts, Texas Instruments Incorporated, Semiconductor
Group (phone 972 480 7442).

*/

/*

  lpc_lib.c: LPC function library

*/

#include <stdio.h>
#include <math.h>
#include "spbstd.h"
#include "lpc.h"

/* 
    Name: lpc_aejw- Compute square of A(z) evaluated at exp(jw)
    Description:
        Compute the magnitude squared of the z-transform of 
<nf>
        A(z) = 1+a(1)z^-1 + ... +a(p)z^-p
</nf>
        evaluated at z=exp(jw)
     Inputs:
        a- LPC filter (a[0] is undefined, a[1..p])
        w- radian frequency
        p- predictor order
     Returns:
        |A(exp(jw))|^2
     See_Also: cos(3), sin(3)
     Includes:
        spbstd.h
        lpc.h
     Systems and Info. Science Lab
     Copyright (c) 1995 by Texas Instruments, Inc.  All rights reserved.

*/

float lpc_aejw(float *a,float w,int p)
{
    int i;
    float c_re,c_im;
    float cs,sn,tmp;

    if (p==0)
        return(1.);

    /* use horners method
    A(exp(jw)) = 1+ e(-jw)[a(1)+e(-jw)[a(2)+e(-jw)[a(3)+..
            ...[a(p-1)+e(-jw)a(p)]]]]
    */

    cs = (float)cos((double)w);
    sn = -(float)sin((double)w);

    c_re = cs*a[p];
    c_im = sn*a[p];

    for(i=p-1; i > 0; i--)
    {
        /* add a[i] */
        c_re += a[i];

        /* multiply by exp(-jw) */
        c_im = cs*(tmp=c_im) + sn*c_re;
        c_re = cs*c_re - sn*tmp;
    }

    /* add one */
    c_re += 1.0;

    return(SQR(c_re) + SQR(c_im));
} /* LPC_AEJW */

/*
    Name: lpc_bwex- Move the zeros of A(z) toward the origin.
    Aliases: lpc_bw_expand
    Description:
        Expand the zeros of the LPC filter by gamma, which
        moves each zero radially into the origin.
<nf>
        for j = 1 to p
            aw[j] = a[j]*gamma^j
</nf>
        (Can also be used to perform an exponential windowing procedure).
    Inputs:
        a- lpc vector (order p, a[1..p])
        gamma- the bandwidth expansion factor
        p- order of lpc filter
    Outputs:
        aw- the bandwidth expanded LPC filter
    Returns: NULL
    See_Also: lpc_lagw(3l)
    Includes:
        spbstd.h
        lpc.h

    Systems and Info. Science Lab
    Copyright (c) 1995 by Texas Instruments, Inc.  All rights reserved.


*/

int lpc_bwex(float *a, float *aw, float gamma, int p)
{
    int i;
    float gk;

    for(i=1,gk=gamma; i <= p; i++, gk *= gamma)
        aw[i] = a[i]*gk;
    return(0);
}

/*
    Name: lpc_clmp- Sort and ensure minimum separation in LSPs.
    Aliases: lpc_clamp
    Description:
        Ensure that all LSPs are ordered and separated
        by at least delta.  The algorithm isn't guarenteed
        to work, so it prints an error message when it fails
        to sort the LSPs properly.
    Inputs:
        w- lsp vector (order p, w[1..p])
        delta- the clamping factor
        p- order of lpc filter
    Outputs:
        w- the sorted and clamped lsps
    Returns: NULL
    See_Also:
    Includes:
        spbstd.h
        lpc.h
    Bugs: 
        Currently only supports 10 loops, which is too
        complex and perhaps unneccesary.

    Systems and Info. Science Lab
    Copyright (c) 1995 by Texas Instruments, Inc.  All rights reserved.
*
*/

#define MAX_LOOPS 10

int lpc_clmp(float *w, float delta, int p)
{
    int i,j,unsorted;
    float tmp,d,step1,step2;

    /* sort the LSPs- for 10 loops, complexity is approximately 150 p */  
    for (j=0,unsorted=TRUE; unsorted && (j < MAX_LOOPS); j++)
    {
        for(i=1,unsorted=FALSE; i < p; i++)
            if (w[i] > w[i+1])
            {
                tmp = w[i+1];
		w[i+1] = w[i];
		w[i] = tmp;
                unsorted = TRUE;
	    }
    }

    /* ensure minimum separation */
    if (!unsorted) 
    {

        for(j=0; j < MAX_LOOPS; j++)
        {
            for(i=1; i < p; i++)
            {
                if ((d = w[i+1]-w[i]) < delta)
                {
                    step1 = step2 = (delta-d)/2.0;
                    if (i==1 && (w[i] < delta))
                    {
                        step1 = w[i]/2.0;
	            }
                    else if (i > 1)
                    {
                        if ((tmp = w[i] - w[i-1]) < delta)
                            step1 = 0;
                        else if (tmp < 2*delta)
                            step1 = (tmp-delta)/2.0;
		    }
                    if (i==(p-1) && (w[i+1] > (1.0-delta)))
                    {
                        step2 = (1-w[i+1])/2.0;
		    }
                    else if (i < (p-1))
                    {
                        if ((tmp = w[i+2] - w[i+1]) < delta)
                            step2 = 0;
                        else if (tmp < 2*delta)
                            step2 = (tmp-delta)/2.0;
		    }
                    w[i] -= step1;
		    w[i+1] += step2;
	        }
	    }
        }
    }

    /* Debug: check if the minimum separation rule was met */
    for(j=1; j < p; j++)
      if ((w[j+1]-w[j]) < 0.99*delta)
          (void)fprintf(stderr,"%s: LSPs not separated by enough (line %d)\n",
              __FILE__,__LINE__);

    if (unsorted)
        (void)fprintf(stderr,"%s: LSPs still unsorted (line %d)\n",
		      __FILE__,__LINE__);

    return(0);
}

/*
    Name: lpc_schr- Schur recursion (autocorrelations to refl coef)
    Aliases: lpc_schur
    Description:
        Compute reflection coefficients from autocorrelations
        based on schur recursion.  Will also compute predictor
        parameters by calling lpc_refl2pred(3l) if necessary.
    Inputs:
        r- autocorrelation vector (r[0..p]).
        p- order of lpc filter.
    Outputs:
        a-     predictor parameters    (can be NULL)
        k_tmp- reflection coefficients (can be NULL)
    Returns:
        alphap- the minimum residual energy
    Includes:
        spbstd.h
        lpc.h
    See_Also:
        lpc_refl2pred(3l) in lpc.h or lpc(3l)

*/

float lpc_schr(float *r, float *a, float *k_tmp, int p)
{
    int i,j;
    float temp,alphap,*y1,*y2,*k;

    MEM_ALLOC(MALLOC,y1,p+2,float);
    MEM_ALLOC(MALLOC,y2,p+2,float);

    if (k_tmp == NULL)
    {
        MEM_ALLOC(MALLOC,k,p+1,float);
    }
    else
        k = k_tmp;

    k[1] = -r[1]/r[0];
    alphap = r[0]*(1-SQR(k[1]));

    y2[1] = r[1];
    y2[2] = r[0]+k[1]*r[1];

    for(i=2; i <= p; i++)
    {
        y1[1] = temp = r[i];

        for(j=1; j < i; j++)
        {
            y1[j+1] = y2[j] + k[j]*temp;
            temp += k[j]*y2[j];
            y2[j] = y1[j];
        }

        k[i] = -temp/y2[i];
        y2[i+1] = y2[i]+k[i]*temp;
        y2[i] = y1[i];

        alphap *= 1-SQR(k[i]);
    }

    if (a != NULL)
    {
        (void)lpc_refl2pred(k,a,p);
    }
    if (k_tmp == NULL)
    {
        MEM_FREE(FREE,k);
    }

    MEM_FREE(FREE,y2);
    MEM_FREE(FREE,y1);
    return(alphap);
}

/* minimum LSP separation-- a global variable */
float lsp_delta = 0.0;

/* private functions */
static float lsp_g(float x,float *c,int p2);
static int   lsp_roots(float *w,float **c,int p2);

#define DELTA  0.00781250
#define BISECTIONS 4
    

/* LPC_PRED2LSP
      get LSP coeffs from the predictor coeffs
      Input:
         a- the predictor coefficients
         p- the predictor order
      Output:
         w- the lsp coefficients
   Reference:  Kabal and Ramachandran

*/

int lpc_pred2lsp(float *a,float *w,int p)
{
    int i,p2;
    float **c;

    p2 = p/2;

    MEM_2ALLOC(MALLOC,c,2,p2+1,float);
    c[0][p2] = c[1][p2] = 1.0;

    for(i=1; i <= p2; i++)
    {
        c[0][p2-i] = (a[i] + a[p+1-i] - c[0][p2+1-i]);
        c[1][p2-i] = c[1][p2+1-i] + a[i] - a[p+1-i];
    }
    c[0][0] /= 2.0;
    c[1][0] /= 2.0;

    i = lsp_roots(w,c,p2);

    if (i)
    {
        for(i=1; i <= p; i++)
            (void)fprintf(stderr,"%11.7f ",a[i]);
        (void)fprintf(stderr,"\n");
    }

    /* ensure minimum separation and sort */
    (void)lpc_clamp(w,lsp_delta,p);

    MEM_2FREE(FREE,c);
    return(i);
} /* LPC_PRED2LSP */

/* LPC_PRED2REFL
      get refl coeffs from the predictor coeffs
      Input:
         a- the predictor coefficients
         p- the predictor order
      Output:
         k- the reflection coefficients
   Reference:  Markel and Gray, Linear Prediction of Speech
*/

int lpc_pred2refl(float *a,float *k,int p)
{
    float *b,*b1,e;
    int   i,j;

    MEM_ALLOC(MALLOC,b,p+1,float);
    MEM_ALLOC(MALLOC,b1,p+1,float);

    /* equate temporary variables (b = a) */
    for(i=1; i <= p; i++)
        b[i] = a[i];

    /* compute reflection coefficients */
    for(i=p; i > 0; i--)
    {
        k[i] = b[i];
        e = 1 - SQR(k[i]);
        for(j=1; j < i; j++)
            b1[j] = b[j];
        for(j=1; j < i; j++)
            b[j] = (b1[j] - k[i]*b1[i-j])/e;
    }

    MEM_FREE(FREE,b1);
    MEM_FREE(FREE,b);
    return(0);
}
/* LPC_LSP2PRED
      get predictor coefficients from the LSPs
   Synopsis: lpc_lsp2pred(w,a,p)
      Input:
         w- the LSPs
         p- the predictor order
      Output:
         a- the predictor coefficients
   Reference:  Kabal and Ramachandran
*/

int lpc_lsp2pred(float *w,float *a,int p)
{
    int i,j,k,p2;
    float **f,c[2];

    /* ensure minimum separation and sort */
    (void)lpc_clamp(w,lsp_delta,p);

    p2 = p/2;
    MEM_2ALLOC(MALLOC,f,2,p2+1,float);
    f[0][0] = f[1][0] = 1.0;
    f[0][1] = (float)-2.0*cos((double)w[1]*M_PI);
    f[1][1] = (float)-2.0*cos((double)w[2]*M_PI);

    k = 3;

    for(i=2; i <= p2; i++)
    {
        c[0] = (float)-2.0*cos((double)w[k++]*M_PI);
        c[1] = (float)-2.0*cos((double)w[k++]*M_PI);
        f[0][i] = f[0][i-2];
        f[1][i] = f[1][i-2];

        for(j=i; j >= 2; j--)
        {
            f[0][j] += c[0]*f[0][j-1]+f[0][j-2];
            f[1][j] += c[1]*f[1][j-1]+f[1][j-2];
        }
        f[0][1] += c[0]*f[0][0];
        f[1][1] += c[1]*f[1][0];
    }

    for(i=p2; i > 0; i--)
    {
        f[0][i] += f[0][i-1];
        f[1][i] -= f[1][i-1];

        a[i] = 0.50*(f[0][i]+f[1][i]);
        a[p+1-i] = 0.50*(f[0][i]-f[1][i]);
    }

    MEM_2FREE(FREE,f);
    return(0);
}

/* LPC_REFL2PRED
      get predictor coefficients from the reflection coeffs

      Input:
         k- the reflection coeffs
         p- the predictor order
      Output:
         a- the predictor coefficients
   Reference:  Markel and Gray, Linear Prediction of Speech
*/

int lpc_refl2pred(float *k,float *a,int p)
{
    int   i,j;

    float *a1;

    MEM_ALLOC(MALLOC,a1,p+1,float);

    for(i=1; i <= p; i++)
    {
        /* refl to a recursion */
        a[i] = k[i];
        for(j=1; j < i; j++)
            a1[j] = a[j];
        for(j=1; j < i; j++)
            a[j] = a1[j] + k[i]*a1[i-j];
    }

    MEM_FREE(FREE,a1);

    return(0);

} /* LPC_REFL2PRED */

/* G - compute the value of the Chebychev series
                sum c_k T_k(x) = x b_1(x) - b_2(x) + c_0
                b_k(x) = 2x b_{k+1}(x) - b_{k+2}(x) + c_k */
static float lsp_g(float x,float *c,int p2)
{
    int i;
    float b[3];

    b[1] = b[2] = 0.0;

    for(i=p2; i > 0; i--)
    {
        b[0] = 2.0*x*b[1] - b[2] + c[i];
        b[2] = b[1];
        b[1] = b[0];
    }
    b[0] = x*b[1]-b[2]+c[0];
    return(b[0]);
} /* G */

/* LSP_ROOTS
        - find the roots of the two polynomials G_1(x) and G_2(x)
          the first root corresponds to G_1(x)
          compute the inverse cos (and these are the LSFs) */
static int lsp_roots(float *w,float **c,int p2)
{
    int i,k;
    float x,x0,x1,y,*ptr,g0,g1;

    w[0] = 0.0;

    ptr = c[0];
    x = 1.0;
    g0 = lsp_g(x,ptr,p2);

    for(k=1,x = 1.0-DELTA; x > -DELTA-1.0; x -= DELTA)
    {
        /* Search for a zero crossing */
        if (g0*(g1 = lsp_g(x,ptr,p2)) <= 0.0)
        {
            /* Search Incrementally using bisection */
            x0 = x+DELTA;
            x1 = x;

            for(i=0; i < BISECTIONS; i++)
            {
                x = (x0+x1)/2.0;
                y = lsp_g(x,ptr,p2);

                if(y*g0 < 0.0)
                {
                    x1 = x;
                    g1 = y;
                }
                else
                {
                    x0 = x;
                    g0 = y;
                }
            }
            /* Linear interpolate */
            x = (g1*x0-g0*x1)/(g1-g0);

            /* Evaluate the LSF */
            w[k] = (float)acos((double)x)/M_PI;

            ptr = c[k % 2];
            k++;
            if (k > 2*p2)
                return(0);
            g1 = lsp_g(x,ptr,p2);
        }
        g0 = g1;
    }
    (void)fprintf(stderr,"\n Error(lsp_roots): LSPs Not All Found\n");
    return(1);
} /* LSP_ROOTS */

/*
    Name: lpc_syn- LPC synthesis filter.
    Aliases: lpc_synthesis
    Description:
        LPC all-pole synthesis filter
<nf>
        for j = 0 to n-1
            y[j] = x[j] - sum(k=1 to p) y[j-k] a[k]
</nf>

    Inputs:
        x- input vector (n samples, x[0..n-1])
        a- lpc vector (order p, a[1..p])
        p- order of lpc filter
        n- number of elements in vector which is to be filtered
        y[-p..-1]- filter memory (past outputs)
    Outputs:
        y- output vector (n samples, y[0..n-1])
    Returns: NULL
    Includes:
        spbstd.h
        lpc.h

    Systems and Info. Science Lab
    Copyright (c) 1995 by Texas Instruments, Inc.  All rights reserved.

*/

int lpc_syn(float *x,float *y,float *a,int p,int n)
{
    int i,j;

    for(j=0; j < n; j++)
    {
        for(i=p,y[j]=x[j]; i > 0; i--)
            y[j] -= y[j-i]*a[i];
    }
    return(0);
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人精品电影在线观看| 国产乱人伦偷精品视频免下载| 精品国产伦一区二区三区观看体验 | 日韩和欧美的一区| 日韩视频不卡中文| 综合久久综合久久| 精品一二三四区| 91国偷自产一区二区开放时间| 久久精品人人爽人人爽| 欧美精品日日鲁夜夜添| www.视频一区| 欧美亚洲自拍偷拍| 久久久精品免费免费| 99久久精品国产一区二区三区 | 久久精品人人做人人综合| 91精品国产全国免费观看| 美女视频一区二区三区| 亚洲摸摸操操av| 国产欧美一区视频| 日韩一区和二区| 91麻豆精品国产91久久久更新时间 | 日本伦理一区二区| 久久免费午夜影院| 亚洲国产综合在线| 91精品国产免费久久综合| 美国十次了思思久久精品导航| 国产欧美一区二区精品仙草咪| 色悠悠久久综合| 极品少妇xxxx精品少妇| 亚洲欧美另类图片小说| 日韩欧美国产一区在线观看| 91蜜桃网址入口| 成人毛片在线观看| 日韩激情中文字幕| 亚洲国产精品自拍| 成人免费在线观看入口| 2023国产精品自拍| 51精品久久久久久久蜜臀| 91亚洲大成网污www| 国产一区二区精品久久99| 视频一区二区三区入口| 一区二区三区中文字幕电影 | 99久久婷婷国产| 国产一区二区0| 国产乱码精品一品二品| 色综合天天综合色综合av | 亚洲国产欧美在线人成| 精品亚洲porn| 久久久亚洲欧洲日产国码αv| 成人黄色片在线观看| 麻豆91在线播放免费| 免费人成精品欧美精品| 免费成人av资源网| 男女男精品视频| 狠狠色丁香久久婷婷综| 狠狠久久亚洲欧美| 久久国产三级精品| 精品一区中文字幕| 成人午夜av电影| av高清不卡在线| 欧美视频中文一区二区三区在线观看| 成人91在线观看| 欧美日韩成人在线一区| 欧美一二三四区在线| 国产精品乱人伦中文| 成人免费在线视频| 日本不卡一二三区黄网| 国产v综合v亚洲欧| 在线观看日韩毛片| 精品国产a毛片| 中文av一区二区| 日韩精品欧美精品| 国产福利一区二区三区在线视频| www.亚洲色图.com| 欧美一级片在线| 亚洲同性gay激情无套| 午夜精品福利视频网站| 成熟亚洲日本毛茸茸凸凹| 欧美日韩大陆在线| 欧美激情中文不卡| 青青青伊人色综合久久| 成人免费视频一区| 精品sm在线观看| 精品亚洲aⅴ乱码一区二区三区| 99精品1区2区| 日本一区二区三区在线不卡| 天天免费综合色| 欧美在线观看一区二区| 国产精品成人在线观看| 精品亚洲porn| 日韩网站在线看片你懂的| 亚洲一区二区三区美女| 91亚洲精品一区二区乱码| 久久久久久久久免费| 久久精品国产精品亚洲红杏| 欧美日韩在线不卡| 午夜精品在线看| 精品视频1区2区3区| 亚洲成人在线网站| 日韩区在线观看| 国产乱码精品一区二区三区忘忧草| 日韩一级黄色大片| 久久成人免费日本黄色| 26uuu欧美日本| 国产精品亚洲专一区二区三区| 欧美r级在线观看| 成人免费看片app下载| 欧美激情中文不卡| 91成人看片片| 蜜臀久久久99精品久久久久久| 日韩欧美一级在线播放| 国产一区二区在线看| 国产精品久久网站| 在线亚洲高清视频| 经典三级一区二区| 亚洲日韩欧美一区二区在线| 欧美群妇大交群的观看方式| 久久精工是国产品牌吗| 亚洲同性同志一二三专区| 欧美日韩色综合| 国产99一区视频免费| 亚洲国产日产av| 国产色一区二区| 欧美日韩精品一二三区| av在线一区二区三区| 丝袜亚洲另类欧美综合| 中文字幕二三区不卡| 欧美一区二区二区| 色欧美片视频在线观看| 国产精品中文字幕欧美| 三级影片在线观看欧美日韩一区二区 | 一区二区三区日韩精品视频| 日韩亚洲国产中文字幕欧美| 91官网在线观看| 懂色中文一区二区在线播放| 日本不卡的三区四区五区| 麻豆精品一区二区| 成人激情小说网站| 亚洲成人免费在线观看| 国产欧美精品日韩区二区麻豆天美| 欧美一区二区三区免费在线看 | 欧美激情在线免费观看| 国产精品视频第一区| 一区二区成人在线视频| 毛片av中文字幕一区二区| 国产精品自在欧美一区| 国产精品自拍av| 色婷婷综合久久久久中文| 欧美日韩亚洲综合在线| 精品日韩在线观看| 久久久久亚洲综合| 综合久久久久久| 午夜精品福利视频网站| 日本伊人午夜精品| 国产成人av电影在线播放| 一道本成人在线| 精品国产一区二区三区久久影院 | 99re8在线精品视频免费播放| 色哟哟亚洲精品| 日韩欧美久久久| 国产三级一区二区三区| 亚洲女人的天堂| 五月婷婷综合在线| 国产成人av网站| 91精品国产一区二区| 亚洲色图在线看| 国产成人精品亚洲777人妖 | 久久婷婷久久一区二区三区| 一区二区三区四区在线免费观看 | 亚洲一卡二卡三卡四卡无卡久久 | 国产精品一二三四区| 欧美久久久久久久久| 亚洲色图在线看| 国产馆精品极品| 精品日产卡一卡二卡麻豆| 亚洲国产精品久久人人爱| 91首页免费视频| 国产精品热久久久久夜色精品三区| 日本免费在线视频不卡一不卡二| 99视频国产精品| 国产日韩在线不卡| 日韩成人av影视| 欧美日韩黄视频| 一区二区日韩av| 色94色欧美sute亚洲13| 国产精品乱码人人做人人爱| 看电视剧不卡顿的网站| 久久精品日韩一区二区三区| 国产毛片精品一区| 国产精品第一页第二页第三页| 99视频精品免费视频| 亚洲va欧美va国产va天堂影院| 日韩欧美中文字幕一区| 成人黄色大片在线观看| 亚洲成人av电影| 国产精品久久精品日日| 91精品国产免费久久综合| 9i在线看片成人免费| 亚洲精品视频观看| 欧美日韩你懂得|