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 | 767 | int sfb_cnt = gr_info->region_count[ireg++]; |
| 768 | 768 | const int16_t *codebook = tabs + tabindex[tab_num]; |
| 769 | 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 | 772 | do |
| 776 | 773 | { |
| 777 | − int j, w = 5; | |
| 778 | − int leaf = codebook[PEEK_BITS(w)]; | |
| 779 | − while (leaf < 0) | |
| 774 | + np = *sfb++ / 2; | |
| 775 | + pairs_to_decode = MINIMP3_MIN(big_val_cnt, np); | |
| 776 | + one = *scf++; | |
| 777 | + do | |
| 780 | 778 | { |
| 781 | − FLUSH_BITS(w); | |
| 782 | − w = leaf & 7; | |
| 783 | − leaf = codebook[PEEK_BITS(w) - (leaf >> 3)]; | |
| 784 | − } | |
| 785 | − FLUSH_BITS(leaf >> 8); | |
| 779 | + int j, w = 5; | |
| 780 | + int leaf = codebook[PEEK_BITS(w)]; | |
| 781 | + while (leaf < 0) | |
| 782 | + { | |
| 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; | |
| 790 | − if (lsb == 15 && linbits) | |
| 816 | + int j, w = 5; | |
| 817 | + int leaf = codebook[PEEK_BITS(w)]; | |
| 818 | + while (leaf < 0) | |
| 791 | 819 | { |
| 792 | − lsb += PEEK_BITS(linbits); | |
| 793 | − FLUSH_BITS(linbits); | |
| 794 | − CHECK_BITS; | |
| 795 | − *dst = one*L3_pow_43(lsb)*((int32_t)bs_cache < 0 ? -1: 1); | |
| 796 | − } else | |
| 820 | + FLUSH_BITS(w); | |
| 821 | + w = leaf & 7; | |
| 822 | + leaf = codebook[PEEK_BITS(w) - (leaf >> 3)]; | |
| 823 | + } | |
| 824 | + FLUSH_BITS(leaf >> 8); | |
| 825 | + | |
| 826 | + for (j = 0; j < 2; j++, dst++, leaf >>= 4) | |
| 797 | 827 | { |
| 828 | + int lsb = leaf & 0x0F; | |
| 798 | 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); | |
| 801 | − } | |
| 802 | − CHECK_BITS; | |
| 803 | − } while (--pairs_to_decode); | |
| 804 | − } while ((big_val_cnt -= np) > 0 && --sfb_cnt >= 0); | |
| 832 | + CHECK_BITS; | |
| 833 | + } while (--pairs_to_decode); | |
| 834 | + } while ((big_val_cnt -= np) > 0 && --sfb_cnt >= 0); | |
| 835 | + } | |
| 805 | 836 | } |
| 806 | 837 | |
| 807 | 838 | for (np = 1 - big_val_cnt;; dst += 4) |