]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Change from INIT_VLC_USE_STATIC to INIT_VLC_USE_NEW_STATIC in atrac3
authorbanan <banan@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 17 May 2009 16:12:07 +0000 (16:12 +0000)
committerbanan <banan@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 17 May 2009 16:12:07 +0000 (16:12 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18865 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/atrac3.c
libavcodec/atrac3data.h

index c0825cb5b5a4b3232b7fdb657f6ac0381874ed88..205a123e29594cc1ef9d47b83aa38fb20324ceb4 100644 (file)
@@ -933,6 +933,8 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
     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 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
 
 
     /* 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);
index 00197d32d46ed68ec64d1851d0bb13a3bd0a16b6..e71dc355605d19819e2945d0b9f63803e99c9f45 100644 (file)
@@ -105,6 +105,10 @@ static const uint8_t* const huff_bits[7] = {
   huffbits1,huffbits2,huffbits3,huffbits4,huffbits5,huffbits6,huffbits7,
 };
 
+static const uint16_t atrac3_vlc_offs[] = {
+    0,512,1024,1536,2048,2560,3072,3584,4096
+};
+
 /* selector tables */
 
 static const uint8_t CLCLengthTab[8] = {0, 4, 3, 3, 4, 4, 5, 6};