[FFmpeg-cvslog] dca: Convert dca_dmixtable to integers
Niels Möller
git at videolan.org
Fri May 23 20:45:04 CEST 2014
ffmpeg | branch: master | Niels Möller <nisse at lysator.liu.se> | Tue May 6 09:41:05 2014 +0200| [6b7b8585d73548f08b98959df39d80b97677662f] | committer: Anton Khirnov
dca: Convert dca_dmixtable to integers
Also include zero in the table, eliminating a special case in the
decoder.
Signed-off-by: Niels Möller <nisse at southpole.se>
Signed-off-by: Anton Khirnov <anton at khirnov.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6b7b8585d73548f08b98959df39d80b97677662f
---
libavcodec/dcadata.h | 64 +++++++++++++++++++++++++-------------------------
libavcodec/dcadec.c | 19 ++++++++-------
2 files changed, 42 insertions(+), 41 deletions(-)
diff --git a/libavcodec/dcadata.h b/libavcodec/dcadata.h
index da3422e..28c40cf 100644
--- a/libavcodec/dcadata.h
+++ b/libavcodec/dcadata.h
@@ -7520,38 +7520,38 @@ DECLARE_ALIGNED(16, static const float, lfe_fir_128)[] =
* 2) [-29.750 to -15] with resolution of 0.250 dB
* 3) [-14.875 to 0] with resolution of 0.125 dB
*/
-static const float dca_dmixtable[241] = {
- 0.001000, 0.001059, 0.001122, 0.001189, 0.001259, 0.001334, 0.001413, 0.001496,
- 0.001585, 0.001679, 0.001778, 0.001884, 0.001995, 0.002113, 0.002239, 0.002371,
- 0.002512, 0.002661, 0.002818, 0.002985, 0.003162, 0.003350, 0.003548, 0.003758,
- 0.003981, 0.004217, 0.004467, 0.004732, 0.005012, 0.005309, 0.005623, 0.005957,
- 0.006310, 0.006683, 0.007079, 0.007499, 0.007943, 0.008414, 0.008913, 0.009441,
- 0.010000, 0.010593, 0.011220, 0.011885, 0.012589, 0.013335, 0.014125, 0.014962,
- 0.015849, 0.016788, 0.017783, 0.018836, 0.019953, 0.021135, 0.022387, 0.023714,
- 0.025119, 0.026607, 0.028184, 0.029854, 0.031623, 0.032546, 0.033497, 0.034475,
- 0.035481, 0.036517, 0.037584, 0.038681, 0.039811, 0.040973, 0.042170, 0.043401,
- 0.044668, 0.045973, 0.047315, 0.048697, 0.050119, 0.051582, 0.053088, 0.054639,
- 0.056234, 0.057876, 0.059566, 0.061306, 0.063096, 0.064938, 0.066834, 0.068786,
- 0.070795, 0.072862, 0.074989, 0.077179, 0.079433, 0.081752, 0.084140, 0.086596,
- 0.089125, 0.091728, 0.094406, 0.097163, 0.100000, 0.102920, 0.105925, 0.109018,
- 0.112202, 0.115478, 0.118850, 0.122321, 0.125893, 0.129569, 0.133352, 0.137246,
- 0.141254, 0.145378, 0.149624, 0.153993, 0.158489, 0.163117, 0.167880, 0.172783,
- 0.177828, 0.180406, 0.183021, 0.185674, 0.188365, 0.191095, 0.193865, 0.196675,
- 0.199526, 0.202418, 0.205353, 0.208329, 0.211349, 0.214412, 0.217520, 0.220673,
- 0.223872, 0.227117, 0.230409, 0.233749, 0.237137, 0.240575, 0.244062, 0.247600,
- 0.251189, 0.254830, 0.258523, 0.262271, 0.266073, 0.269929, 0.273842, 0.277811,
- 0.281838, 0.285924, 0.290068, 0.294273, 0.298538, 0.302866, 0.307256, 0.311709,
- 0.316228, 0.320812, 0.325462, 0.330179, 0.334965, 0.339821, 0.344747, 0.349744,
- 0.354813, 0.359956, 0.365174, 0.370467, 0.375837, 0.381285, 0.386812, 0.392419,
- 0.398107, 0.403878, 0.409732, 0.415671, 0.421697, 0.427809, 0.434010, 0.440301,
- 0.446684, 0.453158, 0.459727, 0.466391, 0.473151, 0.480010, 0.486968, 0.494026,
- 0.501187, 0.508452, 0.515822, 0.523299, 0.530884, 0.538580, 0.546387, 0.554307,
- 0.562341, 0.570493, 0.578762, 0.587151, 0.595662, 0.604296, 0.613056, 0.621942,
- 0.630957, 0.640103, 0.649382, 0.658795, 0.668344, 0.678032, 0.687860, 0.697831,
- 0.707107, 0.718208, 0.728618, 0.739180, 0.749894, 0.760764, 0.771792, 0.782979,
- 0.794328, 0.805842, 0.817523, 0.829373, 0.841395, 0.853591, 0.865964, 0.878517,
- 0.891251, 0.904170, 0.917276, 0.930572, 0.944061, 0.957745, 0.971628, 0.985712,
- 1.000000,
+static const uint16_t dca_dmixtable[242] = {
+ 0, 33, 35, 37, 39, 41, 44, 46,
+ 49, 52, 55, 58, 62, 65, 69, 73,
+ 78, 82, 87, 92, 98, 104, 110, 116,
+ 123, 130, 138, 146, 155, 164, 174, 184,
+ 195, 207, 219, 232, 246, 260, 276, 292,
+ 309, 328, 347, 368, 389, 413, 437, 463,
+ 490, 519, 550, 583, 617, 654, 693, 734,
+ 777, 823, 872, 924, 978, 1036, 1066, 1098,
+ 1130, 1163, 1197, 1232, 1268, 1305, 1343, 1382,
+ 1422, 1464, 1506, 1550, 1596, 1642, 1690, 1740,
+ 1790, 1843, 1896, 1952, 2009, 2068, 2128, 2190,
+ 2254, 2320, 2388, 2457, 2529, 2603, 2679, 2757,
+ 2838, 2920, 3006, 3093, 3184, 3277, 3372, 3471,
+ 3572, 3677, 3784, 3894, 4008, 4125, 4246, 4370,
+ 4497, 4629, 4764, 4903, 5046, 5193, 5345, 5501,
+ 5662, 5827, 5912, 5997, 6084, 6172, 6262, 6353,
+ 6445, 6538, 6633, 6729, 6827, 6925, 7026, 7128,
+ 7231, 7336, 7442, 7550, 7659, 7771, 7883, 7997,
+ 8113, 8231, 8350, 8471, 8594, 8719, 8845, 8973,
+ 9103, 9235, 9369, 9505, 9643, 9783, 9924, 10068,
+ 10214, 10362, 10512, 10665, 10819, 10976, 11135, 11297,
+ 11460, 11627, 11795, 11966, 12139, 12315, 12494, 12675,
+ 12859, 13045, 13234, 13426, 13621, 13818, 14018, 14222,
+ 14428, 14637, 14849, 15064, 15283, 15504, 15729, 15957,
+ 16188, 16423, 16661, 16902, 17147, 17396, 17648, 17904,
+ 18164, 18427, 18694, 18965, 19240, 19519, 19802, 20089,
+ 20380, 20675, 20975, 21279, 21587, 21900, 22218, 22540,
+ 22867, 23170, 23534, 23875, 24221, 24573, 24929, 25290,
+ 25657, 26029, 26406, 26789, 27177, 27571, 27970, 28376,
+ 28787, 29205, 29628, 30057, 30493, 30935, 31383, 31838,
+ 32300, 32768,
};
static const float dca_default_coeffs[10][6][2] = {
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index c8877d6..0727857 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -1695,6 +1695,13 @@ static void dca_exss_parse_header(DCAContext *s)
* from the asset header */
}
+static float dca_dmix_code(unsigned code)
+{
+ int sign = (code >> 8) - 1;
+ code &= 0xff;
+ return ldexpf((dca_dmixtable[code] ^ sign) - sign, -15);
+}
+
/**
* Main frame decoding function
* FIXME add arguments
@@ -1902,16 +1909,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
*/
if (s->core_downmix && (s->core_downmix_amode == DCA_STEREO ||
s->core_downmix_amode == DCA_STEREO_TOTAL)) {
- int sign, code;
for (i = 0; i < num_core_channels + !!s->lfe; i++) {
- sign = s->core_downmix_codes[i][0] & 0x100 ? 1 : -1;
- code = s->core_downmix_codes[i][0] & 0x0FF;
- s->downmix_coef[i][0] = (!code ? 0.0f :
- sign * dca_dmixtable[code - 1]);
- sign = s->core_downmix_codes[i][1] & 0x100 ? 1 : -1;
- code = s->core_downmix_codes[i][1] & 0x0FF;
- s->downmix_coef[i][1] = (!code ? 0.0f :
- sign * dca_dmixtable[code - 1]);
+ /* Range checked earlier */
+ s->downmix_coef[i][0] = dca_dmix_code(s->core_downmix_codes[i][0]);
+ s->downmix_coef[i][1] = dca_dmix_code(s->core_downmix_codes[i][1]);
}
s->output = s->core_downmix_amode;
} else {
More information about the ffmpeg-cvslog
mailing list