Asterisk - The Open Source Telephony Project GIT-master-7e7a603
Functions
placev.c File Reference
#include "f2c.h"
Include dependency graph for placev.c:

Go to the source code of this file.

Functions

int placev_ (integer *osbuf, integer *osptr, integer *oslen, integer *obound, integer *vwin, integer *af, integer *lframe, integer *minwin, integer *maxwin, integer *dvwinl, integer *dvwinh)
 

Function Documentation

◆ placev_()

int placev_ ( integer osbuf,
integer osptr,
integer oslen,
integer obound,
integer vwin,
integer af,
integer lframe,
integer minwin,
integer maxwin,
integer dvwinl,
integer dvwinh 
)

Definition at line 112 of file placev.c.

115{
116 /* System generated locals */
117 integer i__1, i__2;
118
119 /* Local variables */
120 logical crit;
121 integer i__, q, osptr1, hrange, lrange;
122
123/* Arguments */
124/* Local variables that need not be saved */
125/* Variables */
126/* LRANGE, HRANGE Range in which window is placed */
127/* OSPTR1 OSPTR excluding samples in 3F */
128/* Local state */
129/* None */
130/* Voicing Window Placement */
131
132/* __________________ __________________ ______________ */
133/* | | | */
134/* | 1F | 2F | 3F ... */
135/* |__________________|__________________|______________ */
136
137/* Previous | */
138/* Window | */
139/* ...________| */
140
141/* | | */
142/* ------>| This window's placement range |<------ */
143/* | | */
144
145/* There are three cases. Note that these are different from those */
146/* given in the LPC-10e phase 1 report. */
147
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
150*/
151/* the window's placement range, then the window is placed in the left-
152*/
153/* most portion of the placement range. Its length is always MAXWIN. */
154
155/* 2. If the first onset is in 2F and there is sufficient room to place
156 */
157/* the window immediately before this onset, then the window is placed
158*/
159/* there, and its length is set to the maximum possible under these */
160/* constraints. */
161
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). */
165
166/* 3. Otherwise, the window is placed immediately after the onset. The
167 */
168/* window's length */
169/* is the longest length that can fit in the range under these constraint
170s,*/
171/* except that the window may be shortened even further to avoid overlapp
172ing*/
173/* other onsets in the placement range. In any case, the window's length
174*/
175/* is at least MINWIN. */
176
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
181*/
182/* or after the onset. */
183
184/* Note also that onsets which weren't in 2F last time may be in 1F this
185 */
186/* time, due to the filter delays in computing onsets. The result is tha
187t*/
188/* occasionally a voicing window will overlap that onset. The only way
189*/
190/* to circumvent this problem is to add more delay in processing input
191*/
192/* speech. In the trade-off between delay and window-placement, window
193*/
194/* placement lost. */
195/* Compute the placement range */
196 /* Parameter adjustments */
197 --osbuf;
198 vwin -= 3;
199
200 /* Function Body */
201/* Computing MAX */
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) {
208 goto L90;
209 }
210 }
211L90:
212 ++osptr1;
213/* Check for case 1 first (fast case): */
214 if (osptr1 <= 1 || osbuf[osptr1 - 1] < lrange) {
215/* Computing MAX */
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;
219 *obound = 0;
220 } else {
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) {
225 goto L100;
226 }
227 }
228L100:
229 ++q;
230/* Check for case 2 (placement before onset): */
231/* Check for critical region exception: */
232 i__1 = osptr1 - 1;
233 for (i__ = q + 1; i__ <= i__1; ++i__) {
234 if (osbuf[i__] - osbuf[q] >= *minwin) {
235 crit = TRUE_;
236 goto L105;
237 }
238 }
239 crit = FALSE_;
240L105:
241/* Computing MAX */
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;
245/* Computing MAX */
246 i__1 = lrange, i__2 = vwin[(*af << 1) + 2] - *maxwin + 1;
247 vwin[(*af << 1) + 1] = max(i__1,i__2);
248 *obound = 2;
249/* Case 3 (placement after onset) */
250 } else {
251 vwin[(*af << 1) + 1] = osbuf[q];
252L110:
253 ++q;
254 if (q >= osptr1) {
255 goto L120;
256 }
257 if (osbuf[q] > vwin[(*af << 1) + 1] + *maxwin) {
258 goto L120;
259 }
260 if (osbuf[q] < vwin[(*af << 1) + 1] + *minwin) {
261 goto L110;
262 }
263 vwin[(*af << 1) + 2] = osbuf[q] - 1;
264 *obound = 3;
265 return 0;
266L120:
267/* Computing MIN */
268 i__1 = vwin[(*af << 1) + 1] + *maxwin - 1;
269 vwin[(*af << 1) + 2] = min(i__1,hrange);
270 *obound = 1;
271 }
272 }
273 return 0;
274} /* placev_ */
integer lframe
Definition: analys.c:66
#define min(a, b)
Definition: f2c.h:197
#define TRUE_
Definition: f2c.h:67
#define FALSE_
Definition: f2c.h:68
#define max(a, b)
Definition: f2c.h:198
INT32 integer
Definition: lpc10.h:80
INT32 logical
Definition: lpc10.h:81

References FALSE_, lframe, max, min, and TRUE_.

Referenced by analys_().