diff options
author | Michael Giacomelli <giac2000@hotmail.com> | 2009-07-18 00:24:54 +0000 |
---|---|---|
committer | Michael Giacomelli <giac2000@hotmail.com> | 2009-07-18 00:24:54 +0000 |
commit | 6539b535ad08a13d654db3185d78a8f86a75f6a6 (patch) | |
tree | e5d98b03ae86cc4657757bb92db0b446fc6d1a49 /apps/codecs | |
parent | b957f7214be31bc5752625f9b9d60f96a77a9e34 (diff) | |
download | rockbox-6539b535ad08a13d654db3185d78a8f86a75f6a6.tar.gz rockbox-6539b535ad08a13d654db3185d78a8f86a75f6a6.zip |
Optimize overlap_math by only doing shifting if theres gain, and moving the check for sign outside of the for loop. 3% speedup on PP5024.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21940 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r-- | apps/codecs/libcook/cook_fixpoint.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/codecs/libcook/cook_fixpoint.h b/apps/codecs/libcook/cook_fixpoint.h index c2ab9299c6..7e3db8563b 100644 --- a/apps/codecs/libcook/cook_fixpoint.h +++ b/apps/codecs/libcook/cook_fixpoint.h | |||
@@ -268,9 +268,20 @@ static inline void imlt_math(COOKContext *q, FIXP *in) | |||
268 | static inline void overlap_math(COOKContext *q, int gain, FIXP buffer[]) | 268 | static inline void overlap_math(COOKContext *q, int gain, FIXP buffer[]) |
269 | { | 269 | { |
270 | int i; | 270 | int i; |
271 | for(i=0 ; i<q->samples_per_channel ; i++) { | 271 | if(LIKELY(gain == 0)){ |
272 | q->mono_mdct_output[i] = | 272 | for(i=0 ; i<q->samples_per_channel ; i++) { |
273 | fixp_pow2(q->mono_mdct_output[i], gain) + buffer[i]; | 273 | q->mono_mdct_output[i] += buffer[i]; |
274 | } | ||
275 | |||
276 | } else if (gain > 0){ | ||
277 | for(i=0 ; i<q->samples_per_channel ; i++) { | ||
278 | q->mono_mdct_output[i] = (q->mono_mdct_output[i]<< gain) + buffer[i]; } | ||
279 | |||
280 | } else { | ||
281 | for(i=0 ; i<q->samples_per_channel ; i++) { | ||
282 | q->mono_mdct_output[i] = | ||
283 | (q->mono_mdct_output[i] >> -gain) + ((q->mono_mdct_output[i] >> (-gain-1)) & 1)+ buffer[i]; | ||
284 | } | ||
274 | } | 285 | } |
275 | } | 286 | } |
276 | 287 | ||