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