Asterisk - The Open Source Telephony Project  18.5.0
energy.c
Go to the documentation of this file.
1 /*
2 
3 $Log$
4 Revision 1.15 2004/06/26 03:50:14 markster
5 Merge source cleanups (bug #1911)
6 
7 Revision 1.14 2003/02/12 13:59:15 matteo
8 mer feb 12 14:56:57 CET 2003
9 
10 Revision 1.1.1.1 2003/02/12 13:59:15 matteo
11 mer feb 12 14:56:57 CET 2003
12 
13 Revision 1.2 2000/01/05 08:20:39 markster
14 Some OSS fixes and a few lpc changes to make it actually work
15 
16  * Revision 1.1 1996/08/19 22:32:17 jaf
17  * Initial revision
18  *
19 
20 */
21 
22 /* -- translated by f2c (version 19951025).
23  You must link the resulting object file with the libraries:
24  -lf2c -lm (in that order)
25 */
26 
27 #include "f2c.h"
28 
29 #ifdef P_R_O_T_O_T_Y_P_E_S
30 extern int energy_(integer *len, real *speech, real *rms);
31 #endif
32 
33 /* ********************************************************************* */
34 
35 /* ENERGY Version 50 */
36 
37 /* $Log$
38  * Revision 1.15 2004/06/26 03:50:14 markster
39  * Merge source cleanups (bug #1911)
40  *
41  * Revision 1.14 2003/02/12 13:59:15 matteo
42  * mer feb 12 14:56:57 CET 2003
43  *
44  * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
45  * mer feb 12 14:56:57 CET 2003
46  *
47  * Revision 1.2 2000/01/05 08:20:39 markster
48  * Some OSS fixes and a few lpc changes to make it actually work
49  *
50  * Revision 1.1 1996/08/19 22:32:17 jaf
51  * Initial revision
52  * */
53 /* Revision 1.3 1996/03/18 21:17:41 jaf */
54 /* Just added a few comments about which array indices of the arguments */
55 /* are used, and mentioning that this subroutine has no local state. */
56 
57 /* Revision 1.2 1996/03/13 16:46:02 jaf */
58 /* Comments added explaining that none of the local variables of this */
59 /* subroutine need to be saved from one invocation to the next. */
60 
61 /* Revision 1.1 1996/02/07 14:45:40 jaf */
62 /* Initial revision */
63 
64 
65 /* ********************************************************************* */
66 
67 /* Compute RMS energy. */
68 
69 /* Input: */
70 /* LEN - Length of speech buffer */
71 /* SPEECH - Speech buffer */
72 /* Indices 1 through LEN read. */
73 /* Output: */
74 /* RMS - Root Mean Square energy */
75 
76 /* This subroutine has no local state. */
77 
78 /* Subroutine */ int energy_(integer *len, real *speech, real *rms)
79 {
80  /* System generated locals */
81  integer i__1;
82 
83  /* Builtin functions */
84  double sqrt(doublereal);
85 
86  /* Local variables */
87  integer i__;
88 
89 /* Arguments */
90 /* Local variables that need not be saved */
91  /* Parameter adjustments */
92  --speech;
93 
94  /* Function Body */
95  *rms = 0.f;
96  i__1 = *len;
97  for (i__ = 1; i__ <= i__1; ++i__) {
98  *rms += speech[i__] * speech[i__];
99  }
100  *rms = (real)sqrt(*rms / *len);
101  return 0;
102 } /* energy_ */
double doublereal
Definition: f2c.h:50
int energy_(integer *len, real *speech, real *rms)
Definition: energy.c:78
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
float real
Definition: lpc10.h:79
INT32 integer
Definition: lpc10.h:80