forked from len0rd/rockbox
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
This commit is contained in:
parent
b957f7214b
commit
6539b535ad
1 changed files with 14 additions and 3 deletions
|
|
@ -268,9 +268,20 @@ static inline void imlt_math(COOKContext *q, FIXP *in)
|
|||
static inline void overlap_math(COOKContext *q, int gain, FIXP buffer[])
|
||||
{
|
||||
int i;
|
||||
for(i=0 ; i<q->samples_per_channel ; i++) {
|
||||
q->mono_mdct_output[i] =
|
||||
fixp_pow2(q->mono_mdct_output[i], gain) + buffer[i];
|
||||
if(LIKELY(gain == 0)){
|
||||
for(i=0 ; i<q->samples_per_channel ; i++) {
|
||||
q->mono_mdct_output[i] += buffer[i];
|
||||
}
|
||||
|
||||
} else if (gain > 0){
|
||||
for(i=0 ; i<q->samples_per_channel ; i++) {
|
||||
q->mono_mdct_output[i] = (q->mono_mdct_output[i]<< gain) + buffer[i]; }
|
||||
|
||||
} else {
|
||||
for(i=0 ; i<q->samples_per_channel ; i++) {
|
||||
q->mono_mdct_output[i] =
|
||||
(q->mono_mdct_output[i] >> -gain) + ((q->mono_mdct_output[i] >> (-gain-1)) & 1)+ buffer[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue