Mercurial > libavcodec.hg
comparison ac3dec.c @ 7019:81d5c68233e5 libavcodec
move mix level tables from parser to decoder. have parser read bitstream value instead of using an index to a table in the decoder.
author | jbr |
---|---|
date | Sat, 07 Jun 2008 22:30:09 +0000 |
parents | 885cad616170 |
children | 40a2db8dbaa2 |
comparison
equal
deleted
inserted
replaced
7018:885cad616170 | 7019:81d5c68233e5 |
---|---|
93 LEVEL_ZERO, | 93 LEVEL_ZERO, |
94 LEVEL_MINUS_9DB | 94 LEVEL_MINUS_9DB |
95 }; | 95 }; |
96 | 96 |
97 /** | 97 /** |
98 * Table for center mix levels | |
99 * reference: Section 5.4.2.4 cmixlev | |
100 */ | |
101 static const uint8_t center_levels[4] = { 4, 5, 6, 5 }; | |
102 | |
103 /** | |
104 * Table for surround mix levels | |
105 * reference: Section 5.4.2.5 surmixlev | |
106 */ | |
107 static const uint8_t surround_levels[4] = { 4, 6, 7, 6 }; | |
108 | |
109 /** | |
98 * Table for default stereo downmixing coefficients | 110 * Table for default stereo downmixing coefficients |
99 * reference: Section 7.8.2 Downmixing Into Two Channels | 111 * reference: Section 7.8.2 Downmixing Into Two Channels |
100 */ | 112 */ |
101 static const uint8_t ac3_default_coeffs[8][5][2] = { | 113 static const uint8_t ac3_default_coeffs[8][5][2] = { |
102 { { 2, 7 }, { 7, 2 }, }, | 114 { { 2, 7 }, { 7, 2 }, }, |
381 * reference: Section 7.8.2 Downmixing Into Two Channels | 393 * reference: Section 7.8.2 Downmixing Into Two Channels |
382 */ | 394 */ |
383 static void set_downmix_coeffs(AC3DecodeContext *s) | 395 static void set_downmix_coeffs(AC3DecodeContext *s) |
384 { | 396 { |
385 int i; | 397 int i; |
386 float cmix = gain_levels[s->center_mix_level]; | 398 float cmix = gain_levels[center_levels[s->center_mix_level]]; |
387 float smix = gain_levels[s->surround_mix_level]; | 399 float smix = gain_levels[surround_levels[s->surround_mix_level]]; |
388 | 400 |
389 for(i=0; i<s->fbw_channels; i++) { | 401 for(i=0; i<s->fbw_channels; i++) { |
390 s->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[s->channel_mode][i][0]]; | 402 s->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[s->channel_mode][i][0]]; |
391 s->downmix_coeffs[i][1] = gain_levels[ac3_default_coeffs[s->channel_mode][i][1]]; | 403 s->downmix_coeffs[i][1] = gain_levels[ac3_default_coeffs[s->channel_mode][i][1]]; |
392 } | 404 } |