aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dcadec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-23 19:01:12 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-23 19:01:12 +0200
commitc867be03f61ebce3b87033137d0012a660b8ff75 (patch)
tree0d09d51860def1ceab2bb087ac60af2604aa02cd /libavcodec/dcadec.c
parent6a4832caaede15e3d918b1408ff83fe30324507b (diff)
parent6b7b8585d73548f08b98959df39d80b97677662f (diff)
downloadffmpeg-c867be03f61ebce3b87033137d0012a660b8ff75.tar.gz
Merge commit '6b7b8585d73548f08b98959df39d80b97677662f'
* commit '6b7b8585d73548f08b98959df39d80b97677662f': dca: Convert dca_dmixtable to integers Conflicts: libavcodec/dcadec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dcadec.c')
-rw-r--r--libavcodec/dcadec.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 6a9dfa34d4..8cf6fc8955 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -2103,6 +2103,13 @@ static void dca_exss_parse_header(DCAContext *s)
}
}
+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
@@ -2171,16 +2178,10 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
*/
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 {