mload.c
上传用户:zslianheng
上传日期:2013-04-03
资源大小:946k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Visual C++

  1. /*
  2. $Log: mload.c,v $
  3. Revision 1.1.1.1  2002/07/28 05:23:36  freeman_yong
  4. lpc10 codec
  5.  * Revision 1.1  1996/08/19  22:31:25  jaf
  6.  * Initial revision
  7.  *
  8. */
  9. #ifdef P_R_O_T_O_T_Y_P_E_S
  10. extern int mload_(integer *order, integer *awins, integer *awinf, real *speech, real *phi, real *psi);
  11. #endif
  12. /*  -- translated by f2c (version 19951025).
  13.    You must link the resulting object file with the libraries:
  14. -lf2c -lm   (in that order)
  15. */
  16. #include "f2c.h"
  17. /* ***************************************************************** */
  18. /*  MLOAD Version 48 */
  19. /* $Log: mload.c,v $
  20. /* Revision 1.1.1.1  2002/07/28 05:23:36  freeman_yong
  21. /* lpc10 codec
  22. /*
  23.  * Revision 1.1  1996/08/19  22:31:25  jaf
  24.  * Initial revision
  25.  * */
  26. /* Revision 1.5  1996/03/27  23:59:51  jaf */
  27. /* Added some more accurate comments about which indices of the argument */
  28. /* array SPEECH are read.  I thought that this might be the cause of a */
  29. /* problem I've been having, but it isn't. */
  30. /* Revision 1.4  1996/03/26  19:16:53  jaf */
  31. /* Commented out the code at the end that copied the lower triangular */
  32. /* half of PHI into the upper triangular half (making the resulting */
  33. /* matrix symmetric).  The upper triangular half was never used by later */
  34. /* code in subroutine ANALYS. */
  35. /* Revision 1.3  1996/03/18  21:16:00  jaf */
  36. /* Just added a few comments about which array indices of the arguments */
  37. /* are used, and mentioning that this subroutine has no local state. */
  38. /* Revision 1.2  1996/03/13  16:47:41  jaf */
  39. /* Comments added explaining that none of the local variables of this */
  40. /* subroutine need to be saved from one invocation to the next. */
  41. /* Revision 1.1  1996/02/07 14:48:01  jaf */
  42. /* Initial revision */
  43. /* ***************************************************************** */
  44. /* Load a covariance matrix. */
  45. /* Input: */
  46. /*  ORDER            - Analysis order */
  47. /*  AWINS            - Analysis window start */
  48. /*  AWINF            - Analysis window finish */
  49. /*  SPEECH(AWINF)    - Speech buffer */
  50. /*                     Indices MIN(AWINS, AWINF-(ORDER-1)) through */
  51. /*                             MAX(AWINF, AWINS+(ORDER-1)) read. */
  52. /*                     As long as (AWINF-AWINS) .GE. (ORDER-1), */
  53. /*                     this is just indices AWINS through AWINF. */
  54. /* Output: */
  55. /*  PHI(ORDER,ORDER) - Covariance matrix */
  56. /*                    Lower triangular half and diagonal written, and read.*/
  57. /*                     Upper triangular half untouched. */
  58. /*  PSI(ORDER)       - Prediction vector */
  59. /*                     Indices 1 through ORDER written, */
  60. /*                     and most are read after that. */
  61. /* This subroutine has no local state. */
  62. /* Subroutine */ int mload_(integer *order, integer *awins, integer *awinf, 
  63. real *speech, real *phi, real *psi)
  64. {
  65.     /* System generated locals */
  66.     integer phi_dim1, phi_offset, i__1, i__2;
  67.     /* Local variables */
  68.     integer c__, i__, r__, start;
  69. /*       Arguments */
  70. /*       Local variables that need not be saved */
  71. /*   Load first column of triangular covariance matrix PHI */
  72.     /* Parameter adjustments */
  73.     --psi;
  74.     phi_dim1 = *order;
  75.     phi_offset = phi_dim1 + 1;
  76.     phi -= phi_offset;
  77.     --speech;
  78.     /* Function Body */
  79.     start = *awins + *order;
  80.     i__1 = *order;
  81.     for (r__ = 1; r__ <= i__1; ++r__) {
  82. phi[r__ + phi_dim1] = 0.f;
  83. i__2 = *awinf;
  84. for (i__ = start; i__ <= i__2; ++i__) {
  85.     phi[r__ + phi_dim1] += speech[i__ - 1] * speech[i__ - r__];
  86. }
  87.     }
  88. /*   Load last element of vector PSI */
  89.     psi[*order] = 0.f;
  90.     i__1 = *awinf;
  91.     for (i__ = start; i__ <= i__1; ++i__) {
  92. psi[*order] += speech[i__] * speech[i__ - *order];
  93.     }
  94. /*   End correct to get additional columns of PHI */
  95.     i__1 = *order;
  96.     for (r__ = 2; r__ <= i__1; ++r__) {
  97. i__2 = r__;
  98. for (c__ = 2; c__ <= i__2; ++c__) {
  99.     phi[r__ + c__ * phi_dim1] = phi[r__ - 1 + (c__ - 1) * phi_dim1] - 
  100.     speech[*awinf + 1 - r__] * speech[*awinf + 1 - c__] + 
  101.     speech[start - r__] * speech[start - c__];
  102. }
  103.     }
  104. /*   End correct to get additional elements of PSI */
  105.     i__1 = *order - 1;
  106.     for (c__ = 1; c__ <= i__1; ++c__) {
  107. psi[c__] = phi[c__ + 1 + phi_dim1] - speech[start - 1] * speech[start 
  108. - 1 - c__] + speech[*awinf] * speech[*awinf - c__];
  109.     }
  110. /*   Copy lower triangular section into upper (why bother?) */
  111. /*       I'm commenting this out, since the upper triangular half of PHI 
  112. */
  113. /*       is never used by later code, unless a sufficiently high level of 
  114. */
  115. /*       tracing is turned on. */
  116. /*  DO R = 1,ORDER */
  117. /*     DO C = 1,R-1 */
  118. /*        PHI(C,R) = PHI(R,C) */
  119. /*     END DO */
  120. /*  END DO */
  121.     return 0;
  122. } /* mload_ */