Nigel Tao
2a40e8dacf
draw: RGBA dst fast path for scaling.
...
benchmark old ns/op new ns/op delta
BenchmarkScaleLargeDownNN 6124873 3348203 -45.33%
BenchmarkScaleLargeDownAB 15608417 12626534 -19.10%
BenchmarkScaleLargeDownBL 1503354937 1482605150 -1.38%
BenchmarkScaleLargeDownCR 2987623786 2937846270 -1.67%
BenchmarkScaleDownNN 1793478 935896 -47.82%
BenchmarkScaleDownAB 4277596 3405613 -20.38%
BenchmarkScaleDownBL 29932226 29268085 -2.22%
BenchmarkScaleDownCR 57563042 57322266 -0.42%
BenchmarkScaleUpNN 89694138 46216098 -48.47%
BenchmarkScaleUpAB 212318283 169267373 -20.28%
BenchmarkScaleUpBL 120899444 80215032 -33.65%
BenchmarkScaleUpCR 181116518 140140247 -22.62%
BenchmarkScaleSrcNRGBA 13229017 10620746 -19.72%
BenchmarkScaleSrcRGBA 12993292 10155919 -21.84%
BenchmarkScaleSrcUniform 3964808 1146947 -71.07%
BenchmarkScaleSrcYCbCr 15871184 12779895 -19.48%
Change-Id: I7d92bd9f4c20692c5a52ea31019fe3852e657535
Reviewed-on: https://go-review.googlesource.com/6230
Reviewed-by: Rob Pike <r@golang.org>
2015-02-27 06:36:42 +00:00
Nigel Tao
db892dd957
draw: clip scaling to the dst bounds.
...
This is necessary for the upcoming RGBA dst fast path. The RGBA.Set slow
path will clip automatically. Accessing RGBA.Pix directly will not.
Benchmarks look like noise to me:
benchmark old ns/op new ns/op delta
BenchmarkScaleLargeDownNN 6212108 6131166 -1.30%
BenchmarkScaleLargeDownAB 15586042 15656681 +0.45%
BenchmarkScaleLargeDownBL 1518783517 1508124217 -0.70%
BenchmarkScaleLargeDownCR 2998969089 2978114154 -0.70%
BenchmarkScaleDownNN 1821187 1809314 -0.65%
BenchmarkScaleDownAB 4286983 4248974 -0.89%
BenchmarkScaleDownBL 29396818 30181926 +2.67%
BenchmarkScaleDownCR 56441945 57952417 +2.68%
BenchmarkScaleUpNN 90325384 89734496 -0.65%
BenchmarkScaleUpAB 211613922 211625435 +0.01%
BenchmarkScaleUpBL 119730880 120817135 +0.91%
BenchmarkScaleUpCR 178592665 182305702 +2.08%
BenchmarkScaleSrcNRGBA 13271034 13210760 -0.45%
BenchmarkScaleSrcRGBA 13082234 12997551 -0.65%
BenchmarkScaleSrcUniform 4003966 3934184 -1.74%
BenchmarkScaleSrcYCbCr 15939182 15900123 -0.25%
Change-Id: Ibf2843bb3c4eb695b58030e7314053c669533016
Reviewed-on: https://go-review.googlesource.com/6073
Reviewed-by: Rob Pike <r@golang.org>
2015-02-26 22:56:31 +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