Lines Matching +full:0 +full:- +full:6

17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * -----------------------------------------------------------------------
46 * -----------------------------------------------------------------------
55 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
59 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
60 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
61 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
62 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
76 unsigned int v = (unsigned int)val; /* 32-bit word to find the log of */ in log2plus1()
96 * It returns i if table[i - 1] <= val < table[i].
104 for (i = 0; i < size; i++) in quan()
113 * returns the integer product of the 14-bit integer "an" and
114 * "floating point" representation (4-bit exponent, 6-bit mantessa) "srn".
122 anmag = (an > 0) ? an : ((-an) & 0x1FFF); in fmult()
123 anexp = log2plus1(anmag) - 6; in fmult()
124 anmant = (anmag == 0) ? 32 : in fmult()
125 (anexp >= 0) ? anmag >> anexp : anmag << -anexp; in fmult()
126 wanexp = anexp + ((srn >> 6) & 0xF) - 13; in fmult()
128 wanmant = (anmant * (srn & 077) + 0x30) >> 4; in fmult()
129 retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) : in fmult()
130 (wanmant >> -wanexp); in fmult()
132 return (((an ^ srn) < 0) ? -retval : retval); in fmult()
146 state_ptr->yl = 34816; in g72x_init_state()
147 state_ptr->yu = 544; in g72x_init_state()
148 state_ptr->dms = 0; in g72x_init_state()
149 state_ptr->dml = 0; in g72x_init_state()
150 state_ptr->ap = 0; in g72x_init_state()
151 for (cnta = 0; cnta < 2; cnta++) { in g72x_init_state()
152 state_ptr->a[cnta] = 0; in g72x_init_state()
153 state_ptr->pk[cnta] = 0; in g72x_init_state()
154 state_ptr->sr[cnta] = 32; in g72x_init_state()
156 for (cnta = 0; cnta < 6; cnta++) { in g72x_init_state()
157 state_ptr->b[cnta] = 0; in g72x_init_state()
158 state_ptr->dq[cnta] = 32; in g72x_init_state()
160 state_ptr->td = 0; in g72x_init_state()
166 * computes the estimated signal from 6-zero predictor.
174 sezi = fmult(state_ptr->b[0] >> 2, state_ptr->dq[0]); in predictor_zero()
175 for (i = 1; i < 6; i++) /* ACCUM */ in predictor_zero()
176 sezi += fmult(state_ptr->b[i] >> 2, state_ptr->dq[i]); in predictor_zero()
182 * computes the estimated signal from 2-pole predictor.
187 return (fmult(state_ptr->a[1] >> 2, state_ptr->sr[1]) + in predictor_pole()
188 fmult(state_ptr->a[0] >> 2, state_ptr->sr[0])); in predictor_pole()
202 if (state_ptr->ap >= 256) in step_size()
203 return (state_ptr->yu); in step_size()
205 y = state_ptr->yl >> 6; in step_size()
206 dif = state_ptr->yu - y; in step_size()
207 al = state_ptr->ap >> 2; in step_size()
208 if (dif > 0) in step_size()
209 y += (dif * al) >> 6; in step_size()
210 else if (dif < 0) in step_size()
211 y += (dif * al + 0x3F) >> 6; in step_size()
241 mant = ((dqm << 7) >> exp) & 0x7F; /* Fractional portion. */ in quantize()
249 dln = dl - (y >> 2); in quantize()
257 if (d < 0) /* take 1's complement of i */ in quantize()
258 return ((size << 1) + 1 - i); in quantize()
259 else if (i == 0) /* take 1's complement of 0 */ in quantize()
280 if (dql < 0) { in reconstruct()
281 return ((sign) ? -0x8000 : 0); in reconstruct()
285 dq = (dqt << 7) >> (14 - dex); in reconstruct()
286 return ((sign) ? (dq - 0x8000) : dq); in reconstruct()
301 short a2p=0; /* LIMC */ in update()
310 pk0 = (dqsez < 0) ? 1 : 0; /* needed in updating predictor poles */ in update()
312 mag = dq & 0x7FFF; /* prediction difference magnitude */ in update()
314 ylint = state_ptr->yl >> 15; /* exponent part of yl */ in update()
315 ylfrac = (state_ptr->yl >> 10) & 0x1F; /* fractional part of yl */ in update()
319 if (state_ptr->td == 0) /* signal supposed voice */ in update()
320 tr = 0; in update()
322 tr = 0; /* treated as voice */ in update()
331 /* update non-steady state step size multiplier */ in update()
332 state_ptr->yu = y + ((wi - y) >> 5); in update()
335 if (state_ptr->yu < 544) /* 544 <= yu <= 5120 */ in update()
336 state_ptr->yu = 544; in update()
337 else if (state_ptr->yu > 5120) in update()
338 state_ptr->yu = 5120; in update()
342 state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6); in update()
348 state_ptr->a[0] = 0; in update()
349 state_ptr->a[1] = 0; in update()
350 state_ptr->b[0] = 0; in update()
351 state_ptr->b[1] = 0; in update()
352 state_ptr->b[2] = 0; in update()
353 state_ptr->b[3] = 0; in update()
354 state_ptr->b[4] = 0; in update()
355 state_ptr->b[5] = 0; in update()
357 pks1 = pk0 ^ state_ptr->pk[0]; /* UPA2 */ in update()
360 a2p = state_ptr->a[1] - (state_ptr->a[1] >> 7); in update()
361 if (dqsez != 0) { in update()
362 fa1 = (pks1) ? state_ptr->a[0] : -state_ptr->a[0]; in update()
363 if (fa1 < -8191) /* a2p = function of fa1 */ in update()
364 a2p -= 0x100; in update()
366 a2p += 0xFF; in update()
370 if (pk0 ^ state_ptr->pk[1]) in update()
373 if (a2p <= -12160) in update()
374 a2p = -12288; in update()
378 a2p -= 0x80; in update()
380 else if (a2p <= -12416) in update()
381 a2p = -12288; in update()
385 a2p += 0x80; in update()
388 /* Possible bug: a2p not initialized if dqsez == 0) */ in update()
390 state_ptr->a[1] = a2p; in update()
393 /* update predictor pole a[0] */ in update()
394 state_ptr->a[0] -= state_ptr->a[0] >> 8; in update()
395 if (dqsez != 0) in update()
397 if (pks1 == 0) in update()
398 state_ptr->a[0] += 192; in update()
400 state_ptr->a[0] -= 192; in update()
403 a1ul = 15360 - a2p; in update()
404 if (state_ptr->a[0] < -a1ul) in update()
405 state_ptr->a[0] = -a1ul; in update()
406 else if (state_ptr->a[0] > a1ul) in update()
407 state_ptr->a[0] = a1ul; in update()
409 /* UPB : update predictor zeros b[6] */ in update()
410 for (cnt = 0; cnt < 6; cnt++) { in update()
412 state_ptr->b[cnt] -= state_ptr->b[cnt] >> 9; in update()
414 state_ptr->b[cnt] -= state_ptr->b[cnt] >> 8; in update()
415 if (dq & 0x7FFF) { /* XOR */ in update()
416 if ((dq ^ state_ptr->dq[cnt]) >= 0) in update()
417 state_ptr->b[cnt] += 128; in update()
419 state_ptr->b[cnt] -= 128; in update()
424 for (cnt = 5; cnt > 0; cnt--) in update()
425 state_ptr->dq[cnt] = state_ptr->dq[cnt-1]; in update()
426 /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */ in update()
427 if (mag == 0) { in update()
428 state_ptr->dq[0] = (dq >= 0) ? 0x20 : (short)(unsigned short)0xFC20; in update()
431 state_ptr->dq[0] = (dq >= 0) ? in update()
432 (exp << 6) + ((mag << 6) >> exp) : in update()
433 (exp << 6) + ((mag << 6) >> exp) - 0x400; in update()
436 state_ptr->sr[1] = state_ptr->sr[0]; in update()
437 /* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */ in update()
438 if (sr == 0) { in update()
439 state_ptr->sr[0] = 0x20; in update()
440 } else if (sr > 0) { in update()
442 state_ptr->sr[0] = (exp << 6) + ((sr << 6) >> exp); in update()
443 } else if (sr > -32768) { in update()
444 mag = -sr; in update()
446 state_ptr->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400; in update()
448 state_ptr->sr[0] = (short)(unsigned short)0xFC20; in update()
451 state_ptr->pk[1] = state_ptr->pk[0]; in update()
452 state_ptr->pk[0] = pk0; in update()
456 state_ptr->td = 0; /* next one will be treated as voice */ in update()
457 else if (a2p < -11776) /* small sample-to-sample correlation */ in update()
458 state_ptr->td = 1; /* signal may be data */ in update()
460 state_ptr->td = 0; in update()
465 state_ptr->dms += (fi - state_ptr->dms) >> 5; /* FILTA */ in update()
466 state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7); /* FILTB */ in update()
469 state_ptr->ap = 256; in update()
471 state_ptr->ap += (0x200 - state_ptr->ap) >> 4; in update()
472 else if (state_ptr->td == 1) in update()
473 state_ptr->ap += (0x200 - state_ptr->ap) >> 4; in update()
474 else if (abs((state_ptr->dms << 2) - state_ptr->dml) >= in update()
475 (state_ptr->dml >> 3)) in update()
476 state_ptr->ap += (0x200 - state_ptr->ap) >> 4; in update()
478 state_ptr->ap += (-state_ptr->ap) >> 4; in update()
487 * is adjusted by one level of A-law or u-law codes.
497 * adjusted A-law or u-law compressed sample.
501 unsigned char sp; /* A-law compressed 8-bit code */ in tandem_adjust_alaw()
504 int sd; /* adjusted A-law decoded sample value */ in tandem_adjust_alaw()
508 if (sr <= -32768) in tandem_adjust_alaw()
509 sr = -1; in tandem_adjust_alaw()
510 sp = sox_13linear2alaw(((sr >> 1) << 3));/* short to A-law compression */ in tandem_adjust_alaw()
511 dx = (sox_alaw2linear16(sp) >> 2) - se; /* 16-bit prediction error */ in tandem_adjust_alaw()
512 id = quantize(dx, y, qtab, sign - 1); in tandem_adjust_alaw()
517 /* ADPCM codes : 8, 9, ... F, 0, 1, ... , 6, 7 */ in tandem_adjust_alaw()
522 if (sp & 0x80) { in tandem_adjust_alaw()
523 sd = (sp == 0xD5) ? 0x55 : in tandem_adjust_alaw()
524 ((sp ^ 0x55) - 1) ^ 0x55; in tandem_adjust_alaw()
526 sd = (sp == 0x2A) ? 0x2A : in tandem_adjust_alaw()
527 ((sp ^ 0x55) + 1) ^ 0x55; in tandem_adjust_alaw()
530 if (sp & 0x80) in tandem_adjust_alaw()
531 sd = (sp == 0xAA) ? 0xAA : in tandem_adjust_alaw()
532 ((sp ^ 0x55) + 1) ^ 0x55; in tandem_adjust_alaw()
534 sd = (sp == 0x55) ? 0xD5 : in tandem_adjust_alaw()
535 ((sp ^ 0x55) - 1) ^ 0x55; in tandem_adjust_alaw()
543 unsigned char sp; /* u-law compressed 8-bit code */ in tandem_adjust_ulaw()
546 int sd; /* adjusted u-law decoded sample value */ in tandem_adjust_ulaw()
550 if (sr <= -32768) in tandem_adjust_ulaw()
551 sr = 0; in tandem_adjust_ulaw()
552 sp = sox_14linear2ulaw((sr << 2));/* short to u-law compression */ in tandem_adjust_ulaw()
553 dx = (sox_ulaw2linear16(sp) >> 2) - se; /* 16-bit prediction error */ in tandem_adjust_ulaw()
554 id = quantize(dx, y, qtab, sign - 1); in tandem_adjust_ulaw()
558 /* ADPCM codes : 8, 9, ... F, 0, 1, ... , 6, 7 */ in tandem_adjust_ulaw()
562 if (sp & 0x80) in tandem_adjust_ulaw()
563 sd = (sp == 0xFF) ? 0x7E : sp + 1; in tandem_adjust_ulaw()
565 sd = (sp == 0) ? 0 : sp - 1; in tandem_adjust_ulaw()
568 if (sp & 0x80) in tandem_adjust_ulaw()
569 sd = (sp == 0x80) ? 0x80 : sp - 1; in tandem_adjust_ulaw()
571 sd = (sp == 0x7F) ? 0xFE : sp + 1; in tandem_adjust_ulaw()