Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArt Clarke <aclarke@vlideshow.com>2008-07-31 16:09:11 +0400
committerBenoit Fouet <benoit.fouet@free.fr>2008-07-31 16:09:11 +0400
commitbbdf87285aa16092e089d0205fb8a542f20cfe49 (patch)
tree78d3b89c2411585bbc9d324141ce926b81e54cd3 /libavcodec/mpegaudiodec.c
parentfd76c37fd9f564b4e979fbe20ecfcfad13f8b4f4 (diff)
Use static vlc structure to decode layer 3 huffman tables.
Patch by Art Clarke aclarke vlideshow com Originally committed as revision 14483 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 2ff9f427ec..61e0c6fbd6 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -84,7 +84,19 @@ static void compute_antialias_float(MPADecodeContext *s, GranuleDef *g);
/* vlc structure for decoding layer 3 huffman tables */
static VLC huff_vlc[16];
+static VLC_TYPE huff_vlc_tables[
+ 0+128+128+128+130+128+154+166+
+ 142+204+190+170+542+460+662+414
+ ][2];
+static const int huff_vlc_tables_sizes[16] = {
+ 0, 128, 128, 128, 130, 128, 154, 166,
+ 142, 204, 190, 170, 542, 460, 662, 414
+};
static VLC huff_quad_vlc[2];
+static VLC_TYPE huff_quad_vlc_tables[128+16][2];
+static const int huff_quad_vlc_tables_sizes[2] = {
+ 128, 16
+};
/* computed from band_size_long */
static uint16_t band_index_long[9][23];
/* XXX: free when all decoders are closed */
@@ -324,6 +336,8 @@ static int decode_init(AVCodecContext * avctx)
s->compute_antialias= compute_antialias_float;
if (!init && !avctx->parse_only) {
+ int offset;
+
/* scale factors table for layer 1/2 */
for(i=0;i<64;i++) {
int shift, mod;
@@ -351,6 +365,7 @@ static int decode_init(AVCodecContext * avctx)
ff_mpa_synth_init(window);
/* huffman decode tables */
+ offset = 0;
for(i=1;i<16;i++) {
const HuffTable *h = &mpa_huff_tables[i];
int xsize, x, y;
@@ -373,13 +388,25 @@ static int decode_init(AVCodecContext * avctx)
}
/* XXX: fail test */
+ huff_vlc[i].table = huff_vlc_tables+offset;
+ huff_vlc[i].table_allocated = huff_vlc_tables_sizes[i];
init_vlc(&huff_vlc[i], 7, 512,
- tmp_bits, 1, 1, tmp_codes, 2, 2, 1);
+ tmp_bits, 1, 1, tmp_codes, 2, 2,
+ INIT_VLC_USE_NEW_STATIC);
+ offset += huff_vlc_tables_sizes[i];
}
+ assert(offset == sizeof(huff_vlc_tables)/(sizeof(VLC_TYPE)*2));
+
+ offset = 0;
for(i=0;i<2;i++) {
+ huff_quad_vlc[i].table = huff_quad_vlc_tables+offset;
+ huff_quad_vlc[i].table_allocated = huff_quad_vlc_tables_sizes[i];
init_vlc(&huff_quad_vlc[i], i == 0 ? 7 : 4, 16,
- mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1, 1);
+ mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1,
+ INIT_VLC_USE_NEW_STATIC);
+ offset += huff_quad_vlc_tables_sizes[i];
}
+ assert(offset == sizeof(huff_quad_vlc_tables)/(sizeof(VLC_TYPE)*2));
for(i=0;i<9;i++) {
k = 0;