summaryrefslogtreecommitdiff
path: root/src/libac3/tables.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libac3/tables.h')
-rw-r--r--src/libac3/tables.h75
1 files changed, 36 insertions, 39 deletions
diff --git a/src/libac3/tables.h b/src/libac3/tables.h
index 5825f9326..28f030895 100644
--- a/src/libac3/tables.h
+++ b/src/libac3/tables.h
@@ -51,21 +51,21 @@ static int8_t exp_3[128] = {
#define Q1 (0)
#define Q2 ((2 << 15) / 3.0)
-static const float q_1_0[ 32 ] = {
+static const sample_t q_1_0[32] = {
Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,
Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,
Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,
0,0,0,0,0
};
-static const float q_1_1[ 32 ] = {
+static const sample_t q_1_1[32] = {
Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
0,0,0,0,0
};
-static const float q_1_2[ 32 ] = {
+static const sample_t q_1_2[32] = {
Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
@@ -82,7 +82,7 @@ static const float q_1_2[ 32 ] = {
#define Q3 ((2 << 15) / 5.0)
#define Q4 ((4 << 15) / 5.0)
-static const float q_2_0[ 128 ] = {
+static const sample_t q_2_0[128] = {
Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,
Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,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15)/7.0, 0
};
@@ -132,7 +132,7 @@ static const float q_3[8] = {
#define Q9 ((8 << 15) / 11.0)
#define QA ((10 << 15) / 11.0)
-static const float q_4_0[ 128 ] = {
+static const sample_t q_4_0[128] = {
Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0,
Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1,
Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2,
@@ -147,7 +147,7 @@ static const float q_4_0[ 128 ] = {
0, 0, 0, 0, 0, 0, 0
};
-static const float q_4_1[ 128 ] = {
+static const sample_t q_4_1[128] = {
Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
@@ -174,7 +174,7 @@ static const float q_4_1[ 128 ] = {
#undef Q9
#undef QA
-static const float q_5[16] = {
+static const sample_t q_5[16] = {
(-14 << 15)/15.0,(-12 << 15)/15.0,(-10 << 15)/15.0,
( -8 << 15)/15.0,( -6 << 15)/15.0,( -4 << 15)/15.0,
( -2 << 15)/15.0, 0 ,( 2 << 15)/15.0,
@@ -183,37 +183,34 @@ static const float q_5[16] = {
0
};
-static const uint32_t u32_scale_factors[25] =
-{
- 0x38000000, //2 ^ -(0 + 15)
- 0x37800000, //2 ^ -(1 + 15)
- 0x37000000, //2 ^ -(2 + 15)
- 0x36800000, //2 ^ -(3 + 15)
- 0x36000000, //2 ^ -(4 + 15)
- 0x35800000, //2 ^ -(5 + 15)
- 0x35000000, //2 ^ -(6 + 15)
- 0x34800000, //2 ^ -(7 + 15)
- 0x34000000, //2 ^ -(8 + 15)
- 0x33800000, //2 ^ -(9 + 15)
- 0x33000000, //2 ^ -(10 + 15)
- 0x32800000, //2 ^ -(11 + 15)
- 0x32000000, //2 ^ -(12 + 15)
- 0x31800000, //2 ^ -(13 + 15)
- 0x31000000, //2 ^ -(14 + 15)
- 0x30800000, //2 ^ -(15 + 15)
- 0x30000000, //2 ^ -(16 + 15)
- 0x2f800000, //2 ^ -(17 + 15)
- 0x2f000000, //2 ^ -(18 + 15)
- 0x2e800000, //2 ^ -(19 + 15)
- 0x2e000000, //2 ^ -(20 + 15)
- 0x2d800000, //2 ^ -(21 + 15)
- 0x2d000000, //2 ^ -(22 + 15)
- 0x2c800000, //2 ^ -(23 + 15)
- 0x2c000000 //2 ^ -(24 + 15)
+static sample_t scale_factor[25] = {
+ 0.000030517578125,
+ 0.0000152587890625,
+ 0.00000762939453125,
+ 0.000003814697265625,
+ 0.0000019073486328125,
+ 0.00000095367431640625,
+ 0.000000476837158203125,
+ 0.0000002384185791015625,
+ 0.00000011920928955078125,
+ 0.000000059604644775390625,
+ 0.0000000298023223876953125,
+ 0.00000001490116119384765625,
+ 0.000000007450580596923828125,
+ 0.0000000037252902984619140625,
+ 0.00000000186264514923095703125,
+ 0.000000000931322574615478515625,
+ 0.0000000004656612873077392578125,
+ 0.00000000023283064365386962890625,
+ 0.000000000116415321826934814453125,
+ 0.0000000000582076609134674072265625,
+ 0.00000000002910383045673370361328125,
+ 0.000000000014551915228366851806640625,
+ 0.0000000000072759576141834259033203125,
+ 0.00000000000363797880709171295166015625,
+ 0.000000000001818989403545856475830078125
};
-static float * scale_factor = (float *) u32_scale_factors;
-
static const uint16_t dither_lut[256] = {
0x0000, 0xa011, 0xe033, 0x4022, 0x6077, 0xc066, 0x8044, 0x2055,
0xc0ee, 0x60ff, 0x20dd, 0x80cc, 0xa099, 0x0088, 0x40aa, 0xe0bb,