summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-11-12 07:09:09 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-11-12 07:09:09 +0000
commitbb56bc4ba08bf6c6458a289ef4918dfaea30b238 (patch)
treecd9c5cf5a97d72fe17615b79f6e89aca60f1de79 /apps
parentee610d47c7a636a465176cce52b932cdd26fd272 (diff)
downloadrockbox-bb56bc4ba08bf6c6458a289ef4918dfaea30b238.tar.gz
rockbox-bb56bc4ba08bf6c6458a289ef4918dfaea30b238.tar.bz2
rockbox-bb56bc4ba08bf6c6458a289ef4918dfaea30b238.zip
Minor speed up of mpc requantization.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28563 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libmusepack/mpc_decoder.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/apps/codecs/libmusepack/mpc_decoder.c b/apps/codecs/libmusepack/mpc_decoder.c
index c1e1d0e0d2..191ee10a2c 100644
--- a/apps/codecs/libmusepack/mpc_decoder.c
+++ b/apps/codecs/libmusepack/mpc_decoder.c
@@ -525,7 +525,8 @@ void mpc_decoder_read_bitstream_sv7(mpc_decoder * d, mpc_bits_reader * r)
for ( n = 0; n < Max_used_Band; n++ ) {
mpc_int16_t *q = d->Q[n].L, Res = d->Res_L[n];
do {
- mpc_int32_t k;
+ mpc_uint32_t nbit;
+ mpc_int32_t k, dc;
const mpc_lut_data *Table;
switch (Res) {
case -2: case -3: case -4: case -5: case -6: case -7: case -8: case -9:
@@ -564,8 +565,10 @@ void mpc_decoder_read_bitstream_sv7(mpc_decoder * d, mpc_bits_reader * r)
q[k] = mpc_bits_huff_lut(r, Table);
break;
case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17:
+ nbit = Res_bit[Res];
+ dc = Dc[Res];
for ( k = 0; k < 36; k++ )
- q[k] = (mpc_int32_t)mpc_bits_read(r, Res_bit[Res]) - Dc[Res];
+ q[k] = (mpc_int32_t)mpc_bits_read(r, nbit) - dc;
break;
default:
return;
@@ -683,7 +686,8 @@ void mpc_decoder_read_bitstream_sv8(mpc_decoder * d, mpc_bits_reader * r, mpc_bo
mpc_int16_t *q = d->Q[n].L, Res = d->Res_L[n];
static const int thres[] = {0, 0, 3, 0, 0, 1, 3, 4, 8};
do {
- mpc_int32_t k = 0, idx = 1;
+ mpc_uint32_t nbit;
+ mpc_int32_t k = 0, idx = 1, dc;
if (Res != 0) {
if (Res == 2) {
Tables[0] = & mpc_can_Q [0][0];
@@ -736,12 +740,19 @@ void mpc_decoder_read_bitstream_sv8(mpc_decoder * d, mpc_bits_reader * r, mpc_bo
q[k] = mpc_bits_can_dec(r, Tables[idx > thres[Res]]);
idx = (idx >> 1) + absi(q[k]);
}
+ } else if (Res == 9) {
+ dc = Dc[Res];
+ for ( ; k < 36; k++ ) {
+ q[k] = (unsigned char) mpc_bits_can_dec(r, & mpc_can_Q9up);
+ q[k] -= dc;
+ }
} else {
+ nbit = (Res - 9);
+ dc = Dc[Res];
for ( ; k < 36; k++ ) {
q[k] = (unsigned char) mpc_bits_can_dec(r, & mpc_can_Q9up);
- if (Res != 9)
- q[k] = (q[k] << (Res - 9)) | mpc_bits_read(r, Res - 9);
- q[k] -= Dc[Res];
+ q[k] = (q[k] << nbit) | mpc_bits_read(r, nbit);
+ q[k] -= dc;
}
}
}