119{
120
122
123
125
126
131
132
133
134
135 ewin -= 3;
136 awin -= 3;
137 vwin -= 3;
138 --voibuf;
139
140
141 lrange = (*af - 2) * *
lframe + 1;
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167 allv = voibuf[((*af - 2) << 1) + 2] == 1;
168 allv = allv && voibuf[((*af - 1) << 1) + 1] == 1;
169 allv = allv && voibuf[((*af - 1) << 1) + 2] == 1;
170 allv = allv && voibuf[(*af << 1) + 1] == 1;
171 allv = allv && voibuf[(*af << 1) + 2] == 1;
172 winv = voibuf[(*af << 1) + 1] == 1 || voibuf[(*af << 1) + 2] == 1;
173 if (allv || (winv && *obound == 0)) {
174
175
176 i__ = (lrange + *ipitch - 1 - awin[((*af - 1) << 1) + 1]) / *ipitch;
177 i__ *= *ipitch;
178 i__ += awin[((*af - 1) << 1) + 1];
179
180 l = *maxwin;
181
182
183 k = (vwin[(*af << 1) + 1] + vwin[(*af << 1) + 2] + 1 - l) / 2;
184
185
186 r__1 = (
real) (k - i__) / *ipitch;
187 awin[(*af << 1) + 1] = i__ +
i_nint(&r__1) * *ipitch;
188 awin[(*af << 1) + 2] = awin[(*af << 1) + 1] + l - 1;
189
190
191
192
193
194 if (*obound >= 2 && awin[(*af << 1) + 2] > vwin[(*af << 1) + 2]) {
195 awin[(*af << 1) + 1] -= *ipitch;
196 awin[(*af << 1) + 2] -= *ipitch;
197 }
198
199 if ((*obound == 1 || *obound == 3) && awin[(*af << 1) + 1] < vwin[(*
200 af << 1) + 1]) {
201 awin[(*af << 1) + 1] += *ipitch;
202 awin[(*af << 1) + 2] += *ipitch;
203 }
204
205
206 while(awin[(*af << 1) + 2] > hrange) {
207 awin[(*af << 1) + 1] -= *ipitch;
208 awin[(*af << 1) + 2] -= *ipitch;
209 }
210
211
212 while(awin[(*af << 1) + 1] < lrange) {
213 awin[(*af << 1) + 1] += *ipitch;
214 awin[(*af << 1) + 2] += *ipitch;
215 }
216
218
219 } else {
220 awin[(*af << 1) + 1] = vwin[(*af << 1) + 1];
221 awin[(*af << 1) + 2] = vwin[(*af << 1) + 2];
223 }
224
225
226
227
228
229 j = (awin[(*af << 1) + 2] - awin[(*af << 1) + 1] + 1) / *ipitch * *ipitch;
230 if (j == 0 || ! winv) {
231 ewin[(*af << 1) + 1] = vwin[(*af << 1) + 1];
232 ewin[(*af << 1) + 2] = vwin[(*af << 1) + 2];
233 } else if (! ephase && *obound == 2) {
234 ewin[(*af << 1) + 1] = awin[(*af << 1) + 2] - j + 1;
235 ewin[(*af << 1) + 2] = awin[(*af << 1) + 2];
236 } else {
237 ewin[(*af << 1) + 1] = awin[(*af << 1) + 1];
238 ewin[(*af << 1) + 2] = awin[(*af << 1) + 1] + j - 1;
239 }
240 return 0;
241}