Commit Graph

24 Commits

Author SHA1 Message Date
Accipiter Nisus
f3cac2f865 Fix to resize correctly when source image.Bounds().Min is not (0,0) 2014-06-16 13:53:36 +10:00
jst
9884534579 Cache kernel weights for each row.
For each row the convolution kernel is evaluated at fixed positions around "u". By calculating these values once for each row, a huge speedup is achieved.
2014-01-28 18:48:08 +01:00
jst
7c5018c82b Extract method "resizeSlice" to reduce duplicate code. 2014-01-17 19:05:30 +01:00
jst
f8ec710330 Fix wrong calculation of second adjust parameter. 2013-11-23 18:38:06 +01:00
jst
d9287fbcb6 Use x,y as coordinates of the origin image. 2013-11-23 18:02:18 +01:00
jst
d1bef9bdb6 Refactoring 2013-11-18 20:19:56 +01:00
jst
494d8de4e5 Speedup calculation by exploiting the separability of the resizing filter.
Should be ~5x faster! More optimization will follow.

before:
> go test -bench .
PASS
Benchmark_BigResizeLanczos3-4	       1	2438137093 ns/op
Benchmark_BigResizeLanczos3Lut-4	       1	1157612362 ns/op
Benchmark_Reduction-4	       2	 743950618 ns/op

after:
> go test -bench .
PASS
Benchmark_BigResizeLanczos3-4	       5	 403685685 ns/op
Benchmark_BigResizeLanczos3Lut-4	      10	 225539497 ns/op
Benchmark_Reduction-4	      10	 207004759 ns/op
2013-11-18 19:54:31 +01:00
jst
852f4a47e7 Merge branch 'no-image-shift' of http://github.com/jsummers/nfnt.resize
Merge branch 'fix-canvas-size-issue'
2013-03-10 11:33:44 +01:00
jst
b6fef854bc Merge branch 'improve-canvas-size' of http://github.com/jsummers/nfnt.resize into fix-canvas-size-issue 2013-03-10 10:46:06 +01:00
jst
dd1c157427 Include kernel boundary check
Filter kernels should yield Zero if they are evaluted outside their
intended size. Though filterModel.Interpolate doesn't do this by design,
it's better to include it anyways.
2012-12-10 18:56:53 +01:00
Jason Summers
cdbd68f34f Improve the way the new canvas size is calculated
If both dimensions are given, always use those dimensions, avoiding roundoff
error.

If only one dimension is given, slightly prefer rounding the other dimension
up, to rounding it down.
2012-11-27 20:49:01 -05:00
Jason Summers
3d9094eb9e Center the resized image on the canvas, instead of shifting it slightly 2012-11-27 20:38:19 -05:00
jst
3e06045c3f Speed up computation: Try to avoid Image.At() as much as possible -> specialized color access for some image types 2012-09-21 20:02:25 +02:00
jst
e548f52385 Blur input image during downscaling by scaling the filter kernel to prevent moires in the output image 2012-09-19 21:03:56 +02:00
jst
e96bbe5547 Unify filters and their dependencies 2012-09-15 20:24:14 +02:00
jst
eaf9383af0 filters.go simplified 2012-09-14 23:12:05 +02:00
jst
339b8fd43a Speed up calculation by avoiding dynamic casting 2012-09-01 00:21:10 +02:00
jst
294efa80bb Prevent resize from doing things multiple times if #CPUs > width 2012-08-23 19:36:02 +02:00
jst
9041d4db18 Function signature changed again, no need for multiple return value 2012-08-09 18:58:57 +02:00
jst
14d51db8b4 Changed function signature to include error handling. Filters simplified. 2012-08-08 21:32:51 +02:00
nfnt
f725c68998 fixed typo, thanks liuben 2012-08-06 21:49:02 +02:00
nfnt
2d612957ed fixed typo 2012-08-03 18:22:12 +02:00
nfnt
fdc4a64918 Tests added 2012-08-03 18:12:26 +02:00
nfnt
428642c9f1 initial commit 2012-08-02 21:59:40 +02:00