Commit Graph

55 Commits

Author SHA1 Message Date
Nigel Tao
284bc4b702 draw: test that the fast path implementations match the generic ones.
Change-Id: I34418bd8e5dec7b03e9c29efdab10f6116b4463f
Reviewed-on: https://go-review.googlesource.com/5730
Reviewed-by: Rob Pike <r@golang.org>
2015-02-26 00:12:42 +00:00
Nigel Tao
748adb17a1 draw: generate impl.go type switches.
This just the type switches to concrete-type-specific methods.
Generating RGBA- or YCbCr-specific code instead of calling the
general-purpose At and Set methods will be follow-up changes.

benchmark                     old ns/op      new ns/op      delta
BenchmarkScaleLargeDownNN     5771212        5766160        -0.09%
BenchmarkScaleLargeDownAB     14057354       14023083       -0.24%
BenchmarkScaleLargeDownBL     1349968635     1347746478     -0.16%
BenchmarkScaleLargeDownCR     2687753329     2678909022     -0.33%
BenchmarkScaleDownNN          1802408        1808723        +0.35%
BenchmarkScaleDownAB          4352978        4284878        -1.56%
BenchmarkScaleDownBL          29760913       29522171       -0.80%
BenchmarkScaleDownCR          57666917       56334005       -2.31%
BenchmarkScaleUpNN            88886450       89235790       +0.39%
BenchmarkScaleUpAB            214687758      213797857      -0.41%
BenchmarkScaleUpBL            119588096      119846371      +0.22%
BenchmarkScaleUpCR            179784111      180662030      +0.49%
BenchmarkScaleSrcUniform      4128528        3855385        -6.62%
BenchmarkScaleSrcNRGBA        13275457       13375039       +0.75%
BenchmarkScaleSrcRGBA         13333672       12812895       -3.91%
BenchmarkScaleSrcYCbCr        14321945       14139071       -1.28%

Change-Id: I28025c3b49186a12d20ee0182a4c8ff9b036d0ae
Reviewed-on: https://go-review.googlesource.com/5712
Reviewed-by: Rob Pike <r@golang.org>
2015-02-24 06:30:29 +00:00
Nigel Tao
999c3975a8 draw: autogenerate impl.go.
Adding fast paths for concrete dst and src image types will be follow-up
changes.

Change-Id: Ib23e3cc46d9c7a52ebd5eddfbad09177b0b421af
Reviewed-on: https://go-review.googlesource.com/5417
Reviewed-by: Rob Pike <r@golang.org>
2015-02-24 00:55:15 +00:00
Nigel Tao
2a1231edb8 draw: factor out the Scale implementations.
This is just a copy/paste/rename in anticipation of automatically
generating fast-path code for specific dst-image types and src-image
types, a la the standard library's image/draw package.

Change-Id: If6385b347cb5e1d134b0ce841ef38ed4450a6fef
Reviewed-on: https://go-review.googlesource.com/5252
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-02-20 07:27:42 +00:00
Nigel Tao
96b77d5c7a draw: new package, a superset of the standard library's image/draw
package, including the ability to scale an image.

Design discussion:
https://groups.google.com/forum/#!topic/golang-dev/B7-OrWdheic

Previous code review (when Go used hg instead of git):
https://codereview.appspot.com/101670045

New benchmarks:
BenchmarkScaleLargeDownNN	     300	   5935174 ns/op
BenchmarkScaleLargeDownAB	     100	  14482372 ns/op
BenchmarkScaleLargeDownBL	       1	1383805986 ns/op
BenchmarkScaleLargeDownCR	       1	2724631789 ns/op
BenchmarkScaleDownNN     	    1000	   1850500 ns/op
BenchmarkScaleDownAB     	     300	   4413499 ns/op
BenchmarkScaleDownBL     	      50	  30498748 ns/op
BenchmarkScaleDownCR     	      20	  58349653 ns/op
BenchmarkScaleUpNN       	      20	  92306475 ns/op
BenchmarkScaleUpAB       	       5	 220103753 ns/op
BenchmarkScaleUpBL       	      10	 122635195 ns/op
BenchmarkScaleUpCR       	      10	 183275927 ns/op

Change-Id: I69d397e68897bae024c7b330a9375fa3e7688591
Reviewed-on: https://go-review.googlesource.com/4210
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 23:20:02 +00:00