Commit Graph

130 Commits

Author SHA1 Message Date
Nigel Tao
415cb3b420 draw: add Scale and Transform fast paths for YCbCr src images.
benchmark                      old ns/op      new ns/op     delta
BenchmarkScaleLargeDownNN      3239565        1044458       -67.76%
BenchmarkScaleLargeDownAB      12162059       3205972       -73.64%
BenchmarkScaleLargeDownBL      1437923310     358229213     -75.09%
BenchmarkScaleLargeDownCR      2844139449     651228380     -77.10%
BenchmarkScaleSrcYCbCr         12413692       3176042       -74.42%
BenchmarkTformABSrcYCbCr       8363947        2163052       -74.14%
BenchmarkTformCRSrcYCbCr       49944171       11652821      -76.67%

Change-Id: I8cd5ab20aa1f516114599690cab037441a328aec
Reviewed-on: https://go-review.googlesource.com/7796
Reviewed-by: Rob Pike <r@golang.org>
2015-03-20 00:55:56 +00:00
Nigel Tao
c62001d39b draw: optimize Kernel.Transform.
benchmark                      old ns/op      new ns/op      delta
BenchmarkTformCRSrcGray        6111610        5344117        -12.56%
BenchmarkTformCRSrcNRGBA       62070281       59295178       -4.47%
BenchmarkTformCRSrcRGBA        13840290       10612547       -23.32%
BenchmarkTformCRSrcUniform     591637         587621         -0.68%
BenchmarkTformCRSrcYCbCr       72219184       69404747       -3.90%

As of current origin/master, Gray and RGBA have fast paths but the other src
image types do not. They have more fat, so the relative improvement is smaller.

Change-Id: Ibbae91cd3cb3c139efb1dcc8fda1cb6432505189
Reviewed-on: https://go-review.googlesource.com/7794
Reviewed-by: Rob Pike <r@golang.org>
2015-03-19 21:20:14 +00:00
Nigel Tao
ffd1dee1b5 draw: add a fast path for NRGBA src images.
benchmark                      old ns/op      new ns/op      delta
BenchmarkScaleSrcNRGBA         14142583       2043782        -85.55%
BenchmarkTformABSrcNRGBA       9846421        1993564        -79.75%
BenchmarkTformCRSrcNRGBA       62041569       13866457       -77.65%

Change-Id: I1edf699dfc6436c0da7e3ab221684406ab1e362f
Reviewed-on: https://go-review.googlesource.com/7793
Reviewed-by: Rob Pike <r@golang.org>
2015-03-19 21:00:06 +00:00
Nigel Tao
5fe9683216 draw: change tweaks to be at end-of-line, not start-of-line.
I think it reads better that way.

Change-Id: I770fdb6362d2a281f7c62cabade186725daced9b
Reviewed-on: https://go-review.googlesource.com/7714
Reviewed-by: Rob Pike <r@golang.org>
2015-03-19 06:15:25 +00:00
Nigel Tao
ad68cd9759 draw: distinguish YCbCr fast paths by their chroma subsample ratios.
These code paths aren't actually fast yet. That will be a follow-up
change.

Change-Id: I814992573cc6af422e49d0ddf336003e662897a5
Reviewed-on: https://go-review.googlesource.com/7791
Reviewed-by: Rob Pike <r@golang.org>
2015-03-19 00:59:56 +00:00
Josh Bleecher Snyder
5afc4bbba5 image: add codereview.cfg
See golang.org/cl/4131 for context.

Change-Id: If30a8f22fe02ef58e94ee3c90afc065d9cd954d0
Reviewed-on: https://go-review.googlesource.com/7723
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-18 17:04:05 +00:00
Nigel Tao
2f47ec36fb draw: add a fast path for Gray src images.
benchmark                      old ns/op      new ns/op      delta
BenchmarkScaleSrcGray          9296680        552705         -94.05%
BenchmarkTformABSrcGray        6323894        817986         -87.07%
BenchmarkTformCRSrcGray        39229583       4193194        -89.31%

Change-Id: Ie7d43dfe323d49b245b47c3206b5aad2b50cb7fb
Reviewed-on: https://go-review.googlesource.com/7711
Reviewed-by: Rob Pike <r@golang.org>
2015-03-18 06:04:53 +00:00
Nigel Tao
ff75b2d824 draw: have TestSrcTranslationInvariance work on smaller images.
Before/after:
$ go test
PASS
ok      golang.org/x/image/draw 1.173s
$ go test
PASS
ok      golang.org/x/image/draw 0.225s

Change-Id: I5b4742f045870db9353da1d85b0677be992cb347
Reviewed-on: https://go-review.googlesource.com/7712
Reviewed-by: Rob Pike <r@golang.org>
2015-03-18 06:02:26 +00:00
Nigel Tao
a71fdfe7d1 draw: implement Kernel.Transform.
Also fix the NN and ABL fast paths to only apply if we can access the
Pix elements without src-bounds checking.

Change-Id: Ie9fc96b28e0665df49d00c4c53cb81385faee4db
Reviewed-on: https://go-review.googlesource.com/7675
Reviewed-by: Rob Pike <r@golang.org>
2015-03-17 23:09:51 +00:00
Nigel Tao
9b6f4595fb draw: actually use type-specific Transform code paths.
I simply forgot to do this in the previous change.

Change-Id: I0ea5d6bb0a09154cb995a665476ffceb155bd49e
Reviewed-on: https://go-review.googlesource.com/7651
Reviewed-by: Rob Pike <r@golang.org>
2015-03-17 01:16:05 +00:00
Nigel Tao
87013da148 draw: implement NearestNeighbor and ApproxBiLinear Transform.
Change-Id: I70a5e3703dea436354e9591fce7b704ec749c2d1
Reviewed-on: https://go-review.googlesource.com/7541
Reviewed-by: Rob Pike <r@golang.org>
2015-03-16 23:32:22 +00:00
Nigel Tao
ab1ce1a88c draw: make example_test more example-like, by being outside "package
draw".

Change-Id: Ie65c96a81250866c5813d4e3a8843b1168ed5579
Reviewed-on: https://go-review.googlesource.com/7612
Reviewed-by: Rob Pike <r@golang.org>
2015-03-15 21:34:34 +00:00
Nigel Tao
4bf24024c9 draw: add a test for src translation invariance.
Change-Id: Iedd4cc4e2b88c5fa9e4fcd547756588e4d87bfff
Reviewed-on: https://go-review.googlesource.com/7471
Reviewed-by: Rob Pike <r@golang.org>
2015-03-12 23:26:12 +00:00
Nigel Tao
efa0c0977f draw: implement Copy; add an example_test.
Change-Id: Ia9cceac17c0326702530eac3a205308b02b85986
Reviewed-on: https://go-review.googlesource.com/7262
Reviewed-by: Rob Pike <r@golang.org>
2015-03-11 22:37:25 +00:00
Nigel Tao
08593990c4 draw: add Transformer and Option types.
Just stub implementations for now. Actual implementations will be
follow-up changes.

Change-Id: Id21d9042a2073c2dc0f78c9977c4940f000a41df
Reviewed-on: https://go-review.googlesource.com/6805
Reviewed-by: Rob Pike <r@golang.org>
2015-03-10 00:41:02 +00:00
Nigel Tao
7bd522e167 math/f32, math/f64: add a comment that "Aff" stands for affine
transformation.

Change-Id: Ia5762d0578f78b17d85f4a952b397a05e6927bd0
Reviewed-on: https://go-review.googlesource.com/6914
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-06 02:15:01 +00:00
Nigel Tao
93a98e7805 draw: fix a comment typo.
Change-Id: I6d34d091514915333e488cee9e2ddb5a9d78b6a5
Reviewed-on: https://go-review.googlesource.com/6801
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-03-05 00:26:58 +00:00
Nigel Tao
2c27a34d37 draw: make Scale an Interpolator method instead of a function.
This means that only Kernel values have a NewScaler method, which
re-uses computation when scaling multiple images of the same dst and src
dimensions. The NearestNeighbor and ApproxBiLinear scalers don't get any
pre-computation to re-use, so don't need a NewScaler method just to
satisfy the previous Interpolator interface. As a small bonus, NN.Scale
and ABL.Scale should no longer allocate on the fast paths.

This change is consistent the upcoming Transformer method, so that the
Interpolator interface will be

type Interpolator interface {
	Scale(etc)
	Transform(etc)
}

instead of

type Interpolator interface {
	NewScaler(etc) Scaler
	Transform(etc)
}

I don't have a good theory for why the "func (ablInterpolator)
scale_RGBA_RGBA" benchmark is such a dramatic improvement, but at least
it's in the right direction. I'm calling the other benchmark changes as
noise.

benchmark                     old ns/op      new ns/op      delta
BenchmarkScaleLargeDownNN     3233406        3169060        -1.99%
BenchmarkScaleLargeDownAB     12018178       12011348       -0.06%
BenchmarkScaleLargeDownBL     1420827834     1409335695     -0.81%
BenchmarkScaleLargeDownCR     2820669690     2795534035     -0.89%
BenchmarkScaleDownNN          866628         869241         +0.30%
BenchmarkScaleDownAB          3175963        3216041        +1.26%
BenchmarkScaleDownBL          26639767       26677003       +0.14%
BenchmarkScaleDownCR          51720996       51621628       -0.19%
BenchmarkScaleUpNN            42758485       43258611       +1.17%
BenchmarkScaleUpAB            156693813      156943367      +0.16%
BenchmarkScaleUpBL            69511444       69621698       +0.16%
BenchmarkScaleUpCR            124530191      124885601      +0.29%
BenchmarkScaleSrcGray         8992205        9129321        +1.52%
BenchmarkScaleSrcNRGBA        9807837        9894466        +0.88%
BenchmarkScaleSrcRGBA         1333188        1104282        -17.17%
BenchmarkScaleSrcUniform      1147788        1162488        +1.28%
BenchmarkScaleSrcYCbCr        12164542       12305373       +1.16%

Change-Id: I2aee6c392eb7437e843260775aed97ce145b4d47
Reviewed-on: https://go-review.googlesource.com/6556
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 22:50:18 +00:00
Nigel Tao
7c413c859c draw: rename an internal function argument.
This will lessen the diff in a follow-up change.

Change-Id: I67257b935e4b5fc6fcc462c83910a3f09f26702f
Reviewed-on: https://go-review.googlesource.com/6554
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-03-03 05:04:25 +00:00
Nigel Tao
7283107efc math/f32, math/f64: add Aff3 and Aff4 types.
Change-Id: I504a070cf178aa688090ba50136db06856c16f73
Reviewed-on: https://go-review.googlesource.com/6552
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-03 04:33:37 +00:00
Nigel Tao
4f76d37dff math/f32, math/f64: new packages for vector and matrix types.
Change-Id: I937d16429d7321360d0b9f3a811f8d3d719e9bff
Reviewed-on: https://go-review.googlesource.com/6076
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Stephen Gutekanst <stephen.gutekanst@gmail.com>
2015-03-02 00:58:44 +00:00
Nigel Tao
f510ad81a1 draw: generate code paths for image.Gray sources.
Optimizing this code path will be follow-up changes.

Change-Id: Ifece6c7d3685bb8f2d20cf8828a121c9ff346434
Reviewed-on: https://go-review.googlesource.com/6238
Reviewed-by: Rob Pike <r@golang.org>
2015-02-28 21:42:51 +00:00
Nigel Tao
b57ddf1b68 draw: RGBA src fast path for scaling.
benchmark                     old ns/op      new ns/op      delta
BenchmarkScaleSrcRGBA         15124800       2091946        -86.17%

Change-Id: Id8d3088793ebf1d75b929fcf6945987817e87463
Reviewed-on: https://go-review.googlesource.com/6234
Reviewed-by: Rob Pike <r@golang.org>
2015-02-28 01:27:59 +00:00
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
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
Andrew Gerrand
5869597f23 doc: add CONTRIBUTING.md
Change-Id: Ica8168a510824e9519902a3b660025bcf913f762
Reviewed-on: https://go-review.googlesource.com/5413
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-20 05:00:47 +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
Alex Brainman
7f6859d385 image: copying .gitattributes to all subrepositories
Fixes #9281

Change-Id: I9e807f826e8c48fef35cb1de08c89d37845e8721
Reviewed-on: https://go-review.googlesource.com/2075
Reviewed-by: Minux Ma <minux@golang.org>
2014-12-23 11:05:35 +00:00
David Symonds
0351284b2d image: add import comments.
Change-Id: I2d3a1d002ad43af24cd8b451a2cae4c217482675
Reviewed-on: https://go-review.googlesource.com/1237
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 22:43:18 +00:00
David Symonds
b0cc87690b remove codereview.cfg. 2014-12-08 10:59:03 +11:00
David Symonds
95b61cf7c4 convert .hgignore to .gitignore. 2014-12-08 10:42:30 +11:00
Andrew Gerrand
2e99ef522d go.image: use golang.org/x/... import paths
LGTM=bradfitz, rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/169090043
2014-11-10 08:52:14 +11:00
Nigel Tao
c087821dc6 go.image/webp: implement alpha filtering and uncompressed alpha.
This passes the four new alpha_*.webp conformance tests referred to in
https://golang.org/cl/162850043/#msg7

LGTM=pascal.massimino, r
R=r, pascal.massimino
CC=golang-codereviews
https://golang.org/cl/163630043
2014-10-31 17:06:42 +11:00
Nigel Tao
013424077b go.image/riff: new package.
Also update package webp to use package riff.

LGTM=r
R=r
CC=golang-codereviews, pascal.massimino
https://golang.org/cl/162850043
2014-10-23 08:59:14 +11:00
Nigel Tao
ef5e0288ce go.image/webp: implement lossy-with-alpha.
This fixes all three lossy_alpha*.webp conformance tests.

The test data was generated by cwebp/dwebp version 0.4.1:
cwebp yellow_rose.png -o yellow_rose.lossy-with-alpha.webp
dwebp yellow_rose.lossy-with-alpha.webp -pgm -o tmp.pgm
convert tmp.pgm yellow_rose.lossy-with-alpha.webp.nycbcra.png

LGTM=pascal.massimino, r
R=r, pascal.massimino
CC=golang-codereviews
https://golang.org/cl/154350043
2014-10-20 10:46:12 +11:00
Nigel Tao
d354b8dda9 go.image/webp/nycbcra: new package.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/147500043
2014-10-08 14:30:35 +11:00
Nigel Tao
8d4fc1653b go.image/bmp: add a test image for top-down BMPs.
LGTM=ruiu
R=ruiu
CC=bsiegert, golang-codereviews
https://golang.org/cl/149090043
2014-10-01 09:41:12 +10:00
Nigel Tao
8a2d4aba20 go.image/vp8: clamp the UV DC quantization factor to 132.
This fixes the lossy_extreme_probabilities.webp conformance test.

LGTM=pascal.massimino, r
R=r, pascal.massimino
CC=golang-codereviews
https://golang.org/cl/145600043
2014-10-01 09:39:28 +10:00
Nigel Tao
3bcf25db01 go.image/bmp: support decoding 32-bit BMPs, as well as top-down BMPs.
Tested manually, from "dwebp -bmp" output. dwebp comes from
https://developers.google.com/speed/webp/download

LGTM=bsiegert
R=bsiegert
CC=golang-codereviews
https://golang.org/cl/148020043
2014-09-26 11:11:55 +10:00
Nigel Tao
a704c116ac go.image/vp8l: use the default code length for repeated codes.
This fixes the lossless_vec_2_13.webp conformance test.

LGTM=r
R=r, pascal.massimino
CC=golang-codereviews
https://golang.org/cl/143610043
2014-09-26 11:09:06 +10:00
Nigel Tao
96df300f7f go.image/cmd/webp-manual-test: new program to test Go's WEBP
compatibility with the C libwebp implementation.

Current status:
104 PASS, 5 FAIL, 109 TOTAL
Of those 5 failures, 3 are because Go doesn't support lossy-with-alpha
yet, and the other 2 (lossless_vec_2_13.webp,
lossy_extreme_probabilities.webp) look like genuine bugs.

LGTM=r
R=r, pascal.massimino
CC=golang-codereviews
https://golang.org/cl/150000043
2014-09-25 09:44:20 +10:00
Nigel Tao
95764ac466 vp8l: update comments to match latest spec.
The spec change is at
https://gerrit.chromium.org/gerrit/#/c/71605/

LGTM=robsc
R=robsc
CC=golang-codereviews
https://golang.org/cl/146910043
2014-09-22 12:52:41 +10:00
Nigel Tao
34eb6b7c8b go.image/tiff: remove unreachable code.
This makes "go vet code.google.com/p/go.image/..." happy.

LGTM=dsymonds
R=dsymonds
CC=golang-codereviews
https://golang.org/cl/103630047
2014-06-30 11:43:54 +10:00
Nigel Tao
07fcf9c2fe vp8: skip filtering for all-zero-DC macroblock residuals.
This makes the Go code match the libwebp C code's output on
blue-purple-pink-large.*-filter.lossy.webp

Also make the various WEBP benchmarks all decode a similar image,
the image at http://blog.golang.org/gophercon/image01.jpg, to make
it more meaningful to e.g. compare the simple filter's numbers with
the normal filter's numbers.

Also fix a "go vet" warning in webp/decode.go.

The test data was generated by:
wget http://blog.golang.org/gophercon/image01.jpg -O blue-purple-pink-large.jpeg
convert blue-purple-pink-large.jpeg blue-purple-pink-large.png
cwebp -lossless blue-purple-pink-large.png -o blue-purple-pink-large.lossless.webp
cwebp -q 80 -f 0 blue-purple-pink-large.png -o blue-purple-pink-large.no-filter.lossy.webp
cwebp -q 80 -strong blue-purple-pink-large.png -o blue-purple-pink-large.normal-filter.lossy.webp
cwebp -q 80 -nostrong blue-purple-pink-large.png -o blue-purple-pink-large.simple-filter.lossy.webp
dwebp -pgm blue-purple-pink-large.no-filter.lossy.webp -o tmp.pgm && convert tmp.pgm blue-purple-pink-large.no-filter.lossy.webp.ycbcr.png && rm tmp.pgm
dwebp -pgm blue-purple-pink-large.normal-filter.lossy.webp -o tmp.pgm && convert tmp.pgm blue-purple-pink-large.normal-filter.lossy.webp.ycbcr.png && rm tmp.pgm
dwebp -pgm blue-purple-pink-large.simple-filter.lossy.webp -o tmp.pgm && convert tmp.pgm blue-purple-pink-large.simple-filter.lossy.webp.ycbcr.png && rm tmp.pgm

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/106230044
2014-06-30 10:36:25 +10:00
Rui Ueyama
dc115882f1 go.image/vp8: use branch-free abs
This change seems to restore performance to
the level before CL 108140045.

benchmark                         old ns/op    new ns/op    delta
BenchmarkDecodeVP8SimpleFilter       796416       784394   -1.51%
BenchmarkDecodeVP8NormalFilter      4931138      4693078   -4.83%
BenchmarkDecodeVP8L                 7820030      7821796   +0.02%

LGTM=nigeltao, r
R=nigeltao, r
CC=golang-codereviews
https://golang.org/cl/107340047
2014-06-30 10:33:37 +10:00
Nigel Tao
f8a86727c2 go.image/vp8: remove the filter look-up tables.
The benchmarks are a little slower, but the code is shorter.

benchmark                          old ns/op     new ns/op     delta
BenchmarkDecodeVP8SimpleFilter     621950        644184        +3.57%
BenchmarkDecodeVP8NormalFilter     4045745       4269431       +5.53%

LGTM=r
R=r, minux, ruiu
CC=golang-codereviews
https://golang.org/cl/108140045
2014-06-27 09:14:15 +10:00