diff options
author | Niels Möller <nisse@lysator.liu.se> | 2014-05-06 09:41:05 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-05-23 15:07:05 +0200 |
commit | 6b7b8585d73548f08b98959df39d80b97677662f (patch) | |
tree | 94681d4e6e96d51770d3ee80d04372dd015f5cc0 /libavcodec/dcadec.c | |
parent | c23c96b638cbf6c489fd301e6b3d5555632fba37 (diff) | |
download | ffmpeg-6b7b8585d73548f08b98959df39d80b97677662f.tar.gz |
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@southpole.se>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/dcadec.c')
-rw-r--r-- | libavcodec/dcadec.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index c8877d6d1f..0727857bb6 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 { |