comparison mpegaudiodec.c @ 3624:7d8ef3c542a1 libavcodec

avoid reading exponent twice
author michael
date Fri, 25 Aug 2006 13:36:27 +0000
parents d0242f36a793
children 8042fcb3a62a
comparison
equal deleted inserted replaced
3623:d0242f36a793 3624:7d8ef3c542a1
1701 continue; 1701 continue;
1702 } 1702 }
1703 1703
1704 /* read huffcode and compute each couple */ 1704 /* read huffcode and compute each couple */
1705 for(;j>0;j--) { 1705 for(;j>0;j--) {
1706 int exponent;
1707
1706 if (get_bits_count(&s->gb) >= end_pos) 1708 if (get_bits_count(&s->gb) >= end_pos)
1707 break; 1709 break;
1708 y = get_vlc2(&s->gb, vlc->table, 7, 3); 1710 y = get_vlc2(&s->gb, vlc->table, 7, 3);
1709 1711
1710 if(!y){ 1712 if(!y){
1714 continue; 1716 continue;
1715 } 1717 }
1716 1718
1717 x = y >> 4; 1719 x = y >> 4;
1718 y = y & 0x0f; 1720 y = y & 0x0f;
1721 exponent= exponents[s_index];
1719 1722
1720 dprintf("region=%d n=%d x=%d y=%d exp=%d\n", 1723 dprintf("region=%d n=%d x=%d y=%d exp=%d\n",
1721 i, g->region_size[i] - j, x, y, exponents[s_index]); 1724 i, g->region_size[i] - j, x, y, exponent);
1722 if (x) { 1725 if (x) {
1723 #if 0 1726 #if 0
1724 if (x == 15) 1727 if (x == 15)
1725 x += get_bitsz(&s->gb, linbits); 1728 x += get_bitsz(&s->gb, linbits);
1726 v = l3_unscale(x, exponents[s_index]); 1729 v = l3_unscale(x, exponent);
1727 #else 1730 #else
1728 if (x < 15){ 1731 if (x < 15){
1729 v = expval_table[ exponents[s_index] + 400 ][ x ]; 1732 v = expval_table[ exponent + 400 ][ x ];
1733 // v = expval_table[ (exponent&3) + 400 ][ x ] >> FFMIN(0 - (exponent>>2), 31);
1730 }else{ 1734 }else{
1731 x += get_bitsz(&s->gb, linbits); 1735 x += get_bitsz(&s->gb, linbits);
1732 v = l3_unscale(x, exponents[s_index]); 1736 v = l3_unscale(x, exponent);
1733 } 1737 }
1734 #endif 1738 #endif
1735 if (get_bits1(&s->gb)) 1739 if (get_bits1(&s->gb))
1736 v = -v; 1740 v = -v;
1737 } else { 1741 } else {
1740 g->sb_hybrid[s_index++] = v; 1744 g->sb_hybrid[s_index++] = v;
1741 if (y) { 1745 if (y) {
1742 #if 0 1746 #if 0
1743 if (y == 15) 1747 if (y == 15)
1744 y += get_bitsz(&s->gb, linbits); 1748 y += get_bitsz(&s->gb, linbits);
1745 v = l3_unscale(y, exponents[s_index]); 1749 v = l3_unscale(y, exponent);
1746 #else 1750 #else
1747 if (y < 15){ 1751 if (y < 15){
1748 v = expval_table[ exponents[s_index] + 400 ][ y ]; 1752 v = expval_table[ exponent + 400 ][ y ];
1749 }else{ 1753 }else{
1750 y += get_bitsz(&s->gb, linbits); 1754 y += get_bitsz(&s->gb, linbits);
1751 v = l3_unscale(y, exponents[s_index]); 1755 v = l3_unscale(y, exponent);
1752 } 1756 }
1753 #endif 1757 #endif
1754 if (get_bits1(&s->gb)) 1758 if (get_bits1(&s->gb))
1755 v = -v; 1759 v = -v;
1756 } else { 1760 } else {