~ubuntu-branches/ubuntu/quantal/linphone/quantal

« back to all changes in this revision

Viewing changes to lpc10-1.5/energy.c

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2006-11-15 10:34:50 UTC
  • mfrom: (1.2.1 upstream) (2.1.8 feisty)
  • Revision ID: james.westby@ubuntu.com-20061115103450-qgafwcks2lkhctlj
* New upstream release.
* Enable video support.
* Fix mismatched #endif in mscommon.h, closes: #398307.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 
3
 
$Log: energy.c,v $
4
 
Revision 1.1.1.1  2001/11/19 19:50:15  smorlat
5
 
First cvs.
6
 
 
7
 
Revision 1.1.1.1  2001/08/08 21:29:08  simon
8
 
First import
9
 
 
10
 
 * Revision 1.1  1996/08/19  22:32:17  jaf
11
 
 * Initial revision
12
 
 *
13
 
 
14
 
*/
15
 
 
16
 
#ifdef P_R_O_T_O_T_Y_P_E_S
17
 
extern int energy_(integer *len, real *speech, real *rms);
18
 
#endif
19
 
 
20
 
/*  -- translated by f2c (version 19951025).
21
 
   You must link the resulting object file with the libraries:
22
 
        -lf2c -lm   (in that order)
23
 
*/
24
 
 
25
 
#include "f2c.h"
26
 
 
27
 
/* ********************************************************************* */
28
 
 
29
 
/*      ENERGY Version 50 */
30
 
 
31
 
/* $Log: energy.c,v $
32
 
/* Revision 1.1.1.1  2001/11/19 19:50:15  smorlat
33
 
/* First cvs.
34
 
/*
35
 
/* Revision 1.1.1.1  2001/08/08 21:29:08  simon
36
 
/* First import
37
 
/*
38
 
 * Revision 1.1  1996/08/19  22:32:17  jaf
39
 
 * Initial revision
40
 
 * */
41
 
/* Revision 1.3  1996/03/18  21:17:41  jaf */
42
 
/* Just added a few comments about which array indices of the arguments */
43
 
/* are used, and mentioning that this subroutine has no local state. */
44
 
 
45
 
/* Revision 1.2  1996/03/13  16:46:02  jaf */
46
 
/* Comments added explaining that none of the local variables of this */
47
 
/* subroutine need to be saved from one invocation to the next. */
48
 
 
49
 
/* Revision 1.1  1996/02/07 14:45:40  jaf */
50
 
/* Initial revision */
51
 
 
52
 
 
53
 
/* ********************************************************************* */
54
 
 
55
 
/* Compute RMS energy. */
56
 
 
57
 
/* Input: */
58
 
/*  LEN    - Length of speech buffer */
59
 
/*  SPEECH - Speech buffer */
60
 
/*           Indices 1 through LEN read. */
61
 
/* Output: */
62
 
/*  RMS    - Root Mean Square energy */
63
 
 
64
 
/* This subroutine has no local state. */
65
 
 
66
 
/* Subroutine */ int energy_(integer *len, real *speech, real *rms)
67
 
{
68
 
    /* System generated locals */
69
 
    integer i__1;
70
 
 
71
 
    /* Builtin functions */
72
 
    double sqrt(doublereal);
73
 
 
74
 
    /* Local variables */
75
 
    integer i__;
76
 
 
77
 
/*       Arguments */
78
 
/*       Local variables that need not be saved */
79
 
    /* Parameter adjustments */
80
 
    --speech;
81
 
 
82
 
    /* Function Body */
83
 
    *rms = 0.f;
84
 
    i__1 = *len;
85
 
    for (i__ = 1; i__ <= i__1; ++i__) {
86
 
        *rms += speech[i__] * speech[i__];
87
 
    }
88
 
    *rms = sqrt(*rms / *len);
89
 
    return 0;
90
 
} /* energy_ */
91