]> git.sesse.net Git - ffmpeg/commitdiff
Hardcode the table for ungrouping 3 values in 5 bits. It will be reused by
authorJustin Ruggles <justin.ruggles@gmail.com>
Sun, 3 Aug 2008 21:42:43 +0000 (21:42 +0000)
committerJustin Ruggles <justin.ruggles@gmail.com>
Sun, 3 Aug 2008 21:42:43 +0000 (21:42 +0000)
the E-AC-3 decoder.

Originally committed as revision 14527 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/ac3dec.c
libavcodec/ac3dec_data.c
libavcodec/ac3dec_data.h

index a0123fc45c1cf0d2b202cb628f1ec7ee925a564f..1f7ca8f71cec38f2ccae41526efdee9901bc70a4 100644 (file)
@@ -150,9 +150,9 @@ static av_cold void ac3_tables_init(void)
        reference: Section 7.3.5 Ungrouping of Mantissas */
     for(i=0; i<32; i++) {
         /* bap=1 mantissas */
-        b1_mantissas[i][0] = symmetric_dequant( i / 9     , 3);
-        b1_mantissas[i][1] = symmetric_dequant((i % 9) / 3, 3);
-        b1_mantissas[i][2] = symmetric_dequant((i % 9) % 3, 3);
+        b1_mantissas[i][0] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][0], 3);
+        b1_mantissas[i][1] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][1], 3);
+        b1_mantissas[i][2] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][2], 3);
     }
     for(i=0; i<128; i++) {
         /* bap=2 mantissas */
index 86e61aa3795466f83c10078b8b3bc1f9604b2f05..a04bbc0c53e16e4ff44e2111e62534b21853c93d 100644 (file)
 #include "ac3dec_data.h"
 #include "ac3.h"
 
+/**
+ * table used to ungroup 3 values stored in 5 bits.
+ * used by bap=1 mantissas and GAQ.
+ * ff_ac3_ungroup_3_in_5_bits_tab[i] = { i/9, (i%9)/3, (i%9)%3 }
+ */
+const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3] = {
+    { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 1, 0 },
+    { 0, 1, 1 }, { 0, 1, 2 }, { 0, 2, 0 }, { 0, 2, 1 },
+    { 0, 2, 2 }, { 1, 0, 0 }, { 1, 0, 1 }, { 1, 0, 2 },
+    { 1, 1, 0 }, { 1, 1, 1 }, { 1, 1, 2 }, { 1, 2, 0 },
+    { 1, 2, 1 }, { 1, 2, 2 }, { 2, 0, 0 }, { 2, 0, 1 },
+    { 2, 0, 2 }, { 2, 1, 0 }, { 2, 1, 1 }, { 2, 1, 2 },
+    { 2, 2, 0 }, { 2, 2, 1 }, { 2, 2, 2 }, { 3, 0, 0 },
+    { 3, 0, 1 }, { 3, 0, 2 }, { 3, 1, 0 }, { 3, 1, 1 }
+};
+
 const uint8_t ff_eac3_hebap_tab[64] = {
     0, 1, 2, 3, 4, 5, 6, 7, 8, 8,
     8, 8, 9, 9, 9, 10, 10, 10, 10, 11,
index cbab08f55c352ab35d083dce2b65ce1ca64dac34..19c5f462a0fe335fa4ec85c9f5aee359fb67c7b2 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "libavutil/common.h"
 
+extern const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3];
 extern const uint8_t ff_eac3_hebap_tab[64];
 extern const uint8_t ff_eac3_bits_vs_hebap[20];
 extern const int16_t ff_eac3_gaq_remap_1[12];