Remove the fastf2u conversion function

This commit is contained in:
Chris Robinson
2017-06-27 07:25:08 -07:00
parent 8f2bbc434c
commit e9a7218a06
7 changed files with 12 additions and 18 deletions
+2 -2
View File
@@ -231,7 +231,7 @@ ALboolean BsincPrepare(const ALuint increment, BsincState *state)
{ 24, 24, 24, 24, 24, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12, 0 }
};
ALfloat sf;
ALuint si, pi;
ALsizei si, pi;
ALboolean uncut = AL_TRUE;
if(increment > FRACTIONONE)
@@ -249,7 +249,7 @@ ALboolean BsincPrepare(const ALuint increment, BsincState *state)
else
{
sf = (BSINC_SCALE_COUNT - 1) * (sf - scaleBase) * scaleRange;
si = fastf2u(sf);
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.
+1 -1
View File
@@ -91,7 +91,7 @@ static ALboolean ALchorusState_deviceUpdate(ALchorusState *state, ALCdevice *Dev
ALsizei maxlen;
ALsizei it;
maxlen = fastf2u(AL_CHORUS_MAX_DELAY * 2.0f * Device->Frequency) + 1;
maxlen = fastf2i(AL_CHORUS_MAX_DELAY * 2.0f * Device->Frequency) + 1;
maxlen = NextPowerOf2(maxlen);
if(maxlen != state->BufferLength)
+1 -1
View File
@@ -127,7 +127,7 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice *
else /*if(Slot->Params.EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SQUARE)*/
state->Process = ModulateSquare;
state->step = fastf2u(props->Modulator.Frequency*WAVEFORM_FRACONE /
state->step = fastf2i(props->Modulator.Frequency*WAVEFORM_FRACONE /
Device->Frequency);
if(state->step == 0) state->step = 1;
+7 -7
View File
@@ -511,7 +511,7 @@ static ALuint CalcLineLength(const ALfloat length, const ptrdiff_t offset, const
/* All line lengths are powers of 2, calculated from their lengths in
* seconds, rounded up.
*/
samples = fastf2u(ceilf(length*frequency));
samples = fastf2i(ceilf(length*frequency));
samples = NextPowerOf2(samples + extra);
/* All lines share a single sample buffer. */
@@ -627,7 +627,7 @@ static ALboolean ALreverbState_deviceUpdate(ALreverbState *State, ALCdevice *Dev
/* The late feed taps are set a fixed position past the latest delay tap. */
for(i = 0;i < 4;i++)
State->LateFeedTap = fastf2u((AL_EAXREVERB_MAX_REFLECTIONS_DELAY +
State->LateFeedTap = fastf2i((AL_EAXREVERB_MAX_REFLECTIONS_DELAY +
EARLY_TAP_LENGTHS[3]*multiplier) *
frequency);
@@ -1055,7 +1055,7 @@ static ALvoid UpdateModulator(const ALfloat modTime, const ALfloat modDepth,
* (1 sample) and when the timing changes, the index is rescaled to the new
* range to keep the sinus consistent.
*/
range = maxu(fastf2u(modTime*frequency), 1);
range = maxi(fastf2i(modTime*frequency), 1);
State->Mod.Index = (ALuint)(State->Mod.Index * (ALuint64)range /
State->Mod.Range);
State->Mod.Range = range;
@@ -1094,13 +1094,13 @@ static ALvoid UpdateDelayLine(const ALfloat earlyDelay, const ALfloat lateDelay,
for(i = 0;i < 4;i++)
{
length = earlyDelay + EARLY_TAP_LENGTHS[i]*multiplier;
State->EarlyDelayTap[i][1] = fastf2u(length * frequency);
State->EarlyDelayTap[i][1] = fastf2i(length * frequency);
length = EARLY_TAP_LENGTHS[i]*multiplier;
State->EarlyDelayCoeff[i] = CalcDecayCoeff(length, decayTime);
length = lateDelay + (LATE_LINE_LENGTHS[i] - LATE_LINE_LENGTHS[0])*0.25f*multiplier;
State->LateDelayTap[i][1] = State->LateFeedTap + fastf2u(length * frequency);
State->LateDelayTap[i][1] = State->LateFeedTap + fastf2i(length * frequency);
}
}
@@ -1124,7 +1124,7 @@ static ALvoid UpdateEarlyLines(const ALfloat density, const ALfloat decayTime, c
length = EARLY_LINE_LENGTHS[i] * multiplier;
/* Calculate the delay offset for each delay line. */
State->Early.Offset[i][1] = fastf2u(length * frequency);
State->Early.Offset[i][1] = fastf2i(length * frequency);
/* Calculate the gain (coefficient) for each line. */
State->Early.Coeff[i] = CalcDecayCoeff(length, decayTime);
@@ -1181,7 +1181,7 @@ static ALvoid UpdateLateLines(const ALfloat density, const ALfloat diffusion, co
length = lerp(LATE_LINE_LENGTHS[i] * multiplier, echoTime, echoDepth);
/* Calculate the delay offset for each delay line. */
State->Late.Offset[i][1] = fastf2u(length * frequency);
State->Late.Offset[i][1] = fastf2i(length * frequency);
/* Approximate the absorption that the vector all-pass would exhibit
* given the current diffusion so we don't have to process a full T60
-1
View File
@@ -121,7 +121,6 @@ extern inline ALuint64 ScaleRound(ALuint64 val, ALuint64 new_scale, ALuint64 old
extern inline ALuint64 ScaleFloor(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale);
extern inline ALuint64 ScaleCeil(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale);
extern inline ALint fastf2i(ALfloat f);
extern inline ALuint fastf2u(ALfloat f);
ALuint CPUCapFlags = 0;
+1 -1
View File
@@ -89,7 +89,7 @@ static void RmsDetection(Compressor *Comp, const ALsizei SamplesToDo)
ALfloat sig = Comp->Envelope[i];
sum -= window[index];
window[index] = fastf2u(minf(sig * sig * 65536.0f, RMS_VALUE_MAX));
window[index] = fastf2i(minf(sig * sig * 65536.0f, RMS_VALUE_MAX));
sum += window[index];
index = (index + 1) & RMS_WINDOW_MASK;
-5
View File
@@ -443,11 +443,6 @@ inline ALint fastf2i(ALfloat f)
#endif
}
/* Fast float-to-uint conversion. Assumes the FPU is already in round-to-zero
* mode. */
inline ALuint fastf2u(ALfloat f)
{ return fastf2i(f); }
enum DevProbe {
ALL_DEVICE_PROBE,