Improve the gain stepping difference check

Given the more stable stepping now in use, check that the total difference is
enough for perceptible transition, instead of the step itself.
This commit is contained in:
Chris Robinson
2018-09-22 08:26:52 -07:00
parent 36a6b9d42a
commit 77a53594ba
3 changed files with 15 additions and 12 deletions
+7 -6
View File
@@ -108,21 +108,22 @@ void Mix_C(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[
ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos,
ALsizei BufferSize)
{
ALfloat gain, delta, step;
const ALfloat delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f;
ALsizei c;
ASSUME(OutChans > 0);
ASSUME(BufferSize > 0);
delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f;
for(c = 0;c < OutChans;c++)
{
ALsizei pos = 0;
gain = CurrentGains[c];
step = (TargetGains[c] - gain) * delta;
if(fabsf(step) > FLT_EPSILON)
ALfloat gain = CurrentGains[c];
const ALfloat diff = TargetGains[c] - gain;
if(fabsf(diff) > FLT_EPSILON)
{
ALsizei minsize = mini(BufferSize, Counter);
const ALfloat step = diff * delta;
ALfloat step_count = 0.0f;
for(;pos < minsize;pos++)
{
@@ -158,7 +159,7 @@ void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict
for(c = 0;c < InChans;c++)
{
ALfloat gain = Gains[c];
const ALfloat gain = Gains[c];
if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD))
continue;
+4 -3
View File
@@ -179,11 +179,12 @@ void Mix_Neon(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffe
{
ALsizei pos = 0;
ALfloat gain = CurrentGains[c];
const ALfloat step = (TargetGains[c] - gain) * delta;
const ALfloat diff = TargetGains[c] - gain;
if(fabsf(step) > FLT_EPSILON)
if(fabsf(diff) > FLT_EPSILON)
{
ALsizei minsize = mini(BufferSize, Counter);
const ALfloat step = diff * delta;
ALfloat step_count = 0.0f;
/* Mix with applying gain steps in aligned multiples of 4. */
if(LIKELY(minsize > 3))
@@ -260,7 +261,7 @@ void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restr
for(c = 0;c < InChans;c++)
{
ALsizei pos = 0;
ALfloat gain = Gains[c];
const ALfloat gain = Gains[c];
if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD))
continue;
+4 -3
View File
@@ -149,11 +149,12 @@ void Mix_SSE(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer
{
ALsizei pos = 0;
ALfloat gain = CurrentGains[c];
const ALfloat step = (TargetGains[c] - gain) * delta;
const ALfloat diff = TargetGains[c] - gain;
if(fabsf(step) > FLT_EPSILON)
if(fabsf(diff) > FLT_EPSILON)
{
ALsizei minsize = mini(BufferSize, Counter);
const ALfloat step = diff * delta;
ALfloat step_count = 0.0f;
/* Mix with applying gain steps in aligned multiples of 4. */
if(LIKELY(minsize > 3))
@@ -227,7 +228,7 @@ void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restri
for(c = 0;c < InChans;c++)
{
ALsizei pos = 0;
ALfloat gain = Gains[c];
const ALfloat gain = Gains[c];
if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD))
continue;