diff options
author | Chris Robinson <[email protected]> | 2018-09-29 09:47:05 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-09-29 09:47:05 -0700 |
commit | 0396c0ecd2a10ed74cf1f75e58242b1595598b2e (patch) | |
tree | 7c4c413017686e404a04768afcde6183ce7b659f /Alc | |
parent | 51a447852f17b19144e879601cdfa09a6bbdc3bd (diff) |
Add some assumes for the limiter
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/mastering.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Alc/mastering.c b/Alc/mastering.c index e7908828..306f0941 100644 --- a/Alc/mastering.c +++ b/Alc/mastering.c @@ -79,6 +79,9 @@ static void LinkChannels(Compressor *Comp, const ALsizei SamplesToDo, ALfloat (* ALfloat *restrict sideChain = Comp->SideChain; ALsizei c, i; + ASSUME(SamplesToDo > 0); + ASSUME(numChans > 0); + for(i = 0;i < SamplesToDo;i++) sideChain[(index + i) & mask] = 0.0f; @@ -109,6 +112,8 @@ static void CrestDetector(Compressor *Comp, const ALsizei SamplesToDo) ALfloat y2_rms = Comp->LastRmsSq; ALsizei i; + ASSUME(SamplesToDo > 0); + for(i = 0;i < SamplesToDo;i++) { ALfloat x_abs = sideChain[(index + i) & mask]; @@ -134,6 +139,8 @@ static void PeakDetector(Compressor *Comp, const ALsizei SamplesToDo) ALfloat *restrict sideChain = Comp->SideChain; ALsizei i; + ASSUME(SamplesToDo > 0); + for(i = 0;i < SamplesToDo;i++) { ALuint offset = (index + i) & mask; @@ -155,6 +162,8 @@ static void PeakHoldDetector(Compressor *Comp, const ALsizei SamplesToDo) SlidingHold *hold = Comp->Hold; ALsizei i; + ASSUME(SamplesToDo > 0); + for(i = 0;i < SamplesToDo;i++) { ALsizei offset = (index + i) & mask; @@ -201,6 +210,8 @@ static void GainCompressor(Compressor *Comp, const ALsizei SamplesToDo) ALfloat c_dev = Comp->LastGainDev; ALsizei i; + ASSUME(SamplesToDo > 0); + for(i = 0;i < SamplesToDo;i++) { const ALfloat y2_crest = crestFactor[i]; @@ -291,6 +302,9 @@ static void SignalDelay(Compressor *Comp, const ALsizei SamplesToDo, ALfloat (*r ALfloat (*restrict delay)[BUFFERSIZE] = Comp->Delay; ALsizei c, i; + ASSUME(SamplesToDo > 0); + ASSUME(numChans > 0); + for(c = 0;c < numChans;c++) { for(i = 0;i < SamplesToDo;i++) @@ -410,6 +424,9 @@ void ApplyCompression(Compressor *Comp, const ALsizei SamplesToDo, ALfloat (*res ALfloat *restrict sideChain = Comp->SideChain; ALsizei c, i; + ASSUME(SamplesToDo > 0); + ASSUME(numChans > 0); + if(preGain != 1.0f) { for(c = 0;c < numChans;c++) |