diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-05-07 21:36:55 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-05-07 21:36:55 +0000 |
commit | 452c5b2197b0c2572ee4c31d973d6896f08f2631 (patch) | |
tree | c308526f03a2b2aa10a936abe957a525158bef37 /apps/codecs/libmusepack | |
parent | 7831a23376d2316b09e74d9da3c8ab52deaa0024 (diff) |
Unroll mpc's requantization loops for some (minor) speed up.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25891 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libmusepack')
-rw-r--r-- | apps/codecs/libmusepack/mpc_decoder.c | 79 |
1 files changed, 60 insertions, 19 deletions
diff --git a/apps/codecs/libmusepack/mpc_decoder.c b/apps/codecs/libmusepack/mpc_decoder.c index 9e4ef634bf..f403673818 100644 --- a/apps/codecs/libmusepack/mpc_decoder.c +++ b/apps/codecs/libmusepack/mpc_decoder.c @@ -125,54 +125,95 @@ void mpc_decoder_read_bitstream_sv8(mpc_decoder * d, mpc_bits_reader * r, //------------------------------------------------------------------------------ // macros //------------------------------------------------------------------------------ +#define REQUANT_M1_S1_SAMPLES(IDX) \ + *(YL+=IDX) = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); \ + *(YR+=IDX) = templ - tempr; + #define REQUANT_M1_S1(SUBFRAME) \ facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][SUBFRAME] & 0xFF); \ facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][SUBFRAME] & 0xFF); \ - for (n = 0; n < 12; n++, YL += 32, YR += 32) { \ - *YL = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); \ - *YR = templ - tempr; \ + for (n = 0; n < 12; n+=4, YL += 32, YR += 32) { \ + REQUANT_M1_S1_SAMPLES( 0); \ + REQUANT_M1_S1_SAMPLES(32); \ + REQUANT_M1_S1_SAMPLES(32); \ + REQUANT_M1_S1_SAMPLES(32); \ } +#define REQUANT_M1_S0_SAMPLES(IDX) \ + *(YR+=IDX) = *(YL+=IDX) = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + #define REQUANT_M1_S0(SUBFRAME) \ facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][SUBFRAME] & 0xFF); \ - for (n = 0; n < 12; n++, YL += 32, YR += 32) { \ - *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); \ + for (n = 0; n < 12; n+=4, YL += 32, YR += 32) { \ + REQUANT_M1_S0_SAMPLES( 0); \ + REQUANT_M1_S0_SAMPLES(32); \ + REQUANT_M1_S0_SAMPLES(32); \ + REQUANT_M1_S0_SAMPLES(32); \ } +#define REQUANT_M0_S1_SAMPLES(IDX) \ + *(YR+=IDX) = -(*(YL+=IDX) = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); + #define REQUANT_M0_S1(SUBFRAME) \ facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][SUBFRAME] & 0xFF); \ - for (n = 0; n < 12; n++, YL += 32, YR += 32) { \ - *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); \ + for (n = 0; n < 12; n+=4, YL += 32, YR += 32) { \ + REQUANT_M0_S1_SAMPLES( 0); \ + REQUANT_M0_S1_SAMPLES(32); \ + REQUANT_M0_S1_SAMPLES(32); \ + REQUANT_M0_S1_SAMPLES(32); \ } +#define REQUANT_L1_R1_SAMPLES(IDX) \ + *(YL+=IDX) = MPC_MULTIPLY_FLOAT_INT(facL,*L++); \ + *(YR+=IDX) = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + #define REQUANT_L1_R1(SUBFRAME) \ facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][SUBFRAME] & 0xFF); \ facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][SUBFRAME] & 0xFF); \ - for (n = 0; n < 12; n++, YL += 32, YR += 32) { \ - *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); \ - *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); \ + for (n = 0; n < 12; n+=4, YL += 32, YR += 32) { \ + REQUANT_L1_R1_SAMPLES( 0); \ + REQUANT_L1_R1_SAMPLES(32); \ + REQUANT_L1_R1_SAMPLES(32); \ + REQUANT_L1_R1_SAMPLES(32); \ } +#define REQUANT_L1_R0_SAMPLES(IDX) \ + *(YL+=IDX) = MPC_MULTIPLY_FLOAT_INT(facL,*L++); \ + *(YR+=IDX) = 0; + #define REQUANT_L1_R0(SUBFRAME) \ facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , d->SCF_Index_L[Band][SUBFRAME] & 0xFF); \ - for (n = 0; n < 12; n++, YL += 32, YR += 32) { \ - *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); \ - *YR = 0; \ + for (n = 0; n < 12; n+=4, YL += 32, YR += 32) { \ + REQUANT_L1_R0_SAMPLES( 0); \ + REQUANT_L1_R0_SAMPLES(32); \ + REQUANT_L1_R0_SAMPLES(32); \ + REQUANT_L1_R0_SAMPLES(32); \ } +#define REQUANT_L0_R1_SAMPLES(IDX) \ + *(YL+=IDX) = 0; \ + *(YR+=IDX) = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + #define REQUANT_L0_R1(SUBFRAME) \ facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , d->SCF_Index_R[Band][SUBFRAME] & 0xFF); \ - for (n = 0; n < 12; n++, YL += 32, YR += 32) { \ - *YL = 0; \ - *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); \ + for (n = 0; n < 12; n+=4, YL += 32, YR += 32) { \ + REQUANT_L0_R1_SAMPLES( 0); \ + REQUANT_L0_R1_SAMPLES(32); \ + REQUANT_L0_R1_SAMPLES(32); \ + REQUANT_L0_R1_SAMPLES(32); \ } +#define REQUANT_SILENCE_SAMPLES(IDX) \ + *(YR+=IDX) = *(YL+=IDX) = 0; + #define REQUANT_SILENCE \ - for (n = 0; n < 36; n++, YL += 32, YR += 32) { \ - *YR = *YL = 0; \ + for (n = 0; n < 12; n+=4, YL += 32, YR += 32) { \ + REQUANT_SILENCE_SAMPLES( 0); \ + REQUANT_SILENCE_SAMPLES(32); \ + REQUANT_SILENCE_SAMPLES(32); \ + REQUANT_SILENCE_SAMPLES(32); \ } - /** * set the scf indexes for seeking use * needed only for sv7 seeking |