comparison ac3dec.c @ 7018:885cad616170 libavcodec

add more gain levels and adjust mix level tables accordingly.
author jbr
date Sat, 07 Jun 2008 22:30:03 +0000
parents 60fd9ae9540e
children 81d5c68233e5
comparison
equal deleted inserted replaced
7017:60fd9ae9540e 7018:885cad616170
70 70
71 /** dynamic range table. converts codes to scale factors. */ 71 /** dynamic range table. converts codes to scale factors. */
72 static float dynamic_range_tab[256]; 72 static float dynamic_range_tab[256];
73 73
74 /** Adjustments in dB gain */ 74 /** Adjustments in dB gain */
75 #define LEVEL_PLUS_3DB 1.4142135623730950
76 #define LEVEL_PLUS_1POINT5DB 1.1892071150027209
77 #define LEVEL_MINUS_1POINT5DB 0.8408964152537145
75 #define LEVEL_MINUS_3DB 0.7071067811865476 78 #define LEVEL_MINUS_3DB 0.7071067811865476
76 #define LEVEL_MINUS_4POINT5DB 0.5946035575013605 79 #define LEVEL_MINUS_4POINT5DB 0.5946035575013605
77 #define LEVEL_MINUS_6DB 0.5000000000000000 80 #define LEVEL_MINUS_6DB 0.5000000000000000
78 #define LEVEL_MINUS_9DB 0.3535533905932738 81 #define LEVEL_MINUS_9DB 0.3535533905932738
79 #define LEVEL_ZERO 0.0000000000000000 82 #define LEVEL_ZERO 0.0000000000000000
80 #define LEVEL_ONE 1.0000000000000000 83 #define LEVEL_ONE 1.0000000000000000
81 84
82 static const float gain_levels[6] = { 85 static const float gain_levels[9] = {
83 LEVEL_ZERO, 86 LEVEL_PLUS_3DB,
87 LEVEL_PLUS_1POINT5DB,
84 LEVEL_ONE, 88 LEVEL_ONE,
89 LEVEL_MINUS_1POINT5DB,
85 LEVEL_MINUS_3DB, 90 LEVEL_MINUS_3DB,
86 LEVEL_MINUS_4POINT5DB, 91 LEVEL_MINUS_4POINT5DB,
87 LEVEL_MINUS_6DB, 92 LEVEL_MINUS_6DB,
93 LEVEL_ZERO,
88 LEVEL_MINUS_9DB 94 LEVEL_MINUS_9DB
89 }; 95 };
90 96
91 /** 97 /**
92 * Table for default stereo downmixing coefficients 98 * Table for default stereo downmixing coefficients
93 * reference: Section 7.8.2 Downmixing Into Two Channels 99 * reference: Section 7.8.2 Downmixing Into Two Channels
94 */ 100 */
95 static const uint8_t ac3_default_coeffs[8][5][2] = { 101 static const uint8_t ac3_default_coeffs[8][5][2] = {
96 { { 1, 0 }, { 0, 1 }, }, 102 { { 2, 7 }, { 7, 2 }, },
97 { { 2, 2 }, }, 103 { { 4, 4 }, },
98 { { 1, 0 }, { 0, 1 }, }, 104 { { 2, 7 }, { 7, 2 }, },
99 { { 1, 0 }, { 3, 3 }, { 0, 1 }, }, 105 { { 2, 7 }, { 5, 5 }, { 7, 2 }, },
100 { { 1, 0 }, { 0, 1 }, { 4, 4 }, }, 106 { { 2, 7 }, { 7, 2 }, { 6, 6 }, },
101 { { 1, 0 }, { 3, 3 }, { 0, 1 }, { 5, 5 }, }, 107 { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 8, 8 }, },
102 { { 1, 0 }, { 0, 1 }, { 4, 0 }, { 0, 4 }, }, 108 { { 2, 7 }, { 7, 2 }, { 6, 7 }, { 7, 6 }, },
103 { { 1, 0 }, { 3, 3 }, { 0, 1 }, { 4, 0 }, { 0, 4 }, }, 109 { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 6, 7 }, { 7, 6 }, },
104 }; 110 };
105 111
106 /* override ac3.h to include coupling channel */ 112 /* override ac3.h to include coupling channel */
107 #undef AC3_MAX_CHANNELS 113 #undef AC3_MAX_CHANNELS
108 #define AC3_MAX_CHANNELS 7 114 #define AC3_MAX_CHANNELS 7