[FFmpeg-soc] [soc]: r2215 - in eac3: ac3dec_data.c ac3dec_data.h eac3dec.c
jbr
subversion at mplayerhq.hu
Mon May 26 23:35:51 CEST 2008
Author: jbr
Date: Mon May 26 23:35:51 2008
New Revision: 2215
Log:
split GAQ remapping table to reduce redundancy
Modified:
eac3/ac3dec_data.c
eac3/ac3dec_data.h
eac3/eac3dec.c
Modified: eac3/ac3dec_data.c
==============================================================================
--- eac3/ac3dec_data.c (original)
+++ eac3/ac3dec_data.c Mon May 26 23:35:51 2008
@@ -43,35 +43,46 @@ const uint8_t ff_eac3_bits_vs_hebap[20]
};
/**
- * Table E3.6
- * Large mantissa inverse quantization (remapping) constants
- * ff_eac3_gaq_remap[hebap+8][x<0,x>=0][Gk=1,2,4][a,b]
+ * Table E3.6, Gk=1
+ * No gain (Gk=1) inverse quantization, remapping scale factors
+ * ff_eac3_gaq_remap[hebap+8]
*/
-const int16_t ff_eac3_gaq_remap[12][2][3][2] = {
-{{{ 4681, 0}, { -10923, 16384}, { -4681, 8192}},
- {{ 4681, 0}, { -10923, -5461}, { -4681, -1170}}},
-{{{ 2185, 0}, { -14043, 16384}, { -6554, 8192}},
- {{ 2185, 0}, { -14043, -11703}, { -6554, -4915}}},
-{{{ 1057, 0}, { -15292, 16384}, { -7399, 8192}},
- {{ 1057, 0}, { -15292, -14199}, { -7399, -6606}}},
-{{{ 520, 0}, { -15855, 16384}, { -7802, 8192}},
- {{ 520, 0}, { -15855, -15327}, { -7802, -7412}}},
-{{{ 258, 0}, { -16124, 16384}, { -7998, 8192}},
- {{ 258, 0}, { -16124, -15864}, { -7998, -7805}}},
-{{{ 129, 0}, { -16255, 16384}, { -8096, 8192}},
- {{ 129, 0}, { -16255, -16126}, { -8096, -7999}}},
-{{{ 64, 0}, { -16320, 16384}, { -8144, 8192}},
- {{ 64, 0}, { -16320, -16255}, { -8144, -8096}}},
-{{{ 32, 0}, { -16352, 16384}, { -8168, 8192}},
- {{ 32, 0}, { -16352, -16320}, { -8168, -8144}}},
-{{{ 16, 0}, { -16368, 16384}, { -8180, 8192}},
- {{ 16, 0}, { -16368, -16352}, { -8180, -8168}}},
-{{{ 8, 0}, { 0, 0}, { 0, 0}},
- {{ 8, 0}, { 0, 0}, { 0, 0}}},
-{{{ 2, 0}, { 0, 0}, { 0, 0}},
- {{ 2, 0}, { 0, 0}, { 0, 0}}},
-{{{ 0, 0}, { 0, 0}, { 0, 0}},
- {{ 0, 0}, { 0, 0}, { 0, 0}}},
+const int16_t ff_eac3_gaq_remap_1[12] = {
+ 4681, 2185, 1057, 520, 258, 129, 64, 32, 16, 8, 2, 0
+};
+
+/**
+ * Table E3.6, Gk=2 & Gk=4, A
+ * Large mantissa inverse quantization, remapping scale factors
+ * ff_eac3_gaq_remap_2_4_a[hebap-8][Gk=2,4]
+ */
+const int16_t ff_eac3_gaq_remap_2_4_a[9][2] = {
+ { -10923, -4681 },
+ { -14043, -6554 },
+ { -15292, -7399 },
+ { -15855, -7802 },
+ { -16124, -7998 },
+ { -16255, -8096 },
+ { -16320, -8144 },
+ { -16352, -8168 },
+ { -16368, -8180 }
+};
+
+/**
+ * Table E3.6, Gk=2 & Gk=4, B
+ * Large mantissa inverse quantization, negative mantissa remapping offsets
+ * ff_eac3_gaq_remap_3_4_b[hebap-8][Gk=2,4]
+ */
+const int16_t ff_eac3_gaq_remap_2_4_b[9][2] = {
+ { -5461, -1170},
+ { -11703, -4915},
+ { -14199, -6606},
+ { -15327, -7412},
+ { -15864, -7805},
+ { -16126, -7999},
+ { -16255, -8096},
+ { -16320, -8144},
+ { -16352, -8168}
};
/**
Modified: eac3/ac3dec_data.h
==============================================================================
--- eac3/ac3dec_data.h (original)
+++ eac3/ac3dec_data.h Mon May 26 23:35:51 2008
@@ -26,7 +26,9 @@
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[12][2][3][2];
+extern const int16_t ff_eac3_gaq_remap_1[12];
+extern const int16_t ff_eac3_gaq_remap_2_4_a[9][2];
+extern const int16_t ff_eac3_gaq_remap_2_4_b[9][2];
extern const uint8_t ff_eac3_gaq_gk[4][3];
extern const int16_t (*ff_eac3_vq_hebap[8])[6];
Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c (original)
+++ eac3/eac3dec.c Mon May 26 23:35:51 2008
@@ -230,17 +230,23 @@ void ff_eac3_get_transform_coeffs_aht_ch
int pre_mantissa = get_sbits(gbc, gbits);
if (pre_mantissa == -(1 << (gbits-1))) {
// large mantissa
+ int64_t a, b;
mant = get_sbits(gbc, bits-2+log_gain) << (26-log_gain-bits);
- remap = 1;
+ /* remap mantissa value to correct for asymmetric quantization */
+ a = ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] + 32768;
+ if(mant >= 0)
+ b = 32768 >> log_gain;
+ else
+ b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1];
+ mant = (a * mant + b) >> 15;
} else {
+ /* small mantissa, no GAQ, or Gk=1 */
mant = pre_mantissa << (24 - bits);
- remap = !log_gain;
- }
-
- if (remap) {
- int64_t a = ff_eac3_gaq_remap[hebap-8][0][log_gain][0] + 32768;
- int64_t b = ff_eac3_gaq_remap[hebap-8][mant<0][log_gain][1];
- mant = (a * mant + b) >> 15;
+ if(!log_gain) {
+ /* remap mantissa value for no GAQ or Gk=1 */
+ int64_t a = ff_eac3_gaq_remap_1[hebap-8] + 32768;
+ mant = (a * mant) >> 15;
+ }
}
s->pre_mantissa[blk][ch][bin] = mant;
}
More information about the FFmpeg-soc
mailing list