summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-08-24 00:03:51 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-08-24 00:03:51 +0000
commitdaf4cd9ac315e9f64cfea365c17d9385ea0f3aad (patch)
tree9f63dbf389686b581e342485d0bd929e4a1c20a4 /libavcodec/mpegaudiodec.c
parentc7aa36964e7dc1c42b676f4d713daae317f65c80 (diff)
use memset() instead of slow c loops
Originally committed as revision 6059 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 77fec195fc..42da2013f0 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1686,18 +1686,20 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
linbits = mpa_huff_data[k][1];
vlc = &huff_vlc[l];
+ if(!l){
+ memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*j);
+ s_index += 2*j;
+ continue;
+ }
+
/* read huffcode and compute each couple */
for(;j>0;j--) {
if (get_bits_count(&s->gb) >= end_pos)
break;
- if (l) {
- y = get_vlc2(&s->gb, vlc->table, 8, 3);
- x = y >> 4;
- y = y & 0x0f;
- } else {
- x = 0;
- y = 0;
- }
+ y = get_vlc2(&s->gb, vlc->table, 8, 3);
+ x = y >> 4;
+ y = y & 0x0f;
+
dprintf("region=%d n=%d x=%d y=%d exp=%d\n",
i, g->region_size[i] - j, x, y, exponents[s_index]);
if (x) {
@@ -1756,8 +1758,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
g->sb_hybrid[s_index++] = v;
}
}
- while (s_index < 576)
- g->sb_hybrid[s_index++] = 0;
+ memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*(576 - s_index));
return 0;
}