Unified · Split
| @@ -767,41 +767,72 @@ static void L3_huffman(float *dst, bs_t *bs, const L3_gr_info_t *gr_info, const · 766 unmodified lines | |||
| 767 | int sfb_cnt = gr_info->region_count[ireg++]; | 767 | int sfb_cnt = gr_info->region_count[ireg++]; |
| 768 | const int16_t *codebook = tabs + tabindex[tab_num]; | 768 | const int16_t *codebook = tabs + tabindex[tab_num]; |
| 769 | int linbits = g_linbits[tab_num]; | 769 | int linbits = g_linbits[tab_num]; |
| 770 | do | 770 | if (linbits) |
| 771 | { | 771 | { |
| 772 | np = *sfb++ / 2; | ||
| 773 | pairs_to_decode = MINIMP3_MIN(big_val_cnt, np); | ||
| 774 | one = *scf++; | ||
| 775 | do | 772 | do |
| 776 | { | 773 | { |
| 777 | int j, w = 5; | 774 | np = *sfb++ / 2; |
| 778 | int leaf = codebook[PEEK_BITS(w)]; | 775 | pairs_to_decode = MINIMP3_MIN(big_val_cnt, np); |
| 779 | while (leaf < 0) | 776 | one = *scf++; |
| 777 | do | ||
| 780 | { | 778 | { |
| 781 | FLUSH_BITS(w); | 779 | int j, w = 5; |
| 782 | w = leaf & 7; | 780 | int leaf = codebook[PEEK_BITS(w)]; |
| 783 | leaf = codebook[PEEK_BITS(w) - (leaf >> 3)]; | 781 | while (leaf < 0) |
| 784 | } | 782 | { |
| 785 | FLUSH_BITS(leaf >> 8); | 783 | FLUSH_BITS(w); |
| 784 | w = leaf & 7; | ||
| 785 | leaf = codebook[PEEK_BITS(w) - (leaf >> 3)]; | ||
| 786 | } | ||
| 787 | FLUSH_BITS(leaf >> 8); | ||
| 786 | 788 | ||
| 787 | for (j = 0; j < 2; j++, dst++, leaf >>= 4) | 789 | for (j = 0; j < 2; j++, dst++, leaf >>= 4) |
| 790 | { | ||
| 791 | int lsb = leaf & 0x0F; | ||
| 792 | if (lsb == 15) | ||
| 793 | { | ||
| 794 | lsb += PEEK_BITS(linbits); | ||
| 795 | FLUSH_BITS(linbits); | ||
| 796 | CHECK_BITS; | ||
| 797 | *dst = one*L3_pow_43(lsb)*((int32_t)bs_cache < 0 ? -1: 1); | ||
| 798 | } else | ||
| 799 | { | ||
| 800 | *dst = g_pow43[16 + lsb - 16*(bs_cache >> 31)]*one; | ||
| 801 | } | ||
| 802 | FLUSH_BITS(lsb ? 1 : 0); | ||
| 803 | } | ||
| 804 | CHECK_BITS; | ||
| 805 | } while (--pairs_to_decode); | ||
| 806 | } while ((big_val_cnt -= np) > 0 && --sfb_cnt >= 0); | ||
| 807 | } else | ||
| 808 | { | ||
| 809 | do | ||
| 810 | { | ||
| 811 | np = *sfb++ / 2; | ||
| 812 | pairs_to_decode = MINIMP3_MIN(big_val_cnt, np); | ||
| 813 | one = *scf++; | ||
| 814 | do | ||
| 788 | { | 815 | { |
| 789 | int lsb = leaf & 0x0F; | 816 | int j, w = 5; |
| 790 | if (lsb == 15 && linbits) | 817 | int leaf = codebook[PEEK_BITS(w)]; |
| 818 | while (leaf < 0) | ||
| 791 | { | 819 | { |
| 792 | lsb += PEEK_BITS(linbits); | 820 | FLUSH_BITS(w); |
| 793 | FLUSH_BITS(linbits); | 821 | w = leaf & 7; |
| 794 | CHECK_BITS; | 822 | leaf = codebook[PEEK_BITS(w) - (leaf >> 3)]; |
| 795 | *dst = one*L3_pow_43(lsb)*((int32_t)bs_cache < 0 ? -1: 1); | 823 | } |
| 796 | } else | 824 | FLUSH_BITS(leaf >> 8); |
| 825 | |||
| 826 | for (j = 0; j < 2; j++, dst++, leaf >>= 4) | ||
| 797 | { | 827 | { |
| 828 | int lsb = leaf & 0x0F; | ||
| 798 | *dst = g_pow43[16 + lsb - 16*(bs_cache >> 31)]*one; | 829 | *dst = g_pow43[16 + lsb - 16*(bs_cache >> 31)]*one; |
| 830 | FLUSH_BITS(lsb ? 1 : 0); | ||
| 799 | } | 831 | } |
| 800 | FLUSH_BITS(lsb ? 1 : 0); | 832 | CHECK_BITS; |
| 801 | } | 833 | } while (--pairs_to_decode); |
| 802 | CHECK_BITS; | 834 | } while ((big_val_cnt -= np) > 0 && --sfb_cnt >= 0); |
| 803 | } while (--pairs_to_decode); | 835 | } |
| 804 | } while ((big_val_cnt -= np) > 0 && --sfb_cnt >= 0); | ||
| 805 | } | 836 | } |
| 806 | 837 | ||
| 807 | for (np = 1 - big_val_cnt;; dst += 4) | 838 | for (np = 1 - big_val_cnt;; dst += 4) |