hmm?
This commit is contained in:
parent
a4698dc911
commit
d81a181ba5
3 changed files with 33 additions and 3 deletions
|
|
@ -26,6 +26,7 @@ float* DivFilterTables::cubicTable=NULL;
|
|||
float* DivFilterTables::sincTable=NULL;
|
||||
float* DivFilterTables::sincTable8=NULL;
|
||||
float* DivFilterTables::sincIntegralTable=NULL;
|
||||
float* DivFilterTables::sincIntegralSmallTable=NULL;
|
||||
|
||||
// portions from Schism Tracker (scripts/lutgen.c)
|
||||
// licensed under same license as this program.
|
||||
|
|
@ -106,3 +107,25 @@ float* DivFilterTables::getSincIntegralTable() {
|
|||
}
|
||||
return sincIntegralTable;
|
||||
}
|
||||
|
||||
float* DivFilterTables::getSincIntegralSmallTable() {
|
||||
if (sincIntegralSmallTable==NULL) {
|
||||
logD("initializing small sinc integral table.");
|
||||
sincIntegralSmallTable=new float[256];
|
||||
|
||||
sincIntegralSmallTable[0]=-0.5f;
|
||||
for (int i=1; i<256; i++) {
|
||||
int mapped=((i&31)<<3)|(i>>5);
|
||||
int mappedPrev=(((i-1)&31)<<3)|((i-1)>>5);
|
||||
double x=(double)i*M_PI/32.0;
|
||||
double sinc=sin(x)/x;
|
||||
sincIntegralSmallTable[mapped]=sincIntegralSmallTable[mappedPrev]+(sinc/32.0);
|
||||
}
|
||||
|
||||
for (int i=0; i<256; i++) {
|
||||
int mapped=((i&31)<<3)|(i>>5);
|
||||
sincIntegralSmallTable[mapped]*=pow(cos(M_PI*(double)i/512.0),2.0);
|
||||
}
|
||||
}
|
||||
return sincIntegralSmallTable;
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ class DivFilterTables {
|
|||
static float* sincTable;
|
||||
static float* sincTable8;
|
||||
static float* sincIntegralTable;
|
||||
static float* sincIntegralSmallTable;
|
||||
|
||||
/**
|
||||
* get a 1024x4 cubic spline table.
|
||||
|
|
@ -47,4 +48,10 @@ class DivFilterTables {
|
|||
* @return the table.
|
||||
*/
|
||||
static float* getSincIntegralTable();
|
||||
|
||||
/**
|
||||
* get a 32x8 one-side sine-windowed sinc integral table.
|
||||
* @return the table.
|
||||
*/
|
||||
static float* getSincIntegralSmallTable();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue