From f12fef4aa9836128e4eaf99bf38fd94a921103af Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 13 Mar 2016 11:35:35 +0000 Subject: [PATCH] fix compile --- TODO | 15 ++++++++++++--- libvips/resample/reducev.cpp | 4 ++-- libvips/resample/resize.c | 2 +- test/test_create.py | 6 +++--- test/test_resample.py | 2 +- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/TODO b/TODO index 26e3d060..63ebaf48 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,17 @@ -- rename l3 on top of reduce +- try: -- need tests for reducel3, test every kernel plues every numeric type + $ ./test_resample.py TestResample.test_reduce + File "./test_resample.py", line 129, in test_reduce + self.assertLess(d, 5) + AssertionError: 147.0 not less than 5 -- try orc version of reducev? + affine bicubic != reduce cubic + + displacement error, I guess? + +- need more tests for reduce, test every kernel plus every numeric type + +- try orc version of reducev? and shrinkv? maybe shrinkh? diff --git a/libvips/resample/reducev.cpp b/libvips/resample/reducev.cpp index 765e6e02..6dd1537f 100644 --- a/libvips/resample/reducev.cpp +++ b/libvips/resample/reducev.cpp @@ -120,7 +120,7 @@ reducev_unsigned_uint8_6tab( VipsPel *out, const VipsPel *in, { const int l1 = lskip; const int l2 = l1 + l1; - const int = l1 + l2; + const int l3 = l1 + l2; const int l4 = l2 + l2; const int l5 = l4 + l1; @@ -136,7 +136,7 @@ reducev_unsigned_uint8_6tab( VipsPel *out, const VipsPel *in, c0 * in[0] + c1 * in[l1] + c2 * in[l2] + - c3 * in[] + + c3 * in[l3] + c4 * in[l4] + c5 * in[l5] ); diff --git a/libvips/resample/resize.c b/libvips/resample/resize.c index 16002720..590227b8 100644 --- a/libvips/resample/resize.c +++ b/libvips/resample/resize.c @@ -217,7 +217,7 @@ vips_resize_build( VipsObject *object ) vips_info( class->nickname, "residual reduce by %g x %g", hresidual, vresidual ); - if( vips_reducel3( in, &t[2], + if( vips_reduce( in, &t[2], 1.0 / hresidual, 1.0 / vresidual, NULL ) ) return( -1 ); in = t[2]; diff --git a/test/test_create.py b/test/test_create.py index 6fdb71d2..70454b42 100755 --- a/test/test_create.py +++ b/test/test_create.py @@ -110,8 +110,8 @@ class TestCreate(unittest.TestCase): def test_gaussmat(self): im = Vips.Image.gaussmat(1, 0.1) - self.assertEqual(im.width, 7) - self.assertEqual(im.height, 7) + self.assertEqual(im.width, 5) + self.assertEqual(im.height, 5) self.assertEqual(im.bands, 1) self.assertEqual(im.format, Vips.BandFormat.DOUBLE) self.assertEqual(im.max(), 20) @@ -123,7 +123,7 @@ class TestCreate(unittest.TestCase): im = Vips.Image.gaussmat(1, 0.1, separable = True, precision = "float") - self.assertEqual(im.width, 7) + self.assertEqual(im.width, 5) self.assertEqual(im.height, 1) self.assertEqual(im.bands, 1) self.assertEqual(im.format, Vips.BandFormat.DOUBLE) diff --git a/test/test_resample.py b/test/test_resample.py index 4c9c2c21..75161781 100755 --- a/test/test_resample.py +++ b/test/test_resample.py @@ -121,7 +121,7 @@ class TestResample(unittest.TestCase): for fac in [1, 1.1, 1.5, 1.999]: for fmt in all_formats: x = im.cast(fmt) - r = x.reduce(fac, fac) + r = x.reduce(fac, fac, kernel = "cubic") a = x.affine([1.0 / fac, 0, 0, 1.0 / fac], interpolate = bicubic, oarea = [0, 0, x.width / fac, x.height / fac])