summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-05-08 19:36:08 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-05-08 19:36:08 +0000
commitf79769c541eb7235b09625cb084dfdfe6069cb96 (patch)
tree8a12930deb803c70277f17981bce9414c6dc6788 /apps
parent7d4616ea4070caec92af0aa8866177bc4ec7a066 (diff)
downloadrockbox-f79769c541eb7235b09625cb084dfdfe6069cb96.tar.gz
rockbox-f79769c541eb7235b09625cb084dfdfe6069cb96.zip
Minor loop optimization in libfaad's is/ms decoding.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29837 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libfaad/is.c18
-rw-r--r--apps/codecs/libfaad/ms.c9
2 files changed, 14 insertions, 13 deletions
diff --git a/apps/codecs/libfaad/is.c b/apps/codecs/libfaad/is.c
index 127558fb7d..89c6fcf228 100644
--- a/apps/codecs/libfaad/is.c
+++ b/apps/codecs/libfaad/is.c
@@ -32,7 +32,7 @@
32#include "is.h" 32#include "is.h"
33 33
34#ifdef FIXED_POINT 34#ifdef FIXED_POINT
35static real_t pow05_table[] = { 35static real_t pow05_table[] ICONST_ATTR = {
36 COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */ 36 COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */
37 COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */ 37 COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */
38 COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */ 38 COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */
@@ -47,7 +47,7 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
47 uint16_t frame_len) 47 uint16_t frame_len)
48{ 48{
49 uint8_t g, sfb, b; 49 uint8_t g, sfb, b;
50 uint16_t i; 50 uint16_t i, k;
51#ifndef FIXED_POINT 51#ifndef FIXED_POINT
52 real_t scale; 52 real_t scale;
53#else 53#else
@@ -84,19 +84,21 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
84 84
85 /* Scale from left to right channel, 85 /* Scale from left to right channel,
86 do not touch left channel */ 86 do not touch left channel */
87 for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++) 87 k = (group*nshort) + icsr->swb_offset[sfb];
88 for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++, k++)
88 { 89 {
89#ifndef FIXED_POINT 90#ifndef FIXED_POINT
90 r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale); 91 r_spec[k] = MUL_R(l_spec[k], scale);
91#else 92#else
92 if (exp < 0) 93 if (exp < 0)
93 r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp; 94 r_spec[k] = l_spec[k] << -exp;
94 else 95 else
95 r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp; 96 r_spec[k] = l_spec[k] >> exp;
96 r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]); 97
98 r_spec[k] = MUL_C(r_spec[k], pow05_table[frac + 3]);
97#endif 99#endif
98 if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb)) 100 if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
99 r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i]; 101 r_spec[k] = -r_spec[k];
100 } 102 }
101 } 103 }
102 } 104 }
diff --git a/apps/codecs/libfaad/ms.c b/apps/codecs/libfaad/ms.c
index f01e5caa07..b42e95a408 100644
--- a/apps/codecs/libfaad/ms.c
+++ b/apps/codecs/libfaad/ms.c
@@ -41,7 +41,6 @@ void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
41 uint16_t nshort = frame_len/8; 41 uint16_t nshort = frame_len/8;
42 42
43 uint16_t i, k; 43 uint16_t i, k;
44 real_t tmp;
45 44
46 if (ics->ms_mask_present >= 1) 45 if (ics->ms_mask_present >= 1)
47 { 46 {
@@ -58,12 +57,12 @@ void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
58 if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) && 57 if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
59 !is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb)) 58 !is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
60 { 59 {
61 for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++) 60 k = (group*nshort) + ics->swb_offset[sfb];
61 for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++, k++)
62 { 62 {
63 k = (group*nshort) + i; 63 /* L' = L+R, R' = L-R */
64 tmp = l_spec[k] - r_spec[k];
65 l_spec[k] = l_spec[k] + r_spec[k]; 64 l_spec[k] = l_spec[k] + r_spec[k];
66 r_spec[k] = tmp; 65 r_spec[k] = l_spec[k] - (r_spec[k]<<1);
67 } 66 }
68 } 67 }
69 } 68 }