4 Revision 1.15 2004/06/26 03:50:14 markster
5 Merge source cleanups (bug #1911)
7 Revision 1.14 2003/02/12 13:59:15 matteo
8 mer feb 12 14:56:57 CET 2003
10 Revision 1.1.1.1 2003/02/12 13:59:15 matteo
11 mer feb 12 14:56:57 CET 2003
13 Revision 1.3 2001/04/12 21:27:53 markh
14 app_record now supports wildcards of sort so your output file is not overwritten every time it's run. File.h got a documentation update on the ast_fileexists to include the return call. Watch out for the placea.c placev.c code, it's updates have not been tested yet. Just a few parenthesis to make it compile nicer on newer gcc versions with all the -W flags set.
16 Revision 1.2 2000/01/05 08:20:39 markster
17 Some OSS fixes and a few lpc changes to make it actually work
19 * Revision 1.1 1996/08/19 22:31:02 jaf
25 /* -- translated by f2c (version 19951025).
26 You must link the resulting object file with the libraries:
27 -lf2c -lm (in that order)
32 #ifdef P_R_O_T_O_T_Y_P_E_S
33 extern int placev_(integer
*osbuf
, integer
*osptr
, integer
*oslen
, integer
*obound
, integer
*vwin
, integer
*af
, integer
*lframe
, integer
*minwin
, integer
*maxwin
, integer
*dvwinl
, integer
*dvwinh
);
36 /* ****************************************************************** */
38 /* PLACEV Version 48 */
41 * Revision 1.15 2004/06/26 03:50:14 markster
42 * Merge source cleanups (bug #1911)
44 * Revision 1.14 2003/02/12 13:59:15 matteo
45 * mer feb 12 14:56:57 CET 2003
47 * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
48 * mer feb 12 14:56:57 CET 2003
50 * Revision 1.3 2001/04/12 21:27:53 markh
51 * app_record now supports wildcards of sort so your output file is not overwritten every time it's run. File.h got a documentation update on the ast_fileexists to include the return call. Watch out for the placea.c placev.c code, it's updates have not been tested yet. Just a few parenthesis to make it compile nicer on newer gcc versions with all the -W flags set.
53 * Revision 1.2 2000/01/05 08:20:39 markster
54 * Some OSS fixes and a few lpc changes to make it actually work
56 * Revision 1.1 1996/08/19 22:31:02 jaf
59 /* Revision 1.6 1996/03/19 20:42:19 jaf */
60 /* Added some conditions satisfied by the output values in VWIN. */
62 /* Revision 1.5 1996/03/19 18:37:56 jaf */
63 /* Strengthened the specification of which indices of VWIN are read and */
66 /* Revision 1.4 1996/03/15 16:38:33 jaf */
67 /* One tiny comment added. */
69 /* Revision 1.3 1996/03/15 16:36:13 jaf */
70 /* Added comments giving In/Out status of arguments. */
72 /* Revision 1.2 1996/03/12 23:56:01 jaf */
73 /* Comments added explaining that none of the local variables of this */
74 /* subroutine need to be saved from one invocation to the next. */
76 /* Revision 1.1 1996/02/07 14:48:39 jaf */
77 /* Initial revision */
80 /* ****************************************************************** */
83 /* OSBUF Buffer which holds sorted indexes of onsets */
84 /* I believe that only indices 1 through OSPTR-1 can be read. */
86 /* OSPTR Free pointer into OSBUF */
92 /* DVWINH (This argument is never used. Should it be?) */
94 /* VWIN Buffer of Voicing Window Positions (Modified) */
95 /* Index (2,AF-1) is read. */
96 /* Indices (1,AF) and (2,AF) are written, */
97 /* and then possibly read. */
98 /* All other indices are unused. */
99 /* In all cases, the final values will satsify the condition:*/
100 /* VWIN(2,AF)-VWIN(1,AF)+1 .LE. MAXWIN */
101 /* I'm not certain yet, but they may also satisfy: */
102 /* MINWIN .LE. VWIN(2,AF)-VWIN(1,AF)+1 */
104 /* OBOUND This variable is set by this procedure and used */
105 /* in placing analysis windows (PLACEA). Bit 1 */
106 /* indicates whether an onset bounds the left side */
107 /* of the voicing window, and bit 2 indicates whether */
108 /* an onset bounds the right side of the voicing window. */
110 /* This subroutine has no local state. */
112 /* Subroutine */ int placev_(integer
*osbuf
, integer
*osptr
, integer
*oslen
,
113 integer
*obound
, integer
*vwin
, integer
*af
, integer
*lframe
, integer
114 *minwin
, integer
*maxwin
, integer
*dvwinl
, integer
*dvwinh
)
116 /* System generated locals */
119 /* Local variables */
121 integer i__
, q
, osptr1
, hrange
, lrange
;
124 /* Local variables that need not be saved */
126 /* LRANGE, HRANGE Range in which window is placed */
127 /* OSPTR1 OSPTR excluding samples in 3F */
130 /* Voicing Window Placement */
132 /* __________________ __________________ ______________ */
134 /* | 1F | 2F | 3F ... */
135 /* |__________________|__________________|______________ */
142 /* ------>| This window's placement range |<------ */
145 /* There are three cases. Note that these are different from those */
146 /* given in the LPC-10e phase 1 report. */
148 /* 1. If there are no onsets in this range, then the voicing window */
149 /* is centered in the pitch window. If such a placement is not within
151 /* the window's placement range, then the window is placed in the left-
153 /* most portion of the placement range. Its length is always MAXWIN. */
155 /* 2. If the first onset is in 2F and there is sufficient room to place
157 /* the window immediately before this onset, then the window is placed
159 /* there, and its length is set to the maximum possible under these */
162 /* "Critical Region Exception": If there is another onset in 2F */
163 /* such that a window can be placed between the two onsets, the */
164 /* window is placed there (ie, as in case 3). */
166 /* 3. Otherwise, the window is placed immediately after the onset. The
168 /* window's length */
169 /* is the longest length that can fit in the range under these constraint
171 /* except that the window may be shortened even further to avoid overlapp
173 /* other onsets in the placement range. In any case, the window's length
175 /* is at least MINWIN. */
177 /* Note that the values of MINWIN and LFRAME must be chosen such */
178 /* that case 2 = false implies case 3 = true. This means that */
179 /* MINWIN <= LFRAME/2. If this were not the case, then a fourth case */
180 /* would have to be added for when the window cannot fit either before
182 /* or after the onset. */
184 /* Note also that onsets which weren't in 2F last time may be in 1F this
186 /* time, due to the filter delays in computing onsets. The result is tha
188 /* occasionally a voicing window will overlap that onset. The only way
190 /* to circumvent this problem is to add more delay in processing input
192 /* speech. In the trade-off between delay and window-placement, window
194 /* placement lost. */
195 /* Compute the placement range */
196 /* Parameter adjustments */
202 i__1
= vwin
[((*af
- 1) << 1) + 2] + 1, i__2
= (*af
- 2) * *lframe
+ 1;
203 lrange
= max(i__1
,i__2
);
204 hrange
= *af
* *lframe
;
205 /* Compute OSPTR1, so the following code only looks at relevant onsets. */
206 for (osptr1
= *osptr
- 1; osptr1
>= 1; --osptr1
) {
207 if (osbuf
[osptr1
] <= hrange
) {
213 /* Check for case 1 first (fast case): */
214 if (osptr1
<= 1 || osbuf
[osptr1
- 1] < lrange
) {
216 i__1
= vwin
[((*af
- 1) << 1) + 2] + 1;
217 vwin
[(*af
<< 1) + 1] = max(i__1
,*dvwinl
);
218 vwin
[(*af
<< 1) + 2] = vwin
[(*af
<< 1) + 1] + *maxwin
- 1;
221 /* Search backward in OSBUF for first onset in range. */
222 /* This code relies on the above check being performed first. */
223 for (q
= osptr1
- 1; q
>= 1; --q
) {
224 if (osbuf
[q
] < lrange
) {
230 /* Check for case 2 (placement before onset): */
231 /* Check for critical region exception: */
233 for (i__
= q
+ 1; i__
<= i__1
; ++i__
) {
234 if (osbuf
[i__
] - osbuf
[q
] >= *minwin
) {
242 i__1
= (*af
- 1) * *lframe
, i__2
= lrange
+ *minwin
- 1;
243 if (! crit
&& osbuf
[q
] > max(i__1
,i__2
)) {
244 vwin
[(*af
<< 1) + 2] = osbuf
[q
] - 1;
246 i__1
= lrange
, i__2
= vwin
[(*af
<< 1) + 2] - *maxwin
+ 1;
247 vwin
[(*af
<< 1) + 1] = max(i__1
,i__2
);
249 /* Case 3 (placement after onset) */
251 vwin
[(*af
<< 1) + 1] = osbuf
[q
];
257 if (osbuf
[q
] > vwin
[(*af
<< 1) + 1] + *maxwin
) {
260 if (osbuf
[q
] < vwin
[(*af
<< 1) + 1] + *minwin
) {
263 vwin
[(*af
<< 1) + 2] = osbuf
[q
] - 1;
268 i__1
= vwin
[(*af
<< 1) + 1] + *maxwin
- 1;
269 vwin
[(*af
<< 1) + 2] = min(i__1
,hrange
);