mload.c

Go to the documentation of this file.
00001 /*
00002 
00003 $Log$
00004 Revision 1.15  2004/06/26 03:50:14  markster
00005 Merge source cleanups (bug #1911)
00006 
00007 Revision 1.14  2003/02/12 13:59:15  matteo
00008 mer feb 12 14:56:57 CET 2003
00009 
00010 Revision 1.1.1.1  2003/02/12 13:59:15  matteo
00011 mer feb 12 14:56:57 CET 2003
00012 
00013 Revision 1.2  2000/01/05 08:20:39  markster
00014 Some OSS fixes and a few lpc changes to make it actually work
00015 
00016  * Revision 1.1  1996/08/19  22:31:25  jaf
00017  * Initial revision
00018  *
00019 
00020 */
00021 
00022 /*  -- translated by f2c (version 19951025).
00023    You must link the resulting object file with the libraries:
00024    -lf2c -lm   (in that order)
00025 */
00026 
00027 #include "f2c.h"
00028 
00029 #ifdef P_R_O_T_O_T_Y_P_E_S
00030 extern int mload_(integer *order, integer *awins, integer *awinf, real *speech, real *phi, real *psi);
00031 #endif
00032 
00033 /* ***************************************************************** */
00034 
00035 /*    MLOAD Version 48 */
00036 
00037 /* $Log$
00038  * Revision 1.15  2004/06/26 03:50:14  markster
00039  * Merge source cleanups (bug #1911)
00040  *
00041  * Revision 1.14  2003/02/12 13:59:15  matteo
00042  * mer feb 12 14:56:57 CET 2003
00043  *
00044  * Revision 1.1.1.1  2003/02/12 13:59:15  matteo
00045  * mer feb 12 14:56:57 CET 2003
00046  *
00047  * Revision 1.2  2000/01/05 08:20:39  markster
00048  * Some OSS fixes and a few lpc changes to make it actually work
00049  *
00050  * Revision 1.1  1996/08/19  22:31:25  jaf
00051  * Initial revision
00052  * */
00053 /* Revision 1.5  1996/03/27  23:59:51  jaf */
00054 /* Added some more accurate comments about which indices of the argument */
00055 /* array SPEECH are read.  I thought that this might be the cause of a */
00056 /* problem I've been having, but it isn't. */
00057 
00058 /* Revision 1.4  1996/03/26  19:16:53  jaf */
00059 /* Commented out the code at the end that copied the lower triangular */
00060 /* half of PHI into the upper triangular half (making the resulting */
00061 /* matrix symmetric).  The upper triangular half was never used by later */
00062 /* code in subroutine ANALYS. */
00063 
00064 /* Revision 1.3  1996/03/18  21:16:00  jaf */
00065 /* Just added a few comments about which array indices of the arguments */
00066 /* are used, and mentioning that this subroutine has no local state. */
00067 
00068 /* Revision 1.2  1996/03/13  16:47:41  jaf */
00069 /* Comments added explaining that none of the local variables of this */
00070 /* subroutine need to be saved from one invocation to the next. */
00071 
00072 /* Revision 1.1  1996/02/07 14:48:01  jaf */
00073 /* Initial revision */
00074 
00075 
00076 /* ***************************************************************** */
00077 
00078 /* Load a covariance matrix. */
00079 
00080 /* Input: */
00081 /*  ORDER            - Analysis order */
00082 /*  AWINS            - Analysis window start */
00083 /*  AWINF            - Analysis window finish */
00084 /*  SPEECH(AWINF)    - Speech buffer */
00085 /*                     Indices MIN(AWINS, AWINF-(ORDER-1)) through */
00086 /*                             MAX(AWINF, AWINS+(ORDER-1)) read. */
00087 /*                     As long as (AWINF-AWINS) .GE. (ORDER-1), */
00088 /*                     this is just indices AWINS through AWINF. */
00089 /* Output: */
00090 /*  PHI(ORDER,ORDER) - Covariance matrix */
00091 /*                    Lower triangular half and diagonal written, and read.*/
00092 /*                     Upper triangular half untouched. */
00093 /*  PSI(ORDER)       - Prediction vector */
00094 /*                     Indices 1 through ORDER written, */
00095 /*                     and most are read after that. */
00096 
00097 /* This subroutine has no local state. */
00098 
00099 /* Subroutine */ int mload_(integer *order, integer *awins, integer *awinf, 
00100    real *speech, real *phi, real *psi)
00101 {
00102     /* System generated locals */
00103     integer phi_dim1, phi_offset, i__1, i__2;
00104 
00105     /* Local variables */
00106     integer c__, i__, r__, start;
00107 
00108 /*       Arguments */
00109 /*       Local variables that need not be saved */
00110 /*   Load first column of triangular covariance matrix PHI */
00111     /* Parameter adjustments */
00112     --psi;
00113     phi_dim1 = *order;
00114     phi_offset = phi_dim1 + 1;
00115     phi -= phi_offset;
00116     --speech;
00117 
00118     /* Function Body */
00119     start = *awins + *order;
00120     i__1 = *order;
00121     for (r__ = 1; r__ <= i__1; ++r__) {
00122    phi[r__ + phi_dim1] = 0.f;
00123    i__2 = *awinf;
00124    for (i__ = start; i__ <= i__2; ++i__) {
00125        phi[r__ + phi_dim1] += speech[i__ - 1] * speech[i__ - r__];
00126    }
00127     }
00128 /*   Load last element of vector PSI */
00129     psi[*order] = 0.f;
00130     i__1 = *awinf;
00131     for (i__ = start; i__ <= i__1; ++i__) {
00132    psi[*order] += speech[i__] * speech[i__ - *order];
00133     }
00134 /*   End correct to get additional columns of PHI */
00135     i__1 = *order;
00136     for (r__ = 2; r__ <= i__1; ++r__) {
00137    i__2 = r__;
00138    for (c__ = 2; c__ <= i__2; ++c__) {
00139        phi[r__ + c__ * phi_dim1] = phi[r__ - 1 + (c__ - 1) * phi_dim1] - 
00140           speech[*awinf + 1 - r__] * speech[*awinf + 1 - c__] + 
00141           speech[start - r__] * speech[start - c__];
00142    }
00143     }
00144 /*   End correct to get additional elements of PSI */
00145     i__1 = *order - 1;
00146     for (c__ = 1; c__ <= i__1; ++c__) {
00147    psi[c__] = phi[c__ + 1 + phi_dim1] - speech[start - 1] * speech[start 
00148       - 1 - c__] + speech[*awinf] * speech[*awinf - c__];
00149     }
00150 /*   Copy lower triangular section into upper (why bother?) */
00151 /*       I'm commenting this out, since the upper triangular half of PHI 
00152 */
00153 /*       is never used by later code, unless a sufficiently high level of 
00154 */
00155 /*       tracing is turned on. */
00156 /*    DO R = 1,ORDER */
00157 /*       DO C = 1,R-1 */
00158 /*          PHI(C,R) = PHI(R,C) */
00159 /*       END DO */
00160 /*    END DO */
00161     return 0;
00162 } /* mload_ */
00163 

Generated on Thu Apr 16 06:27:40 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6