changeset 11215:964d01b50f17 libavcodec

remove a Huffman table from WMA which also exists in AAC
author stefang
date Fri, 19 Feb 2010 20:42:55 +0000
parents ed3a745e9723
children 359c8ba0698e
files Makefile wma.h wmadata.h wmadec.c wmaenc.c
diffstat 5 files changed, 10 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Feb 19 17:23:00 2010 +0000
+++ b/Makefile	Fri Feb 19 20:42:55 2010 +0000
@@ -339,10 +339,10 @@
 OBJS-$(CONFIG_VQA_DECODER)             += vqavideo.o
 OBJS-$(CONFIG_WAVPACK_DECODER)         += wavpack.o
 OBJS-$(CONFIG_WMAPRO_DECODER)          += wmaprodec.o wma.o
-OBJS-$(CONFIG_WMAV1_DECODER)           += wmadec.o wma.o
-OBJS-$(CONFIG_WMAV1_ENCODER)           += wmaenc.o wma.o
-OBJS-$(CONFIG_WMAV2_DECODER)           += wmadec.o wma.o
-OBJS-$(CONFIG_WMAV2_ENCODER)           += wmaenc.o wma.o
+OBJS-$(CONFIG_WMAV1_DECODER)           += wmadec.o wma.o aactab.o
+OBJS-$(CONFIG_WMAV1_ENCODER)           += wmaenc.o wma.o aactab.o
+OBJS-$(CONFIG_WMAV2_DECODER)           += wmadec.o wma.o aactab.o
+OBJS-$(CONFIG_WMAV2_ENCODER)           += wmaenc.o wma.o aactab.o
 OBJS-$(CONFIG_WMAVOICE_DECODER)        += wmavoice.o \
                                           celp_math.o celp_filters.o \
                                           acelp_vectors.o acelp_filters.o \
--- a/wma.h	Fri Feb 19 17:23:00 2010 +0000
+++ b/wma.h	Fri Feb 19 20:42:55 2010 +0000
@@ -143,8 +143,8 @@
 extern const uint16_t ff_wma_hgain_huffcodes[37];
 extern const uint8_t ff_wma_hgain_huffbits[37];
 extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16];
-extern const uint32_t ff_wma_scale_huffcodes[121];
-extern const uint8_t ff_wma_scale_huffbits[121];
+extern const uint32_t ff_aac_scalefactor_code[121];
+extern const uint8_t  ff_aac_scalefactor_bits[121];
 
 int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version,
                                       unsigned int decode_flags);
--- a/wmadata.h	Fri Feb 19 17:23:00 2010 +0000
+++ b/wmadata.h	Fri Feb 19 20:42:55 2010 +0000
@@ -92,44 +92,6 @@
  { -1.56144989, -1.65944032, -1.72689685, -1.77857740, -1.82203011, -1.86220079, -1.90283983, -1.94820479, },
 };
 
-const uint32_t ff_wma_scale_huffcodes[121] = {
- 0x3ffe8, 0x3ffe6, 0x3ffe7, 0x3ffe5, 0x7fff5, 0x7fff1, 0x7ffed, 0x7fff6,
- 0x7ffee, 0x7ffef, 0x7fff0, 0x7fffc, 0x7fffd, 0x7ffff, 0x7fffe, 0x7fff7,
- 0x7fff8, 0x7fffb, 0x7fff9, 0x3ffe4, 0x7fffa, 0x3ffe3, 0x1ffef, 0x1fff0,
- 0x0fff5, 0x1ffee, 0x0fff2, 0x0fff3, 0x0fff4, 0x0fff1, 0x07ff6, 0x07ff7,
- 0x03ff9, 0x03ff5, 0x03ff7, 0x03ff3, 0x03ff6, 0x03ff2, 0x01ff7, 0x01ff5,
- 0x00ff9, 0x00ff7, 0x00ff6, 0x007f9, 0x00ff4, 0x007f8, 0x003f9, 0x003f7,
- 0x003f5, 0x001f8, 0x001f7, 0x000fa, 0x000f8, 0x000f6, 0x00079, 0x0003a,
- 0x00038, 0x0001a, 0x0000b, 0x00004, 0x00000, 0x0000a, 0x0000c, 0x0001b,
- 0x00039, 0x0003b, 0x00078, 0x0007a, 0x000f7, 0x000f9, 0x001f6, 0x001f9,
- 0x003f4, 0x003f6, 0x003f8, 0x007f5, 0x007f4, 0x007f6, 0x007f7, 0x00ff5,
- 0x00ff8, 0x01ff4, 0x01ff6, 0x01ff8, 0x03ff8, 0x03ff4, 0x0fff0, 0x07ff4,
- 0x0fff6, 0x07ff5, 0x3ffe2, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd,
- 0x7ffde, 0x7ffd8, 0x7ffd2, 0x7ffd3, 0x7ffd4, 0x7ffd5, 0x7ffd6, 0x7fff2,
- 0x7ffdf, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffe6, 0x7ffe0,
- 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffd7, 0x7ffec, 0x7fff4,
- 0x7fff3,
-};
-
-const uint8_t ff_wma_scale_huffbits[121] = {
- 18, 18, 18, 18, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 18, 19, 18, 17, 17,
- 16, 17, 16, 16, 16, 16, 15, 15,
- 14, 14, 14, 14, 14, 14, 13, 13,
- 12, 12, 12, 11, 12, 11, 10, 10,
- 10,  9,  9,  8,  8,  8,  7,  6,
-  6,  5,  4,  3,  1,  4,  4,  5,
-  6,  6,  7,  7,  8,  8,  9,  9,
- 10, 10, 10, 11, 11, 11, 11, 12,
- 12, 13, 13, 13, 14, 14, 16, 15,
- 16, 15, 18, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 19,
-};
-
 static const uint32_t coef0_huffcodes[666] = {
  0x00258, 0x0003d, 0x00000, 0x00005, 0x00008, 0x00008, 0x0000c, 0x0001b,
  0x0001f, 0x00015, 0x00024, 0x00032, 0x0003a, 0x00026, 0x0002c, 0x0002f,
--- a/wmadec.c	Fri Feb 19 17:23:00 2010 +0000
+++ b/wmadec.c	Fri Feb 19 20:42:55 2010 +0000
@@ -116,9 +116,9 @@
     }
 
     if (s->use_exp_vlc) {
-        init_vlc(&s->exp_vlc, EXPVLCBITS, sizeof(ff_wma_scale_huffbits), //FIXME move out of context
-                 ff_wma_scale_huffbits, 1, 1,
-                 ff_wma_scale_huffcodes, 4, 4, 0);
+        init_vlc(&s->exp_vlc, EXPVLCBITS, sizeof(ff_aac_scalefactor_bits), //FIXME move out of context
+                 ff_aac_scalefactor_bits, 1, 1,
+                 ff_aac_scalefactor_code, 4, 4, 0);
     } else {
         wma_lsp_to_curve_init(s, s->frame_len);
     }
--- a/wmaenc.c	Fri Feb 19 17:23:00 2010 +0000
+++ b/wmaenc.c	Fri Feb 19 20:42:55 2010 +0000
@@ -134,7 +134,7 @@
         int exp = *exp_param++;
         int code = exp - last_exp + 60;
         assert(code >= 0 && code < 120);
-        put_bits(&s->pb, ff_wma_scale_huffbits[code], ff_wma_scale_huffcodes[code]);
+        put_bits(&s->pb, ff_aac_scalefactor_bits[code], ff_aac_scalefactor_code[code]);
         /* XXX: use a table */
         q+= *ptr++;
         last_exp= exp;