irc2pc.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. $Log$
  3. Revision 1.15 2004/06/26 03:50:14 markster
  4. Merge source cleanups (bug #1911)
  5. Revision 1.14 2003/02/12 13:59:15 matteo
  6. mer feb 12 14:56:57 CET 2003
  7. Revision 1.1.1.1 2003/02/12 13:59:15 matteo
  8. mer feb 12 14:56:57 CET 2003
  9. Revision 1.2 2000/01/05 08:20:39 markster
  10. Some OSS fixes and a few lpc changes to make it actually work
  11. * Revision 1.1 1996/08/19 22:31:56 jaf
  12. * Initial revision
  13. *
  14. */
  15. /* -- translated by f2c (version 19951025).
  16. You must link the resulting object file with the libraries:
  17. -lf2c -lm (in that order)
  18. */
  19. #include "f2c.h"
  20. #ifdef P_R_O_T_O_T_Y_P_E_S
  21. extern int irc2pc_(real *rc, real *pc, integer *order, real *gprime, real *g2pass);
  22. #endif
  23. /* ***************************************************************** */
  24. /* IRC2PC Version 48 */
  25. /* $Log$
  26. * Revision 1.15 2004/06/26 03:50:14 markster
  27. * Merge source cleanups (bug #1911)
  28. *
  29. * Revision 1.14 2003/02/12 13:59:15 matteo
  30. * mer feb 12 14:56:57 CET 2003
  31. *
  32. * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
  33. * mer feb 12 14:56:57 CET 2003
  34. *
  35. * Revision 1.2 2000/01/05 08:20:39 markster
  36. * Some OSS fixes and a few lpc changes to make it actually work
  37. *
  38. * Revision 1.1 1996/08/19 22:31:56 jaf
  39. * Initial revision
  40. * */
  41. /* Revision 1.3 1996/03/20 15:47:19 jaf */
  42. /* Added comments about which indices of array arguments are read or */
  43. /* written. */
  44. /* Revision 1.2 1996/03/14 16:59:04 jaf */
  45. /* Comments added explaining that none of the local variables of this */
  46. /* subroutine need to be saved from one invocation to the next. */
  47. /* Revision 1.1 1996/02/07 14:47:27 jaf */
  48. /* Initial revision */
  49. /* ***************************************************************** */
  50. /* Convert Reflection Coefficients to Predictor Coeficients */
  51. /* Inputs: */
  52. /* RC - Reflection coefficients */
  53. /* Indices 1 through ORDER read. */
  54. /* ORDER - Number of RC's */
  55. /* GPRIME - Excitation modification gain */
  56. /* Outputs: */
  57. /* PC - Predictor coefficients */
  58. /* Indices 1 through ORDER written. */
  59. /* Indices 1 through ORDER-1 are read after being written. */
  60. /* G2PASS - Excitation modification sharpening factor */
  61. /* This subroutine has no local state. */
  62. /* Subroutine */ int irc2pc_(real *rc, real *pc, integer *order, real *gprime,
  63. real *g2pass)
  64. {
  65. /* System generated locals */
  66. integer i__1, i__2;
  67. /* Builtin functions */
  68. double sqrt(doublereal);
  69. /* Local variables */
  70. real temp[10];
  71. integer i__, j;
  72. /* Arguments */
  73. /* $Log$
  74. * Revision 1.15 2004/06/26 03:50:14 markster
  75. * Merge source cleanups (bug #1911)
  76. *
  77. * Revision 1.14 2003/02/12 13:59:15 matteo
  78. * mer feb 12 14:56:57 CET 2003
  79. *
  80. * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
  81. * mer feb 12 14:56:57 CET 2003
  82. *
  83. * Revision 1.2 2000/01/05 08:20:39 markster
  84. * Some OSS fixes and a few lpc changes to make it actually work
  85. *
  86. * Revision 1.1 1996/08/19 22:31:56 jaf
  87. * Initial revision
  88. * */
  89. /* Revision 1.3 1996/03/29 22:03:47 jaf */
  90. /* Removed definitions for any constants that were no longer used. */
  91. /* Revision 1.2 1996/03/26 19:34:33 jaf */
  92. /* Added comments indicating which constants are not needed in an */
  93. /* application that uses the LPC-10 coder. */
  94. /* Revision 1.1 1996/02/07 14:43:51 jaf */
  95. /* Initial revision */
  96. /* LPC Configuration parameters: */
  97. /* Frame size, Prediction order, Pitch period */
  98. /* Local variables that need not be saved */
  99. /* Parameter adjustments */
  100. --pc;
  101. --rc;
  102. /* Function Body */
  103. *g2pass = 1.f;
  104. i__1 = *order;
  105. for (i__ = 1; i__ <= i__1; ++i__) {
  106. *g2pass *= 1.f - rc[i__] * rc[i__];
  107. }
  108. *g2pass = *gprime * (real)sqrt(*g2pass);
  109. pc[1] = rc[1];
  110. i__1 = *order;
  111. for (i__ = 2; i__ <= i__1; ++i__) {
  112. i__2 = i__ - 1;
  113. for (j = 1; j <= i__2; ++j) {
  114. temp[j - 1] = pc[j] - rc[i__] * pc[i__ - j];
  115. }
  116. i__2 = i__ - 1;
  117. for (j = 1; j <= i__2; ++j) {
  118. pc[j] = temp[j - 1];
  119. }
  120. pc[i__] = rc[i__];
  121. }
  122. return 0;
  123. } /* irc2pc_ */