Changeset 296 for libmpc/trunk/libmpcdec/mpc_decoder.c
- Timestamp:
- 04/24/07 15:07:19 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/trunk/libmpcdec/mpc_decoder.c
r290 r296 52 52 53 53 //SV8 tables 54 extern const mpc_huffman mpc_table_HuffBands[33]; 55 extern const mpc_lut_data mpc_HuffRes [2]; 56 extern const mpc_lut_data mpc_HuffQ_8 [8][2]; 57 extern const mpc_lut_data mpc_HuffQ9up_8; 58 extern const mpc_lut_data mpc_HuffSCFI_1; 59 extern const mpc_lut_data mpc_HuffSCFI_2; 60 extern const mpc_lut_data mpc_HuffDSCF_1; 61 extern const mpc_lut_data mpc_HuffDSCF_2; 54 extern const mpc_can_data mpc_can_Bands; 55 extern const mpc_can_data mpc_can_SCFI[2]; 56 extern const mpc_can_data mpc_can_DSCF[2]; 57 extern const mpc_can_data mpc_can_Res [2]; 58 extern const mpc_can_data mpc_can_Q [8][2]; 59 extern const mpc_can_data mpc_can_Q1; 60 extern const mpc_can_data mpc_can_Q9up; 62 61 63 62 //------------------------------------------------------------------------------ … … 509 508 510 509 mpc_int32_t n, Max_used_Band; 511 const mpc_ lut_data * Table, * Tables[2];510 const mpc_can_data * Table, * Tables[2]; 512 511 513 512 /***************************** Header *****************************/ … … 516 515 Max_used_Band = mpc_bits_log_dec(r, d->max_band + 1); 517 516 } else { 518 Max_used_Band = d->last_max_band + mpc_bits_ huff_dec(r, mpc_table_HuffBands);517 Max_used_Band = d->last_max_band + mpc_bits_can_dec(r, & mpc_can_Bands); 519 518 if (Max_used_Band > 32) Max_used_Band -= 33; 520 519 } … … 522 521 523 522 if (Max_used_Band) { 524 d->Res_L[Max_used_Band-1] = mpc_bits_ huff_lut(r, & mpc_HuffRes[0]);525 d->Res_R[Max_used_Band-1] = mpc_bits_ huff_lut(r, & mpc_HuffRes[0]);523 d->Res_L[Max_used_Band-1] = mpc_bits_can_dec(r, & mpc_can_Res[0]); 524 d->Res_R[Max_used_Band-1] = mpc_bits_can_dec(r, & mpc_can_Res[0]); 526 525 if (d->Res_L[Max_used_Band-1] > 15) d->Res_L[Max_used_Band-1] -= 17; 527 526 if (d->Res_R[Max_used_Band-1] > 15) d->Res_R[Max_used_Band-1] -= 17; 528 527 for ( n = Max_used_Band - 2; n >= 0; n--) { 529 d->Res_L[n] = mpc_bits_ huff_lut(r, & mpc_HuffRes[d->Res_L[n + 1] > 2]) + d->Res_L[n + 1];528 d->Res_L[n] = mpc_bits_can_dec(r, & mpc_can_Res[d->Res_L[n + 1] > 2]) + d->Res_L[n + 1]; 530 529 if (d->Res_L[n] > 15) d->Res_L[n] -= 17; 531 d->Res_R[n] = mpc_bits_ huff_lut(r, & mpc_HuffRes[d->Res_R[n + 1] > 2]) + d->Res_R[n + 1];530 d->Res_R[n] = mpc_bits_can_dec(r, & mpc_can_Res[d->Res_R[n + 1] > 2]) + d->Res_R[n + 1]; 532 531 if (d->Res_R[n] > 15) d->Res_R[n] -= 17; 533 532 } … … 562 561 } 563 562 564 Tables[0] = & mpc_ HuffSCFI_1;565 Tables[1] = & mpc_ HuffSCFI_2;563 Tables[0] = & mpc_can_SCFI[0]; 564 Tables[1] = & mpc_can_SCFI[1]; 566 565 for ( n = 0; n < Max_used_Band; n++ ) { 567 566 int tmp = 0, cnt = -1; … … 569 568 if (d->Res_R[n]) cnt++; 570 569 if (cnt >= 0) { 571 tmp = mpc_bits_ huff_lut(r, Tables[cnt]);570 tmp = mpc_bits_can_dec(r, Tables[cnt]); 572 571 if (d->Res_L[n]) d->SCFI_L[n] = tmp >> (2 * cnt); 573 572 if (d->Res_R[n]) d->SCFI_R[n] = tmp & 3; … … 589 588 *DSCF_Flag = 0; 590 589 } else { 591 mpc_uint_t tmp = mpc_bits_ huff_lut(r, & mpc_HuffDSCF_2);590 mpc_uint_t tmp = mpc_bits_can_dec(r, & mpc_can_DSCF[1]); 592 591 if (tmp == 64) 593 592 tmp += mpc_bits_read(r, 6); … … 596 595 for( m = 0; m < 2; m++){ 597 596 if (((SCFI << m) & 2) == 0) { 598 mpc_uint_t tmp = mpc_bits_ huff_lut(r, & mpc_HuffDSCF_1);597 mpc_uint_t tmp = mpc_bits_can_dec(r, & mpc_can_DSCF[0]); 599 598 if (tmp == 31) 600 599 tmp = 64 + mpc_bits_read(r, 6); … … 621 620 if (Res != 0) { 622 621 if (Res == 2) { 623 Tables[0] = & mpc_ HuffQ_8 [1][0];624 Tables[1] = & mpc_ HuffQ_8 [1][1];622 Tables[0] = & mpc_can_Q [0][0]; 623 Tables[1] = & mpc_can_Q [0][1]; 625 624 idx = 2 * thres[Res]; 626 625 for ( ; k < 36; k += 3) { 627 int tmp = mpc_bits_ huff_lut(r, Tables[idx > thres[Res]]);626 int tmp = mpc_bits_can_dec(r, Tables[idx > thres[Res]]); 628 627 q[k] = idx50[tmp]; 629 628 q[k + 1] = idx51[tmp]; … … 632 631 } 633 632 } else if (Res == 1) { 634 Table = & mpc_ HuffQ_8 [0][0];633 Table = & mpc_can_Q1; 635 634 for( ; k < 36; ){ 636 635 int kmax = k + 18; 637 mpc_uint_t cnt = mpc_bits_ huff_lut(r, Table);636 mpc_uint_t cnt = mpc_bits_can_dec(r, Table); 638 637 idx = 0; 639 638 if (cnt > 0 && cnt < 18) … … 653 652 } 654 653 } else if (Res <= 4) { 655 Table = & mpc_ HuffQ_8[Res - 1][0];654 Table = & mpc_can_Q[1][Res - 3]; 656 655 for ( ; k < 36; k += 2 ) { 657 656 union { … … 659 658 struct { mpc_int8_t s1:4, s2:4; }; 660 659 } tmp; 661 tmp.sym = mpc_bits_ huff_lut(r, Table);660 tmp.sym = mpc_bits_can_dec(r, Table); 662 661 q[k] = tmp.s1; 663 662 q[k + 1] = tmp.s2; 664 663 } 665 664 } else if (Res <= 8) { 666 Tables[0] = & mpc_ HuffQ_8 [Res - 1][0];667 Tables[1] = & mpc_ HuffQ_8 [Res - 1][1];665 Tables[0] = & mpc_can_Q [Res - 3][0]; 666 Tables[1] = & mpc_can_Q [Res - 3][1]; 668 667 idx = 2 * thres[Res]; 669 668 for ( ; k < 36; k++ ) { 670 q[k] = mpc_bits_ huff_lut(r, Tables[idx > thres[Res]]);669 q[k] = mpc_bits_can_dec(r, Tables[idx > thres[Res]]); 671 670 idx = (idx >> 1) + absi(q[k]); 672 671 } 673 672 } else { 674 673 for ( ; k < 36; k++ ) { 675 q[k] = (unsigned char) mpc_bits_ huff_lut(r, & mpc_HuffQ9up_8);674 q[k] = (unsigned char) mpc_bits_can_dec(r, & mpc_can_Q9up); 676 675 if (Res != 9) 677 676 q[k] = (q[k] << (Res - 9)) | mpc_bits_read(r, Res - 9);
Note: See TracChangeset
for help on using the changeset viewer.