⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pitsyn.c,v

📁 lpc10-15为美军2400bps语音压缩标准的C语音源代码。
💻 C,V
📖 第 1 页 / 共 2 页
字号:
/* Note that all of the 180 values in the table are really LFRAME, but *//* 180 has fewer characters, and it makes the table a little more *//* concrete.  If LFRAME is ever changed, keep this in mind.  Similarly, *//* 135's are 3*LFRAME/4, and 45's are LFRAME/4.  If LFRAME is not a *//* multiple of 4, then the 135 for NL-JSAMP is actually LFRAME-LFRAME/4, *//* and the 45 for NL-JSAMP is actually LFRAME-3*LFRAME/4. *//* Note that LSAMP-JSAMP is given as the variable.  This was just for *//* brevity, to avoid adding "+JSAMP" to all of the column entries. *//* Similarly for NL-JSAMP. *//* Variable    | 000  001    011,010  111       110       100,101 *//* ------------+-------------------------------------------------- *//* ISTART      | 1    NL+1   NL+1     1         1         1 *//* LSAMP-JSAMP | 180  180    180      180       135       45 *//* IPITO       | 45   PITCH  PITCH    oldPITCH  oldPITCH  oldPITCH *//* SLOPE       | 0    0      0        seebelow  0         0 *//* JUSED       | 0    NL     NL       0         0         0 *//* PITCH       | 45   PITCH  PITCH    PITCH     PITCH     PITCH *//* NL-JSAMP    | --   135    45       --        --        -- *//* VFLAG       | 0    0      0        0         1         1 *//* NOUT        | 0    2      2        0         0         0 *//* IVOICE      | 0    1      1        1         1         1 *//* while_loop  | once once   once     once      twice     twice *//* ISTART      | --   --     --       --        JUSED+1   JUSED+1 *//* LSAMP-JSAMP | --   --     --       --        180       180 *//* IPITO       | --   --     --       --        oldPITCH  oldPITCH *//* SLOPE       | --   --     --       --        0         0 *//* JUSED       | --   --     --       --        ??        ?? *//* PITCH       | --   --     --       --        PITCH     PITCH *//* NL-JSAMP    | --   --     --       --        --        -- *//* VFLAG       | --   --     --       --        0         0 *//* NOUT        | --   --     --       --        ??        ?? *//* IVOICE      | --   --     --       --        0         0 *//* UVPIT is always 0.0 on the first pass through the DO WHILE (.TRUE.) *//* loop below. *//* The only possible non-0 value of SLOPE (in column 111) is *//* (PITCH-IPITO)/FLOAT(LSAMP) *//* Column 101 is identical to 100.  Any good properties we can prove *//* for 100 will also hold for 101.  Similarly for 010 and 011. *//* SYNTHS calls this subroutine with PITCH restricted to the range 20 to *//* 156.  IPITO is similarly restricted to this range, after the first *//* call.  IP below is also restricted to this range, given the *//* definitions of IPITO, SLOPE, UVPIT, and that I is in the range ISTART *//* to LSAMP. */	while(TRUE_) {/*             JUSED is the total length of all pitch periods currently *//*             in the output arrays, in samples. *//*             An invariant of the DO I = ISTART,LSAMP loop below, under *//*             the condition that IP is always in the range 1 through *//*             MAXPIT, is: *//*             (I - MAXPIT) .LE. JUSED .LE. (I-1) *//*             Note that the final value of I is LSAMP+1, so that after *//*             the DO loop is complete, we know: *//*             (LSAMP - MAXPIT + 1) .LE. JUSED .LE. LSAMP */	    i__1 = lsamp;	    for (i__ = istart; i__ <= i__1; ++i__) {		r__1 = *ipito + slope * i__;		ip = r__1 + .5f;		if (uvpit != 0.f) {		    ip = uvpit;		}		if (ip <= i__ - jused) {		    ++(*nout);/*                   The following check is no longer necessary, now that *//*                   we can prove that NOUT will never go over 16. *//* 		    IF (NOUT .GT. 16) STOP 'PITSYN: too many epochs' */		    ipiti[*nout] = ip;		    *pitch = ip;		    ivuv[*nout] = ivoice;		    jused += ip;		    prop = (jused - ip / 2) / (real) lsamp;		    i__2 = *order;		    for (j = 1; j <= i__2; ++j) {			alro = log((rco[j - 1] + 1) / (1 - rco[j - 1]));			alrn = log((rc[j] + 1) / (1 - rc[j]));			xxy = alro + prop * (alrn - alro);			xxy = exp(xxy);			rci[j + *nout * rci_dim1] = (xxy - 1) / (xxy + 1);		    }		    rmsi[*nout] = log(*rmso) + prop * (log(*rms) - log(*rmso));		    rmsi[*nout] = exp(rmsi[*nout]);		}	    }	    if (vflag != 1) {		goto L100;	    }/*             I want to prove what range UVPIT must lie in after the *//*             assignments to it below.  To do this, I must determine *//*             what range (LSAMP-ISTART) must lie in, after the *//*             assignments to ISTART and LSAMP below. *//*             Let oldLSAMP be the value of LSAMP at this point in the *//*             execution.  This is 135+JSAMP in state 110, or 45+JSAMP in *//*             states 100 or 101. *//*             Given the loop invariant on JUSED above, we know that: *//*             (oldLSAMP - MAXPIT + 1) .LE. JUSED .LE. oldLSAMP *//*             ISTART is one more than this. *//*             Let newLSAMP be the value assigned to LSAMP below.  This *//*             is 180+JSAMP.  Thus (newLSAMP-oldLSAMP) is either 45 or *//*             135, depending on the state. *//*             Thus, the range of newLSAMP-ISTART is: *//*             (newLSAMP-(oldLSAMP+1)) .LE. newLSAMP-ISTART *//*             .LE. (newLSAMP-(oldLSAMP - MAXPIT + 2)) *//*             or: *//*             46 .LE. newLSAMP-ISTART .LE. 133+MAXPIT .EQ. 289 *//*             Therefore, UVPIT is in the range 23 to 144 after the first *//*             assignment to UVPIT below, and after the conditional *//*             assignment, it is in the range 23 to 90. *//*             The important thing is that it is in the range 20 to 156, *//*             so that in the loop above, IP is always in this range. */	    vflag = 0;	    istart = jused + 1;	    lsamp = *lframe + *jsamp;	    slope = 0.f;	    ivoice = 0;	    uvpit = (real) ((lsamp - istart) / 2);	    if (uvpit > 90.f) {		uvpit /= 2;	    }	    *rmso = *rms;	    i__1 = *order;	    for (i__ = 1; i__ <= i__1; ++i__) {		rc[i__] = yarc[i__ - 1];		rco[i__ - 1] = yarc[i__ - 1];	    }	}L100:	*jsamp = lsamp - jused;    }/*       Given that the maximum pitch period MAXPIT .LT. LFRAME (this is *//*       currently true on every call, since SYNTHS always sets *//*       LFRAME=180), NOUT will always be .GE. 1 at this point. */    if (*nout != 0) {	*ivoico = voice[2];	*ipito = *pitch;	*rmso = *rms;	i__1 = *order;	for (i__ = 1; i__ <= i__1; ++i__) {	    rco[i__ - 1] = rc[i__];	}    }    return 0;} /* pitsyn_ */@1.1log@Initial revision@text@d3 4a6 1$Log$d11 1a11 2extern int pitsyn_(integer *order, integer *voice, integer *pitch, real *rms, real *rc, integer *lframe, integer *ivuv, integer *ipiti, real *rmsi, real *rci, integer *nout, real *ratio);extern int initpitsyn_(void);d25 4a28 1/* $Log: pitsyn.f,v $ */d86 1a86 1/* Subroutine */ int pitsyn_0_(int n__, integer *order, integer *voice, d88 2a89 1	integer *ipiti, real *rmsi, real *rci, integer *nout, real *ratio)d93 2a94 2    static real rmso = 1.f;    static logical first = TRUE_;d106 1a106 1    static integer jsamp;d108 1a108 1    static integer ipito;d111 1a111 1    static integer ivoico;d113 1a113 1    static real rco[10];d117 4a120 1/* $Log: config.fh,v $ */d187 6a192 3    switch(n__) {	case 1: goto L_initpitsyn;	}d197 2a198 2    if (rmso < 1.f) {	rmso = 1.f;d201 2a202 2    *ratio = *rms / (rmso + 8.f);    if (first) {d209 1a209 1	jsamp = *lframe - *nout * *pitch;d230 1a230 1	first = FALSE_;d233 2a234 2	lsamp = *lframe + jsamp;	slope = (*pitch - ipito) / (real) lsamp;d238 1a238 1	if (voice[1] == ivoico && voice[2] == voice[1]) {d242 1a242 1		ipito = *pitch;d244 1a244 1		    rmso = *rms;d248 1a248 1	    slope = (*pitch - ipito) / (real) lsamp;d251 2a252 2	    if (ivoico != 1) {		if (ivoico == voice[1]) {d263 2a264 2		rmsi[1] = rmso;		rmsi[2] = rmso;d273 1a273 1		ipito = *pitch;d278 1a278 1		if (ivoico != voice[1]) {d280 1a280 1		    lsamp = *lframe / 4 + jsamp;d283 1a283 1		    lsamp = *lframe * 3 / 4 + jsamp;d398 1a398 1		r__1 = ipito + slope * i__;d427 1a427 1		    rmsi[*nout] = log(rmso) + prop * (log(*rms) - log(rmso));d483 1a483 1	    lsamp = *lframe + jsamp;d490 1a490 1	    rmso = *rms;d498 1a498 1	jsamp = lsamp - jused;d505 3a507 3	ivoico = voice[2];	ipito = *pitch;	rmso = *rms;a513 5L_initpitsyn:    rmso = 1.f;    first = TRUE_;    return 0;a514 16/* Subroutine */ int pitsyn_(integer *order, integer *voice, integer *pitch, 	real *rms, real *rc, integer *lframe, integer *ivuv, integer *ipiti, 	real *rmsi, real *rci, integer *nout, real *ratio){    return pitsyn_0_(0, order, voice, pitch, rms, rc, lframe, ivuv, ipiti, 	    rmsi, rci, nout, ratio);    }/* Subroutine */ int initpitsyn_(void){    return pitsyn_0_(1, (integer *)0, (integer *)0, (integer *)0, (real *)0, (	    real *)0, (integer *)0, (integer *)0, (integer *)0, (real *)0, (	    real *)0, (integer *)0, (real *)0);    }@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -