Lines Matching +full:- +full:i
1 /* libFLAC - Free Lossless Audio Codec library
2 * Copyright (C) 2000-2009 Josh Coalson
3 * Copyright (C) 2011-2016 Xiph.Org Foundation
9 * - Redistributions of source code must retain the above copyright
12 * - Redistributions in binary form must reproduce the above copyright
16 * - Neither the name of the Xiph.org Foundation nor the names of its
68 unsigned i; in FLAC__lpc_window_data() local
69 for(i = 0; i < data_len; i++) in FLAC__lpc_window_data()
70 out[i] = in[i] * window[i]; in FLAC__lpc_window_data()
78 unsigned i; in FLAC__lpc_compute_autocorrelation()
85 * for(i = 0; i < data_len; i++) in FLAC__lpc_compute_autocorrelation()
86 * data[i] -= mean; in FLAC__lpc_compute_autocorrelation()
90 while(lag--) { in FLAC__lpc_compute_autocorrelation()
91 for(i = lag, d = 0.0; i < data_len; i++) in FLAC__lpc_compute_autocorrelation()
92 d += data[i] * data[i - lag]; in FLAC__lpc_compute_autocorrelation()
103 const unsigned limit = data_len - lag; in FLAC__lpc_compute_autocorrelation()
117 for(coeff = 0; coeff < data_len - sample; coeff++) in FLAC__lpc_compute_autocorrelation()
124 unsigned i, j; in FLAC__lpc_compute_lp_coefficients() local
134 for(i = 0; i < *max_order; i++) { in FLAC__lpc_compute_lp_coefficients()
136 r = -autoc[i+1]; in FLAC__lpc_compute_lp_coefficients()
137 for(j = 0; j < i; j++) in FLAC__lpc_compute_lp_coefficients()
138 r -= lpc[j] * autoc[i-j]; in FLAC__lpc_compute_lp_coefficients()
142 lpc[i]=r; in FLAC__lpc_compute_lp_coefficients()
143 for(j = 0; j < (i>>1); j++) { in FLAC__lpc_compute_lp_coefficients()
145 lpc[j] += r * lpc[i-1-j]; in FLAC__lpc_compute_lp_coefficients()
146 lpc[i-1-j] += r * tmp; in FLAC__lpc_compute_lp_coefficients()
148 if(i & 1) in FLAC__lpc_compute_lp_coefficients()
151 err *= (1.0 - r * r); in FLAC__lpc_compute_lp_coefficients()
154 for(j = 0; j <= i; j++) in FLAC__lpc_compute_lp_coefficients()
155 lp_coeff[i][j] = (FLAC__real)(-lpc[j]); /* negate FIR filter coeff to get predictor coeff */ in FLAC__lpc_compute_lp_coefficients()
156 error[i] = err; in FLAC__lpc_compute_lp_coefficients()
160 *max_order = i+1; in FLAC__lpc_compute_lp_coefficients()
168 unsigned i; in FLAC__lpc_quantize_coefficients() local
175 /* drop one bit for the sign; from here on out we consider only |lp_coeff[i]| */ in FLAC__lpc_quantize_coefficients()
176 precision--; in FLAC__lpc_quantize_coefficients()
178 qmin = -qmax; in FLAC__lpc_quantize_coefficients()
179 qmax--; in FLAC__lpc_quantize_coefficients()
181 /* calc cmax = max( |lp_coeff[i]| ) */ in FLAC__lpc_quantize_coefficients()
183 for(i = 0; i < order; i++) { in FLAC__lpc_quantize_coefficients()
184 const double d = fabs(lp_coeff[i]); in FLAC__lpc_quantize_coefficients()
190 /* => coefficients are all 0, which means our constant-detect didn't work */ in FLAC__lpc_quantize_coefficients()
194 const int max_shiftlimit = (1 << (FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN-1)) - 1; in FLAC__lpc_quantize_coefficients()
195 const int min_shiftlimit = -max_shiftlimit - 1; in FLAC__lpc_quantize_coefficients()
199 log2cmax--; in FLAC__lpc_quantize_coefficients()
200 *shift = (int)precision - log2cmax - 1; in FLAC__lpc_quantize_coefficients()
211 for(i = 0; i < order; i++) { in FLAC__lpc_quantize_coefficients()
212 error += lp_coeff[i] * (1 << *shift); in FLAC__lpc_quantize_coefficients()
217 …ax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmax,*shift,cmax,precision+1,i,lp_coeff[i]); in FLAC__lpc_quantize_coefficients()
219 …in %d<%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmin,*shift,cmax,precision+1,i,lp_coeff[i]); in FLAC__lpc_quantize_coefficients()
225 error -= q; in FLAC__lpc_quantize_coefficients()
226 qlp_coeff[i] = q; in FLAC__lpc_quantize_coefficients()
234 const int nshift = -(*shift); in FLAC__lpc_quantize_coefficients()
240 for(i = 0; i < order; i++) { in FLAC__lpc_quantize_coefficients()
241 error += lp_coeff[i] / (1 << nshift); in FLAC__lpc_quantize_coefficients()
245 …ax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmax,*shift,cmax,precision+1,i,lp_coeff[i]); in FLAC__lpc_quantize_coefficients()
247 …in %d<%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmin,*shift,cmax,precision+1,i,lp_coeff[i]); in FLAC__lpc_quantize_coefficients()
253 error -= q; in FLAC__lpc_quantize_coefficients()
254 qlp_coeff[i] = q; in FLAC__lpc_quantize_coefficients()
271 unsigned i, j; in FLAC__lpc_compute_residual_from_qlp_coefficients() local
277 for(i=0;i<order;i++) in FLAC__lpc_compute_residual_from_qlp_coefficients()
278 fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]); in FLAC__lpc_compute_residual_from_qlp_coefficients()
283 for(i = 0; i < data_len; i++) { in FLAC__lpc_compute_residual_from_qlp_coefficients()
288 sum += qlp_coeff[j] * (*(--history)); in FLAC__lpc_compute_residual_from_qlp_coefficients()
290 if(sumo > 2147483647ll || sumo < -2147483648ll) in FLAC__lpc_compute_residual_from_qlp_coefficients()
291 …lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%" PRId64 "\n",… in FLAC__lpc_compute_residual_from_qlp_coefficients()
293 *(residual++) = *(data++) - (sum >> lp_quantization); in FLAC__lpc_compute_residual_from_qlp_coefficients()
297 for(i = 0; i < data_len; i++) { in FLAC__lpc_compute_residual_from_qlp_coefficients()
300 sum += qlp_coeff[j] * data[i-j-1]; in FLAC__lpc_compute_residual_from_qlp_coefficients()
301 residual[i] = data[i] - (sum >> lp_quantization); in FLAC__lpc_compute_residual_from_qlp_coefficients()
307 int i;
322 for(i = 0; i < (int)data_len; i++) {
324 sum += qlp_coeff[11] * data[i-12];
325 sum += qlp_coeff[10] * data[i-11];
326 sum += qlp_coeff[9] * data[i-10];
327 sum += qlp_coeff[8] * data[i-9];
328 sum += qlp_coeff[7] * data[i-8];
329 sum += qlp_coeff[6] * data[i-7];
330 sum += qlp_coeff[5] * data[i-6];
331 sum += qlp_coeff[4] * data[i-5];
332 sum += qlp_coeff[3] * data[i-4];
333 sum += qlp_coeff[2] * data[i-3];
334 sum += qlp_coeff[1] * data[i-2];
335 sum += qlp_coeff[0] * data[i-1];
336 residual[i] = data[i] - (sum >> lp_quantization);
340 for(i = 0; i < (int)data_len; i++) {
342 sum += qlp_coeff[10] * data[i-11];
343 sum += qlp_coeff[9] * data[i-10];
344 sum += qlp_coeff[8] * data[i-9];
345 sum += qlp_coeff[7] * data[i-8];
346 sum += qlp_coeff[6] * data[i-7];
347 sum += qlp_coeff[5] * data[i-6];
348 sum += qlp_coeff[4] * data[i-5];
349 sum += qlp_coeff[3] * data[i-4];
350 sum += qlp_coeff[2] * data[i-3];
351 sum += qlp_coeff[1] * data[i-2];
352 sum += qlp_coeff[0] * data[i-1];
353 residual[i] = data[i] - (sum >> lp_quantization);
359 for(i = 0; i < (int)data_len; i++) {
361 sum += qlp_coeff[9] * data[i-10];
362 sum += qlp_coeff[8] * data[i-9];
363 sum += qlp_coeff[7] * data[i-8];
364 sum += qlp_coeff[6] * data[i-7];
365 sum += qlp_coeff[5] * data[i-6];
366 sum += qlp_coeff[4] * data[i-5];
367 sum += qlp_coeff[3] * data[i-4];
368 sum += qlp_coeff[2] * data[i-3];
369 sum += qlp_coeff[1] * data[i-2];
370 sum += qlp_coeff[0] * data[i-1];
371 residual[i] = data[i] - (sum >> lp_quantization);
375 for(i = 0; i < (int)data_len; i++) {
377 sum += qlp_coeff[8] * data[i-9];
378 sum += qlp_coeff[7] * data[i-8];
379 sum += qlp_coeff[6] * data[i-7];
380 sum += qlp_coeff[5] * data[i-6];
381 sum += qlp_coeff[4] * data[i-5];
382 sum += qlp_coeff[3] * data[i-4];
383 sum += qlp_coeff[2] * data[i-3];
384 sum += qlp_coeff[1] * data[i-2];
385 sum += qlp_coeff[0] * data[i-1];
386 residual[i] = data[i] - (sum >> lp_quantization);
394 for(i = 0; i < (int)data_len; i++) {
396 sum += qlp_coeff[7] * data[i-8];
397 sum += qlp_coeff[6] * data[i-7];
398 sum += qlp_coeff[5] * data[i-6];
399 sum += qlp_coeff[4] * data[i-5];
400 sum += qlp_coeff[3] * data[i-4];
401 sum += qlp_coeff[2] * data[i-3];
402 sum += qlp_coeff[1] * data[i-2];
403 sum += qlp_coeff[0] * data[i-1];
404 residual[i] = data[i] - (sum >> lp_quantization);
408 for(i = 0; i < (int)data_len; i++) {
410 sum += qlp_coeff[6] * data[i-7];
411 sum += qlp_coeff[5] * data[i-6];
412 sum += qlp_coeff[4] * data[i-5];
413 sum += qlp_coeff[3] * data[i-4];
414 sum += qlp_coeff[2] * data[i-3];
415 sum += qlp_coeff[1] * data[i-2];
416 sum += qlp_coeff[0] * data[i-1];
417 residual[i] = data[i] - (sum >> lp_quantization);
423 for(i = 0; i < (int)data_len; i++) {
425 sum += qlp_coeff[5] * data[i-6];
426 sum += qlp_coeff[4] * data[i-5];
427 sum += qlp_coeff[3] * data[i-4];
428 sum += qlp_coeff[2] * data[i-3];
429 sum += qlp_coeff[1] * data[i-2];
430 sum += qlp_coeff[0] * data[i-1];
431 residual[i] = data[i] - (sum >> lp_quantization);
435 for(i = 0; i < (int)data_len; i++) {
437 sum += qlp_coeff[4] * data[i-5];
438 sum += qlp_coeff[3] * data[i-4];
439 sum += qlp_coeff[2] * data[i-3];
440 sum += qlp_coeff[1] * data[i-2];
441 sum += qlp_coeff[0] * data[i-1];
442 residual[i] = data[i] - (sum >> lp_quantization);
450 for(i = 0; i < (int)data_len; i++) {
452 sum += qlp_coeff[3] * data[i-4];
453 sum += qlp_coeff[2] * data[i-3];
454 sum += qlp_coeff[1] * data[i-2];
455 sum += qlp_coeff[0] * data[i-1];
456 residual[i] = data[i] - (sum >> lp_quantization);
460 for(i = 0; i < (int)data_len; i++) {
462 sum += qlp_coeff[2] * data[i-3];
463 sum += qlp_coeff[1] * data[i-2];
464 sum += qlp_coeff[0] * data[i-1];
465 residual[i] = data[i] - (sum >> lp_quantization);
471 for(i = 0; i < (int)data_len; i++) {
473 sum += qlp_coeff[1] * data[i-2];
474 sum += qlp_coeff[0] * data[i-1];
475 residual[i] = data[i] - (sum >> lp_quantization);
479 for(i = 0; i < (int)data_len; i++)
480 residual[i] = data[i] - ((qlp_coeff[0] * data[i-1]) >> lp_quantization);
486 for(i = 0; i < (int)data_len; i++) {
489 case 32: sum += qlp_coeff[31] * data[i-32];
490 case 31: sum += qlp_coeff[30] * data[i-31];
491 case 30: sum += qlp_coeff[29] * data[i-30];
492 case 29: sum += qlp_coeff[28] * data[i-29];
493 case 28: sum += qlp_coeff[27] * data[i-28];
494 case 27: sum += qlp_coeff[26] * data[i-27];
495 case 26: sum += qlp_coeff[25] * data[i-26];
496 case 25: sum += qlp_coeff[24] * data[i-25];
497 case 24: sum += qlp_coeff[23] * data[i-24];
498 case 23: sum += qlp_coeff[22] * data[i-23];
499 case 22: sum += qlp_coeff[21] * data[i-22];
500 case 21: sum += qlp_coeff[20] * data[i-21];
501 case 20: sum += qlp_coeff[19] * data[i-20];
502 case 19: sum += qlp_coeff[18] * data[i-19];
503 case 18: sum += qlp_coeff[17] * data[i-18];
504 case 17: sum += qlp_coeff[16] * data[i-17];
505 case 16: sum += qlp_coeff[15] * data[i-16];
506 case 15: sum += qlp_coeff[14] * data[i-15];
507 case 14: sum += qlp_coeff[13] * data[i-14];
508 case 13: sum += qlp_coeff[12] * data[i-13];
509 sum += qlp_coeff[11] * data[i-12];
510 sum += qlp_coeff[10] * data[i-11];
511 sum += qlp_coeff[ 9] * data[i-10];
512 sum += qlp_coeff[ 8] * data[i- 9];
513 sum += qlp_coeff[ 7] * data[i- 8];
514 sum += qlp_coeff[ 6] * data[i- 7];
515 sum += qlp_coeff[ 5] * data[i- 6];
516 sum += qlp_coeff[ 4] * data[i- 5];
517 sum += qlp_coeff[ 3] * data[i- 4];
518 sum += qlp_coeff[ 2] * data[i- 3];
519 sum += qlp_coeff[ 1] * data[i- 2];
520 sum += qlp_coeff[ 0] * data[i- 1];
522 residual[i] = data[i] - (sum >> lp_quantization);
531 unsigned i, j; in FLAC__lpc_compute_residual_from_qlp_coefficients_wide() local
537 for(i=0;i<order;i++) in FLAC__lpc_compute_residual_from_qlp_coefficients_wide()
538 fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]); in FLAC__lpc_compute_residual_from_qlp_coefficients_wide()
543 for(i = 0; i < data_len; i++) { in FLAC__lpc_compute_residual_from_qlp_coefficients_wide()
547 sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history)); in FLAC__lpc_compute_residual_from_qlp_coefficients_wide()
549 …AC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%" PRId64 "\n", i, (sum >… in FLAC__lpc_compute_residual_from_qlp_coefficients_wide()
552 if(FLAC__bitmath_silog2((FLAC__int64)(*data) - (sum >> lp_quantization)) > 32) { in FLAC__lpc_compute_residual_from_qlp_coefficients_wide()
553 …de: OVERFLOW, i=%u, data=%d, sum=%" PRId64 ", residual=%" PRId64 "\n", i, *data, (int64_t)(sum >> … in FLAC__lpc_compute_residual_from_qlp_coefficients_wide()
556 *(residual++) = *(data++) - (FLAC__int32)(sum >> lp_quantization); in FLAC__lpc_compute_residual_from_qlp_coefficients_wide()
561 int i;
576 for(i = 0; i < (int)data_len; i++) {
578 sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
579 sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
580 sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
581 sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
582 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
583 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
584 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
585 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
586 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
587 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
588 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
589 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
590 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
594 for(i = 0; i < (int)data_len; i++) {
596 sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
597 sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
598 sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
599 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
600 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
601 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
602 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
603 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
604 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
605 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
606 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
607 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
613 for(i = 0; i < (int)data_len; i++) {
615 sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
616 sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
617 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
618 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
619 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
620 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
621 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
622 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
623 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
624 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
625 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
629 for(i = 0; i < (int)data_len; i++) {
631 sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
632 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
633 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
634 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
635 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
636 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
637 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
638 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
639 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
640 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
648 for(i = 0; i < (int)data_len; i++) {
650 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
651 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
652 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
653 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
654 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
655 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
656 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
657 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
658 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
662 for(i = 0; i < (int)data_len; i++) {
664 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
665 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
666 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
667 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
668 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
669 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
670 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
671 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
677 for(i = 0; i < (int)data_len; i++) {
679 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
680 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
681 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
682 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
683 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
684 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
685 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
689 for(i = 0; i < (int)data_len; i++) {
691 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
692 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
693 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
694 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
695 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
696 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
704 for(i = 0; i < (int)data_len; i++) {
706 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
707 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
708 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
709 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
710 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
714 for(i = 0; i < (int)data_len; i++) {
716 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
717 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
718 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
719 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
725 for(i = 0; i < (int)data_len; i++) {
727 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
728 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
729 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
733 for(i = 0; i < (int)data_len; i++)
734 … residual[i] = data[i] - (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization);
740 for(i = 0; i < (int)data_len; i++) {
743 case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32];
744 case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31];
745 case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30];
746 case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29];
747 case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28];
748 case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27];
749 case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26];
750 case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25];
751 case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24];
752 case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23];
753 case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22];
754 case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21];
755 case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20];
756 case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19];
757 case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18];
758 case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17];
759 case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16];
760 case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15];
761 case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14];
762 case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13];
763 sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
764 sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
765 sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10];
766 sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9];
767 sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8];
768 sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7];
769 sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6];
770 sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5];
771 sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4];
772 sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3];
773 sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2];
774 sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1];
776 residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization);
788 unsigned i, j; in FLAC__lpc_restore_signal() local
794 for(i=0;i<order;i++) in FLAC__lpc_restore_signal()
795 fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]); in FLAC__lpc_restore_signal()
800 for(i = 0; i < data_len; i++) { in FLAC__lpc_restore_signal()
805 sum += qlp_coeff[j] * (*(--history)); in FLAC__lpc_restore_signal()
807 if(sumo > 2147483647ll || sumo < -2147483648ll) in FLAC__lpc_restore_signal()
808 …fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%" PRId64 "\n",i,… in FLAC__lpc_restore_signal()
814 for(i = 0; i < data_len; i++) { in FLAC__lpc_restore_signal()
817 sum += qlp_coeff[j] * data[i-j-1]; in FLAC__lpc_restore_signal()
818 data[i] = residual[i] + (sum >> lp_quantization); in FLAC__lpc_restore_signal()
824 int i;
839 for(i = 0; i < (int)data_len; i++) {
841 sum += qlp_coeff[11] * data[i-12];
842 sum += qlp_coeff[10] * data[i-11];
843 sum += qlp_coeff[9] * data[i-10];
844 sum += qlp_coeff[8] * data[i-9];
845 sum += qlp_coeff[7] * data[i-8];
846 sum += qlp_coeff[6] * data[i-7];
847 sum += qlp_coeff[5] * data[i-6];
848 sum += qlp_coeff[4] * data[i-5];
849 sum += qlp_coeff[3] * data[i-4];
850 sum += qlp_coeff[2] * data[i-3];
851 sum += qlp_coeff[1] * data[i-2];
852 sum += qlp_coeff[0] * data[i-1];
853 data[i] = residual[i] + (sum >> lp_quantization);
857 for(i = 0; i < (int)data_len; i++) {
859 sum += qlp_coeff[10] * data[i-11];
860 sum += qlp_coeff[9] * data[i-10];
861 sum += qlp_coeff[8] * data[i-9];
862 sum += qlp_coeff[7] * data[i-8];
863 sum += qlp_coeff[6] * data[i-7];
864 sum += qlp_coeff[5] * data[i-6];
865 sum += qlp_coeff[4] * data[i-5];
866 sum += qlp_coeff[3] * data[i-4];
867 sum += qlp_coeff[2] * data[i-3];
868 sum += qlp_coeff[1] * data[i-2];
869 sum += qlp_coeff[0] * data[i-1];
870 data[i] = residual[i] + (sum >> lp_quantization);
876 for(i = 0; i < (int)data_len; i++) {
878 sum += qlp_coeff[9] * data[i-10];
879 sum += qlp_coeff[8] * data[i-9];
880 sum += qlp_coeff[7] * data[i-8];
881 sum += qlp_coeff[6] * data[i-7];
882 sum += qlp_coeff[5] * data[i-6];
883 sum += qlp_coeff[4] * data[i-5];
884 sum += qlp_coeff[3] * data[i-4];
885 sum += qlp_coeff[2] * data[i-3];
886 sum += qlp_coeff[1] * data[i-2];
887 sum += qlp_coeff[0] * data[i-1];
888 data[i] = residual[i] + (sum >> lp_quantization);
892 for(i = 0; i < (int)data_len; i++) {
894 sum += qlp_coeff[8] * data[i-9];
895 sum += qlp_coeff[7] * data[i-8];
896 sum += qlp_coeff[6] * data[i-7];
897 sum += qlp_coeff[5] * data[i-6];
898 sum += qlp_coeff[4] * data[i-5];
899 sum += qlp_coeff[3] * data[i-4];
900 sum += qlp_coeff[2] * data[i-3];
901 sum += qlp_coeff[1] * data[i-2];
902 sum += qlp_coeff[0] * data[i-1];
903 data[i] = residual[i] + (sum >> lp_quantization);
911 for(i = 0; i < (int)data_len; i++) {
913 sum += qlp_coeff[7] * data[i-8];
914 sum += qlp_coeff[6] * data[i-7];
915 sum += qlp_coeff[5] * data[i-6];
916 sum += qlp_coeff[4] * data[i-5];
917 sum += qlp_coeff[3] * data[i-4];
918 sum += qlp_coeff[2] * data[i-3];
919 sum += qlp_coeff[1] * data[i-2];
920 sum += qlp_coeff[0] * data[i-1];
921 data[i] = residual[i] + (sum >> lp_quantization);
925 for(i = 0; i < (int)data_len; i++) {
927 sum += qlp_coeff[6] * data[i-7];
928 sum += qlp_coeff[5] * data[i-6];
929 sum += qlp_coeff[4] * data[i-5];
930 sum += qlp_coeff[3] * data[i-4];
931 sum += qlp_coeff[2] * data[i-3];
932 sum += qlp_coeff[1] * data[i-2];
933 sum += qlp_coeff[0] * data[i-1];
934 data[i] = residual[i] + (sum >> lp_quantization);
940 for(i = 0; i < (int)data_len; i++) {
942 sum += qlp_coeff[5] * data[i-6];
943 sum += qlp_coeff[4] * data[i-5];
944 sum += qlp_coeff[3] * data[i-4];
945 sum += qlp_coeff[2] * data[i-3];
946 sum += qlp_coeff[1] * data[i-2];
947 sum += qlp_coeff[0] * data[i-1];
948 data[i] = residual[i] + (sum >> lp_quantization);
952 for(i = 0; i < (int)data_len; i++) {
954 sum += qlp_coeff[4] * data[i-5];
955 sum += qlp_coeff[3] * data[i-4];
956 sum += qlp_coeff[2] * data[i-3];
957 sum += qlp_coeff[1] * data[i-2];
958 sum += qlp_coeff[0] * data[i-1];
959 data[i] = residual[i] + (sum >> lp_quantization);
967 for(i = 0; i < (int)data_len; i++) {
969 sum += qlp_coeff[3] * data[i-4];
970 sum += qlp_coeff[2] * data[i-3];
971 sum += qlp_coeff[1] * data[i-2];
972 sum += qlp_coeff[0] * data[i-1];
973 data[i] = residual[i] + (sum >> lp_quantization);
977 for(i = 0; i < (int)data_len; i++) {
979 sum += qlp_coeff[2] * data[i-3];
980 sum += qlp_coeff[1] * data[i-2];
981 sum += qlp_coeff[0] * data[i-1];
982 data[i] = residual[i] + (sum >> lp_quantization);
988 for(i = 0; i < (int)data_len; i++) {
990 sum += qlp_coeff[1] * data[i-2];
991 sum += qlp_coeff[0] * data[i-1];
992 data[i] = residual[i] + (sum >> lp_quantization);
996 for(i = 0; i < (int)data_len; i++)
997 data[i] = residual[i] + ((qlp_coeff[0] * data[i-1]) >> lp_quantization);
1003 for(i = 0; i < (int)data_len; i++) {
1006 case 32: sum += qlp_coeff[31] * data[i-32];
1007 case 31: sum += qlp_coeff[30] * data[i-31];
1008 case 30: sum += qlp_coeff[29] * data[i-30];
1009 case 29: sum += qlp_coeff[28] * data[i-29];
1010 case 28: sum += qlp_coeff[27] * data[i-28];
1011 case 27: sum += qlp_coeff[26] * data[i-27];
1012 case 26: sum += qlp_coeff[25] * data[i-26];
1013 case 25: sum += qlp_coeff[24] * data[i-25];
1014 case 24: sum += qlp_coeff[23] * data[i-24];
1015 case 23: sum += qlp_coeff[22] * data[i-23];
1016 case 22: sum += qlp_coeff[21] * data[i-22];
1017 case 21: sum += qlp_coeff[20] * data[i-21];
1018 case 20: sum += qlp_coeff[19] * data[i-20];
1019 case 19: sum += qlp_coeff[18] * data[i-19];
1020 case 18: sum += qlp_coeff[17] * data[i-18];
1021 case 17: sum += qlp_coeff[16] * data[i-17];
1022 case 16: sum += qlp_coeff[15] * data[i-16];
1023 case 15: sum += qlp_coeff[14] * data[i-15];
1024 case 14: sum += qlp_coeff[13] * data[i-14];
1025 case 13: sum += qlp_coeff[12] * data[i-13];
1026 sum += qlp_coeff[11] * data[i-12];
1027 sum += qlp_coeff[10] * data[i-11];
1028 sum += qlp_coeff[ 9] * data[i-10];
1029 sum += qlp_coeff[ 8] * data[i- 9];
1030 sum += qlp_coeff[ 7] * data[i- 8];
1031 sum += qlp_coeff[ 6] * data[i- 7];
1032 sum += qlp_coeff[ 5] * data[i- 6];
1033 sum += qlp_coeff[ 4] * data[i- 5];
1034 sum += qlp_coeff[ 3] * data[i- 4];
1035 sum += qlp_coeff[ 2] * data[i- 3];
1036 sum += qlp_coeff[ 1] * data[i- 2];
1037 sum += qlp_coeff[ 0] * data[i- 1];
1039 data[i] = residual[i] + (sum >> lp_quantization);
1048 unsigned i, j; in FLAC__lpc_restore_signal_wide() local
1054 for(i=0;i<order;i++) in FLAC__lpc_restore_signal_wide()
1055 fprintf(stderr,", q[%u]=%d",i,qlp_coeff[i]); in FLAC__lpc_restore_signal_wide()
1060 for(i = 0; i < data_len; i++) { in FLAC__lpc_restore_signal_wide()
1064 sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history)); in FLAC__lpc_restore_signal_wide()
1066 …fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%" PRId64 "\n", i, (sum >> lp_q… in FLAC__lpc_restore_signal_wide()
1070 …derr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%" PRId64 ", data=%" PRId64 … in FLAC__lpc_restore_signal_wide()
1078 int i;
1093 for(i = 0; i < (int)data_len; i++) {
1095 sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
1096 sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
1097 sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
1098 sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
1099 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
1100 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
1101 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
1102 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
1103 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
1104 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1105 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1106 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1107 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1111 for(i = 0; i < (int)data_len; i++) {
1113 sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
1114 sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
1115 sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
1116 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
1117 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
1118 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
1119 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
1120 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
1121 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1122 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1123 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1124 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1130 for(i = 0; i < (int)data_len; i++) {
1132 sum += qlp_coeff[9] * (FLAC__int64)data[i-10];
1133 sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
1134 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
1135 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
1136 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
1137 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
1138 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
1139 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1140 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1141 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1142 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1146 for(i = 0; i < (int)data_len; i++) {
1148 sum += qlp_coeff[8] * (FLAC__int64)data[i-9];
1149 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
1150 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
1151 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
1152 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
1153 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
1154 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1155 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1156 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1157 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1165 for(i = 0; i < (int)data_len; i++) {
1167 sum += qlp_coeff[7] * (FLAC__int64)data[i-8];
1168 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
1169 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
1170 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
1171 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
1172 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1173 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1174 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1175 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1179 for(i = 0; i < (int)data_len; i++) {
1181 sum += qlp_coeff[6] * (FLAC__int64)data[i-7];
1182 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
1183 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
1184 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
1185 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1186 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1187 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1188 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1194 for(i = 0; i < (int)data_len; i++) {
1196 sum += qlp_coeff[5] * (FLAC__int64)data[i-6];
1197 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
1198 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
1199 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1200 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1201 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1202 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1206 for(i = 0; i < (int)data_len; i++) {
1208 sum += qlp_coeff[4] * (FLAC__int64)data[i-5];
1209 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
1210 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1211 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1212 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1213 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1221 for(i = 0; i < (int)data_len; i++) {
1223 sum += qlp_coeff[3] * (FLAC__int64)data[i-4];
1224 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1225 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1226 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1227 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1231 for(i = 0; i < (int)data_len; i++) {
1233 sum += qlp_coeff[2] * (FLAC__int64)data[i-3];
1234 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1235 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1236 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1242 for(i = 0; i < (int)data_len; i++) {
1244 sum += qlp_coeff[1] * (FLAC__int64)data[i-2];
1245 sum += qlp_coeff[0] * (FLAC__int64)data[i-1];
1246 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1250 for(i = 0; i < (int)data_len; i++)
1251 … data[i] = residual[i] + (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization);
1257 for(i = 0; i < (int)data_len; i++) {
1260 case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32];
1261 case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31];
1262 case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30];
1263 case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29];
1264 case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28];
1265 case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27];
1266 case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26];
1267 case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25];
1268 case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24];
1269 case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23];
1270 case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22];
1271 case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21];
1272 case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20];
1273 case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19];
1274 case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18];
1275 case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17];
1276 case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16];
1277 case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15];
1278 case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14];
1279 case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13];
1280 sum += qlp_coeff[11] * (FLAC__int64)data[i-12];
1281 sum += qlp_coeff[10] * (FLAC__int64)data[i-11];
1282 sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10];
1283 sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9];
1284 sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8];
1285 sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7];
1286 sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6];
1287 sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5];
1288 sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4];
1289 sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3];
1290 sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2];
1291 sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1];
1293 data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization);
1325 ….0) { /* error should not be negative but can happen due to inadequate floating-point resolution */ in FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale()
1335 …unsigned order, indx, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_er… in FLAC__lpc_compute_best_order()
1344 best_bits = (unsigned)(-1); in FLAC__lpc_compute_best_order()
1347 …ple_with_error_scale(lpc_error[indx], error_scale) * (double)(total_samples - order) + (double)(or… in FLAC__lpc_compute_best_order()
1354 return best_index+1; /* +1 since indx of lpc_error[] is order-1 */ in FLAC__lpc_compute_best_order()