forked from len0rd/rockbox
Tiny speedup by simplifying the filter wrap check.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19101 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c8d0a6522e
commit
60e16e8e7a
1 changed files with 15 additions and 16 deletions
|
@ -45,7 +45,7 @@ struct filter_t {
|
||||||
int16_t* coeffs; /* ORDER entries */
|
int16_t* coeffs; /* ORDER entries */
|
||||||
|
|
||||||
/* We store all the filter delays in a single buffer */
|
/* We store all the filter delays in a single buffer */
|
||||||
int16_t* historybuffer; /* ORDER*2 + HISTORY_SIZE entries */
|
int16_t* history_end;
|
||||||
|
|
||||||
int16_t* delay;
|
int16_t* delay;
|
||||||
int16_t* adaptcoeffs;
|
int16_t* adaptcoeffs;
|
||||||
|
@ -143,11 +143,11 @@ static void ICODE_ATTR_DEMAC do_apply_filter_3980(struct filter_t* f,
|
||||||
f->adaptcoeffs++;
|
f->adaptcoeffs++;
|
||||||
|
|
||||||
/* Have we filled the history buffer? */
|
/* Have we filled the history buffer? */
|
||||||
if (f->delay == f->historybuffer + HISTORY_SIZE + (ORDER*2)) {
|
if (f->delay == f->history_end) {
|
||||||
memmove(f->historybuffer, f->delay - (ORDER*2),
|
memmove(f->coeffs + ORDER, f->delay - (ORDER*2),
|
||||||
(ORDER*2) * sizeof(int16_t));
|
(ORDER*2) * sizeof(int16_t));
|
||||||
f->delay = f->historybuffer + ORDER*2;
|
f->adaptcoeffs = f->coeffs + ORDER*2;
|
||||||
f->adaptcoeffs = f->historybuffer + ORDER;
|
f->delay = f->coeffs + ORDER*3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,11 +188,11 @@ static void ICODE_ATTR_DEMAC do_apply_filter_3970(struct filter_t* f,
|
||||||
f->adaptcoeffs++;
|
f->adaptcoeffs++;
|
||||||
|
|
||||||
/* Have we filled the history buffer? */
|
/* Have we filled the history buffer? */
|
||||||
if (f->delay == f->historybuffer + HISTORY_SIZE + (ORDER*2)) {
|
if (f->delay == f->history_end) {
|
||||||
memmove(f->historybuffer, f->delay - (ORDER*2),
|
memmove(f->coeffs + ORDER, f->delay - (ORDER*2),
|
||||||
(ORDER*2) * sizeof(int16_t));
|
(ORDER*2) * sizeof(int16_t));
|
||||||
f->delay = f->historybuffer + ORDER*2;
|
f->adaptcoeffs = f->coeffs + ORDER*2;
|
||||||
f->adaptcoeffs = f->historybuffer + ORDER;
|
f->delay = f->coeffs + ORDER*3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,15 +203,14 @@ static struct filter_t filter1 IBSS_ATTR;
|
||||||
static void do_init_filter(struct filter_t* f, int16_t* buf)
|
static void do_init_filter(struct filter_t* f, int16_t* buf)
|
||||||
{
|
{
|
||||||
f->coeffs = buf;
|
f->coeffs = buf;
|
||||||
f->historybuffer = buf + ORDER;
|
f->history_end = buf + ORDER*3 + HISTORY_SIZE;
|
||||||
|
|
||||||
/* Zero the output history buffer */
|
/* Init pointers */
|
||||||
memset(f->historybuffer, 0 , (ORDER*2) * sizeof(int16_t));
|
f->adaptcoeffs = f->coeffs + ORDER*2;
|
||||||
f->delay = f->historybuffer + ORDER*2;
|
f->delay = f->coeffs + ORDER*3;
|
||||||
f->adaptcoeffs = f->historybuffer + ORDER;
|
|
||||||
|
|
||||||
/* Zero the co-efficients */
|
/* Zero coefficients and history buffer */
|
||||||
memset(f->coeffs, 0, ORDER * sizeof(int16_t));
|
memset(f->coeffs, 0, ORDER*3 * sizeof(int16_t));
|
||||||
|
|
||||||
/* Zero the running average */
|
/* Zero the running average */
|
||||||
f->avg = 0;
|
f->avg = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue