sampling: fix off-by-one padding error

This commit is contained in:
Roman Zeyde
2014-08-19 17:53:20 +03:00
parent 30d138dcbc
commit 1348ab3ba2
2 changed files with 2 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ class Sampler(object):
self.width = self.interp.width
# TODO: explain indices arithmetic
padding = [0.0] * (self.interp.width - 1)
padding = [0.0] * self.interp.width
self.src = itertools.chain(padding, src)
self.offset = self.interp.width + 1
self.buff = np.zeros(self.interp.coeff_len)

View File

@@ -11,7 +11,7 @@ def test_resample():
dst = BytesIO()
sampling.resample(src=src, dst=dst, df=0.0)
y = common.loads(dst.getvalue())
err = x[1:len(y)+1] - y
err = x[:len(y)] - y
assert np.max(np.abs(err)) < 1e-4
dst = BytesIO()