comparison mpegaudiodec.c @ 3609:6560c84eef72 libavcodec

use memset() instead of slow c loops
author michael
date Thu, 24 Aug 2006 00:03:51 +0000
parents f713d34d5d01
children d97b4709aaf0
comparison
equal deleted inserted replaced
3608:f713d34d5d01 3609:6560c84eef72
1684 k = g->table_select[i]; 1684 k = g->table_select[i];
1685 l = mpa_huff_data[k][0]; 1685 l = mpa_huff_data[k][0];
1686 linbits = mpa_huff_data[k][1]; 1686 linbits = mpa_huff_data[k][1];
1687 vlc = &huff_vlc[l]; 1687 vlc = &huff_vlc[l];
1688 1688
1689 if(!l){
1690 memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*j);
1691 s_index += 2*j;
1692 continue;
1693 }
1694
1689 /* read huffcode and compute each couple */ 1695 /* read huffcode and compute each couple */
1690 for(;j>0;j--) { 1696 for(;j>0;j--) {
1691 if (get_bits_count(&s->gb) >= end_pos) 1697 if (get_bits_count(&s->gb) >= end_pos)
1692 break; 1698 break;
1693 if (l) { 1699 y = get_vlc2(&s->gb, vlc->table, 8, 3);
1694 y = get_vlc2(&s->gb, vlc->table, 8, 3); 1700 x = y >> 4;
1695 x = y >> 4; 1701 y = y & 0x0f;
1696 y = y & 0x0f; 1702
1697 } else {
1698 x = 0;
1699 y = 0;
1700 }
1701 dprintf("region=%d n=%d x=%d y=%d exp=%d\n", 1703 dprintf("region=%d n=%d x=%d y=%d exp=%d\n",
1702 i, g->region_size[i] - j, x, y, exponents[s_index]); 1704 i, g->region_size[i] - j, x, y, exponents[s_index]);
1703 if (x) { 1705 if (x) {
1704 if (x == 15) 1706 if (x == 15)
1705 x += get_bitsz(&s->gb, linbits); 1707 x += get_bitsz(&s->gb, linbits);
1754 v = 0; 1756 v = 0;
1755 } 1757 }
1756 g->sb_hybrid[s_index++] = v; 1758 g->sb_hybrid[s_index++] = v;
1757 } 1759 }
1758 } 1760 }
1759 while (s_index < 576) 1761 memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*(576 - s_index));
1760 g->sb_hybrid[s_index++] = 0;
1761 return 0; 1762 return 0;
1762 } 1763 }
1763 1764
1764 /* Reorder short blocks from bitstream order to interleaved order. It 1765 /* Reorder short blocks from bitstream order to interleaved order. It
1765 would be faster to do it in parsing, but the code would be far more 1766 would be faster to do it in parsing, but the code would be far more