mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
limit reading from input array to 0 .. samples-1
This commit is contained in:
parent
d7acee8494
commit
9334e0339e
1 changed files with 2 additions and 0 deletions
|
|
@ -40,6 +40,8 @@ public:
|
||||||
double x = i * ratio;
|
double x = i * ratio;
|
||||||
int s0 = nearbyint(x);
|
int s0 = nearbyint(x);
|
||||||
int s1 = s0 + TAPS;
|
int s1 = s0 + TAPS;
|
||||||
|
if (s0 < 0 || s1 > samples)
|
||||||
|
continue;
|
||||||
for (int s = s0; s < s1; ++s) {
|
for (int s = s0; s < s1; ++s) {
|
||||||
TYPE k = s - x;
|
TYPE k = s - x;
|
||||||
sum += lpf(k) * input[s * stride];
|
sum += lpf(k) * input[s * stride];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue