1 /*
2 * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 /**
17 * @file picosig2.c
18 *
19 * Signal Generation PU - Internal functions - Implementation
20 *
21 * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland
22 * All rights reserved.
23 *
24 * History:
25 * - 2009-04-20 -- initial version
26 *
27 */
28 #include "picoos.h"
29 #include "picodsp.h"
30 #include "picosig2.h"
31 #include "picofftsg.h"
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 #if 0
37 }
38 #endif
39 /*---------------------------------------------------------------------------
40 * INTERNAL FUNCTIONS DECLARATION
41 *---------------------------------------------------------------------------*/
42 static void gen_hann2(sig_innerobj_t *sig_inObj);
43 static void get_simple_excitation(sig_innerobj_t *sig_inObj,
44 picoos_int16 *nextPeak);
45 static void enh_wind_init(sig_innerobj_t *sig_inObj);
46 static void init_rand(sig_innerobj_t *sig_inObj);
47 static void get_trig(picoos_int32 ang, picoos_int32 *table, picoos_int32 *cs,
48 picoos_int32 *sn);
49
50 /*---------------------------------------------------------------------------
51 * PICO SYSTEM FUNCTIONS
52 *---------------------------------------------------------------------------*/
53 /**
54 * allocation of DSP memory for SIG PU
55 * @param mm : memory manager
56 * @param sig_inObj : sig PU internal object of the sub-object
57 * @return PICO_OK : allocation successful
58 * @return PICO_ERR_OTHER : allocation NOT successful
59 * @callgraph
60 * @callergraph
61 */
sigAllocate(picoos_MemoryManager mm,sig_innerobj_t * sig_inObj)62 pico_status_t sigAllocate(picoos_MemoryManager mm, sig_innerobj_t *sig_inObj)
63 {
64 picoos_int16 *data_i;
65 picoos_int32 *d32;
66 picoos_int32 nCount;
67
68 sig_inObj->int_vec22 =
69 sig_inObj->int_vec23 =
70 sig_inObj->int_vec24 =
71 sig_inObj->int_vec25 =
72 sig_inObj->int_vec26 =
73 sig_inObj->int_vec28 =
74 sig_inObj->int_vec29 =
75 sig_inObj->int_vec30 =
76 sig_inObj->int_vec31 =
77 sig_inObj->int_vec32 =
78 sig_inObj->int_vec33 =
79 sig_inObj->int_vec34 =
80 sig_inObj->int_vec35 =
81 sig_inObj->int_vec36 =
82 sig_inObj->int_vec37 =
83 sig_inObj->int_vec39 =
84 sig_inObj->int_vec40 = NULL;
85
86 sig_inObj->sig_vec1 = NULL;
87
88 sig_inObj->idx_vect1 = sig_inObj->idx_vect2 = sig_inObj->idx_vect4 = NULL;
89 sig_inObj->idx_vect5 = sig_inObj->idx_vect6 = sig_inObj->idx_vect7 =
90 sig_inObj->idx_vect8 = sig_inObj->idx_vect9 = NULL;
91 sig_inObj->ivalue17 = sig_inObj->ivalue18 = 0;
92
93 /*-----------------------------------------------------------------
94 * Memory allocations
95 * NOTE : it would be far better to do a single allocation
96 * and to do pointer initialization inside this routine
97 * ------------------------------------------------------------------*/
98 data_i = (picoos_int16 *) picoos_allocate(mm, sizeof(picoos_int16)
99 * PICODSP_FFTSIZE);
100 if (NULL == data_i) {
101 sigDeallocate(mm, sig_inObj);
102 return PICO_ERR_OTHER;
103 }
104 sig_inObj->idx_vect1 = data_i;
105
106 data_i = (picoos_int16 *) picoos_allocate(mm, sizeof(picoos_int16)
107 * PICODSP_HFFTSIZE_P1);
108 if (NULL == data_i) {
109 sigDeallocate(mm, sig_inObj);
110 return PICO_ERR_OTHER;
111 }
112 sig_inObj->idx_vect2 = data_i;
113
114 data_i = (picoos_int16 *) picoos_allocate(mm, sizeof(picoos_int16)
115 * PICODSP_FFTSIZE);
116 if (NULL == data_i) {
117 sigDeallocate(mm, sig_inObj);
118 return PICO_ERR_OTHER;
119 }
120 sig_inObj->idx_vect4 = data_i;
121
122 data_i = (picoos_int16 *) picoos_allocate(mm, sizeof(picoos_int16)
123 * PICODSP_FFTSIZE);
124 if (NULL == data_i) {
125 sigDeallocate(mm, sig_inObj);
126 return PICO_ERR_OTHER;
127 }
128 sig_inObj->idx_vect5 = data_i;
129
130 data_i = (picoos_int16 *) picoos_allocate(mm, sizeof(picoos_int16)
131 * PICODSP_FFTSIZE);
132 if (NULL == data_i) {
133 sigDeallocate(mm, sig_inObj);
134 return PICO_ERR_OTHER;
135 }
136 sig_inObj->idx_vect6 = data_i;
137
138 data_i = (picoos_int16 *) picoos_allocate(mm, sizeof(picoos_int16)
139 * PICODSP_HFFTSIZE_P1);
140 if (NULL == data_i) {
141 sigDeallocate(mm, sig_inObj);
142 return PICO_ERR_OTHER;
143 }
144 sig_inObj->idx_vect7 = data_i;
145
146 data_i = (picoos_int16 *) picoos_allocate(mm, sizeof(picoos_int16)
147 * PICODSP_MAX_EX);
148 if (NULL == data_i) {
149 sigDeallocate(mm, sig_inObj);
150 return PICO_ERR_OTHER;
151 }
152 sig_inObj->idx_vect8 = data_i;
153
154 data_i = (picoos_int16 *) picoos_allocate(mm, sizeof(picoos_int16)
155 * PICODSP_MAX_EX);
156 if (data_i == NULL) {
157 sigDeallocate(mm, sig_inObj);
158 return PICO_ERR_OTHER;
159 }
160 sig_inObj->idx_vect9 = data_i;
161
162 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
163 * PICODSP_FFTSIZE);
164 if (NULL == d32) {
165 sigDeallocate(mm, sig_inObj);
166 return PICO_ERR_OTHER;
167 }
168 sig_inObj->int_vec22 = d32;
169 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
170 * PICODSP_FFTSIZE);
171 if (NULL == d32) {
172 sigDeallocate(mm, sig_inObj);
173 return PICO_ERR_OTHER;
174 }
175 sig_inObj->int_vec23 = d32;
176 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
177 * PICODSP_FFTSIZE);
178 if (NULL == d32) {
179 sigDeallocate(mm, sig_inObj);
180 return PICO_ERR_OTHER;
181 }
182 sig_inObj->int_vec24 = d32;
183 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
184 * PICODSP_FFTSIZE);
185 if (NULL == d32) {
186 sigDeallocate(mm, sig_inObj);
187 return PICO_ERR_OTHER;
188 }
189 sig_inObj->int_vec25 = d32;
190 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
191 * PICODSP_FFTSIZE * 2);
192 if (NULL == d32) {
193 sigDeallocate(mm, sig_inObj);
194 return PICO_ERR_OTHER;
195 }
196 sig_inObj->int_vec26 = d32;
197
198 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
199 * PICODSP_FFTSIZE);
200 if (NULL == d32) {
201 sigDeallocate(mm, sig_inObj);
202 return PICO_ERR_OTHER;
203 }
204 sig_inObj->int_vec28 = d32;
205 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
206 * PICODSP_FFTSIZE);
207 if (NULL == d32) {
208 sigDeallocate(mm, sig_inObj);
209 return PICO_ERR_OTHER;
210 }
211 sig_inObj->int_vec29 = d32;
212 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
213 * PICODSP_FFTSIZE);
214 if (NULL == d32) {
215 sigDeallocate(mm, sig_inObj);
216 return PICO_ERR_OTHER;
217 }
218 sig_inObj->int_vec38 = d32;
219 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
220 * PICODSP_FFTSIZE);
221 if (NULL == d32) {
222 sigDeallocate(mm, sig_inObj);
223 return PICO_ERR_OTHER;
224 }
225 sig_inObj->int_vec30 = d32;
226 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
227 * PICODSP_FFTSIZE);
228 if (NULL == d32) {
229 sigDeallocate(mm, sig_inObj);
230 return PICO_ERR_OTHER;
231 }
232 sig_inObj->int_vec31 = d32;
233
234 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
235 * PICODSP_FFTSIZE);
236 if (NULL == d32) {
237 sigDeallocate(mm, sig_inObj);
238 return PICO_ERR_OTHER;
239 }
240 sig_inObj->int_vec32 = d32;
241 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
242 * PICODSP_FFTSIZE);
243 if (NULL == d32) {
244 sigDeallocate(mm, sig_inObj);
245 return PICO_ERR_OTHER;
246 }
247 sig_inObj->int_vec33 = d32;
248 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
249 * PICODSP_N_RAND_TABLE);
250 if (NULL == d32) {
251 sigDeallocate(mm, sig_inObj);
252 return PICO_ERR_OTHER;
253 }
254 sig_inObj->int_vec34 = d32;
255 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
256 * PICODSP_N_RAND_TABLE);
257 if (NULL == d32) {
258 sigDeallocate(mm, sig_inObj);
259 return PICO_ERR_OTHER;
260 }
261 sig_inObj->int_vec35 = d32;
262 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
263 * PICODSP_N_RAND_TABLE);
264 if (NULL == d32) {
265 sigDeallocate(mm, sig_inObj);
266 return PICO_ERR_OTHER;
267 }
268 sig_inObj->int_vec36 = d32;
269 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
270 * PICODSP_N_RAND_TABLE);
271 if (NULL == d32) {
272 sigDeallocate(mm, sig_inObj);
273 return PICO_ERR_OTHER;
274 }
275 sig_inObj->int_vec37 = d32;
276
277 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
278 * PICODSP_HFFTSIZE_P1);
279 if (NULL == d32) {
280 sigDeallocate(mm, sig_inObj);
281 return PICO_ERR_OTHER;
282 }
283 sig_inObj->int_vec39 = d32;
284 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32) * (1
285 + PICODSP_COS_TABLE_LEN));
286 if (NULL == d32) {
287 sigDeallocate(mm, sig_inObj);
288 return PICO_ERR_OTHER;
289 }
290 sig_inObj->int_vec40 = d32;
291
292 for (nCount = 0; nCount < CEPST_BUFF_SIZE; nCount++) {
293 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32) * (PICODSP_CEPORDER));
294 if (NULL == d32) {
295 sigDeallocate(mm, sig_inObj);
296 return PICO_ERR_OTHER;
297 }
298 sig_inObj->int_vec41[nCount] = d32;
299 }
300
301 for (nCount = 0; nCount < PHASE_BUFF_SIZE; nCount++) {
302 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32) * (PICODSP_PHASEORDER));
303 if (NULL == d32) {
304 sigDeallocate(mm, sig_inObj);
305 return PICO_ERR_OTHER;
306 }
307 sig_inObj->int_vec42[nCount] = d32;
308 }
309
310 d32 = (picoos_int32 *) picoos_allocate(mm, sizeof(picoos_int32)
311 * PICODSP_FFTSIZE * 2); /* - fixed point */
312 if (NULL == d32) {
313 sigDeallocate(mm, sig_inObj);
314 return PICO_ERR_OTHER;
315 }
316 sig_inObj->sig_vec1 = d32;
317
318 return PICO_OK;
319 }/*sigAllocate*/
320
321 /**
322 * frees DSP memory for SIG PU
323 * @param mm : memory manager
324 * @param sig_inObj : sig PU internal object of the sub-object
325 * @return void
326 * @callgraph
327 * @callergraph
328 */
sigDeallocate(picoos_MemoryManager mm,sig_innerobj_t * sig_inObj)329 void sigDeallocate(picoos_MemoryManager mm, sig_innerobj_t *sig_inObj)
330 {
331 picoos_int32 nCount;
332 /*-----------------------------------------------------------------
333 * Memory de-allocations
334 * ------------------------------------------------------------------*/
335 if (NULL != sig_inObj->idx_vect1)
336 picoos_deallocate(mm, (void *) &(sig_inObj->idx_vect1));
337 if (NULL != sig_inObj->idx_vect2)
338 picoos_deallocate(mm, (void *) &(sig_inObj->idx_vect2));
339 if (NULL != sig_inObj->idx_vect4)
340 picoos_deallocate(mm, (void *) &(sig_inObj->idx_vect4));
341 if (NULL != sig_inObj->idx_vect5)
342 picoos_deallocate(mm, (void *) &(sig_inObj->idx_vect5));
343 if (NULL != sig_inObj->idx_vect6)
344 picoos_deallocate(mm, (void *) &(sig_inObj->idx_vect6));
345 if (NULL != sig_inObj->idx_vect7)
346 picoos_deallocate(mm, (void *) &(sig_inObj->idx_vect7));
347 if (NULL != sig_inObj->idx_vect8)
348 picoos_deallocate(mm, (void *) &(sig_inObj->idx_vect8));
349 if (NULL != sig_inObj->idx_vect9)
350 picoos_deallocate(mm, (void *) &(sig_inObj->idx_vect9));
351
352 if (NULL != sig_inObj->int_vec22)
353 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec22));
354 if (NULL != sig_inObj->int_vec23)
355 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec23));
356 if (NULL != sig_inObj->int_vec24)
357 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec24));
358 if (NULL != sig_inObj->int_vec25)
359 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec25));
360 if (NULL != sig_inObj->int_vec26)
361 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec26));
362 if (NULL != sig_inObj->int_vec28)
363 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec28));
364 if (NULL != sig_inObj->int_vec29)
365 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec29));
366 if (NULL != sig_inObj->int_vec38)
367 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec38));
368 if (NULL != sig_inObj->int_vec30)
369 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec30));
370 if (NULL != sig_inObj->int_vec31)
371 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec31));
372 if (NULL != sig_inObj->int_vec32)
373 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec32));
374 if (NULL != sig_inObj->int_vec33)
375 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec33));
376 if (NULL != sig_inObj->int_vec34)
377 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec34));
378 if (NULL != sig_inObj->int_vec35)
379 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec35));
380 if (NULL != sig_inObj->int_vec36)
381 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec36));
382 if (NULL != sig_inObj->int_vec37)
383 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec37));
384 if (NULL != sig_inObj->int_vec39)
385 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec39));
386 if (NULL != sig_inObj->int_vec40)
387 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec40));
388
389 for (nCount = 0; nCount < CEPST_BUFF_SIZE; nCount++) {
390 if (NULL != sig_inObj->int_vec41[nCount]) {
391 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec41[nCount]));
392 }
393 }
394
395 for (nCount = 0; nCount < PHASE_BUFF_SIZE; nCount++) {
396 if (NULL != sig_inObj->int_vec42[nCount]) {
397 picoos_deallocate(mm, (void *) &(sig_inObj->int_vec42[nCount]));
398 }
399 }
400
401 if (NULL != sig_inObj->sig_vec1) {
402 picoos_deallocate(mm, (void *) &(sig_inObj->sig_vec1));
403 }
404 }/*sigDeAllocate*/
405
406 /**
407 * initializes all memory neededed by DSP at instance creation time
408 * @param sig_inObj : sig PU internal object of the sub-object
409 * @return void
410 * @callgraph
411 * @callergraph
412 */
sigDspInitialize(sig_innerobj_t * sig_inObj,picoos_int32 resetMode)413 void sigDspInitialize(sig_innerobj_t *sig_inObj, picoos_int32 resetMode)
414 {
415 picoos_int32 i, j;
416 picoos_int32 *pnt;
417
418 if (resetMode == PICO_RESET_SOFT) {
419 /*minimal initialization when receiving a soft reset */
420 return;
421 }
422 /*-----------------------------------------------------------------
423 * Initialization
424 * ------------------------------------------------------------------*/
425 sig_inObj->warp_p = PICODSP_FREQ_WARP_FACT;
426 sig_inObj->VCutoff_p = PICODSP_V_CUTOFF_FREQ; /*voicing cut off frequency in Hz (will be modeled in the future)*/
427 sig_inObj->UVCutoff_p = PICODSP_UV_CUTOFF_FREQ;/*unvoiced frames only (periodize lowest components to mask bad voicing transitions)*/
428 sig_inObj->Fs_p = PICODSP_SAMP_FREQ; /*Sampling freq*/
429
430 sig_inObj->m1_p = PICODSP_CEPORDER;
431 sig_inObj->m2_p = PICODSP_FFTSIZE; /*also initializes windowLen*/
432 sig_inObj->framesz_p = PICODSP_DISPLACE; /*1/4th of the frame size = displacement*/
433 sig_inObj->hfftsize_p = PICODSP_H_FFTSIZE; /*half of the FFT size*/
434 sig_inObj->voxbnd_p = (picoos_int32) ((picoos_single) sig_inObj->hfftsize_p
435 / ((picoos_single) sig_inObj->Fs_p / (picoos_single) 2)
436 * (picoos_single) sig_inObj->VCutoff_p);
437 sig_inObj->voxbnd2_p
438 = (picoos_int32) ((picoos_single) sig_inObj->hfftsize_p
439 / ((picoos_single) sig_inObj->Fs_p / (picoos_single) 2)
440 * (picoos_single) sig_inObj->UVCutoff_p);
441 sig_inObj->hop_p = sig_inObj->framesz_p;
442 sig_inObj->nextPeak_p = (((int) (PICODSP_FFTSIZE))
443 / ((int) PICODSP_DISPLACE) - 1) * sig_inObj->hop_p;
444 sig_inObj->phId_p = 0; /*phonetic id*/
445 sig_inObj->E_p = (picoos_single) 0.0f;
446 sig_inObj->F0_p = (picoos_single) 0.0f;
447 sig_inObj->voiced_p = 0;
448 sig_inObj->nV = sig_inObj->nU = 0;
449 sig_inObj->sMod_p = (picoos_single) 1.0f;
450
451 /*cleanup vectors*/
452 for (i = 0; i < 2 * PICODSP_FFTSIZE; i++) {
453 sig_inObj->sig_vec1[i] = 0;
454 sig_inObj->int_vec26[i] = 0; /*wav buff cleanup */
455 }
456
457 for (i = 0; i < PICODSP_FFTSIZE; i++) {
458 sig_inObj->idx_vect1[i] = sig_inObj->idx_vect4[i]
459 = sig_inObj->idx_vect5[i] = sig_inObj->idx_vect6[i] = 0;
460 sig_inObj->int_vec32[i] = sig_inObj->int_vec33[i] = 0;
461 }
462
463 for (i = 0; i < PICODSP_HFFTSIZE_P1; i++) {
464 sig_inObj->idx_vect2[i] = (picoos_int16) 0;
465 }
466
467 for (i = 0; i < CEPST_BUFF_SIZE; i++) {
468 sig_inObj->F0Buff[i]=0;
469 sig_inObj->PhIdBuff[i]=0;
470 sig_inObj->VoicingBuff[i]=0;
471 sig_inObj->FuVBuff[i]=0;
472 if (NULL != sig_inObj->CepBuff[i]) {
473 pnt = sig_inObj->CepBuff[i];
474 for (j = 0; j < PICODSP_CEPORDER; j++) {
475 pnt[j] = 0;
476 }
477 }
478 }
479
480 for (i = 0; i < PHASE_BUFF_SIZE; i++) {
481 if (NULL != sig_inObj->int_vec42[i]) {
482 pnt = sig_inObj->int_vec42[i];
483 for (j = 0; j < PICODSP_PHASEORDER; j++) {
484 pnt[j] = 0;
485 }
486 }
487 }
488 sig_inObj->n_available=0;
489 /*---------------------------------------------
490 Init formant enhancement window
491 hanning window,
492 Post Filter Hermite's interpolator Matrix
493 Mel-2-Lin lookup tables
494 ---------------------------------------------*/
495 enh_wind_init(sig_inObj); /*creates the formant enhancement window*/
496 init_rand(sig_inObj);
497 gen_hann2(sig_inObj);
498 mel_2_lin_init(sig_inObj);
499
500 }/*sigDspInitialize*/
501
502 /*-------------------------------------------------------------------------------
503 PROCESSING FUNCTIONS : CALLED WITHIN sigStep (cfr. picosig.c)
504 --------------------------------------------------------------------------------*/
505 /**
506 * convert from mel scale to linear scale
507 * @param sig_inObj : sig PU internal object of the sub-object
508 * @param scmeanMGC : mean value of the MGC
509 * @return void
510 * @callgraph
511 * @callergraph
512 * @remarks translated from matlab code to c-code
513 * Input
514 * - c1 : input mfcc vector (ceporder=m1, real)
515 * - m1 : input order
516 * - A,B,D : lookup tables
517 * - m2 : output order
518 * - Xr,Xi (m2=FFT size, real) temporary arrays for FFT
519 * - WNr,WNi (m2=FFT size, real) cos and sin precalculated tables
520 * Output
521 * - Xr (m2=FFT size, real) linear cepstral vector
522 */
mel_2_lin_lookup(sig_innerobj_t * sig_inObj,picoos_uint32 scmeanMGC)523 void mel_2_lin_lookup(sig_innerobj_t *sig_inObj, picoos_uint32 scmeanMGC)
524 {
525 /*Local vars*/
526 picoos_int16 nI, k;
527 picoos_int32 delta, term1, term2;
528
529 /*Local vars to be linked with sig data object*/
530 picoos_int32 *c1, *XXr;
531 picoos_single K1;
532 picoos_int32 *D, K2, shift;
533 picoos_int16 m1, *A, m2, m4, voiced, i;
534
535 /*Link local variables with sig data object*/
536 c1 = sig_inObj->wcep_pI;
537 m1 = sig_inObj->m1_p;
538 m2 = PICODSP_FFTSIZE;
539 m4 = m2 >> 1;
540
541 A = sig_inObj->A_p;
542 D = sig_inObj->d_p;
543
544 XXr = sig_inObj->wcep_pI;
545 voiced = sig_inObj->voiced_p;
546
547 shift = 27 - scmeanMGC;
548 K2 = 1 << shift;
549 K1 = (picoos_single) PICODSP_START_FLOAT_NORM * K2;
550 XXr[0] = (picoos_int32) ((picoos_single) c1[0] * K1);
551 for (nI = 1; nI < m1; nI++) {
552 XXr[nI] = c1[nI] << shift;
553 }
554 i = sizeof(picoos_int32) * (PICODSP_FFTSIZE + 1 - m1);
555 picoos_mem_set(XXr + m1, 0, i);
556 dfct_nmf(m4, XXr); /* DFCT directly in fixed point */
557
558 /* *****************************************************************************************
559 Linear frequency scale envelope through interpolation.
560 Two additions and one multiplication per entry.
561
562 Optimization of linear interpolation algorithm
563 - Start from 1 and stop at PICODSP_H_FFTSIZE-1 because 0 and PICODSP_H_FFTSIZE are invariant points
564 - B[k]=A[k]+1 except for 0 and PICODSP_H_FFTSIZE
565 - get rid of extra -1 operation by adapting the table A[]
566
567 *******************************************************************************************/
568 for (nI = 1; nI < PICODSP_H_FFTSIZE; nI++) {
569 k = A[nI];
570 term2 = XXr[k];
571 term1 = XXr[k + 1];
572 delta = term1 - term2;
573 XXr[nI] = term2 + ((D[nI] * delta) >> 5); /* ok because nI<=A[nI] <=B[nI] */
574 }
575 }/*mel_2_lin_lookup*/
576
577 /**
578 * calculate phase
579 * @remarks voiced phase taken from phase codebook and smoothed,
580 * @remarks unvoiced phase - random
581 * @param sig_inObj : sig PU internal object of the sub-object
582 * @return void
583 * @callgraph
584 * @callergraph
585 */
phase_spec2(sig_innerobj_t * sig_inObj)586 void phase_spec2(sig_innerobj_t *sig_inObj)
587 {
588 picoos_int16 nI, iRand, firstUV;
589 picoos_int32 *tmp1, *tmp2;
590 picoos_int16 VOXBND_M1;
591 picoos_int32 *spect, *ang;
592 picoos_int16 voiced, m2;
593 picoos_int32 *co, *so, *c, *s, voxbnd, voxbnd2;
594 picoos_int16 i,j, k, n_comp;
595 picoos_int16 *Pvoxbnd;
596 picoos_int32 *phs_p2, *phs_p1, *phs_n1, *phs_n2;
597 picoos_int32 *phs;
598
599 /*Link local variables to sig data object*/
600 spect = sig_inObj->wcep_pI; /* spect_p;*/
601 /* current spect scale : times PICODSP_FIX_SCALE1 */
602 ang = sig_inObj->ang_p;
603 voxbnd = (picoos_int32) (sig_inObj->voxbnd_p * sig_inObj->voicing);
604 voxbnd2 = sig_inObj->voxbnd2_p;
605 voiced = sig_inObj->voiced_p;
606 m2 = sig_inObj->m2_p;
607 VOXBND_M1 = voxbnd - 1;
608 firstUV = 1;
609
610 /*code starts here*/
611 if (voiced == 1) {
612 firstUV = voxbnd;
613 Pvoxbnd = sig_inObj->VoxBndBuff;
614 n_comp = Pvoxbnd[2];
615 phs_p2 = sig_inObj->PhsBuff[0];
616 phs_p1 = sig_inObj->PhsBuff[1];
617 phs = sig_inObj->PhsBuff[2];
618 phs_n1 = sig_inObj->PhsBuff[3];
619 phs_n2 = sig_inObj->PhsBuff[4];
620
621 /* find and smooth components which have full context */
622 j = n_comp;
623 for (i=0; i<5; i++) {
624 if (Pvoxbnd[i]<j) j = Pvoxbnd[i];
625 }
626 for (i=0; i<j; i++) {
627 ang[i] = -(((phs_p2[i]+phs_p1[i]+phs[i]+phs_n1[i]+phs_n2[i])<<6) / 5);
628 }
629
630 /* find and smooth components which at least one component on each side */
631 k = n_comp;
632 if (Pvoxbnd[2]<k) k = Pvoxbnd[2];
633 if (Pvoxbnd[4]<k) k = Pvoxbnd[4];
634 for (i=j; i<k; i++) { /* smooth using only two surrounding neighbours */
635 ang[i] = -(((phs_p1[i]+phs[i]+phs_n1[i])<<6) / 3);
636 }
637
638 /* handle rest of components - at least one side does not exist */
639 for (i=k; i<n_comp; i++) {
640 ang[i] = -(phs[i]<<6); /* - simple copy without smoothing */
641 }
642
643 /*Phase unwrap - cumsum */
644 tmp1 = &(ang[1]);
645 tmp2 = &(ang[0]);
646 /* current ang scale : PICODSP_M_PI = PICODSP_FIX_SCALE2 */
647 FAST_DEVICE(VOXBND_M1,*(tmp1++)+=*(tmp2)-PICODSP_FIX_SCALE2;*(tmp2)=(*tmp2>=0)?(*tmp2)>>PICODSP_SHIFT_FACT4:-((-(*tmp2))>>PICODSP_SHIFT_FACT4);tmp2++);
648 *tmp2 = (*tmp2 >= 0) ? (*tmp2) >> PICODSP_SHIFT_FACT4 : -((-(*tmp2))
649 >> PICODSP_SHIFT_FACT4); /*ang[voxbnd-1]/=2;*/
650 }
651
652 /* now for the unvoiced part */
653 iRand = sig_inObj->iRand;
654 c = sig_inObj->randCosTbl + iRand;
655 s = sig_inObj->randSinTbl + iRand;
656 co = sig_inObj->outCosTbl + firstUV;
657 so = sig_inObj->outSinTbl + firstUV;
658 for (nI = firstUV; nI < PICODSP_HFFTSIZE_P1 - 1; nI++) {
659 *co++ = *c++;
660 *so++ = *s++;
661 }
662 *co = 1;
663 *so = 0;
664 sig_inObj->iRand += (PICODSP_HFFTSIZE_P1 - firstUV);
665 if (sig_inObj->iRand > PICODSP_N_RAND_TABLE - PICODSP_HFFTSIZE_P1)
666 sig_inObj->iRand = 1 + sig_inObj->iRand + PICODSP_HFFTSIZE_P1
667 - PICODSP_N_RAND_TABLE;
668 }/*phase_spec2*/
669
670 /**
671 * Prepare Envelope spectrum for inverse FFT
672 * @param sig_inObj : sig PU internal object of the sub-object
673 * @return void
674 * @remarks make phase bilateral -->> angh (FFT size, real)
675 * @remarks combine in complex input vector for IFFT F = e**(spet/2+j*ang)
676 * @remarks Compute energy -->> E (scalar, real)
677 * @callgraph
678 * @callergraph
679 * Input
680 * - spect (FFT size, real)
681 * - ang (half FFT size -1, real)
682 * - m2 fftsize
683 * - WNr,WNi (FFT size, real) the tabulated sine and cosine values
684 * - brev (FFT size, real) the tabulated bit reversal indexes
685 * Output
686 * - Fr, Fi (FFT size, complex) the envelope spectrum
687 * - E (scalar, real) the energy
688 */
env_spec(sig_innerobj_t * sig_inObj)689 void env_spec(sig_innerobj_t *sig_inObj)
690 {
691
692 picoos_int16 nI;
693 picoos_int32 fcX, fsX, fExp, voxbnd;
694 picoos_int32 *spect, *ang, *ctbl;
695 picoos_int16 voiced, prev_voiced;
696 picoos_int32 *co, *so;
697 picoos_int32 *Fr, *Fi;
698 picoos_single mult;
699
700 /*Link local variables to sig object*/
701 spect = sig_inObj->wcep_pI; /*spect_p*/
702 /* current spect scale : times PICODSP_FIX_SCALE1 */
703 ang = sig_inObj->ang_p;
704 /* current spect scale : PICODSP_M_PI = PICODSP_FIX_SCALE2 */
705 Fr = sig_inObj->F2r_p;
706 Fi = sig_inObj->F2i_p;
707 voiced = sig_inObj->voiced_p;
708 prev_voiced = sig_inObj->prevVoiced_p;
709 voxbnd = (picoos_int32) (sig_inObj->voxbnd_p * sig_inObj->voicing);
710 ctbl = sig_inObj->cos_table;
711 /* ctbl scale : times 4096 */
712 mult = PICODSP_ENVSPEC_K1 / PICODSP_FIX_SCALE1;
713
714 /*remove dc from real part*/
715 if (sig_inObj->F0_p > 120) {
716 spect[0] = spect[1] = 0;
717 spect[2] /= PICODSP_ENVSPEC_K2;
718 } else {
719 spect[0] = 0;
720 }
721
722 /* if using rand table, use sin and cos tables as well */
723 if (voiced || (prev_voiced)) {
724 /*Envelope becomes a complex exponential : F=exp(.5*spect + j*angh);*/
725 for (nI = 0; nI < voxbnd; nI++) {
726 get_trig(ang[nI], ctbl, &fcX, &fsX);
727 fExp = (picoos_int32) EXP((double)spect[nI]*mult);
728 Fr[nI] = fExp * fcX;
729 Fi[nI] = fExp * fsX;
730 }
731 /* ao=sig_inObj->ang_p+(picoos_int32)voxbnd; */
732 co = sig_inObj->outCosTbl + voxbnd;
733 so = sig_inObj->outSinTbl + voxbnd;
734
735 for (nI = voxbnd; nI < PICODSP_HFFTSIZE_P1; nI++) {
736 fcX = *co++;
737 fsX = *so++;
738 fExp = (picoos_int32) EXP((double)spect[nI]*mult);
739 Fr[nI] = fExp * fcX;
740 Fi[nI] = fExp * fsX;
741 }
742 } else {
743 /*ao=sig_inObj->ang_p+1;*/
744 co = sig_inObj->outCosTbl + 1;
745 so = sig_inObj->outSinTbl + 1;
746 for (nI = 1; nI < PICODSP_HFFTSIZE_P1; nI++) {
747 fcX = *co++;
748 fsX = *so++;
749 fExp = (picoos_int32) EXP((double)spect[nI]*mult);
750
751 Fr[nI] = fExp * fcX;
752 Fi[nI] = fExp * fsX;
753 }
754 }
755
756 }/*env_spec*/
757
758 /**
759 * Calculates the impulse response of the comlpex spectrum through inverse rFFT
760 * @param sig_inObj : sig PU internal object of the sub-object
761 * @return void
762 * @remarks Imp corresponds with the real part of the FFT
763 * @callgraph
764 * @callergraph
765 * Input
766 * - Fr, Fi (FFT size, real & imaginary) the complex envelope spectrum (only first half of spectrum)
767 * Output
768 * - Imp: impulse response (length: m2)
769 * - E (scalar, real) RMS value
770 */
impulse_response(sig_innerobj_t * sig_inObj)771 void impulse_response(sig_innerobj_t *sig_inObj)
772 {
773 /*Define local variables*/
774 picoos_single f;
775 picoos_int16 nI, nn, m2, m4, voiced;
776 picoos_single *E;
777 picoos_int32 *norm_window; /* - fixed point */
778 picoos_int32 *fr, *Fr, *Fi, *t1, ff; /* - fixed point */
779
780 /*Link local variables with sig object*/
781 m2 = sig_inObj->m2_p;
782 m4 = m2 >> 1;
783 Fr = sig_inObj->F2r_p;
784 Fi = sig_inObj->F2i_p;
785 norm_window = sig_inObj->norm_window_p;
786 E = &(sig_inObj->E_p); /*as pointer: value will be modified*/
787 voiced = sig_inObj->voiced_p;
788 fr = sig_inObj->imp_p;
789
790 /*Inverse FFT*/
791 for (nI = 0, nn = 0; nI < m4; nI++, nn += 2) {
792 fr[nn] = Fr[nI]; /* - fixed point */
793 }
794
795 fr[1] = (picoos_int32) (Fr[m4]);
796 for (nI = 1, nn = 3; nI < m4; nI++, nn += 2) {
797 fr[nn] = -Fi[nI]; /* - fixed point */
798 }
799
800 rdft(m2, -1, fr);
801 /*window, normalize and differentiate*/
802 *E = norm_result(m2, fr, norm_window);
803
804 if (*E > 0) {
805 f = *E * PICODSP_FIXRESP_NORM;
806 } else {
807 f = 20; /*PICODSP_FIXRESP_NORM*/
808 }
809 ff = (picoos_int32) f;
810 if (ff < 1)
811 ff = 1;
812 /*normalize impulse response*/
813 t1 = fr;FAST_DEVICE(PICODSP_FFTSIZE,*(t1++) /= ff;); /* - fixed point */
814
815 } /* impulse_response */
816
817 /**
818 * time domain pitch synchronous overlap add over two frames (when no voicing transition)
819 * @param sig_inObj : sig PU internal object of the sub-object
820 * @return void
821 * @remarks Special treatment at voicing boundaries
822 * @remarks Introduced to get rid of time-domain aliasing (and additional speed up)
823 * @callgraph
824 * @callergraph
825 */
td_psola2(sig_innerobj_t * sig_inObj)826 void td_psola2(sig_innerobj_t *sig_inObj)
827 {
828 picoos_int16 nI;
829 picoos_int16 hop, m2, *nextPeak, voiced;
830 picoos_int32 *t1, *t2;
831 picoos_int16 cnt;
832 picoos_int32 *fr, *v1, ff, f;
833 picoos_int16 a, i;
834 picoos_int32 *window;
835 picoos_int16 s = (picoos_int16) 1;
836 window = sig_inObj->window_p;
837
838 /*Link local variables with sig object*/
839 hop = sig_inObj->hop_p;
840 m2 = sig_inObj->m2_p;
841 nextPeak = &(sig_inObj->nextPeak_p);
842 voiced = sig_inObj->voiced_p;
843 fr = sig_inObj->imp_p;
844 /*toggle the pointers and initialize signal vector */
845 v1 = sig_inObj->sig_vec1;
846
847 t1 = v1;
848 FAST_DEVICE(PICODSP_FFTSIZE-PICODSP_DISPLACE,*(t1++)=0;);
849 t1 = &(v1[PICODSP_FFTSIZE - PICODSP_DISPLACE]);
850 t2 = &(v1[PICODSP_FFTSIZE]);
851 FAST_DEVICE(PICODSP_FFTSIZE, *(t1++)=*(t2++););
852 t1 = &(v1[2 * PICODSP_FFTSIZE - PICODSP_DISPLACE]);FAST_DEVICE(PICODSP_DISPLACE,*(t1++)=0;);
853 /*calculate excitation points*/
854 get_simple_excitation(sig_inObj, nextPeak);
855
856 /*TD-PSOLA based on excitation vector */
857 if ((sig_inObj->nU == 0) && (sig_inObj->voiced_p == 1)) {
858 /* purely voiced */
859 for (nI = 0; nI < sig_inObj->nV; nI++) {
860 f = sig_inObj->EnV[nI];
861 a = 0;
862 cnt = PICODSP_FFTSIZE;
863 ff = (f * window[sig_inObj->LocV[nI]]) >> PICODSP_SHIFT_FACT1;
864 t1 = &(v1[a + sig_inObj->LocV[nI]]);
865 t2 = &(fr[a]);
866 if (cnt > 0)FAST_DEVICE(cnt,*(t1++)+=*(t2++)*ff;);
867 }
868 } else if ((sig_inObj->nV == 0) && (sig_inObj->voiced_p == 0)) {
869 /* PURELY UNVOICED*/
870 for (nI = 0; nI < sig_inObj->nU; nI++) {
871 f = sig_inObj->EnU[nI];
872 s = -s; /*reverse order to reduce the periodicity effect*/
873 if (s == 1) {
874 a = 0;
875 cnt = PICODSP_FFTSIZE;
876 ff = (f * window[sig_inObj->LocU[nI]]) >> PICODSP_SHIFT_FACT1;
877 t1 = &(v1[a + sig_inObj->LocU[nI]]);
878 t2 = &(fr[a]);
879 if (cnt > 0)FAST_DEVICE(cnt,*(t1++)+=*(t2++)*ff; );
880 } else { /*s==-1*/
881 a = 0;
882 cnt = PICODSP_FFTSIZE;
883 ff = (f * window[sig_inObj->LocU[nI]]) >> PICODSP_SHIFT_FACT1;
884 t1 = &(v1[(m2 - 1 - a) + sig_inObj->LocU[nI]]);
885 t2 = &(fr[a]);
886 if (cnt > 0)FAST_DEVICE(cnt,*(t1--)+=*(t2++)*ff; );
887 }
888 }
889 } else if (sig_inObj->VoicTrans == 0) {
890 /*voicing transition from unvoiced to voiced*/
891 for (nI = 0; nI < sig_inObj->nV; nI++) {
892 f = sig_inObj->EnV[nI];
893 a = 0;
894 cnt = PICODSP_FFTSIZE;
895 ff = (f * window[sig_inObj->LocV[nI]]) >> PICODSP_SHIFT_FACT1;
896 t1 = &(v1[a + sig_inObj->LocV[nI]]);
897 t2 = &(fr[a]);
898 if (cnt > 0)FAST_DEVICE(cnt,*(t1++)+=*(t2++)*ff;);
899 }
900 /*add remaining stuff from unvoiced part*/
901 for (nI = 0; nI < sig_inObj->nU; nI++) {
902 f = sig_inObj->EnU[nI];
903 s = -s; /*reverse order to reduce the periodicity effect*/
904 if (s == 1) {
905 a = 0;
906 cnt = PICODSP_FFTSIZE;
907 ff = (f * window[sig_inObj->LocU[nI]]) >> PICODSP_SHIFT_FACT1;
908 t1 = &(v1[a + sig_inObj->LocU[nI]]);
909 t2 = &(sig_inObj->ImpResp_p[a]); /*saved impulse response*/
910 if (cnt > 0)FAST_DEVICE(cnt,*(t1++)+=*(t2++)*ff; );
911 } else {
912 a = 0;
913 cnt = PICODSP_FFTSIZE;
914 ff = (f * window[sig_inObj->LocU[nI]]) >> PICODSP_SHIFT_FACT1;
915 t1 = &(v1[(m2 - 1 - a) + sig_inObj->LocU[nI]]);
916 t2 = &(sig_inObj->ImpResp_p[a]);
917 if (cnt > 0)FAST_DEVICE(cnt,*(t1--)+=*(t2++)*ff; );
918 }
919 }
920 } else {
921 /*voiced to unvoiced*/
922 for (nI = 0; nI < sig_inObj->nU; nI++) {
923 f = sig_inObj->EnU[nI];
924 s = -s; /*reverse order to reduce the periodicity effect*/
925 if (s > 0) {
926 a = 0;
927 cnt = PICODSP_FFTSIZE;
928 ff = (f * window[sig_inObj->LocU[nI]]) >> PICODSP_SHIFT_FACT1;
929 t1 = &(v1[a + sig_inObj->LocU[nI]]);
930 t2 = &(fr[a]);
931 if (cnt > 0)FAST_DEVICE(cnt,*(t1++)+=*(t2++)*ff; );
932 } else {
933 a = 0;
934 cnt = PICODSP_FFTSIZE;
935 ff = (f * window[sig_inObj->LocU[nI]]) >> PICODSP_SHIFT_FACT1;
936 t1 = &(v1[(m2 - 1 - a) + sig_inObj->LocU[nI]]);
937 t2 = &(fr[a]);
938 if (cnt > 0)FAST_DEVICE(cnt,*(t1--)+=*(t2++)*ff; );
939 }
940 }
941 /*add remaining stuff from voiced part*/
942 for (nI = 0; nI < sig_inObj->nV; nI++) {
943 f = sig_inObj->EnV[nI];
944 a = 0;
945 cnt = PICODSP_FFTSIZE;
946 ff = (f * window[sig_inObj->LocV[nI]]) >> PICODSP_SHIFT_FACT1;
947 t1 = &(v1[a + sig_inObj->LocV[nI]]);
948 t2 = &(sig_inObj->ImpResp_p[a]);
949 if (cnt > 0)FAST_DEVICE(cnt,*(t1++)+=*(t2++)*ff;);
950 }
951 }
952
953 t1 = sig_inObj->sig_vec1;
954 for (i = 0; i < PICODSP_FFTSIZE; i++, t1++) {
955 if (*t1 >= 0)
956 *t1 >>= PICODSP_SHIFT_FACT5;
957 else
958 *t1 = -((-*t1) >> PICODSP_SHIFT_FACT5);
959 }
960
961 }/*td_psola2*/
962
963 /**
964 * overlap + add summing of impulse responses on the final destination sample buffer
965 * @param sig_inObj : sig PU internal object of the sub-object
966 * @return void
967 * @remarks Special treatment at voicing boundaries
968 * @remarks Introduced to get rid of time-domain aliasing (and additional speed up)
969 * Input
970 * - wlet : the generic impulse response (FFT size, real)
971 * - window : the windowing funcion (FFT size, real) fixed
972 * - WavBuff : the destination buffer with past samples (FFT size*2, short)
973 * - m2 : fftsize
974 * Output
975 * - WavBuff : the destination buffer with updated samples (FFT size*2, short)
976 * @callgraph
977 * @callergraph
978 */
overlap_add(sig_innerobj_t * sig_inObj)979 void overlap_add(sig_innerobj_t *sig_inObj)
980 {
981 /*Local variables*/
982 picoos_int32 *w, *v;
983
984 /*Link local variables with sig object*/
985 w = sig_inObj->WavBuff_p;
986 v = sig_inObj->sig_vec1;
987
988 FAST_DEVICE(PICODSP_FFTSIZE, *(w++)+=*(v++)<<PICODSP_SHIFT_FACT6;);
989
990 }/*overlap_add*/
991
992 /*-------------------------------------------------------------------------------
993 INITIALIZATION AND INTERNAL FUNCTIONS
994 --------------------------------------------------------------------------------*/
995 /**
996 * Hanning window initialization
997 * @param sig_inObj : sig PU internal object of the sub-object
998 * @return PICO_OK
999 * @callgraph
1000 * @callergraph
1001 */
gen_hann2(sig_innerobj_t * sig_inObj)1002 static void gen_hann2(sig_innerobj_t *sig_inObj)
1003 {
1004 picoos_int32 *hann;
1005 picoos_int32 *norm;
1006 /*link local variables with sig object*/
1007 hann = sig_inObj->window_p;
1008 norm = sig_inObj->norm_window_p;
1009
1010 norm[0] = 80224;
1011 norm[1] = 320832;
1012 norm[2] = 721696;
1013 norm[3] = 1282560;
1014 norm[4] = 2003104;
1015 norm[5] = 2882880;
1016 norm[6] = 3921376;
1017 norm[7] = 5117984;
1018 norm[8] = 6471952;
1019 norm[9] = 7982496;
1020 norm[10] = 9648720;
1021 norm[11] = 11469616;
1022 norm[12] = 13444080;
1023 norm[13] = 15570960;
1024 norm[14] = 17848976;
1025 norm[15] = 20276752;
1026 norm[16] = 22852864;
1027 norm[17] = 25575744;
1028 norm[18] = 28443776;
1029 norm[19] = 31455264;
1030 norm[20] = 34608368;
1031 norm[21] = 37901248;
1032 norm[22] = 41331904;
1033 norm[23] = 44898304;
1034 norm[24] = 48598304;
1035 norm[25] = 52429696;
1036 norm[26] = 56390192;
1037 norm[27] = 60477408;
1038 norm[28] = 64688944;
1039 norm[29] = 69022240;
1040 norm[30] = 73474720;
1041 norm[31] = 78043744;
1042 norm[32] = 82726544;
1043 norm[33] = 87520352;
1044 norm[34] = 92422272;
1045 norm[35] = 97429408;
1046 norm[36] = 102538752;
1047 norm[37] = 107747248;
1048 norm[38] = 113051776;
1049 norm[39] = 118449184;
1050 norm[40] = 123936224;
1051 norm[41] = 129509648;
1052 norm[42] = 135166080;
1053 norm[43] = 140902192;
1054 norm[44] = 146714528;
1055 norm[45] = 152599584;
1056 norm[46] = 158553904;
1057 norm[47] = 164573888;
1058 norm[48] = 170655936;
1059 norm[49] = 176796448;
1060 norm[50] = 182991712;
1061 norm[51] = 189238064;
1062 norm[52] = 195531744;
1063 norm[53] = 201868992;
1064 norm[54] = 208246016;
1065 norm[55] = 214659040;
1066 norm[56] = 221104176;
1067 norm[57] = 227577616;
1068 norm[58] = 234075488;
1069 norm[59] = 240593872;
1070 norm[60] = 247128912;
1071 norm[61] = 253676688;
1072 norm[62] = 260233280;
1073 norm[63] = 266794768;
1074 norm[64] = 273357248;
1075 norm[65] = 279916768;
1076 norm[66] = 286469440;
1077 norm[67] = 293011360;
1078 norm[68] = 299538560;
1079 norm[69] = 306047168;
1080 norm[70] = 312533312;
1081 norm[71] = 318993088;
1082 norm[72] = 325422656;
1083 norm[73] = 331818144;
1084 norm[74] = 338175744;
1085 norm[75] = 344491680;
1086 norm[76] = 350762176;
1087 norm[77] = 356983424;
1088 norm[78] = 363151808;
1089 norm[79] = 369263520;
1090 norm[80] = 375315008;
1091 norm[81] = 381302592;
1092 norm[82] = 387222720;
1093 norm[83] = 393071872;
1094 norm[84] = 398846528;
1095 norm[85] = 404543232;
1096 norm[86] = 410158560;
1097 norm[87] = 415689216;
1098 norm[88] = 421131840;
1099 norm[89] = 426483200;
1100 norm[90] = 431740096;
1101 norm[91] = 436899392;
1102 norm[92] = 441958016;
1103 norm[93] = 446912928;
1104 norm[94] = 451761152;
1105 norm[95] = 456499840;
1106 norm[96] = 461126080;
1107 norm[97] = 465637152;
1108 norm[98] = 470030400;
1109 norm[99] = 474303104;
1110 norm[100] = 478452800;
1111 norm[101] = 482476960;
1112 norm[102] = 486373184;
1113 norm[103] = 490139200;
1114 norm[104] = 493772640;
1115 norm[105] = 497271424;
1116 norm[106] = 500633440;
1117 norm[107] = 503856704;
1118 norm[108] = 506939200;
1119 norm[109] = 509879168;
1120 norm[110] = 512674880;
1121 norm[111] = 515324544;
1122 norm[112] = 517826688;
1123 norm[113] = 520179776;
1124 norm[114] = 522382368;
1125 norm[115] = 524433184;
1126 norm[116] = 526331008;
1127 norm[117] = 528074688;
1128 norm[118] = 529663200;
1129 norm[119] = 531095552;
1130 norm[120] = 532370944;
1131 norm[121] = 533488576;
1132 norm[122] = 534447808;
1133 norm[123] = 535248000;
1134 norm[124] = 535888768;
1135 norm[125] = 536369664;
1136 norm[126] = 536690432;
1137 norm[127] = 536850880;
1138 norm[128] = 536850880;
1139 norm[129] = 536690432;
1140 norm[130] = 536369664;
1141 norm[131] = 535888768;
1142 norm[132] = 535248000;
1143 norm[133] = 534447808;
1144 norm[134] = 533488576;
1145 norm[135] = 532370944;
1146 norm[136] = 531095552;
1147 norm[137] = 529663200;
1148 norm[138] = 528074688;
1149 norm[139] = 526331008;
1150 norm[140] = 524433216;
1151 norm[141] = 522382368;
1152 norm[142] = 520179776;
1153 norm[143] = 517826688;
1154 norm[144] = 515324544;
1155 norm[145] = 512674880;
1156 norm[146] = 509879168;
1157 norm[147] = 506939200;
1158 norm[148] = 503856704;
1159 norm[149] = 500633472;
1160 norm[150] = 497271424;
1161 norm[151] = 493772672;
1162 norm[152] = 490139200;
1163 norm[153] = 486373184;
1164 norm[154] = 482476992;
1165 norm[155] = 478452800;
1166 norm[156] = 474303104;
1167 norm[157] = 470030400;
1168 norm[158] = 465637184;
1169 norm[159] = 461126080;
1170 norm[160] = 456499840;
1171 norm[161] = 451761152;
1172 norm[162] = 446912960;
1173 norm[163] = 441958016;
1174 norm[164] = 436899424;
1175 norm[165] = 431740096;
1176 norm[166] = 426483200;
1177 norm[167] = 421131840;
1178 norm[168] = 415689216;
1179 norm[169] = 410158560;
1180 norm[170] = 404543232;
1181 norm[171] = 398846528;
1182 norm[172] = 393071872;
1183 norm[173] = 387222720;
1184 norm[174] = 381302592;
1185 norm[175] = 375315008;
1186 norm[176] = 369263552;
1187 norm[177] = 363151808;
1188 norm[178] = 356983456;
1189 norm[179] = 350762176;
1190 norm[180] = 344491712;
1191 norm[181] = 338175776;
1192 norm[182] = 331818144;
1193 norm[183] = 325422656;
1194 norm[184] = 318993088;
1195 norm[185] = 312533312;
1196 norm[186] = 306047168;
1197 norm[187] = 299538560;
1198 norm[188] = 293011360;
1199 norm[189] = 286469472;
1200 norm[190] = 279916800;
1201 norm[191] = 273357248;
1202 norm[192] = 266794784;
1203 norm[193] = 260233280;
1204 norm[194] = 253676688;
1205 norm[195] = 247128928;
1206 norm[196] = 240593888;
1207 norm[197] = 234075488;
1208 norm[198] = 227577632;
1209 norm[199] = 221104192;
1210 norm[200] = 214659040;
1211 norm[201] = 208246032;
1212 norm[202] = 201868992;
1213 norm[203] = 195531744;
1214 norm[204] = 189238080;
1215 norm[205] = 182991728;
1216 norm[206] = 176796448;
1217 norm[207] = 170655952;
1218 norm[208] = 164573888;
1219 norm[209] = 158553920;
1220 norm[210] = 152599600;
1221 norm[211] = 146714528;
1222 norm[212] = 140902208;
1223 norm[213] = 135166096;
1224 norm[214] = 129509648;
1225 norm[215] = 123936240;
1226 norm[216] = 118449184;
1227 norm[217] = 113051776;
1228 norm[218] = 107747248;
1229 norm[219] = 102538752;
1230 norm[220] = 97429424;
1231 norm[221] = 92422288;
1232 norm[222] = 87520352;
1233 norm[223] = 82726544;
1234 norm[224] = 78043744;
1235 norm[225] = 73474736;
1236 norm[226] = 69022240;
1237 norm[227] = 64688944;
1238 norm[228] = 60477424;
1239 norm[229] = 56390192;
1240 norm[230] = 52429696;
1241 norm[231] = 48598304;
1242 norm[232] = 44898304;
1243 norm[233] = 41331904;
1244 norm[234] = 37901248;
1245 norm[235] = 34608384;
1246 norm[236] = 31455264;
1247 norm[237] = 28443792;
1248 norm[238] = 25575744;
1249 norm[239] = 22852864;
1250 norm[240] = 20276752;
1251 norm[241] = 17848976;
1252 norm[242] = 15570960;
1253 norm[243] = 13444080;
1254 norm[244] = 11469616;
1255 norm[245] = 9648720;
1256 norm[246] = 7982512;
1257 norm[247] = 6471952;
1258 norm[248] = 5117984;
1259 norm[249] = 3921376;
1260 norm[250] = 2882880;
1261 norm[251] = 2003104;
1262 norm[252] = 1282560;
1263 norm[253] = 721696;
1264 norm[254] = 320832;
1265 norm[255] = 80224;
1266 hann[0] = 0;
1267 hann[1] = 0;
1268 hann[2] = 1;
1269 hann[3] = 2;
1270 hann[4] = 3;
1271 hann[5] = 5;
1272 hann[6] = 7;
1273 hann[7] = 9;
1274 hann[8] = 12;
1275 hann[9] = 15;
1276 hann[10] = 18;
1277 hann[11] = 21;
1278 hann[12] = 25;
1279 hann[13] = 29;
1280 hann[14] = 34;
1281 hann[15] = 38;
1282 hann[16] = 43;
1283 hann[17] = 48;
1284 hann[18] = 54;
1285 hann[19] = 59;
1286 hann[20] = 66;
1287 hann[21] = 72;
1288 hann[22] = 78;
1289 hann[23] = 85;
1290 hann[24] = 92;
1291 hann[25] = 100;
1292 hann[26] = 107;
1293 hann[27] = 115;
1294 hann[28] = 123;
1295 hann[29] = 131;
1296 hann[30] = 140;
1297 hann[31] = 148;
1298 hann[32] = 157;
1299 hann[33] = 166;
1300 hann[34] = 176;
1301 hann[35] = 185;
1302 hann[36] = 195;
1303 hann[37] = 205;
1304 hann[38] = 215;
1305 hann[39] = 225;
1306 hann[40] = 236;
1307 hann[41] = 247;
1308 hann[42] = 257;
1309 hann[43] = 268;
1310 hann[44] = 279;
1311 hann[45] = 291;
1312 hann[46] = 302;
1313 hann[47] = 313;
1314 hann[48] = 325;
1315 hann[49] = 337;
1316 hann[50] = 349;
1317 hann[51] = 360;
1318 hann[52] = 372;
1319 hann[53] = 385;
1320 hann[54] = 397;
1321 hann[55] = 409;
1322 hann[56] = 421;
1323 hann[57] = 434;
1324 hann[58] = 446;
1325 hann[59] = 458;
1326 hann[60] = 471;
1327 hann[61] = 483;
1328 hann[62] = 496;
1329 hann[63] = 508;
1330 hann[64] = 521;
1331 hann[65] = 533;
1332 hann[66] = 546;
1333 hann[67] = 558;
1334 hann[68] = 571;
1335 hann[69] = 583;
1336 hann[70] = 596;
1337 hann[71] = 608;
1338 hann[72] = 620;
1339 hann[73] = 632;
1340 hann[74] = 645;
1341 hann[75] = 657;
1342 hann[76] = 669;
1343 hann[77] = 680;
1344 hann[78] = 692;
1345 hann[79] = 704;
1346 hann[80] = 715;
1347 hann[81] = 727;
1348 hann[82] = 738;
1349 hann[83] = 749;
1350 hann[84] = 760;
1351 hann[85] = 771;
1352 hann[86] = 782;
1353 hann[87] = 792;
1354 hann[88] = 803;
1355 hann[89] = 813;
1356 hann[90] = 823;
1357 hann[91] = 833;
1358 hann[92] = 842;
1359 hann[93] = 852;
1360 hann[94] = 861;
1361 hann[95] = 870;
1362 hann[96] = 879;
1363 hann[97] = 888;
1364 hann[98] = 896;
1365 hann[99] = 904;
1366 hann[100] = 912;
1367 hann[101] = 920;
1368 hann[102] = 927;
1369 hann[103] = 934;
1370 hann[104] = 941;
1371 hann[105] = 948;
1372 hann[106] = 954;
1373 hann[107] = 961;
1374 hann[108] = 966;
1375 hann[109] = 972;
1376 hann[110] = 977;
1377 hann[111] = 982;
1378 hann[112] = 987;
1379 hann[113] = 992;
1380 hann[114] = 996;
1381 hann[115] = 1000;
1382 hann[116] = 1003;
1383 hann[117] = 1007;
1384 hann[118] = 1010;
1385 hann[119] = 1012;
1386 hann[120] = 1015;
1387 hann[121] = 1017;
1388 hann[122] = 1019;
1389 hann[123] = 1020;
1390 hann[124] = 1022;
1391 hann[125] = 1023;
1392 hann[126] = 1023;
1393 hann[127] = 1023;
1394 hann[128] = 1023;
1395 hann[129] = 1023;
1396 hann[130] = 1023;
1397 hann[131] = 1022;
1398 hann[132] = 1020;
1399 hann[133] = 1019;
1400 hann[134] = 1017;
1401 hann[135] = 1015;
1402 hann[136] = 1012;
1403 hann[137] = 1010;
1404 hann[138] = 1007;
1405 hann[139] = 1003;
1406 hann[140] = 1000;
1407 hann[141] = 996;
1408 hann[142] = 992;
1409 hann[143] = 987;
1410 hann[144] = 982;
1411 hann[145] = 977;
1412 hann[146] = 972;
1413 hann[147] = 966;
1414 hann[148] = 961;
1415 hann[149] = 954;
1416 hann[150] = 948;
1417 hann[151] = 941;
1418 hann[152] = 934;
1419 hann[153] = 927;
1420 hann[154] = 920;
1421 hann[155] = 912;
1422 hann[156] = 904;
1423 hann[157] = 896;
1424 hann[158] = 888;
1425 hann[159] = 879;
1426 hann[160] = 870;
1427 hann[161] = 861;
1428 hann[162] = 852;
1429 hann[163] = 842;
1430 hann[164] = 833;
1431 hann[165] = 823;
1432 hann[166] = 813;
1433 hann[167] = 803;
1434 hann[168] = 792;
1435 hann[169] = 782;
1436 hann[170] = 771;
1437 hann[171] = 760;
1438 hann[172] = 749;
1439 hann[173] = 738;
1440 hann[174] = 727;
1441 hann[175] = 715;
1442 hann[176] = 704;
1443 hann[177] = 692;
1444 hann[178] = 680;
1445 hann[179] = 669;
1446 hann[180] = 657;
1447 hann[181] = 645;
1448 hann[182] = 632;
1449 hann[183] = 620;
1450 hann[184] = 608;
1451 hann[185] = 596;
1452 hann[186] = 583;
1453 hann[187] = 571;
1454 hann[188] = 558;
1455 hann[189] = 546;
1456 hann[190] = 533;
1457 hann[191] = 521;
1458 hann[192] = 508;
1459 hann[193] = 496;
1460 hann[194] = 483;
1461 hann[195] = 471;
1462 hann[196] = 458;
1463 hann[197] = 446;
1464 hann[198] = 434;
1465 hann[199] = 421;
1466 hann[200] = 409;
1467 hann[201] = 397;
1468 hann[202] = 385;
1469 hann[203] = 372;
1470 hann[204] = 360;
1471 hann[205] = 349;
1472 hann[206] = 337;
1473 hann[207] = 325;
1474 hann[208] = 313;
1475 hann[209] = 302;
1476 hann[210] = 291;
1477 hann[211] = 279;
1478 hann[212] = 268;
1479 hann[213] = 257;
1480 hann[214] = 247;
1481 hann[215] = 236;
1482 hann[216] = 225;
1483 hann[217] = 215;
1484 hann[218] = 205;
1485 hann[219] = 195;
1486 hann[220] = 185;
1487 hann[221] = 176;
1488 hann[222] = 166;
1489 hann[223] = 157;
1490 hann[224] = 148;
1491 hann[225] = 140;
1492 hann[226] = 131;
1493 hann[227] = 123;
1494 hann[228] = 115;
1495 hann[229] = 107;
1496 hann[230] = 100;
1497 hann[231] = 92;
1498 hann[232] = 85;
1499 hann[233] = 78;
1500 hann[234] = 72;
1501 hann[235] = 66;
1502 hann[236] = 59;
1503 hann[237] = 54;
1504 hann[238] = 48;
1505 hann[239] = 43;
1506 hann[240] = 38;
1507 hann[241] = 34;
1508 hann[242] = 29;
1509 hann[243] = 25;
1510 hann[244] = 21;
1511 hann[245] = 18;
1512 hann[246] = 15;
1513 hann[247] = 12;
1514 hann[248] = 9;
1515 hann[249] = 7;
1516 hann[250] = 5;
1517 hann[251] = 3;
1518 hann[252] = 2;
1519 hann[253] = 1;
1520 hann[254] = 0;
1521 hann[255] = 0;
1522
1523 } /* gen_hann2 */
1524
1525 /**
1526 * Creates the non uniform enhancement window (bilinearly mapped hannning window)
1527 * in order to reduce the formant enhancement in the high spectrum
1528 * @param mm : memory manager
1529 * @param sig_inObj : sig PU internal object of the sub-object
1530 * @return void
1531 * @callgraph
1532 * @callergraph
1533 * @remarks the outgput is based on the matlab script below\n
1534 matlab script
1535 -------------
1536 function makeEnhWind(alpha)
1537 N=129; % =HFFTSIZEE_P1
1538 s=(bilinmap(alpha,N));
1539 h=[hann(N)'];
1540 x=(1:N)/N;
1541 W=interp1(x,h,s); W(1)=0;
1542
1543 fid=fopen('enhwind.txt','wt');
1544 fprintf(fid,'picoos_int16 enh_wind_init(sig_innerobj_t *sig_inObj) {\n');
1545 for i=1:N,
1546 fprintf(fid,[' sig_inObj->enhwind[' int2str(i) '] = (picoos_single)' num2str(W(i),'%0.7g') ';\n']);
1547 end;
1548 fprintf(fid,' return PICO_OK;\n');
1549 fprintf(fid,' }; \n');
1550 fclose(fid);
1551 %figure(1); plot(x*8,W);
1552 */
enh_wind_init(sig_innerobj_t * sig_inObj)1553 static void enh_wind_init(sig_innerobj_t *sig_inObj)
1554 {
1555 /* picoos_int16 i; */
1556 picoos_int32 *c;
1557
1558 c = sig_inObj->cos_table;
1559
1560 c[0] = 4096;
1561 c[1] = 4095;
1562 c[2] = 4095;
1563 c[3] = 4095;
1564 c[4] = 4095;
1565 c[5] = 4095;
1566 c[6] = 4095;
1567 c[7] = 4095;
1568 c[8] = 4094;
1569 c[9] = 4094;
1570 c[10] = 4094;
1571 c[11] = 4093;
1572 c[12] = 4093;
1573 c[13] = 4092;
1574 c[14] = 4092;
1575 c[15] = 4091;
1576 c[16] = 4091;
1577 c[17] = 4090;
1578 c[18] = 4089;
1579 c[19] = 4089;
1580 c[20] = 4088;
1581 c[21] = 4087;
1582 c[22] = 4086;
1583 c[23] = 4085;
1584 c[24] = 4084;
1585 c[25] = 4083;
1586 c[26] = 4082;
1587 c[27] = 4081;
1588 c[28] = 4080;
1589 c[29] = 4079;
1590 c[30] = 4078;
1591 c[31] = 4077;
1592 c[32] = 4076;
1593 c[33] = 4075;
1594 c[34] = 4073;
1595 c[35] = 4072;
1596 c[36] = 4071;
1597 c[37] = 4069;
1598 c[38] = 4068;
1599 c[39] = 4066;
1600 c[40] = 4065;
1601 c[41] = 4063;
1602 c[42] = 4062;
1603 c[43] = 4060;
1604 c[44] = 4058;
1605 c[45] = 4057;
1606 c[46] = 4055;
1607 c[47] = 4053;
1608 c[48] = 4051;
1609 c[49] = 4049;
1610 c[50] = 4047;
1611 c[51] = 4045;
1612 c[52] = 4043;
1613 c[53] = 4041;
1614 c[54] = 4039;
1615 c[55] = 4037;
1616 c[56] = 4035;
1617 c[57] = 4033;
1618 c[58] = 4031;
1619 c[59] = 4029;
1620 c[60] = 4026;
1621 c[61] = 4024;
1622 c[62] = 4022;
1623 c[63] = 4019;
1624 c[64] = 4017;
1625 c[65] = 4014;
1626 c[66] = 4012;
1627 c[67] = 4009;
1628 c[68] = 4007;
1629 c[69] = 4004;
1630 c[70] = 4001;
1631 c[71] = 3999;
1632 c[72] = 3996;
1633 c[73] = 3993;
1634 c[74] = 3990;
1635 c[75] = 3988;
1636 c[76] = 3985;
1637 c[77] = 3982;
1638 c[78] = 3979;
1639 c[79] = 3976;
1640 c[80] = 3973;
1641 c[81] = 3970;
1642 c[82] = 3967;
1643 c[83] = 3963;
1644 c[84] = 3960;
1645 c[85] = 3957;
1646 c[86] = 3954;
1647 c[87] = 3950;
1648 c[88] = 3947;
1649 c[89] = 3944;
1650 c[90] = 3940;
1651 c[91] = 3937;
1652 c[92] = 3933;
1653 c[93] = 3930;
1654 c[94] = 3926;
1655 c[95] = 3923;
1656 c[96] = 3919;
1657 c[97] = 3915;
1658 c[98] = 3912;
1659 c[99] = 3908;
1660 c[100] = 3904;
1661 c[101] = 3900;
1662 c[102] = 3897;
1663 c[103] = 3893;
1664 c[104] = 3889;
1665 c[105] = 3885;
1666 c[106] = 3881;
1667 c[107] = 3877;
1668 c[108] = 3873;
1669 c[109] = 3869;
1670 c[110] = 3864;
1671 c[111] = 3860;
1672 c[112] = 3856;
1673 c[113] = 3852;
1674 c[114] = 3848;
1675 c[115] = 3843;
1676 c[116] = 3839;
1677 c[117] = 3834;
1678 c[118] = 3830;
1679 c[119] = 3826;
1680 c[120] = 3821;
1681 c[121] = 3816;
1682 c[122] = 3812;
1683 c[123] = 3807;
1684 c[124] = 3803;
1685 c[125] = 3798;
1686 c[126] = 3793;
1687 c[127] = 3789;
1688 c[128] = 3784;
1689 c[129] = 3779;
1690 c[130] = 3774;
1691 c[131] = 3769;
1692 c[132] = 3764;
1693 c[133] = 3759;
1694 c[134] = 3754;
1695 c[135] = 3749;
1696 c[136] = 3744;
1697 c[137] = 3739;
1698 c[138] = 3734;
1699 c[139] = 3729;
1700 c[140] = 3723;
1701 c[141] = 3718;
1702 c[142] = 3713;
1703 c[143] = 3708;
1704 c[144] = 3702;
1705 c[145] = 3697;
1706 c[146] = 3691;
1707 c[147] = 3686;
1708 c[148] = 3680;
1709 c[149] = 3675;
1710 c[150] = 3669;
1711 c[151] = 3664;
1712 c[152] = 3658;
1713 c[153] = 3652;
1714 c[154] = 3647;
1715 c[155] = 3641;
1716 c[156] = 3635;
1717 c[157] = 3629;
1718 c[158] = 3624;
1719 c[159] = 3618;
1720 c[160] = 3612;
1721 c[161] = 3606;
1722 c[162] = 3600;
1723 c[163] = 3594;
1724 c[164] = 3588;
1725 c[165] = 3582;
1726 c[166] = 3576;
1727 c[167] = 3570;
1728 c[168] = 3563;
1729 c[169] = 3557;
1730 c[170] = 3551;
1731 c[171] = 3545;
1732 c[172] = 3538;
1733 c[173] = 3532;
1734 c[174] = 3526;
1735 c[175] = 3519;
1736 c[176] = 3513;
1737 c[177] = 3506;
1738 c[178] = 3500;
1739 c[179] = 3493;
1740 c[180] = 3487;
1741 c[181] = 3480;
1742 c[182] = 3473;
1743 c[183] = 3467;
1744 c[184] = 3460;
1745 c[185] = 3453;
1746 c[186] = 3447;
1747 c[187] = 3440;
1748 c[188] = 3433;
1749 c[189] = 3426;
1750 c[190] = 3419;
1751 c[191] = 3412;
1752 c[192] = 3405;
1753 c[193] = 3398;
1754 c[194] = 3391;
1755 c[195] = 3384;
1756 c[196] = 3377;
1757 c[197] = 3370;
1758 c[198] = 3363;
1759 c[199] = 3356;
1760 c[200] = 3348;
1761 c[201] = 3341;
1762 c[202] = 3334;
1763 c[203] = 3326;
1764 c[204] = 3319;
1765 c[205] = 3312;
1766 c[206] = 3304;
1767 c[207] = 3297;
1768 c[208] = 3289;
1769 c[209] = 3282;
1770 c[210] = 3274;
1771 c[211] = 3267;
1772 c[212] = 3259;
1773 c[213] = 3252;
1774 c[214] = 3244;
1775 c[215] = 3236;
1776 c[216] = 3229;
1777 c[217] = 3221;
1778 c[218] = 3213;
1779 c[219] = 3205;
1780 c[220] = 3197;
1781 c[221] = 3190;
1782 c[222] = 3182;
1783 c[223] = 3174;
1784 c[224] = 3166;
1785 c[225] = 3158;
1786 c[226] = 3150;
1787 c[227] = 3142;
1788 c[228] = 3134;
1789 c[229] = 3126;
1790 c[230] = 3117;
1791 c[231] = 3109;
1792 c[232] = 3101;
1793 c[233] = 3093;
1794 c[234] = 3085;
1795 c[235] = 3076;
1796 c[236] = 3068;
1797 c[237] = 3060;
1798 c[238] = 3051;
1799 c[239] = 3043;
1800 c[240] = 3034;
1801 c[241] = 3026;
1802 c[242] = 3018;
1803 c[243] = 3009;
1804 c[244] = 3000;
1805 c[245] = 2992;
1806 c[246] = 2983;
1807 c[247] = 2975;
1808 c[248] = 2966;
1809 c[249] = 2957;
1810 c[250] = 2949;
1811 c[251] = 2940;
1812 c[252] = 2931;
1813 c[253] = 2922;
1814 c[254] = 2914;
1815 c[255] = 2905;
1816 c[256] = 2896;
1817 c[257] = 2887;
1818 c[258] = 2878;
1819 c[259] = 2869;
1820 c[260] = 2860;
1821 c[261] = 2851;
1822 c[262] = 2842;
1823 c[263] = 2833;
1824 c[264] = 2824;
1825 c[265] = 2815;
1826 c[266] = 2806;
1827 c[267] = 2796;
1828 c[268] = 2787;
1829 c[269] = 2778;
1830 c[270] = 2769;
1831 c[271] = 2760;
1832 c[272] = 2750;
1833 c[273] = 2741;
1834 c[274] = 2732;
1835 c[275] = 2722;
1836 c[276] = 2713;
1837 c[277] = 2703;
1838 c[278] = 2694;
1839 c[279] = 2684;
1840 c[280] = 2675;
1841 c[281] = 2665;
1842 c[282] = 2656;
1843 c[283] = 2646;
1844 c[284] = 2637;
1845 c[285] = 2627;
1846 c[286] = 2617;
1847 c[287] = 2608;
1848 c[288] = 2598;
1849 c[289] = 2588;
1850 c[290] = 2578;
1851 c[291] = 2569;
1852 c[292] = 2559;
1853 c[293] = 2549;
1854 c[294] = 2539;
1855 c[295] = 2529;
1856 c[296] = 2519;
1857 c[297] = 2510;
1858 c[298] = 2500;
1859 c[299] = 2490;
1860 c[300] = 2480;
1861 c[301] = 2470;
1862 c[302] = 2460;
1863 c[303] = 2450;
1864 c[304] = 2439;
1865 c[305] = 2429;
1866 c[306] = 2419;
1867 c[307] = 2409;
1868 c[308] = 2399;
1869 c[309] = 2389;
1870 c[310] = 2379;
1871 c[311] = 2368;
1872 c[312] = 2358;
1873 c[313] = 2348;
1874 c[314] = 2337;
1875 c[315] = 2327;
1876 c[316] = 2317;
1877 c[317] = 2306;
1878 c[318] = 2296;
1879 c[319] = 2286;
1880 c[320] = 2275;
1881 c[321] = 2265;
1882 c[322] = 2254;
1883 c[323] = 2244;
1884 c[324] = 2233;
1885 c[325] = 2223;
1886 c[326] = 2212;
1887 c[327] = 2201;
1888 c[328] = 2191;
1889 c[329] = 2180;
1890 c[330] = 2170;
1891 c[331] = 2159;
1892 c[332] = 2148;
1893 c[333] = 2138;
1894 c[334] = 2127;
1895 c[335] = 2116;
1896 c[336] = 2105;
1897 c[337] = 2094;
1898 c[338] = 2084;
1899 c[339] = 2073;
1900 c[340] = 2062;
1901 c[341] = 2051;
1902 c[342] = 2040;
1903 c[343] = 2029;
1904 c[344] = 2018;
1905 c[345] = 2007;
1906 c[346] = 1997;
1907 c[347] = 1986;
1908 c[348] = 1975;
1909 c[349] = 1964;
1910 c[350] = 1952;
1911 c[351] = 1941;
1912 c[352] = 1930;
1913 c[353] = 1919;
1914 c[354] = 1908;
1915 c[355] = 1897;
1916 c[356] = 1886;
1917 c[357] = 1875;
1918 c[358] = 1864;
1919 c[359] = 1852;
1920 c[360] = 1841;
1921 c[361] = 1830;
1922 c[362] = 1819;
1923 c[363] = 1807;
1924 c[364] = 1796;
1925 c[365] = 1785;
1926 c[366] = 1773;
1927 c[367] = 1762;
1928 c[368] = 1751;
1929 c[369] = 1739;
1930 c[370] = 1728;
1931 c[371] = 1717;
1932 c[372] = 1705;
1933 c[373] = 1694;
1934 c[374] = 1682;
1935 c[375] = 1671;
1936 c[376] = 1659;
1937 c[377] = 1648;
1938 c[378] = 1636;
1939 c[379] = 1625;
1940 c[380] = 1613;
1941 c[381] = 1602;
1942 c[382] = 1590;
1943 c[383] = 1579;
1944 c[384] = 1567;
1945 c[385] = 1555;
1946 c[386] = 1544;
1947 c[387] = 1532;
1948 c[388] = 1520;
1949 c[389] = 1509;
1950 c[390] = 1497;
1951 c[391] = 1485;
1952 c[392] = 1474;
1953 c[393] = 1462;
1954 c[394] = 1450;
1955 c[395] = 1438;
1956 c[396] = 1427;
1957 c[397] = 1415;
1958 c[398] = 1403;
1959 c[399] = 1391;
1960 c[400] = 1379;
1961 c[401] = 1368;
1962 c[402] = 1356;
1963 c[403] = 1344;
1964 c[404] = 1332;
1965 c[405] = 1320;
1966 c[406] = 1308;
1967 c[407] = 1296;
1968 c[408] = 1284;
1969 c[409] = 1272;
1970 c[410] = 1260;
1971 c[411] = 1248;
1972 c[412] = 1237;
1973 c[413] = 1225;
1974 c[414] = 1213;
1975 c[415] = 1201;
1976 c[416] = 1189;
1977 c[417] = 1176;
1978 c[418] = 1164;
1979 c[419] = 1152;
1980 c[420] = 1140;
1981 c[421] = 1128;
1982 c[422] = 1116;
1983 c[423] = 1104;
1984 c[424] = 1092;
1985 c[425] = 1080;
1986 c[426] = 1068;
1987 c[427] = 1056;
1988 c[428] = 1043;
1989 c[429] = 1031;
1990 c[430] = 1019;
1991 c[431] = 1007;
1992 c[432] = 995;
1993 c[433] = 983;
1994 c[434] = 970;
1995 c[435] = 958;
1996 c[436] = 946;
1997 c[437] = 934;
1998 c[438] = 921;
1999 c[439] = 909;
2000 c[440] = 897;
2001 c[441] = 885;
2002 c[442] = 872;
2003 c[443] = 860;
2004 c[444] = 848;
2005 c[445] = 836;
2006 c[446] = 823;
2007 c[447] = 811;
2008 c[448] = 799;
2009 c[449] = 786;
2010 c[450] = 774;
2011 c[451] = 762;
2012 c[452] = 749;
2013 c[453] = 737;
2014 c[454] = 725;
2015 c[455] = 712;
2016 c[456] = 700;
2017 c[457] = 687;
2018 c[458] = 675;
2019 c[459] = 663;
2020 c[460] = 650;
2021 c[461] = 638;
2022 c[462] = 625;
2023 c[463] = 613;
2024 c[464] = 601;
2025 c[465] = 588;
2026 c[466] = 576;
2027 c[467] = 563;
2028 c[468] = 551;
2029 c[469] = 538;
2030 c[470] = 526;
2031 c[471] = 513;
2032 c[472] = 501;
2033 c[473] = 488;
2034 c[474] = 476;
2035 c[475] = 463;
2036 c[476] = 451;
2037 c[477] = 438;
2038 c[478] = 426;
2039 c[479] = 413;
2040 c[480] = 401;
2041 c[481] = 388;
2042 c[482] = 376;
2043 c[483] = 363;
2044 c[484] = 351;
2045 c[485] = 338;
2046 c[486] = 326;
2047 c[487] = 313;
2048 c[488] = 301;
2049 c[489] = 288;
2050 c[490] = 276;
2051 c[491] = 263;
2052 c[492] = 251;
2053 c[493] = 238;
2054 c[494] = 226;
2055 c[495] = 213;
2056 c[496] = 200;
2057 c[497] = 188;
2058 c[498] = 175;
2059 c[499] = 163;
2060 c[500] = 150;
2061 c[501] = 138;
2062 c[502] = 125;
2063 c[503] = 113;
2064 c[504] = 100;
2065 c[505] = 87;
2066 c[506] = 75;
2067 c[507] = 62;
2068 c[508] = 50;
2069 c[509] = 37;
2070 c[510] = 25;
2071 c[511] = 12;
2072 c[512] = 0;
2073 } /*enh_wind_init*/
2074
2075 /**
2076 * Initializes a useful large array of random numbers
2077 * @param sig_inObj : sig PU internal object of the sub-object
2078 * @return void
2079 * @callgraph
2080 * @callergraph
2081 */
init_rand(sig_innerobj_t * sig_inObj)2082 static void init_rand(sig_innerobj_t *sig_inObj)
2083 {
2084 picoos_int32 *q = sig_inObj->int_vec34;
2085 picoos_int32 *r = sig_inObj->int_vec35;
2086
2087 sig_inObj->iRand = 0;
2088
2089 q[0] = -2198;
2090 r[0] = 3455;
2091 q[1] = 3226;
2092 r[1] = -2522;
2093 q[2] = -845;
2094 r[2] = 4007;
2095 q[3] = -1227;
2096 r[3] = 3907;
2097 q[4] = -3480;
2098 r[4] = 2158;
2099 q[5] = -1325;
2100 r[5] = -3875;
2101 q[6] = 2089;
2102 r[6] = -3522;
2103 q[7] = -468;
2104 r[7] = 4069;
2105 q[8] = 711;
2106 r[8] = -4033;
2107 q[9] = 3862;
2108 r[9] = 1362;
2109 q[10] = 4054;
2110 r[10] = -579;
2111 q[11] = 2825;
2112 r[11] = 2965;
2113 q[12] = 2704;
2114 r[12] = -3076;
2115 q[13] = 4081;
2116 r[13] = 344;
2117 q[14] = -3912;
2118 r[14] = 1211;
2119 q[15] = -3541;
2120 r[15] = 2058;
2121 q[16] = 2694;
2122 r[16] = 3084;
2123 q[17] = 835;
2124 r[17] = 4009;
2125 q[18] = -2578;
2126 r[18] = -3182;
2127 q[19] = 3205;
2128 r[19] = 2550;
2129 q[20] = -4074;
2130 r[20] = -418;
2131 q[21] = -183;
2132 r[21] = -4091;
2133 q[22] = -2665;
2134 r[22] = -3110;
2135 q[23] = -1367;
2136 r[23] = 3860;
2137 q[24] = -2266;
2138 r[24] = -3411;
2139 q[25] = 3327;
2140 r[25] = -2387;
2141 q[26] = -2807;
2142 r[26] = -2982;
2143 q[27] = -3175;
2144 r[27] = -2587;
2145 q[28] = -4095;
2146 r[28] = 27;
2147 q[29] = -811;
2148 r[29] = -4014;
2149 q[30] = 4082;
2150 r[30] = 332;
2151 q[31] = -2175;
2152 r[31] = 3470;
2153 q[32] = 3112;
2154 r[32] = 2662;
2155 q[33] = 1168;
2156 r[33] = -3925;
2157 q[34] = 2659;
2158 r[34] = 3115;
2159 q[35] = 4048;
2160 r[35] = 622;
2161 q[36] = 4092;
2162 r[36] = -165;
2163 q[37] = -4036;
2164 r[37] = 697;
2165 q[38] = 1081;
2166 r[38] = -3950;
2167 q[39] = -548;
2168 r[39] = 4059;
2169 q[40] = 4038;
2170 r[40] = 685;
2171 q[41] = -511;
2172 r[41] = 4063;
2173 q[42] = 3317;
2174 r[42] = -2402;
2175 q[43] = -3180;
2176 r[43] = 2580;
2177 q[44] = 851;
2178 r[44] = -4006;
2179 q[45] = 2458;
2180 r[45] = -3276;
2181 q[46] = -1453;
2182 r[46] = 3829;
2183 q[47] = -3577;
2184 r[47] = 1995;
2185 q[48] = -3708;
2186 r[48] = -1738;
2187 q[49] = -3890;
2188 r[49] = 1282;
2189 q[50] = 4041;
2190 r[50] = 666;
2191 q[51] = -3511;
2192 r[51] = -2108;
2193 q[52] = -1454;
2194 r[52] = -3828;
2195 q[53] = 2124;
2196 r[53] = 3502;
2197 q[54] = -3159;
2198 r[54] = 2606;
2199 q[55] = 2384;
2200 r[55] = -3330;
2201 q[56] = -3767;
2202 r[56] = -1607;
2203 q[57] = -4063;
2204 r[57] = -513;
2205 q[58] = 3952;
2206 r[58] = -1075;
2207 q[59] = -3778;
2208 r[59] = -1581;
2209 q[60] = -301;
2210 r[60] = -4084;
2211 q[61] = -4026;
2212 r[61] = 751;
2213 q[62] = -3346;
2214 r[62] = 2361;
2215 q[63] = -2426;
2216 r[63] = 3299;
2217 q[64] = 428;
2218 r[64] = -4073;
2219 q[65] = 3968;
2220 r[65] = 1012;
2221 q[66] = 2900;
2222 r[66] = -2892;
2223 q[67] = -263;
2224 r[67] = 4087;
2225 q[68] = 4083;
2226 r[68] = 322;
2227 q[69] = 2024;
2228 r[69] = 3560;
2229 q[70] = 4015;
2230 r[70] = 808;
2231 q[71] = -3971;
2232 r[71] = -1000;
2233 q[72] = 3785;
2234 r[72] = -1564;
2235 q[73] = -3726;
2236 r[73] = 1701;
2237 q[74] = -3714;
2238 r[74] = 1725;
2239 q[75] = 743;
2240 r[75] = 4027;
2241 q[76] = 875;
2242 r[76] = -4001;
2243 q[77] = 294;
2244 r[77] = 4085;
2245 q[78] = 2611;
2246 r[78] = 3155;
2247 q[79] = 2491;
2248 r[79] = -3251;
2249 q[80] = 1558;
2250 r[80] = 3787;
2251 q[81] = -2063;
2252 r[81] = -3538;
2253 q[82] = 3809;
2254 r[82] = -1505;
2255 q[83] = -2987;
2256 r[83] = 2802;
2257 q[84] = -1955;
2258 r[84] = 3599;
2259 q[85] = 1980;
2260 r[85] = -3585;
2261 q[86] = -539;
2262 r[86] = -4060;
2263 q[87] = -3210;
2264 r[87] = 2543;
2265 q[88] = 2415;
2266 r[88] = -3308;
2267 q[89] = 1587;
2268 r[89] = 3775;
2269 q[90] = -3943;
2270 r[90] = 1106;
2271 q[91] = 3476;
2272 r[91] = 2165;
2273 q[92] = 2253;
2274 r[92] = 3420;
2275 q[93] = -2584;
2276 r[93] = 3177;
2277 q[94] = 3804;
2278 r[94] = -1518;
2279 q[95] = -3637;
2280 r[95] = 1883;
2281 q[96] = 3289;
2282 r[96] = -2440;
2283 q[97] = -1621;
2284 r[97] = 3761;
2285 q[98] = 1645;
2286 r[98] = 3751;
2287 q[99] = -3471;
2288 r[99] = 2173;
2289 q[100] = 4071;
2290 r[100] = -449;
2291 q[101] = -872;
2292 r[101] = -4001;
2293 q[102] = -3897;
2294 r[102] = 1259;
2295 q[103] = -3590;
2296 r[103] = 1970;
2297 q[104] = -2456;
2298 r[104] = -3277;
2299 q[105] = -3004;
2300 r[105] = 2783;
2301 q[106] = 2589;
2302 r[106] = 3173;
2303 q[107] = 3727;
2304 r[107] = -1698;
2305 q[108] = 2992;
2306 r[108] = 2796;
2307 q[109] = 794;
2308 r[109] = -4018;
2309 q[110] = -918;
2310 r[110] = 3991;
2311 q[111] = 1446;
2312 r[111] = -3831;
2313 q[112] = 3871;
2314 r[112] = -1338;
2315 q[113] = -612;
2316 r[113] = -4049;
2317 q[114] = -1566;
2318 r[114] = -3784;
2319 q[115] = 672;
2320 r[115] = -4040;
2321 q[116] = 3841;
2322 r[116] = 1422;
2323 q[117] = 3545;
2324 r[117] = -2051;
2325 q[118] = -1982;
2326 r[118] = -3584;
2327 q[119] = -3413;
2328 r[119] = 2263;
2329 q[120] = -3265;
2330 r[120] = -2473;
2331 q[121] = -2876;
2332 r[121] = -2915;
2333 q[122] = 4094;
2334 r[122] = -117;
2335 q[123] = -269;
2336 r[123] = 4087;
2337 q[124] = -4077;
2338 r[124] = 391;
2339 q[125] = -3759;
2340 r[125] = 1626;
2341 q[126] = 1639;
2342 r[126] = 3753;
2343 q[127] = 3041;
2344 r[127] = -2743;
2345 q[128] = 5;
2346 r[128] = 4095;
2347 q[129] = 2778;
2348 r[129] = -3009;
2349 q[130] = 1121;
2350 r[130] = -3939;
2351 q[131] = -455;
2352 r[131] = -4070;
2353 q[132] = 3532;
2354 r[132] = 2073;
2355 q[133] = -143;
2356 r[133] = -4093;
2357 q[134] = -2357;
2358 r[134] = -3349;
2359 q[135] = 458;
2360 r[135] = 4070;
2361 q[136] = -2887;
2362 r[136] = -2904;
2363 q[137] = -1104;
2364 r[137] = 3944;
2365 q[138] = -2104;
2366 r[138] = -3513;
2367 q[139] = 126;
2368 r[139] = 4094;
2369 q[140] = -3655;
2370 r[140] = -1848;
2371 q[141] = -3896;
2372 r[141] = 1263;
2373 q[142] = -3874;
2374 r[142] = -1327;
2375 q[143] = 4058;
2376 r[143] = 553;
2377 q[144] = -1831;
2378 r[144] = -3663;
2379 q[145] = -255;
2380 r[145] = -4088;
2381 q[146] = -1211;
2382 r[146] = 3912;
2383 q[147] = 445;
2384 r[147] = 4071;
2385 q[148] = 2268;
2386 r[148] = 3410;
2387 q[149] = -4010;
2388 r[149] = 833;
2389 q[150] = 2621;
2390 r[150] = 3147;
2391 q[151] = -250;
2392 r[151] = 4088;
2393 q[152] = -3409;
2394 r[152] = -2269;
2395 q[153] = -2710;
2396 r[153] = -3070;
2397 q[154] = 4063;
2398 r[154] = 518;
2399 q[155] = -3611;
2400 r[155] = -1933;
2401 q[156] = -3707;
2402 r[156] = -1741;
2403 q[157] = -1151;
2404 r[157] = -3930;
2405 q[158] = 3976;
2406 r[158] = -983;
2407 q[159] = -1736;
2408 r[159] = 3709;
2409 q[160] = 3669;
2410 r[160] = 1820;
2411 q[161] = -143;
2412 r[161] = 4093;
2413 q[162] = -3879;
2414 r[162] = -1313;
2415 q[163] = -2242;
2416 r[163] = -3427;
2417 q[164] = -4095;
2418 r[164] = 0;
2419 q[165] = -1159;
2420 r[165] = -3928;
2421 q[166] = -3155;
2422 r[166] = 2611;
2423 q[167] = -2887;
2424 r[167] = -2904;
2425 q[168] = -4095;
2426 r[168] = 56;
2427 q[169] = -3861;
2428 r[169] = -1364;
2429 q[170] = -2814;
2430 r[170] = 2976;
2431 q[171] = -3680;
2432 r[171] = -1798;
2433 q[172] = -4094;
2434 r[172] = -107;
2435 q[173] = -3626;
2436 r[173] = 1903;
2437 q[174] = 3403;
2438 r[174] = 2278;
2439 q[175] = -1735;
2440 r[175] = -3710;
2441 q[176] = -2126;
2442 r[176] = -3500;
2443 q[177] = 3183;
2444 r[177] = -2577;
2445 q[178] = -3499;
2446 r[178] = 2128;
2447 q[179] = -1736;
2448 r[179] = 3709;
2449 q[180] = 2592;
2450 r[180] = -3170;
2451 q[181] = 3875;
2452 r[181] = 1326;
2453 q[182] = 3596;
2454 r[182] = 1960;
2455 q[183] = 3915;
2456 r[183] = -1202;
2457 q[184] = 1570;
2458 r[184] = 3783;
2459 q[185] = -3319;
2460 r[185] = -2400;
2461 q[186] = 4019;
2462 r[186] = 787;
2463 q[187] = -187;
2464 r[187] = 4091;
2465 q[188] = 1370;
2466 r[188] = -3859;
2467 q[189] = -4091;
2468 r[189] = 199;
2469 q[190] = 3626;
2470 r[190] = 1904;
2471 q[191] = -2943;
2472 r[191] = 2848;
2473 q[192] = 56;
2474 r[192] = 4095;
2475 q[193] = 2824;
2476 r[193] = 2966;
2477 q[194] = -3994;
2478 r[194] = -904;
2479 q[195] = 56;
2480 r[195] = 4095;
2481 q[196] = -2045;
2482 r[196] = 3548;
2483 q[197] = -3653;
2484 r[197] = 1850;
2485 q[198] = -2864;
2486 r[198] = 2927;
2487 q[199] = -1996;
2488 r[199] = 3576;
2489 q[200] = -4061;
2490 r[200] = 527;
2491 q[201] = 159;
2492 r[201] = 4092;
2493 q[202] = -3363;
2494 r[202] = 2336;
2495 q[203] = -4074;
2496 r[203] = 421;
2497 q[204] = 2043;
2498 r[204] = 3549;
2499 q[205] = 4095;
2500 r[205] = -70;
2501 q[206] = -2107;
2502 r[206] = -3512;
2503 q[207] = -1973;
2504 r[207] = 3589;
2505 q[208] = -3138;
2506 r[208] = 2631;
2507 q[209] = -3625;
2508 r[209] = -1905;
2509 q[210] = 2413;
2510 r[210] = 3309;
2511 q[211] = -50;
2512 r[211] = -4095;
2513 q[212] = 2813;
2514 r[212] = 2976;
2515 q[213] = -535;
2516 r[213] = -4060;
2517 q[214] = 1250;
2518 r[214] = 3900;
2519 q[215] = 1670;
2520 r[215] = -3739;
2521 q[216] = 1945;
2522 r[216] = -3604;
2523 q[217] = -476;
2524 r[217] = -4068;
2525 q[218] = -3659;
2526 r[218] = -1840;
2527 q[219] = 2745;
2528 r[219] = 3039;
2529 q[220] = -674;
2530 r[220] = -4040;
2531 q[221] = 2383;
2532 r[221] = 3330;
2533 q[222] = 4086;
2534 r[222] = 274;
2535 q[223] = -4030;
2536 r[223] = 730;
2537 q[224] = 768;
2538 r[224] = -4023;
2539 q[225] = 3925;
2540 r[225] = 1170;
2541 q[226] = 785;
2542 r[226] = 4019;
2543 q[227] = -3101;
2544 r[227] = -2675;
2545 q[228] = 4030;
2546 r[228] = -729;
2547 q[229] = 3422;
2548 r[229] = 2249;
2549 q[230] = -3847;
2550 r[230] = 1403;
2551 q[231] = 3902;
2552 r[231] = -1243;
2553 q[232] = 2114;
2554 r[232] = -3507;
2555 q[233] = -2359;
2556 r[233] = 3348;
2557 q[234] = 3754;
2558 r[234] = -1638;
2559 q[235] = -4095;
2560 r[235] = -83;
2561 q[236] = 2301;
2562 r[236] = -3388;
2563 q[237] = 3336;
2564 r[237] = 2375;
2565 q[238] = -2045;
2566 r[238] = 3548;
2567 q[239] = -413;
2568 r[239] = -4075;
2569 q[240] = 1848;
2570 r[240] = 3655;
2571 q[241] = 4072;
2572 r[241] = -437;
2573 q[242] = 4069;
2574 r[242] = -463;
2575 q[243] = 1386;
2576 r[243] = -3854;
2577 q[244] = 966;
2578 r[244] = 3980;
2579 q[245] = -1684;
2580 r[245] = -3733;
2581 q[246] = 2953;
2582 r[246] = 2837;
2583 q[247] = -3961;
2584 r[247] = -1040;
2585 q[248] = 3512;
2586 r[248] = -2107;
2587 q[249] = 1363;
2588 r[249] = 3862;
2589 q[250] = 1883;
2590 r[250] = 3637;
2591 q[251] = 2657;
2592 r[251] = 3116;
2593 q[252] = 2347;
2594 r[252] = -3356;
2595 q[253] = -1635;
2596 r[253] = -3755;
2597 q[254] = 3170;
2598 r[254] = 2593;
2599 q[255] = 2856;
2600 r[255] = 2935;
2601 q[256] = 494;
2602 r[256] = 4066;
2603 q[257] = 1936;
2604 r[257] = -3609;
2605 q[258] = 245;
2606 r[258] = 4088;
2607 q[259] = -1211;
2608 r[259] = -3912;
2609 q[260] = -3600;
2610 r[260] = 1952;
2611 q[261] = 1632;
2612 r[261] = 3756;
2613 q[262] = 2341;
2614 r[262] = 3360;
2615 q[263] = 186;
2616 r[263] = -4091;
2617 q[264] = 4011;
2618 r[264] = 829;
2619 q[265] = -3490;
2620 r[265] = -2143;
2621 q[266] = 269;
2622 r[266] = -4087;
2623 q[267] = -2939;
2624 r[267] = 2852;
2625 q[268] = 1600;
2626 r[268] = 3770;
2627 q[269] = -3405;
2628 r[269] = -2275;
2629 q[270] = -3134;
2630 r[270] = -2636;
2631 q[271] = 2642;
2632 r[271] = -3129;
2633 q[272] = 3629;
2634 r[272] = 1898;
2635 q[273] = 3413;
2636 r[273] = 2264;
2637 q[274] = 2050;
2638 r[274] = 3545;
2639 q[275] = 988;
2640 r[275] = -3975;
2641 q[276] = -660;
2642 r[276] = 4042;
2643 q[277] = 978;
2644 r[277] = -3977;
2645 q[278] = 1965;
2646 r[278] = -3593;
2647 q[279] = -1513;
2648 r[279] = -3806;
2649 q[280] = -4076;
2650 r[280] = 401;
2651 q[281] = -4094;
2652 r[281] = -92;
2653 q[282] = -1914;
2654 r[282] = 3621;
2655 q[283] = 2006;
2656 r[283] = -3570;
2657 q[284] = -1550;
2658 r[284] = -3791;
2659 q[285] = 3774;
2660 r[285] = -1591;
2661 q[286] = -3958;
2662 r[286] = 1052;
2663 q[287] = -3576;
2664 r[287] = 1997;
2665 q[288] = -382;
2666 r[288] = 4078;
2667 q[289] = 1288;
2668 r[289] = 3888;
2669 q[290] = -2965;
2670 r[290] = -2825;
2671 q[291] = 1608;
2672 r[291] = 3767;
2673 q[292] = 3052;
2674 r[292] = -2731;
2675 q[293] = -622;
2676 r[293] = 4048;
2677 q[294] = -3836;
2678 r[294] = 1434;
2679 q[295] = -3542;
2680 r[295] = 2056;
2681 q[296] = -2648;
2682 r[296] = 3124;
2683 q[297] = -1178;
2684 r[297] = -3922;
2685 q[298] = -1109;
2686 r[298] = 3942;
2687 q[299] = 3910;
2688 r[299] = 1217;
2689 q[300] = 1199;
2690 r[300] = -3916;
2691 q[301] = -3386;
2692 r[301] = 2303;
2693 q[302] = -3453;
2694 r[302] = 2202;
2695 q[303] = -2877;
2696 r[303] = 2914;
2697 q[304] = 4095;
2698 r[304] = -47;
2699 q[305] = 3635;
2700 r[305] = 1886;
2701 q[306] = -2134;
2702 r[306] = -3495;
2703 q[307] = 613;
2704 r[307] = -4049;
2705 q[308] = -2700;
2706 r[308] = 3079;
2707 q[309] = 4091;
2708 r[309] = -195;
2709 q[310] = 3989;
2710 r[310] = -927;
2711 q[311] = -2385;
2712 r[311] = 3329;
2713 q[312] = 4094;
2714 r[312] = -103;
2715 q[313] = 1044;
2716 r[313] = -3960;
2717 q[314] = -1734;
2718 r[314] = -3710;
2719 q[315] = 1646;
2720 r[315] = 3750;
2721 q[316] = 575;
2722 r[316] = 4055;
2723 q[317] = -2629;
2724 r[317] = -3140;
2725 q[318] = 3266;
2726 r[318] = 2471;
2727 q[319] = 4091;
2728 r[319] = -194;
2729 q[320] = -2154;
2730 r[320] = 3483;
2731 q[321] = 659;
2732 r[321] = 4042;
2733 q[322] = -1785;
2734 r[322] = -3686;
2735 q[323] = -717;
2736 r[323] = -4032;
2737 q[324] = 4095;
2738 r[324] = -37;
2739 q[325] = -2963;
2740 r[325] = -2827;
2741 q[326] = -2645;
2742 r[326] = -3126;
2743 q[327] = 2619;
2744 r[327] = -3148;
2745 q[328] = 1855;
2746 r[328] = -3651;
2747 q[329] = -3726;
2748 r[329] = 1699;
2749 q[330] = -3437;
2750 r[330] = 2227;
2751 q[331] = 2948;
2752 r[331] = 2842;
2753 q[332] = -2125;
2754 r[332] = 3501;
2755 q[333] = -1700;
2756 r[333] = 3726;
2757 q[334] = 4094;
2758 r[334] = -101;
2759 q[335] = 2084;
2760 r[335] = -3525;
2761 q[336] = 3225;
2762 r[336] = -2524;
2763 q[337] = 2220;
2764 r[337] = 3442;
2765 q[338] = 3174;
2766 r[338] = 2588;
2767 q[339] = 229;
2768 r[339] = -4089;
2769 q[340] = -2381;
2770 r[340] = -3332;
2771 q[341] = -3677;
2772 r[341] = -1803;
2773 q[342] = -3191;
2774 r[342] = -2567;
2775 q[343] = 2465;
2776 r[343] = 3270;
2777 q[344] = 2681;
2778 r[344] = -3096;
2779 q[345] = 975;
2780 r[345] = -3978;
2781 q[346] = 2004;
2782 r[346] = -3572;
2783 q[347] = -3442;
2784 r[347] = -2219;
2785 q[348] = 3676;
2786 r[348] = -1805;
2787 q[349] = -3753;
2788 r[349] = 1638;
2789 q[350] = 3544;
2790 r[350] = 2053;
2791 q[351] = 397;
2792 r[351] = -4076;
2793 q[352] = 2221;
2794 r[352] = 3440;
2795 q[353] = -302;
2796 r[353] = 4084;
2797 q[354] = 4083;
2798 r[354] = -323;
2799 q[355] = -2253;
2800 r[355] = -3420;
2801 q[356] = -3038;
2802 r[356] = 2746;
2803 q[357] = 2884;
2804 r[357] = 2908;
2805 q[358] = 4070;
2806 r[358] = 454;
2807 q[359] = -1072;
2808 r[359] = -3953;
2809 q[360] = 3831;
2810 r[360] = 1449;
2811 q[361] = 3663;
2812 r[361] = -1831;
2813 q[362] = -1971;
2814 r[362] = 3590;
2815 q[363] = 3226;
2816 r[363] = -2522;
2817 q[364] = -145;
2818 r[364] = -4093;
2819 q[365] = 1882;
2820 r[365] = -3637;
2821 q[366] = 529;
2822 r[366] = 4061;
2823 q[367] = 2637;
2824 r[367] = 3133;
2825 q[368] = -4077;
2826 r[368] = 389;
2827 q[369] = 2156;
2828 r[369] = -3482;
2829 q[370] = -3276;
2830 r[370] = 2458;
2831 q[371] = -2687;
2832 r[371] = -3090;
2833 q[372] = 3469;
2834 r[372] = -2177;
2835 q[373] = -4093;
2836 r[373] = -139;
2837 q[374] = -850;
2838 r[374] = 4006;
2839 q[375] = -625;
2840 r[375] = 4048;
2841 q[376] = 1110;
2842 r[376] = -3942;
2843 q[377] = -3078;
2844 r[377] = -2702;
2845 q[378] = -2719;
2846 r[378] = 3063;
2847 q[379] = 742;
2848 r[379] = 4028;
2849 q[380] = -3902;
2850 r[380] = -1245;
2851 q[381] = 3888;
2852 r[381] = -1287;
2853 q[382] = -4081;
2854 r[382] = 347;
2855 q[383] = 1070;
2856 r[383] = 3953;
2857 q[384] = -996;
2858 r[384] = -3972;
2859 q[385] = 4041;
2860 r[385] = -668;
2861 q[386] = -2712;
2862 r[386] = 3069;
2863 q[387] = -3403;
2864 r[387] = -2279;
2865 q[388] = -3320;
2866 r[388] = -2398;
2867 q[389] = 3036;
2868 r[389] = -2749;
2869 q[390] = 1308;
2870 r[390] = -3881;
2871 q[391] = 2256;
2872 r[391] = 3418;
2873 q[392] = -1486;
2874 r[392] = 3816;
2875 q[393] = -2771;
2876 r[393] = -3015;
2877 q[394] = -3883;
2878 r[394] = -1302;
2879 q[395] = -3867;
2880 r[395] = -1349;
2881 q[396] = 3952;
2882 r[396] = -1075;
2883 q[397] = -789;
2884 r[397] = 4019;
2885 q[398] = 1458;
2886 r[398] = 3827;
2887 q[399] = 3832;
2888 r[399] = -1446;
2889 q[400] = -3001;
2890 r[400] = -2787;
2891 q[401] = 3463;
2892 r[401] = 2186;
2893 q[402] = 3606;
2894 r[402] = 1942;
2895 q[403] = 4023;
2896 r[403] = 764;
2897 q[404] = 3387;
2898 r[404] = 2303;
2899 q[405] = 2648;
2900 r[405] = -3124;
2901 q[406] = 1370;
2902 r[406] = -3860;
2903 q[407] = -3134;
2904 r[407] = 2636;
2905 q[408] = 4051;
2906 r[408] = -600;
2907 q[409] = -1977;
2908 r[409] = -3587;
2909 q[410] = 3160;
2910 r[410] = 2605;
2911 q[411] = 4042;
2912 r[411] = 659;
2913 q[412] = 3004;
2914 r[412] = 2783;
2915 q[413] = 3370;
2916 r[413] = 2327;
2917 q[414] = -419;
2918 r[414] = -4074;
2919 q[415] = -1968;
2920 r[415] = 3591;
2921 q[416] = -3705;
2922 r[416] = -1746;
2923 q[417] = -3331;
2924 r[417] = -2383;
2925 q[418] = -3634;
2926 r[418] = 1888;
2927 q[419] = -1981;
2928 r[419] = -3584;
2929 q[420] = 4069;
2930 r[420] = -469;
2931 q[421] = -628;
2932 r[421] = -4047;
2933 q[422] = -1900;
2934 r[422] = 3628;
2935 q[423] = 1039;
2936 r[423] = -3961;
2937 q[424] = 2554;
2938 r[424] = -3201;
2939 q[425] = -2955;
2940 r[425] = 2836;
2941 q[426] = 2286;
2942 r[426] = -3398;
2943 q[427] = -1624;
2944 r[427] = 3760;
2945 q[428] = 2213;
2946 r[428] = 3446;
2947 q[429] = -3989;
2948 r[429] = -926;
2949 q[430] = 192;
2950 r[430] = -4091;
2951 q[431] = -723;
2952 r[431] = 4031;
2953 q[432] = 2878;
2954 r[432] = 2913;
2955 q[433] = -2109;
2956 r[433] = 3511;
2957 q[434] = 1463;
2958 r[434] = -3825;
2959 q[435] = -741;
2960 r[435] = -4028;
2961 q[436] = -1314;
2962 r[436] = -3879;
2963 q[437] = 3115;
2964 r[437] = 2659;
2965 q[438] = -3160;
2966 r[438] = -2605;
2967 q[439] = 1868;
2968 r[439] = 3644;
2969 q[440] = -824;
2970 r[440] = 4012;
2971 q[441] = 781;
2972 r[441] = 4020;
2973 q[442] = -1257;
2974 r[442] = -3898;
2975 q[443] = 3331;
2976 r[443] = -2382;
2977 q[444] = 1642;
2978 r[444] = -3752;
2979 q[445] = 3748;
2980 r[445] = -1650;
2981 q[446] = -487;
2982 r[446] = -4066;
2983 q[447] = 3085;
2984 r[447] = -2694;
2985 q[448] = 4009;
2986 r[448] = 839;
2987 q[449] = -2308;
2988 r[449] = -3383;
2989 q[450] = 3850;
2990 r[450] = 1397;
2991 q[451] = -4078;
2992 r[451] = -374;
2993 q[452] = 2989;
2994 r[452] = -2799;
2995 q[453] = 3023;
2996 r[453] = -2762;
2997 q[454] = 1397;
2998 r[454] = -3850;
2999 q[455] = 323;
3000 r[455] = 4083;
3001 q[456] = 268;
3002 r[456] = -4087;
3003 q[457] = 2414;
3004 r[457] = 3308;
3005 q[458] = 3876;
3006 r[458] = 1322;
3007 q[459] = -3584;
3008 r[459] = 1982;
3009 q[460] = 1603;
3010 r[460] = 3769;
3011 q[461] = -1502;
3012 r[461] = 3810;
3013 q[462] = 1318;
3014 r[462] = 3878;
3015 q[463] = 1554;
3016 r[463] = -3789;
3017 q[464] = 2492;
3018 r[464] = 3250;
3019 q[465] = -4093;
3020 r[465] = -154;
3021 q[466] = 4008;
3022 r[466] = 842;
3023 q[467] = -2279;
3024 r[467] = 3403;
3025 q[468] = 3013;
3026 r[468] = 2774;
3027 q[469] = 2557;
3028 r[469] = 3199;
3029 q[470] = 4068;
3030 r[470] = 475;
3031 q[471] = 3324;
3032 r[471] = -2392;
3033 q[472] = 2653;
3034 r[472] = -3120;
3035 q[473] = 796;
3036 r[473] = 4017;
3037 q[474] = -1312;
3038 r[474] = 3880;
3039 q[475] = 1794;
3040 r[475] = 3681;
3041 q[476] = -2347;
3042 r[476] = -3356;
3043 q[477] = -4008;
3044 r[477] = -840;
3045 q[478] = -3773;
3046 r[478] = -1592;
3047 q[479] = 1609;
3048 r[479] = 3766;
3049 q[480] = -1564;
3050 r[480] = -3785;
3051 q[481] = 3004;
3052 r[481] = 2784;
3053 q[482] = 1258;
3054 r[482] = 3897;
3055 q[483] = 3729;
3056 r[483] = 1693;
3057 q[484] = -4095;
3058 r[484] = -28;
3059 q[485] = -4093;
3060 r[485] = -146;
3061 q[486] = 1393;
3062 r[486] = -3851;
3063 q[487] = 297;
3064 r[487] = -4085;
3065 q[488] = 2294;
3066 r[488] = 3393;
3067 q[489] = -2562;
3068 r[489] = 3195;
3069 q[490] = -1716;
3070 r[490] = -3718;
3071 q[491] = 2224;
3072 r[491] = -3439;
3073 q[492] = 2032;
3074 r[492] = 3555;
3075 q[493] = -2968;
3076 r[493] = 2822;
3077 q[494] = 2338;
3078 r[494] = 3363;
3079 q[495] = 1584;
3080 r[495] = -3776;
3081 q[496] = -3072;
3082 r[496] = 2708;
3083 q[497] = -1596;
3084 r[497] = -3771;
3085 q[498] = -2256;
3086 r[498] = -3418;
3087 q[499] = 4095;
3088 r[499] = 89;
3089 q[500] = -1949;
3090 r[500] = 3602;
3091 q[501] = 1844;
3092 r[501] = 3657;
3093 q[502] = -3375;
3094 r[502] = 2319;
3095 q[503] = -1481;
3096 r[503] = -3818;
3097 q[504] = 3228;
3098 r[504] = -2520;
3099 q[505] = 1116;
3100 r[505] = 3940;
3101 q[506] = -2783;
3102 r[506] = 3004;
3103 q[507] = 3915;
3104 r[507] = 1201;
3105 q[508] = 283;
3106 r[508] = 4086;
3107 q[509] = -3732;
3108 r[509] = 1685;
3109 q[510] = -433;
3110 r[510] = -4072;
3111 q[511] = -3667;
3112 r[511] = 1823;
3113 q[512] = 3883;
3114 r[512] = 1300;
3115 q[513] = -3742;
3116 r[513] = 1663;
3117 q[514] = 4093;
3118 r[514] = -143;
3119 q[515] = 3874;
3120 r[515] = 1328;
3121 q[516] = -3800;
3122 r[516] = 1528;
3123 q[517] = -1257;
3124 r[517] = 3898;
3125 q[518] = -1606;
3126 r[518] = 3767;
3127 q[519] = 3394;
3128 r[519] = 2291;
3129 q[520] = 2255;
3130 r[520] = 3419;
3131 q[521] = -4094;
3132 r[521] = 120;
3133 q[522] = -3767;
3134 r[522] = 1606;
3135 q[523] = 1849;
3136 r[523] = -3654;
3137 q[524] = -2883;
3138 r[524] = 2908;
3139 q[525] = 3469;
3140 r[525] = 2176;
3141 q[526] = 2654;
3142 r[526] = 3119;
3143 q[527] = -239;
3144 r[527] = 4088;
3145 q[528] = -651;
3146 r[528] = 4043;
3147 q[529] = -1140;
3148 r[529] = 3934;
3149 q[530] = 328;
3150 r[530] = -4082;
3151 q[531] = 3246;
3152 r[531] = 2497;
3153 q[532] = 4026;
3154 r[532] = -753;
3155 q[533] = -2041;
3156 r[533] = -3550;
3157 q[534] = -1154;
3158 r[534] = 3929;
3159 q[535] = -2710;
3160 r[535] = 3070;
3161 q[536] = -2860;
3162 r[536] = 2932;
3163 q[537] = 2097;
3164 r[537] = 3517;
3165 q[538] = 3492;
3166 r[538] = -2140;
3167 q[539] = 3123;
3168 r[539] = 2649;
3169 q[540] = 3360;
3170 r[540] = 2342;
3171 q[541] = 2498;
3172 r[541] = 3245;
3173 q[542] = 3976;
3174 r[542] = 982;
3175 q[543] = -2441;
3176 r[543] = -3288;
3177 q[544] = 3601;
3178 r[544] = 1951;
3179 q[545] = -4008;
3180 r[545] = -842;
3181 q[546] = 1243;
3182 r[546] = 3902;
3183 q[547] = 4069;
3184 r[547] = 466;
3185 q[548] = -2031;
3186 r[548] = 3556;
3187 q[549] = 4077;
3188 r[549] = 386;
3189 q[550] = -3112;
3190 r[550] = -2663;
3191 q[551] = 4087;
3192 r[551] = -262;
3193 q[552] = 4087;
3194 r[552] = 266;
3195 q[553] = -3907;
3196 r[553] = -1228;
3197 q[554] = -1611;
3198 r[554] = 3765;
3199 q[555] = 3066;
3200 r[555] = -2715;
3201 q[556] = 2657;
3202 r[556] = 3117;
3203 q[557] = 3912;
3204 r[557] = -1213;
3205 q[558] = -2531;
3206 r[558] = -3220;
3207 q[559] = 3500;
3208 r[559] = -2127;
3209 q[560] = -76;
3210 r[560] = -4095;
3211 q[561] = 3413;
3212 r[561] = -2264;
3213 q[562] = -4071;
3214 r[562] = -448;
3215 q[563] = 828;
3216 r[563] = 4011;
3217 q[564] = 3664;
3218 r[564] = 1830;
3219 q[565] = -1578;
3220 r[565] = 3779;
3221 q[566] = 3555;
3222 r[566] = 2033;
3223 q[567] = 3868;
3224 r[567] = -1345;
3225 q[568] = 4054;
3226 r[568] = -580;
3227 q[569] = -4094;
3228 r[569] = 124;
3229 q[570] = -3820;
3230 r[570] = -1477;
3231 q[571] = -3658;
3232 r[571] = -1842;
3233 q[572] = 2595;
3234 r[572] = 3168;
3235 q[573] = 3354;
3236 r[573] = 2350;
3237 q[574] = -701;
3238 r[574] = -4035;
3239 q[575] = -772;
3240 r[575] = -4022;
3241 q[576] = 2799;
3242 r[576] = 2990;
3243 q[577] = -3632;
3244 r[577] = 1893;
3245 q[578] = 310;
3246 r[578] = 4084;
3247 q[579] = 3984;
3248 r[579] = -947;
3249 q[580] = 3794;
3250 r[580] = -1542;
3251 q[581] = -2419;
3252 r[581] = 3304;
3253 q[582] = -3916;
3254 r[582] = 1200;
3255 q[583] = -3886;
3256 r[583] = 1292;
3257 q[584] = -3299;
3258 r[584] = 2426;
3259 q[585] = -437;
3260 r[585] = 4072;
3261 q[586] = 2053;
3262 r[586] = -3544;
3263 q[587] = 3987;
3264 r[587] = 937;
3265 q[588] = -789;
3266 r[588] = -4019;
3267 q[589] = 4055;
3268 r[589] = -575;
3269 q[590] = -3894;
3270 r[590] = 1270;
3271 q[591] = 4003;
3272 r[591] = -864;
3273 q[592] = -3060;
3274 r[592] = 2721;
3275 q[593] = -4009;
3276 r[593] = 836;
3277 q[594] = -1655;
3278 r[594] = -3746;
3279 q[595] = 3954;
3280 r[595] = -1067;
3281 q[596] = -773;
3282 r[596] = 4022;
3283 q[597] = -422;
3284 r[597] = 4074;
3285 q[598] = -3384;
3286 r[598] = 2306;
3287 q[599] = 195;
3288 r[599] = -4091;
3289 q[600] = -298;
3290 r[600] = 4085;
3291 q[601] = -3988;
3292 r[601] = 931;
3293 q[602] = 2014;
3294 r[602] = -3566;
3295 q[603] = 3349;
3296 r[603] = -2357;
3297 q[604] = 3800;
3298 r[604] = 1526;
3299 q[605] = 3858;
3300 r[605] = 1374;
3301 q[606] = 2947;
3302 r[606] = 2844;
3303 q[607] = -1483;
3304 r[607] = -3818;
3305 q[608] = 4056;
3306 r[608] = -565;
3307 q[609] = 2612;
3308 r[609] = -3154;
3309 q[610] = 2326;
3310 r[610] = 3371;
3311 q[611] = -3545;
3312 r[611] = 2051;
3313 q[612] = -1001;
3314 r[612] = -3971;
3315 q[613] = 3211;
3316 r[613] = 2541;
3317 q[614] = -2717;
3318 r[614] = 3065;
3319 q[615] = -3159;
3320 r[615] = -2606;
3321 q[616] = 2869;
3322 r[616] = -2922;
3323 q[617] = -1290;
3324 r[617] = -3887;
3325 q[618] = 2479;
3326 r[618] = 3260;
3327 q[619] = 3420;
3328 r[619] = 2252;
3329 q[620] = 1823;
3330 r[620] = 3667;
3331 q[621] = 3368;
3332 r[621] = 2330;
3333 q[622] = -3819;
3334 r[622] = -1480;
3335 q[623] = 3800;
3336 r[623] = 1528;
3337 q[624] = 3773;
3338 r[624] = 1594;
3339 q[625] = -189;
3340 r[625] = -4091;
3341 q[626] = -4067;
3342 r[626] = -485;
3343 q[627] = 2277;
3344 r[627] = -3404;
3345 q[628] = -4089;
3346 r[628] = -233;
3347 q[629] = -3634;
3348 r[629] = 1889;
3349 q[630] = 3292;
3350 r[630] = 2437;
3351 q[631] = -530;
3352 r[631] = 4061;
3353 q[632] = -3109;
3354 r[632] = 2666;
3355 q[633] = -3741;
3356 r[633] = 1667;
3357 q[634] = -1903;
3358 r[634] = -3626;
3359 q[635] = 3879;
3360 r[635] = -1315;
3361 q[636] = 4083;
3362 r[636] = -315;
3363 q[637] = -1148;
3364 r[637] = 3931;
3365 q[638] = 2630;
3366 r[638] = 3139;
3367 q[639] = -4001;
3368 r[639] = 876;
3369 q[640] = -2295;
3370 r[640] = -3392;
3371 q[641] = 1090;
3372 r[641] = -3948;
3373 q[642] = -3024;
3374 r[642] = 2762;
3375 q[643] = 2728;
3376 r[643] = -3054;
3377 q[644] = -3305;
3378 r[644] = 2419;
3379 q[645] = 60;
3380 r[645] = 4095;
3381 q[646] = 4048;
3382 r[646] = -620;
3383 q[647] = 589;
3384 r[647] = -4053;
3385 q[648] = -3867;
3386 r[648] = 1347;
3387 q[649] = -2944;
3388 r[649] = -2847;
3389 q[650] = -2721;
3390 r[650] = 3060;
3391 q[651] = 2928;
3392 r[651] = 2863;
3393 q[652] = 801;
3394 r[652] = 4016;
3395 q[653] = -3644;
3396 r[653] = 1870;
3397 q[654] = -1648;
3398 r[654] = -3749;
3399 q[655] = 825;
3400 r[655] = -4012;
3401 q[656] = -2036;
3402 r[656] = -3553;
3403 q[657] = -1192;
3404 r[657] = -3918;
3405 q[658] = 2875;
3406 r[658] = 2916;
3407 q[659] = -1831;
3408 r[659] = -3663;
3409 q[660] = -2865;
3410 r[660] = -2926;
3411 q[661] = -575;
3412 r[661] = -4055;
3413 q[662] = -3870;
3414 r[662] = 1340;
3415 q[663] = -4080;
3416 r[663] = -356;
3417 q[664] = -2176;
3418 r[664] = -3469;
3419 q[665] = -2986;
3420 r[665] = -2803;
3421 q[666] = 3978;
3422 r[666] = -972;
3423 q[667] = 2437;
3424 r[667] = 3291;
3425 q[668] = -3528;
3426 r[668] = 2080;
3427 q[669] = -3300;
3428 r[669] = -2425;
3429 q[670] = 3085;
3430 r[670] = 2693;
3431 q[671] = -3700;
3432 r[671] = -1756;
3433 q[672] = 3216;
3434 r[672] = -2535;
3435 q[673] = 4094;
3436 r[673] = -91;
3437 q[674] = 3775;
3438 r[674] = -1589;
3439 q[675] = 1097;
3440 r[675] = -3946;
3441 q[676] = -152;
3442 r[676] = -4093;
3443 q[677] = -3490;
3444 r[677] = 2142;
3445 q[678] = 3747;
3446 r[678] = 1654;
3447 q[679] = -1490;
3448 r[679] = -3815;
3449 q[680] = -3998;
3450 r[680] = -886;
3451 q[681] = 3726;
3452 r[681] = -1700;
3453 q[682] = -1600;
3454 r[682] = 3770;
3455 q[683] = -87;
3456 r[683] = 4095;
3457 q[684] = 2538;
3458 r[684] = -3214;
3459 q[685] = -4095;
3460 r[685] = 52;
3461 q[686] = -3993;
3462 r[686] = -910;
3463 q[687] = 4051;
3464 r[687] = 603;
3465 q[688] = -1242;
3466 r[688] = -3902;
3467 q[689] = 2155;
3468 r[689] = 3482;
3469 q[690] = 1270;
3470 r[690] = 3893;
3471 q[691] = 1919;
3472 r[691] = -3618;
3473 q[692] = -3145;
3474 r[692] = 2623;
3475 q[693] = 2475;
3476 r[693] = 3263;
3477 q[694] = 2226;
3478 r[694] = -3437;
3479 q[695] = -3894;
3480 r[695] = -1269;
3481 q[696] = -429;
3482 r[696] = 4073;
3483 q[697] = -1346;
3484 r[697] = 3868;
3485 q[698] = 1297;
3486 r[698] = 3885;
3487 q[699] = 1699;
3488 r[699] = 3726;
3489 q[700] = -3375;
3490 r[700] = 2319;
3491 q[701] = 1577;
3492 r[701] = -3779;
3493 q[702] = -63;
3494 r[702] = 4095;
3495 q[703] = 1215;
3496 r[703] = -3911;
3497 q[704] = -1492;
3498 r[704] = 3814;
3499 q[705] = -1530;
3500 r[705] = -3799;
3501 q[706] = 3442;
3502 r[706] = 2218;
3503 q[707] = -3867;
3504 r[707] = -1349;
3505 q[708] = -3291;
3506 r[708] = -2437;
3507 q[709] = -2253;
3508 r[709] = -3420;
3509 q[710] = -150;
3510 r[710] = -4093;
3511 q[711] = -2686;
3512 r[711] = -3092;
3513 q[712] = 3470;
3514 r[712] = 2175;
3515 q[713] = -3826;
3516 r[713] = -1461;
3517 q[714] = -3148;
3518 r[714] = 2619;
3519 q[715] = -3858;
3520 r[715] = 1375;
3521 q[716] = -3844;
3522 r[716] = -1412;
3523 q[717] = -3652;
3524 r[717] = 1854;
3525 q[718] = 4018;
3526 r[718] = -791;
3527 q[719] = 179;
3528 r[719] = -4092;
3529 q[720] = 3498;
3530 r[720] = 2129;
3531 q[721] = -1999;
3532 r[721] = -3574;
3533 q[722] = 3531;
3534 r[722] = 2075;
3535 q[723] = 4050;
3536 r[723] = -606;
3537 q[724] = -1639;
3538 r[724] = 3753;
3539 q[725] = -3661;
3540 r[725] = 1835;
3541 q[726] = 4039;
3542 r[726] = 679;
3543 q[727] = 3561;
3544 r[727] = 2023;
3545 q[728] = 528;
3546 r[728] = 4061;
3547 q[729] = -634;
3548 r[729] = -4046;
3549 q[730] = 364;
3550 r[730] = -4079;
3551 q[731] = 2735;
3552 r[731] = 3048;
3553 q[732] = 3978;
3554 r[732] = 973;
3555 q[733] = -4073;
3556 r[733] = -427;
3557 q[734] = -3722;
3558 r[734] = 1708;
3559 q[735] = 2356;
3560 r[735] = -3350;
3561 q[736] = -1125;
3562 r[736] = -3938;
3563 q[737] = 4054;
3564 r[737] = 580;
3565 q[738] = 3328;
3566 r[738] = -2387;
3567 q[739] = 1439;
3568 r[739] = -3834;
3569 q[740] = 1746;
3570 r[740] = 3705;
3571 q[741] = 2507;
3572 r[741] = 3238;
3573 q[742] = 3839;
3574 r[742] = -1427;
3575 q[743] = 488;
3576 r[743] = -4066;
3577 q[744] = 1187;
3578 r[744] = 3920;
3579 q[745] = 2038;
3580 r[745] = -3552;
3581 q[746] = -905;
3582 r[746] = -3994;
3583 q[747] = -236;
3584 r[747] = 4089;
3585 q[748] = 208;
3586 r[748] = -4090;
3587 q[749] = 1660;
3588 r[749] = 3744;
3589 q[750] = -4074;
3590 r[750] = -415;
3591 q[751] = -2304;
3592 r[751] = 3385;
3593 q[752] = -2457;
3594 r[752] = 3276;
3595 q[753] = 3302;
3596 r[753] = 2423;
3597 q[754] = 1778;
3598 r[754] = -3689;
3599 q[755] = 2019;
3600 r[755] = 3563;
3601 q[756] = 4037;
3602 r[756] = 687;
3603 q[757] = -2365;
3604 r[757] = 3343;
3605 q[758] = 5;
3606 r[758] = -4095;
3607 q[759] = 160;
3608 r[759] = -4092;
3609
3610 } /*initRand*/
3611
3612 /**
3613 * initializes the MEL-2_LINEAR LOOKUP TABLE
3614 * @param sig_inObj : sig PU internal object of the sub-object
3615 * @return void
3616 * @remarks translated from matlab code to c-code
3617 * @callgraph
3618 * @callergraph
3619 *
3620 * input
3621 * - bilinTab : base address of bilinTable destination vector
3622 * - alpha : warping factor
3623 * - size : size of the vectors to be generated
3624 * - A,B : base address of array of indexes for lookup table implementation
3625 * - D : base address of delta array for lookup table implementation
3626 *
3627 * output
3628 * - bilinTab, A, B, D : initialized vectors
3629 */
mel_2_lin_init(sig_innerobj_t * sig_inObj)3630 void mel_2_lin_init(sig_innerobj_t *sig_inObj)
3631 {
3632
3633 /*Declare variables tied to I/O PARAMS formerly passed by value or reference*/
3634 picoos_single alpha;
3635 picoos_int32 *D;
3636 picoos_int32 size;
3637 picoos_int16 *A;
3638
3639 /*Link local variables with sig data object*/
3640
3641 alpha = sig_inObj->warp_p;
3642 size = (sig_inObj->hfftsize_p) + 1;
3643 A = sig_inObj->A_p;
3644 D = sig_inObj->d_p;
3645 /*
3646 fixed point interpolation tables
3647 scaling factor: 0x20
3648 corresponding bit shift: 5
3649 */
3650
3651 A[0] = 0;
3652 D[0] = 0;
3653 A[1] = 2;
3654 D[1] = 14;
3655 A[2] = 4;
3656 D[2] = 29;
3657 A[3] = 7;
3658 D[3] = 11;
3659 A[4] = 9;
3660 D[4] = 24;
3661 A[5] = 12;
3662 D[5] = 5;
3663 A[6] = 14;
3664 D[6] = 18;
3665 A[7] = 16;
3666 D[7] = 30;
3667 A[8] = 19;
3668 D[8] = 9;
3669 A[9] = 21;
3670 D[9] = 19;
3671 A[10] = 23;
3672 D[10] = 29;
3673 A[11] = 26;
3674 D[11] = 5;
3675 A[12] = 28;
3676 D[12] = 12;
3677 A[13] = 30;
3678 D[13] = 19;
3679 A[14] = 32;
3680 D[14] = 24;
3681 A[15] = 34;
3682 D[15] = 27;
3683 A[16] = 36;
3684 D[16] = 30;
3685 A[17] = 38;
3686 D[17] = 31;
3687 A[18] = 40;
3688 D[18] = 31;
3689 A[19] = 42;
3690 D[19] = 29;
3691 A[20] = 44;
3692 D[20] = 26;
3693 A[21] = 46;
3694 D[21] = 22;
3695 A[22] = 48;
3696 D[22] = 17;
3697 A[23] = 50;
3698 D[23] = 10;
3699 A[24] = 52;
3700 D[24] = 2;
3701 A[25] = 53;
3702 D[25] = 24;
3703 A[26] = 55;
3704 D[26] = 13;
3705 A[27] = 57;
3706 D[27] = 1;
3707 A[28] = 58;
3708 D[28] = 20;
3709 A[29] = 60;
3710 D[29] = 5;
3711 A[30] = 61;
3712 D[30] = 21;
3713 A[31] = 63;
3714 D[31] = 4;
3715 A[32] = 64;
3716 D[32] = 18;
3717 A[33] = 65;
3718 D[33] = 31;
3719 A[34] = 67;
3720 D[34] = 11;
3721 A[35] = 68;
3722 D[35] = 21;
3723 A[36] = 69;
3724 D[36] = 31;
3725 A[37] = 71;
3726 D[37] = 7;
3727 A[38] = 72;
3728 D[38] = 14;
3729 A[39] = 73;
3730 D[39] = 21;
3731 A[40] = 74;
3732 D[40] = 27;
3733 A[41] = 75;
3734 D[41] = 31;
3735 A[42] = 77;
3736 D[42] = 3;
3737 A[43] = 78;
3738 D[43] = 6;
3739 A[44] = 79;
3740 D[44] = 8;
3741 A[45] = 80;
3742 D[45] = 10;
3743 A[46] = 81;
3744 D[46] = 10;
3745 A[47] = 82;
3746 D[47] = 10;
3747 A[48] = 83;
3748 D[48] = 9;
3749 A[49] = 84;
3750 D[49] = 8;
3751 A[50] = 85;
3752 D[50] = 6;
3753 A[51] = 86;
3754 D[51] = 3;
3755 A[52] = 86;
3756 D[52] = 31;
3757 A[53] = 87;
3758 D[53] = 27;
3759 A[54] = 88;
3760 D[54] = 23;
3761 A[55] = 89;
3762 D[55] = 18;
3763 A[56] = 90;
3764 D[56] = 12;
3765 A[57] = 91;
3766 D[57] = 6;
3767 A[58] = 91;
3768 D[58] = 31;
3769 A[59] = 92;
3770 D[59] = 24;
3771 A[60] = 93;
3772 D[60] = 16;
3773 A[61] = 94;
3774 D[61] = 8;
3775 A[62] = 94;
3776 D[62] = 31;
3777 A[63] = 95;
3778 D[63] = 22;
3779 A[64] = 96;
3780 D[64] = 13;
3781 A[65] = 97;
3782 D[65] = 3;
3783 A[66] = 97;
3784 D[66] = 25;
3785 A[67] = 98;
3786 D[67] = 14;
3787 A[68] = 99;
3788 D[68] = 3;
3789 A[69] = 99;
3790 D[69] = 24;
3791 A[70] = 100;
3792 D[70] = 13;
3793 A[71] = 101;
3794 D[71] = 1;
3795 A[72] = 101;
3796 D[72] = 21;
3797 A[73] = 102;
3798 D[73] = 8;
3799 A[74] = 102;
3800 D[74] = 27;
3801 A[75] = 103;
3802 D[75] = 14;
3803 A[76] = 104;
3804 D[76] = 1;
3805 A[77] = 104;
3806 D[77] = 19;
3807 A[78] = 105;
3808 D[78] = 6;
3809 A[79] = 105;
3810 D[79] = 24;
3811 A[80] = 106;
3812 D[80] = 9;
3813 A[81] = 106;
3814 D[81] = 27;
3815 A[82] = 107;
3816 D[82] = 12;
3817 A[83] = 107;
3818 D[83] = 29;
3819 A[84] = 108;
3820 D[84] = 14;
3821 A[85] = 108;
3822 D[85] = 31;
3823 A[86] = 109;
3824 D[86] = 15;
3825 A[87] = 109;
3826 D[87] = 31;
3827 A[88] = 110;
3828 D[88] = 16;
3829 A[89] = 110;
3830 D[89] = 31;
3831 A[90] = 111;
3832 D[90] = 15;
3833 A[91] = 111;
3834 D[91] = 31;
3835 A[92] = 112;
3836 D[92] = 14;
3837 A[93] = 112;
3838 D[93] = 30;
3839 A[94] = 113;
3840 D[94] = 13;
3841 A[95] = 113;
3842 D[95] = 28;
3843 A[96] = 114;
3844 D[96] = 11;
3845 A[97] = 114;
3846 D[97] = 26;
3847 A[98] = 115;
3848 D[98] = 9;
3849 A[99] = 115;
3850 D[99] = 23;
3851 A[100] = 116;
3852 D[100] = 6;
3853 A[101] = 116;
3854 D[101] = 20;
3855 A[102] = 117;
3856 D[102] = 2;
3857 A[103] = 117;
3858 D[103] = 16;
3859 A[104] = 117;
3860 D[104] = 31;
3861 A[105] = 118;
3862 D[105] = 13;
3863 A[106] = 118;
3864 D[106] = 27;
3865 A[107] = 119;
3866 D[107] = 8;
3867 A[108] = 119;
3868 D[108] = 22;
3869 A[109] = 120;
3870 D[109] = 4;
3871 A[110] = 120;
3872 D[110] = 17;
3873 A[111] = 120;
3874 D[111] = 31;
3875 A[112] = 121;
3876 D[112] = 13;
3877 A[113] = 121;
3878 D[113] = 26;
3879 A[114] = 122;
3880 D[114] = 8;
3881 A[115] = 122;
3882 D[115] = 21;
3883 A[116] = 123;
3884 D[116] = 2;
3885 A[117] = 123;
3886 D[117] = 15;
3887 A[118] = 123;
3888 D[118] = 29;
3889 A[119] = 124;
3890 D[119] = 10;
3891 A[120] = 124;
3892 D[120] = 23;
3893 A[121] = 125;
3894 D[121] = 4;
3895 A[122] = 125;
3896 D[122] = 17;
3897 A[123] = 125;
3898 D[123] = 31;
3899 A[124] = 126;
3900 D[124] = 12;
3901 A[125] = 126;
3902 D[125] = 25;
3903 A[126] = 127;
3904 D[126] = 6;
3905 A[127] = 127;
3906 D[127] = 19;
3907 A[128] = 128;
3908 D[128] = 0;
3909
3910 }/*mel_2_lin_init*/
3911
3912 /**
3913 * function to be documented
3914 * @param ang : ??
3915 * @param table : ??
3916 * @param cs : ??
3917 * @param sn : ??
3918 * @return void
3919 * @callgraph
3920 * @callergraph
3921 */
get_trig(picoos_int32 ang,picoos_int32 * table,picoos_int32 * cs,picoos_int32 * sn)3922 static void get_trig(picoos_int32 ang, picoos_int32 *table, picoos_int32 *cs,
3923 picoos_int32 *sn)
3924 {
3925 picoos_int32 i, j, k;
3926
3927 i = k = ang >> PICODSP_PI_SHIFT; /* * PICODSP_COS_TABLE_LEN2/PICODSP_FIX_SCALE2 */
3928 if (i < 0)
3929 i = -i;
3930 j = 1;
3931 i &= (PICODSP_COS_TABLE_LEN4 - 1);
3932 if (i > PICODSP_COS_TABLE_LEN2)
3933 i = PICODSP_COS_TABLE_LEN4 - i;
3934 if (i > PICODSP_COS_TABLE_LEN) {
3935 j = -1;
3936 i = PICODSP_COS_TABLE_LEN2 - i;
3937 }
3938 if (j == 1)
3939 *cs = table[i];
3940 else
3941 *cs = -table[i];
3942
3943 i = k - PICODSP_COS_TABLE_LEN;
3944 if (i < 0)
3945 i = -i;
3946 j = 1;
3947 i &= (PICODSP_COS_TABLE_LEN4 - 1);
3948 if (i > PICODSP_COS_TABLE_LEN2)
3949 i = PICODSP_COS_TABLE_LEN4 - i;
3950 if (i > PICODSP_COS_TABLE_LEN) {
3951 j = -1;
3952 i = PICODSP_COS_TABLE_LEN2 - i;
3953 }
3954 if (j == 1)
3955 *sn = table[i];
3956 else
3957 *sn = -table[i];
3958 }/*get_trig*/
3959
3960 /**
3961 * function to be documented
3962 * @param sig_inObj : sig PU internal object of the sub-object
3963 * @return void
3964 * @callgraph
3965 * @callergraph
3966 */
save_transition_frame(sig_innerobj_t * sig_inObj)3967 void save_transition_frame(sig_innerobj_t *sig_inObj)
3968 {
3969 picoos_int32 *tmp, *tmp2; /*for loop unrolling*/
3970
3971 if (sig_inObj->voiced_p != sig_inObj->prevVoiced_p) {
3972 sig_inObj->VoicTrans = sig_inObj->prevVoiced_p; /*remember last voicing transition*/
3973 tmp = sig_inObj->ImpResp_p;
3974 tmp2 = sig_inObj->imp_p;
3975 FAST_DEVICE(PICODSP_FFTSIZE,*(tmp++)=*(tmp2++););
3976 if (sig_inObj->voiced_p == 1)
3977 sig_inObj->nV = 0;
3978 else
3979 sig_inObj->nU = 0; /*to avoid problems in case of very short voiced or unvoiced parts (less than 4 frames long)*/
3980 }
3981 }/*save_transition_frame*/
3982
3983 /**
3984 * calculates an unweighted excitation window
3985 * @param sig_inObj : sig PU internal object of the sub-object
3986 * @param nextPeak : position of next peak (excitation position)
3987 * @return PICO_OK
3988 * @callgraph
3989 * @callergraph
3990 * input
3991 * - hop : hop size in samples
3992 * - winlen : excitation window length
3993 * - E : energy
3994 * - F0 : pitch
3995 * - nextPeak : state that remembers next excitation index
3996 * - Fs - sampling frequency
3997 * output
3998 * - LocV, LocU : (MAX_EN size) location of excitation points
3999 * - EnV, EnU : (MAX_EN size) RMS values of excitation (scaled)
4000 * - nV, nU : (integers) number of excitation points
4001 * - nextPeak new position of lastPeak to calculate next frame
4002 */
get_simple_excitation(sig_innerobj_t * sig_inObj,picoos_int16 * nextPeak)4003 static void get_simple_excitation(sig_innerobj_t *sig_inObj,
4004 picoos_int16 *nextPeak)
4005 {
4006 /*Define local variables*/
4007 picoos_int16 nI, nJ, k;
4008 /* picoos_single InvSqrt3=(picoos_single)2/(picoos_single)sqrt(3.0); *//*constant*/
4009 picoos_int32 Ti, sqrtTi;
4010 picoos_int16 hop, winlen, Fs;
4011 picoos_single E, F0;
4012 picoos_int16 voiced;
4013 picoos_single fact; /*normalization factor*/
4014 picoos_single rounding = 0.5f;
4015
4016 /*Link local variables to sig object*/
4017 hop = sig_inObj->hop_p;
4018 winlen = sig_inObj->m2_p;
4019 Fs = sig_inObj->Fs_p;
4020 E = sig_inObj->E_p;
4021 F0 = sig_inObj->F0_p;
4022 voiced = sig_inObj->voiced_p;
4023
4024 E = (E > 5) ? 9 : (E > 1) ? 2 * E - 1 : E;
4025
4026
4027 /* shift previous excitation window by hop samples*/
4028 for (nI = 0; nI < sig_inObj->nV; nI++) {
4029 sig_inObj->LocV[nI] = sig_inObj->LocV[nI] - hop;
4030 }
4031 for (nI = 0; nI < sig_inObj->nU; nI++) {
4032 sig_inObj->LocU[nI] = sig_inObj->LocU[nI] - hop;
4033 }
4034
4035 /*get rid of the voiced points that fall out of the interval*/
4036 nI = 0;
4037 while ((sig_inObj->LocV[nI] < 0) && nI < sig_inObj->nV)
4038 nI++;
4039
4040 for (nJ = nI; nJ < sig_inObj->nV; nJ++) {
4041 sig_inObj->LocV[nJ - nI] = sig_inObj->LocV[nJ];
4042 sig_inObj->EnV[nJ - nI] = sig_inObj->EnV[nJ];
4043 }
4044 sig_inObj->nV -= nI;
4045 /*get rid of the unvoiced points that fall out of the interval */
4046 nI = 0;
4047 while ((sig_inObj->LocU[nI] < 0) && nI < sig_inObj->nU)
4048 nI++;
4049
4050 for (nJ = nI; nJ < sig_inObj->nU; nJ++) {
4051 sig_inObj->LocU[nJ - nI] = sig_inObj->LocU[nJ];
4052 sig_inObj->EnU[nJ - nI] = sig_inObj->EnU[nJ];
4053 }
4054 sig_inObj->nU -= nI;
4055
4056 *nextPeak -= hop;
4057 k = *nextPeak;
4058
4059 fact = 3;
4060 if (voiced == 0) { /*Unvoiced*/
4061
4062 Ti = (picoos_int32) (rounding + (picoos_single) Fs
4063 / (picoos_single) sig_inObj->Fuv_p); /* round Period*/
4064 sqrtTi = (picoos_int32) (E * sqrt((double) Fs
4065 / (hop * sig_inObj->Fuv_p)) * fact * PICODSP_GETEXC_K1);
4066 while (k < winlen) {
4067 if (k < winlen) {
4068 sig_inObj->LocU[sig_inObj->nU] = k;
4069 sig_inObj->EnU[sig_inObj->nU] = sqrtTi;
4070 sig_inObj->nU++;
4071 k += (picoos_int16) Ti;
4072 }
4073 }
4074 } else { /*Voiced*/
4075 Ti
4076 = (picoos_int32) (rounding + (picoos_single) Fs
4077 / (picoos_single) F0); /*Period*/
4078 sqrtTi = (picoos_int32) (E
4079 * sqrt((double) Fs / (hop * sig_inObj->F0_p)) * fact
4080 * PICODSP_GETEXC_K1);
4081 while (k < winlen) {
4082 sig_inObj->LocV[sig_inObj->nV] = k;
4083 sig_inObj->EnV[sig_inObj->nV] = sqrtTi;
4084 sig_inObj->nV++;
4085 k += (picoos_int16) Ti;
4086 }
4087 }
4088 *nextPeak = k;
4089
4090 }/*get_simple_excitation*/
4091
4092 #ifdef __cplusplus
4093 }
4094 #endif
4095
4096 /* end picosig2.c */
4097