Asterisk - The Open Source Telephony Project
GIT-master-f36a736
codecs
lpc10
random.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.2 1996/08/20 20:41:32 jaf
17
* Removed all static local variables that were SAVE'd in the Fortran
18
* code, and put them in struct lpc10_decoder_state that is passed as an
19
* argument.
20
*
21
* Removed init function, since all initialization is now done in
22
* init_lpc10_decoder_state().
23
*
24
* Revision 1.1 1996/08/19 22:30:49 jaf
25
* Initial revision
26
*
27
28
*/
29
30
/* -- translated by f2c (version 19951025).
31
You must link the resulting object file with the libraries:
32
-lf2c -lm (in that order)
33
*/
34
35
#include "
f2c.h
"
36
37
#ifdef P_R_O_T_O_T_Y_P_E_S
38
extern
integer
random_
(
struct
lpc10_decoder_state
*st);
39
#endif
40
41
/* ********************************************************************** */
42
43
/* RANDOM Version 49 */
44
45
/* $Log$
46
* Revision 1.15 2004/06/26 03:50:14 markster
47
* Merge source cleanups (bug #1911)
48
*
49
* Revision 1.14 2003/02/12 13:59:15 matteo
50
* mer feb 12 14:56:57 CET 2003
51
*
52
* Revision 1.1.1.1 2003/02/12 13:59:15 matteo
53
* mer feb 12 14:56:57 CET 2003
54
*
55
* Revision 1.2 2000/01/05 08:20:39 markster
56
* Some OSS fixes and a few lpc changes to make it actually work
57
*
58
* Revision 1.2 1996/08/20 20:41:32 jaf
59
* Removed all static local variables that were SAVE'd in the Fortran
60
* code, and put them in struct lpc10_decoder_state that is passed as an
61
* argument.
62
*
63
* Removed init function, since all initialization is now done in
64
* init_lpc10_decoder_state().
65
*
66
* Revision 1.1 1996/08/19 22:30:49 jaf
67
* Initial revision
68
* */
69
/* Revision 1.3 1996/03/20 16:13:54 jaf */
70
/* Rearranged comments a little bit, and added comments explaining that */
71
/* even though there is local state here, there is no need to create an */
72
/* ENTRY for reinitializing it. */
73
74
/* Revision 1.2 1996/03/14 22:25:29 jaf */
75
/* Just rearranged the comments and local variable declarations a bit. */
76
77
/* Revision 1.1 1996/02/07 14:49:01 jaf */
78
/* Initial revision */
79
80
81
/* ********************************************************************* */
82
83
/* Pseudo random number generator based on Knuth, Vol 2, p. 27. */
84
85
/* Function Return: */
86
/* RANDOM - Integer variable, uniformly distributed over -32768 to 32767 */
87
88
/* This subroutine maintains local state from one call to the next. */
89
/* In the context of the LPC10 coder, there is no reason to reinitialize */
90
/* this local state when switching between audio streams, because its */
91
/* results are only used to generate noise for unvoiced frames. */
92
93
integer
random_
(
struct
lpc10_decoder_state
*st)
94
{
95
/* Initialized data */
96
97
integer
*j;
98
integer
*k;
99
shortint
*y;
100
101
/* System generated locals */
102
integer
ret_val;
103
104
/* Parameters/constants */
105
/* Local state */
106
/* The following is a 16 bit 2's complement addition, */
107
/* with overflow checking disabled */
108
109
j = &(st->
j
);
110
k = &(st->
k
);
111
y = &(st->
y
[0]);
112
113
y[*k - 1] += y[*j - 1];
114
ret_val = y[*k - 1];
115
--(*k);
116
if
(*k <= 0) {
117
*k = 5;
118
}
119
--(*j);
120
if
(*j <= 0) {
121
*j = 5;
122
}
123
return
ret_val;
124
}
/* random_ */
f2c.h
integer
INT32 integer
Definition:
lpc10.h:80
shortint
INT16 shortint
Definition:
lpc10.h:82
random_
integer random_(struct lpc10_decoder_state *st)
Definition:
random.c:93
lpc10_decoder_state
Definition:
lpc10.h:149
lpc10_decoder_state::y
shortint y[5]
Definition:
lpc10.h:189
lpc10_decoder_state::j
integer j
Definition:
lpc10.h:187
lpc10_decoder_state::k
integer k
Definition:
lpc10.h:188
Generated on Wed Dec 18 2024 20:04:15 for Asterisk - The Open Source Telephony Project by
1.9.4