Mercurial > libavcodec.hg
comparison mpegaudiodec.c @ 3612:9283f094680e libavcodec
dont copy the whole GetBitContext around
author | michael |
---|---|
date | Thu, 24 Aug 2006 06:57:32 +0000 |
parents | a20d179c79c3 |
children | 5cb45b2211a0 |
comparison
equal
deleted
inserted
replaced
3611:a20d179c79c3 | 3612:9283f094680e |
---|---|
1669 static int huffman_decode(MPADecodeContext *s, GranuleDef *g, | 1669 static int huffman_decode(MPADecodeContext *s, GranuleDef *g, |
1670 int16_t *exponents, int end_pos) | 1670 int16_t *exponents, int end_pos) |
1671 { | 1671 { |
1672 int s_index; | 1672 int s_index; |
1673 int linbits, code, x, y, l, v, i, j, k, pos; | 1673 int linbits, code, x, y, l, v, i, j, k, pos; |
1674 GetBitContext last_gb; | 1674 int last_pos; |
1675 VLC *vlc; | 1675 VLC *vlc; |
1676 | 1676 |
1677 /* low frequencies (called big values) */ | 1677 /* low frequencies (called big values) */ |
1678 s_index = 0; | 1678 s_index = 0; |
1679 for(i=0;i<3;i++) { | 1679 for(i=0;i<3;i++) { |
1733 } | 1733 } |
1734 } | 1734 } |
1735 | 1735 |
1736 /* high frequencies */ | 1736 /* high frequencies */ |
1737 vlc = &huff_quad_vlc[g->count1table_select]; | 1737 vlc = &huff_quad_vlc[g->count1table_select]; |
1738 last_gb.buffer = NULL; | 1738 last_pos=0; |
1739 while (s_index <= 572) { | 1739 while (s_index <= 572) { |
1740 pos = get_bits_count(&s->gb); | 1740 pos = get_bits_count(&s->gb); |
1741 if (pos >= end_pos) { | 1741 if (pos >= end_pos) { |
1742 if (pos > end_pos && last_gb.buffer != NULL) { | 1742 if (pos > end_pos && last_pos){ |
1743 /* some encoders generate an incorrect size for this | 1743 /* some encoders generate an incorrect size for this |
1744 part. We must go back into the data */ | 1744 part. We must go back into the data */ |
1745 s_index -= 4; | 1745 s_index -= 4; |
1746 s->gb = last_gb; | 1746 init_get_bits(&s->gb, s->gb.buffer + (last_pos>>3), s->gb.size_in_bits - (last_pos&(~7))); |
1747 skip_bits(&s->gb, last_pos&7); | |
1747 } | 1748 } |
1748 break; | 1749 break; |
1749 } | 1750 } |
1750 last_gb= s->gb; | 1751 last_pos= pos; |
1751 | 1752 |
1752 code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1); | 1753 code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1); |
1753 dprintf("t=%d code=%d\n", g->count1table_select, code); | 1754 dprintf("t=%d code=%d\n", g->count1table_select, code); |
1754 g->sb_hybrid[s_index+0]= | 1755 g->sb_hybrid[s_index+0]= |
1755 g->sb_hybrid[s_index+1]= | 1756 g->sb_hybrid[s_index+1]= |