diff atrac3.c @ 9666:c80df3181479 libavcodec

Change from INIT_VLC_USE_STATIC to INIT_VLC_USE_NEW_STATIC in atrac3
author banan
date Sun, 17 May 2009 16:12:07 +0000
parents 67a20f0eb42c
children 6f80791c9195
line wrap: on
line diff
--- a/atrac3.c	Sun May 17 10:31:16 2009 +0000
+++ b/atrac3.c	Sun May 17 16:12:07 2009 +0000
@@ -933,6 +933,8 @@
     int i;
     const uint8_t *edata_ptr = avctx->extradata;
     ATRAC3Context *q = avctx->priv_data;
+    static VLC_TYPE atrac3_vlc_table[4096][2];
+    static int vlcs_initialized = 0;
 
     /* Take data from the AVCodecContext (RM container). */
     q->sample_rate = avctx->sample_rate;
@@ -1023,10 +1025,15 @@
 
 
     /* Initialize the VLC tables. */
+    if (!vlcs_initialized) {
     for (i=0 ; i<7 ; i++) {
+        spectral_coeff_tab[i].table = &atrac3_vlc_table[atrac3_vlc_offs[i]];
+        spectral_coeff_tab[i].table_allocated = atrac3_vlc_offs[i + 1] - atrac3_vlc_offs[i];
         init_vlc (&spectral_coeff_tab[i], 9, huff_tab_sizes[i],
             huff_bits[i], 1, 1,
-            huff_codes[i], 1, 1, INIT_VLC_USE_STATIC);
+            huff_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
+    }
+        vlcs_initialized = 1;
     }
 
     init_atrac3_transforms(q);