Don't return whether the bsinc filter cuts or not

This commit is contained in:
Chris Robinson
2018-01-10 19:20:58 -08:00
parent ea6b384980
commit 279799ad70
2 changed files with 9 additions and 23 deletions
+8 -22
View File
@@ -208,34 +208,21 @@ void aluInit(void)
* modified for use with an interpolated increment for buttery-smooth pitch
* changes.
*/
ALboolean BsincPrepare(const ALuint increment, BsincState *state, const BSincTable *table)
void BsincPrepare(const ALuint increment, BsincState *state, const BSincTable *table)
{
ALboolean uncut = AL_TRUE;
ALfloat sf;
ALsizei si;
if(increment > FRACTIONONE)
{
sf = (ALfloat)FRACTIONONE / increment;
if(sf < table->scaleBase)
{
/* Signal has been completely cut. The return result can be used
* to skip the filter (and output zeros) as an optimization.
*/
sf = 0.0f;
si = 0;
uncut = AL_FALSE;
}
else
{
sf = (BSINC_SCALE_COUNT - 1) * (sf - table->scaleBase) * table->scaleRange;
si = fastf2i(sf);
/* The interpolation factor is fit to this diagonally-symmetric
* curve to reduce the transition ripple caused by interpolating
* different scales of the sinc function.
*/
sf = 1.0f - cosf(asinf(sf - si));
}
sf = maxf(0.0f, (BSINC_SCALE_COUNT-1) * (sf-table->scaleBase) * table->scaleRange);
si = fastf2i(sf);
/* The interpolation factor is fit to this diagonally-symmetric curve
* to reduce the transition ripple caused by interpolating different
* scales of the sinc function.
*/
sf = 1.0f - cosf(asinf(sf - si));
}
else
{
@@ -247,7 +234,6 @@ ALboolean BsincPrepare(const ALuint increment, BsincState *state, const BSincTab
state->m = table->m[si];
state->l = -((state->m/2) - 1);
state->filter = table->Tab + table->filterOffset[si];
return uncut;
}
+1 -1
View File
@@ -92,7 +92,7 @@ typedef const ALfloat* (*ResamplerFunc)(const InterpState *state,
ALfloat *restrict dst, ALsizei dstlen
);
ALboolean BsincPrepare(const ALuint increment, BsincState *state, const struct BSincTable *table);
void BsincPrepare(const ALuint increment, BsincState *state, const struct BSincTable *table);
extern const struct BSincTable bsinc12;
extern const struct BSincTable bsinc24;