Nigel Tao
83686c5479
font/sfnt: parse the glyf table.
...
Change-Id: Ib7ff75d99d3641f68f621db4ba2279cc1bda8c3a
Reviewed-on: https://go-review.googlesource.com/35271
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-01-19 08:01:09 +00:00
Nigel Tao
1ff62c9216
math/fixed: add some Point and Rectangle methods.
...
These are analogous to the image.Point and image.Rectangle methods in
the standard library.
Change-Id: If8997421a9aeb31d29cfe5eefb79cc481a39df82
Reviewed-on: https://go-review.googlesource.com/34753
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-01-06 00:18:22 +00:00
Nigel Tao
3ba119400e
font: fix rectangle-union for empty rectangles.
...
The bounding box of a string does not necessarily contain the origin.
Prior to this commit, BoundString(etc, "x") would call grow exactly
once, with the first argument being the (empty) zero rectangle.
Change-Id: Id7d4f6c250ac0749f6dae19d11f4e97f9c6f45bc
Reviewed-on: https://go-review.googlesource.com/34674
Reviewed-by: Dave Day <djd@golang.org>
2016-12-28 23:11:51 +00:00
Raphael Geronimi
f1b1ff53e1
font: add bounds measurement methods
...
Fixes golang/go#18297
Change-Id: Ib873b18c9bc5cac0d820c6129d9a28cb44f2a8da
Reviewed-on: https://go-review.googlesource.com/34514
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-12-20 10:41:26 +00:00
Nigel Tao
2d771d3c32
font/sfnt: add a Font.Name method.
...
Also make all of the Buffer fields non-exported. LoadGlyph now returns
the segments instead of setting Buffer.Segments for the caller to use.
Change-Id: I3f87070da5e8f014f88dbca70b62a4cd30e3fd66
Reviewed-on: https://go-review.googlesource.com/34532
Reviewed-by: Dave Day <djd@golang.org>
2016-12-20 10:23:14 +00:00
Nigel Tao
ed90ab82a8
font/sfnt: add a comment about contour ordering.
...
Change-Id: I591c735cc1c3108aa806b0a7be6c54152fe2029e
Reviewed-on: https://go-review.googlesource.com/34174
Reviewed-by: Dave Day <djd@golang.org>
2016-12-15 04:48:35 +00:00
Nigel Tao
88b013251f
font/sfnt: implement rrcurveto.
...
Change-Id: I2e24293568b296dd916b2ef6a9c1113ffd5f9253
Reviewed-on: https://go-review.googlesource.com/34171
Reviewed-by: Dave Day <djd@golang.org>
2016-12-12 04:37:57 +00:00
Nigel Tao
ce50dba65c
font/sfnt: parse Type 2 Charstrings.
...
Change-Id: I61beec4611612800a519045e2552c513eb83c3f8
Reviewed-on: https://go-review.googlesource.com/33932
Reviewed-by: Dave Day <djd@golang.org>
2016-12-09 07:38:38 +00:00
Nigel Tao
ae63d5d566
font: add some comments for the XxxBytes methods.
...
Change-Id: I391b539e79d7e35f80d9ee0b8c7c70c2f42e2e99
Reviewed-on: https://go-review.googlesource.com/34095
Reviewed-by: Dave Day <djd@golang.org>
2016-12-08 06:59:50 +00:00
Nigel Tao
e2d0a9f0e6
font/sfnt: parse CFF 2-byte operators and real numbers.
...
Change-Id: I6f2cdfb44817832cf833883ef6fca692a001b6b1
Reviewed-on: https://go-review.googlesource.com/33813
Reviewed-by: Dave Day <djd@golang.org>
2016-12-05 08:11:59 +00:00
Nigel Tao
5286ed5c2a
font/sfnt: parse the CFF table.
...
Parsing the per-glyph Charstrings will be a follow-up commit.
Change-Id: I52f849a77dd7fa14b6e07420820bdfb4347c2438
Reviewed-on: https://go-review.googlesource.com/33593
Reviewed-by: Dave Day <djd@golang.org>
2016-12-01 07:43:55 +00:00
Nigel Tao
c39d899a5b
font/sfnt: new package for parsing SFNT fonts.
...
Updates golang/go#16904
Change-Id: Ic4c55865741b712f7d82448276fc357f2edf9b45
Reviewed-on: https://go-review.googlesource.com/33417
Reviewed-by: Dave Day <djd@golang.org>
2016-11-23 02:01:16 +00:00
Nigel Tao
d2f07f8aaa
font/gofont: add style descriptions to the generated package docs.
...
Fixes golang/go#17964
Change-Id: I3b9f567db7e613a5fcf8fc5e3d4d9f15069fd19b
Reviewed-on: https://go-review.googlesource.com/33370
Reviewed-by: Rob Pike <r@golang.org>
2016-11-18 00:40:29 +00:00
Nigel Tao
b7f8df6bc0
font/gofont: new packages for the Go font family.
...
See https://blog.golang.org/go-fonts for details.
Change-Id: Ib7219ace9ffe49115d975439b85237472167a1c1
Reviewed-on: https://go-review.googlesource.com/33335
Reviewed-by: Rob Pike <r@golang.org>
2016-11-17 02:12:59 +00:00
Nigel Tao
507b1a44bd
vector: measure the fixed point rasterizer's accuracy.
...
When commit 8874bef1
changed ϕ from 10 to 9, this total diff grew from:
Total diff = 3051, n = 208, avg = 14.66827 out of 65535, or 0.02238%.
to:
Total diff = 6412, n = 208, avg = 30.82692 out of 65535, or 0.04704%.
Also fix a comment typo.
Change-Id: I91cc861a3d3ab282b5431cfb141fb010fd1f8d14
Reviewed-on: https://go-review.googlesource.com/32771
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-11-15 01:09:02 +00:00
Nigel Tao
98f3e4e74d
vector: make args float32 pairs instead of f32.Vec2.
...
The f32.Vec2 type doesn't seem worth it.
Change-Id: I021c7e13d7e2dd261334f4aa7e867df4fd8f1c3e
Reviewed-on: https://go-review.googlesource.com/32772
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-11-15 00:52:01 +00:00
Nigel Tao
c78039e8ce
vector: tweak the asm register assignment.
...
This makes the fixed point and floating point code more similar.
Benchmarks don't show any significant change.
Change-Id: I723fa1605eaa248b40e784201b680c16cc3d26a2
Reviewed-on: https://go-review.googlesource.com/32134
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-26 22:33:17 +00:00
Nigel Tao
0ed2caa453
vector: add go1.6 build tag for asm code.
...
Go 1.5 doesn't understand amd64 opcode mnemonics like PADDD or PMULLD.
Change-Id: Ic31ab4d2a8a222ca18288387de40db6ce673d7f1
Reviewed-on: https://go-review.googlesource.com/32132
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-26 22:29:37 +00:00
Nigel Tao
93fad3647f
vector: remove a shift from the inner loop.
...
PSHUFB already lets us pick certain bytes out of an XMM register.
There's no need to shift by 8 bits (1 byte) beforehand.
The code generator is simpler. There's also a small win on the
benchmarks, especially for FixedAccumulateOpOverSIMD.
name old time/op new time/op delta
FixedAccumulateOpOverSIMD16-8 183ns ± 0% 174ns ± 0% -4.92% (p=0.000 n=8+8)
FixedAccumulateOpSrcSIMD16-8 87.0ns ± 1% 86.3ns ± 0% -0.77% (p=0.000 n=10+9)
FixedAccumulateMaskSIMD16-8 80.4ns ± 1% 81.2ns ± 1% +1.01% (p=0.000 n=10+10)
FloatingAccumulateOpOverSIMD16-8 250ns ± 1% 244ns ± 0% -2.39% (p=0.000 n=10+8)
FloatingAccumulateOpSrcSIMD16-8 176ns ± 1% 176ns ± 0% ~ (p=0.142 n=10+8)
FloatingAccumulateMaskSIMD16-8 167ns ± 0% 167ns ± 0% ~ (p=0.137 n=8+10)
FixedAccumulateOpOverSIMD64-8 2.73µs ± 1% 2.58µs ± 0% -5.36% (p=0.000 n=10+7)
FixedAccumulateOpSrcSIMD64-8 1.18µs ± 1% 1.17µs ± 0% -0.33% (p=0.003 n=10+9)
FixedAccumulateMaskSIMD64-8 1.09µs ± 0% 1.09µs ± 0% -0.17% (p=0.047 n=9+9)
FloatingAccumulateOpOverSIMD64-8 3.67µs ± 0% 3.61µs ± 1% -1.47% (p=0.000 n=7+10)
FloatingAccumulateOpSrcSIMD64-8 2.60µs ± 0% 2.61µs ± 0% +0.19% (p=0.003 n=8+8)
FloatingAccumulateMaskSIMD64-8 2.47µs ± 0% 2.46µs ± 0% ~ (p=0.162 n=10+9)
GlyphAlpha16Over-8 2.99µs ± 0% 2.98µs ± 1% -0.50% (p=0.021 n=9+10)
GlyphAlpha16Src-8 2.89µs ± 1% 2.89µs ± 0% ~ (p=0.381 n=10+10)
GlyphAlpha32Over-8 4.53µs ± 0% 4.50µs ± 0% -0.83% (p=0.000 n=10+10)
GlyphAlpha32Src-8 4.14µs ± 0% 4.13µs ± 0% -0.21% (p=0.026 n=9+10)
GlyphAlpha64Over-8 8.97µs ± 1% 8.80µs ± 0% -1.85% (p=0.000 n=10+9)
GlyphAlpha64Src-8 7.42µs ± 1% 7.39µs ± 0% -0.45% (p=0.011 n=10+10)
GlyphAlpha128Over-8 21.8µs ± 0% 21.2µs ± 0% -2.91% (p=0.000 n=9+9)
GlyphAlpha128Src-8 15.6µs ± 0% 15.6µs ± 0% ~ (p=0.982 n=10+7)
GlyphAlpha256Over-8 66.3µs ± 1% 63.7µs ± 0% -3.84% (p=0.000 n=10+9)
GlyphAlpha256Src-8 41.2µs ± 1% 41.2µs ± 1% ~ (p=1.000 n=10+10)
GlyphRGBA16Over-8 4.75µs ± 0% 4.75µs ± 1% ~ (p=0.735 n=9+10)
GlyphRGBA16Src-8 4.20µs ± 0% 4.20µs ± 0% ~ (p=0.503 n=8+8)
GlyphRGBA32Over-8 11.4µs ± 0% 11.4µs ± 0% ~ (p=0.119 n=9+9)
GlyphRGBA32Src-8 9.34µs ± 1% 9.32µs ± 0% ~ (p=0.062 n=9+8)
GlyphRGBA64Over-8 36.0µs ± 0% 36.1µs ± 0% ~ (p=0.209 n=8+9)
GlyphRGBA64Src-8 27.9µs ± 1% 27.8µs ± 0% ~ (p=0.796 n=10+10)
GlyphRGBA128Over-8 131µs ± 0% 131µs ± 0% ~ (p=0.931 n=9+9)
GlyphRGBA128Src-8 97.9µs ± 0% 97.7µs ± 1% ~ (p=0.053 n=9+10)
GlyphRGBA256Over-8 503µs ± 0% 503µs ± 1% ~ (p=0.274 n=8+10)
GlyphRGBA256Src-8 370µs ± 0% 369µs ± 0% ~ (p=0.497 n=9+10)
Change-Id: I56651e70b258792b83ea2a74904756243c88bef4
Reviewed-on: https://go-review.googlesource.com/31537
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-22 21:39:22 +00:00
Nigel Tao
8874bef159
vector: change ϕ from 10 to 9.
...
This slight loss in quality allows us to use int32 math exclusively
throughout raster_fixed.go, instead of occasionally dropping into int64
math. The change in ϕ doesn't affect the benchmarks noticably, but
staying in int32 does. The net effect:
name old time/op new time/op delta
GlyphAlpha16Over-8 3.36µs ± 0% 2.99µs ± 0% -10.89% (p=0.000 n=10+9)
GlyphAlpha16Src-8 3.26µs ± 0% 2.89µs ± 1% -11.34% (p=0.000 n=9+10)
GlyphAlpha32Over-8 5.20µs ± 0% 4.53µs ± 0% -12.76% (p=0.000 n=8+10)
GlyphAlpha32Src-8 4.81µs ± 1% 4.14µs ± 0% -13.91% (p=0.000 n=9+9)
GlyphAlpha64Over-8 10.2µs ± 0% 9.0µs ± 1% -11.99% (p=0.000 n=9+10)
GlyphAlpha64Src-8 8.62µs ± 0% 7.42µs ± 1% -13.89% (p=0.000 n=9+10)
GlyphAlpha128Over-8 24.1µs ± 0% 21.8µs ± 0% -9.32% (p=0.000 n=9+9)
GlyphAlpha128Src-8 17.9µs ± 0% 15.6µs ± 0% -12.68% (p=0.000 n=9+10)
GlyphAlpha256Over-8 70.1µs ± 0% 66.3µs ± 1% -5.44% (p=0.000 n=10+10)
GlyphAlpha256Src-8 45.2µs ± 1% 41.2µs ± 1% -8.92% (p=0.000 n=10+10)
GlyphRGBA16Over-8 5.12µs ± 0% 4.75µs ± 0% -7.15% (p=0.000 n=10+9)
GlyphRGBA16Src-8 4.57µs ± 1% 4.20µs ± 0% -8.18% (p=0.000 n=9+8)
GlyphRGBA32Over-8 12.1µs ± 0% 11.4µs ± 0% -5.50% (p=0.000 n=10+9)
GlyphRGBA32Src-8 10.0µs ± 0% 9.3µs ± 1% -6.80% (p=0.000 n=10+9)
GlyphRGBA64Over-8 37.2µs ± 0% 36.0µs ± 0% -3.17% (p=0.000 n=9+8)
GlyphRGBA64Src-8 29.0µs ± 1% 27.9µs ± 1% -4.05% (p=0.000 n=9+10)
GlyphRGBA128Over-8 134µs ± 1% 131µs ± 0% -1.85% (p=0.000 n=9+9)
GlyphRGBA128Src-8 100µs ± 1% 98µs ± 0% -2.27% (p=0.000 n=10+9)
GlyphRGBA256Over-8 506µs ± 0% 503µs ± 0% -0.56% (p=0.000 n=10+8)
GlyphRGBA256Src-8 373µs ± 0% 370µs ± 0% -1.01% (p=0.000 n=10+9)
Change-Id: Ie02afac6fd6fa95f090bf3fe0a5c744799ea9dc5
Reviewed-on: https://go-review.googlesource.com/31532
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-20 04:12:57 +00:00
Nigel Tao
fa54d6fa1c
vector: simplify fixedLineTo computation.
...
name old time/op new time/op delta
GlyphAlpha16Over-8 3.38µs ± 0% 3.36µs ± 0% -0.54% (p=0.000 n=10+10)
GlyphAlpha16Src-8 3.28µs ± 0% 3.26µs ± 0% -0.69% (p=0.000 n=10+9)
GlyphAlpha32Over-8 5.23µs ± 1% 5.20µs ± 0% -0.58% (p=0.000 n=10+8)
GlyphAlpha32Src-8 4.83µs ± 0% 4.81µs ± 1% -0.46% (p=0.001 n=10+9)
GlyphAlpha64Over-8 10.2µs ± 0% 10.2µs ± 0% -0.21% (p=0.003 n=10+9)
GlyphAlpha64Src-8 8.68µs ± 1% 8.62µs ± 0% -0.70% (p=0.000 n=10+9)
GlyphAlpha128Over-8 24.2µs ± 1% 24.1µs ± 0% -0.58% (p=0.001 n=10+9)
GlyphAlpha128Src-8 18.0µs ± 1% 17.9µs ± 0% -0.61% (p=0.001 n=10+9)
GlyphAlpha256Over-8 70.3µs ± 0% 70.1µs ± 0% -0.37% (p=0.019 n=10+10)
GlyphAlpha256Src-8 45.4µs ± 0% 45.2µs ± 1% -0.38% (p=0.041 n=8+10)
GlyphRGBA16Over-8 5.14µs ± 0% 5.12µs ± 0% -0.43% (p=0.000 n=9+10)
GlyphRGBA16Src-8 4.59µs ± 0% 4.57µs ± 1% -0.43% (p=0.005 n=9+9)
GlyphRGBA32Over-8 12.2µs ± 1% 12.1µs ± 0% -0.70% (p=0.000 n=10+10)
GlyphRGBA32Src-8 10.0µs ± 0% 10.0µs ± 0% ~ (p=0.092 n=7+10)
GlyphRGBA64Over-8 37.5µs ± 1% 37.2µs ± 0% -0.75% (p=0.000 n=10+9)
GlyphRGBA64Src-8 29.1µs ± 0% 29.0µs ± 1% ~ (p=0.243 n=10+9)
GlyphRGBA128Over-8 135µs ± 0% 134µs ± 1% -0.72% (p=0.000 n=9+9)
GlyphRGBA128Src-8 101µs ± 1% 100µs ± 1% ~ (p=0.197 n=10+10)
GlyphRGBA256Over-8 511µs ± 0% 506µs ± 0% -0.97% (p=0.000 n=10+10)
GlyphRGBA256Src-8 374µs ± 0% 373µs ± 0% -0.29% (p=0.002 n=10+10)
Change-Id: Ic05a900935cb59e55711374db1e62b055d75c8e3
Reviewed-on: https://go-review.googlesource.com/31116
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-16 03:06:30 +00:00
Nigel Tao
f72412cfe3
vector: fix overflow when rasterizing a 30 degree line.
...
There are some obvious TODOs, but they will be follow-up commits.
This is about correctness, not performance, but for the record:
name old time/op new time/op delta
GlyphAlpha16Over-8 3.16µs ± 0% 3.38µs ± 0% +6.96% (p=0.000 n=9+10)
GlyphAlpha16Src-8 3.06µs ± 0% 3.28µs ± 0% +7.21% (p=0.000 n=10+10)
GlyphAlpha32Over-8 4.92µs ± 1% 5.23µs ± 1% +6.24% (p=0.000 n=10+10)
GlyphAlpha32Src-8 4.53µs ± 1% 4.83µs ± 0% +6.69% (p=0.000 n=10+10)
GlyphAlpha64Over-8 9.60µs ± 1% 10.21µs ± 0% +6.36% (p=0.000 n=10+10)
GlyphAlpha64Src-8 8.04µs ± 0% 8.68µs ± 1% +7.99% (p=0.000 n=9+10)
GlyphAlpha128Over-8 23.1µs ± 0% 24.2µs ± 1% +5.08% (p=0.000 n=9+10)
GlyphAlpha128Src-8 16.8µs ± 0% 18.0µs ± 1% +6.76% (p=0.000 n=10+10)
GlyphAlpha256Over-8 68.6µs ± 1% 70.3µs ± 0% +2.50% (p=0.000 n=10+10)
GlyphAlpha256Src-8 43.6µs ± 0% 45.4µs ± 0% +4.08% (p=0.000 n=10+8)
GlyphRGBA16Over-8 4.92µs ± 0% 5.14µs ± 0% +4.48% (p=0.000 n=9+9)
GlyphRGBA16Src-8 4.39µs ± 0% 4.59µs ± 0% +4.60% (p=0.000 n=8+9)
GlyphRGBA32Over-8 11.8µs ± 0% 12.2µs ± 1% +2.89% (p=0.000 n=9+10)
GlyphRGBA32Src-8 9.79µs ± 1% 10.03µs ± 0% +2.49% (p=0.000 n=10+7)
GlyphRGBA64Over-8 36.7µs ± 1% 37.5µs ± 1% +2.23% (p=0.000 n=10+10)
GlyphRGBA64Src-8 28.5µs ± 0% 29.1µs ± 0% +2.09% (p=0.000 n=10+10)
GlyphRGBA128Over-8 133µs ± 0% 135µs ± 0% +1.51% (p=0.000 n=10+9)
GlyphRGBA128Src-8 99.1µs ± 0% 100.5µs ± 1% +1.47% (p=0.000 n=9+10)
GlyphRGBA256Over-8 505µs ± 0% 511µs ± 0% +1.18% (p=0.000 n=9+10)
GlyphRGBA256Src-8 372µs ± 0% 374µs ± 0% +0.69% (p=0.000 n=9+10)
Change-Id: Ice1d77de5bc2649f8cd88366bcae3c00e78d65c2
Reviewed-on: https://go-review.googlesource.com/31113
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-14 22:25:13 +00:00
Nigel Tao
e78c45720c
vector: add SIMD versions of xxxAccumulateMask.
...
name old time/op new time/op delta
GlyphAlphaLoose16Over-8 3.96µs ± 0% 3.64µs ± 1% -8.08% (p=0.000 n=8+10)
GlyphAlphaLoose16Src-8 3.64µs ± 0% 3.35µs ± 0% -7.88% (p=0.000 n=8+9)
GlyphAlphaLoose32Over-8 8.45µs ± 0% 6.74µs ± 0% -20.22% (p=0.000 n=8+9)
GlyphAlphaLoose32Src-8 7.24µs ± 0% 5.54µs ± 1% -23.48% (p=0.000 n=8+10)
GlyphAlphaLoose64Over-8 22.2µs ± 0% 17.4µs ± 0% -21.67% (p=0.000 n=9+9)
GlyphAlphaLoose64Src-8 17.6µs ± 1% 12.2µs ± 1% -30.32% (p=0.000 n=10+10)
GlyphAlphaLoose128Over-8 67.9µs ± 0% 53.3µs ± 1% -21.53% (p=0.000 n=10+10)
GlyphAlphaLoose128Src-8 48.2µs ± 0% 32.6µs ± 2% -32.41% (p=0.000 n=9+10)
GlyphAlphaLoose256Over-8 242µs ± 1% 187µs ± 1% -22.96% (p=0.000 n=9+9)
GlyphAlphaLoose256Src-8 163µs ± 0% 105µs ± 1% -35.83% (p=0.000 n=9+9)
GlyphRGBA16Over-8 5.25µs ± 1% 4.95µs ± 0% -5.78% (p=0.000 n=9+9)
GlyphRGBA16Src-8 4.72µs ± 0% 4.43µs ± 1% -6.22% (p=0.000 n=9+10)
GlyphRGBA32Over-8 13.5µs ± 0% 11.9µs ± 1% -12.19% (p=0.000 n=9+10)
GlyphRGBA32Src-8 11.5µs ± 1% 9.8µs ± 0% -14.72% (p=0.000 n=9+9)
GlyphRGBA64Over-8 42.0µs ± 2% 36.9µs ± 1% -12.19% (p=0.000 n=10+10)
GlyphRGBA64Src-8 34.1µs ± 1% 28.5µs ± 0% -16.25% (p=0.000 n=9+7)
GlyphRGBA128Over-8 149µs ± 2% 133µs ± 1% -10.24% (p=0.000 n=10+9)
GlyphRGBA128Src-8 115µs ± 1% 99µs ± 1% -13.57% (p=0.000 n=9+10)
GlyphRGBA256Over-8 566µs ± 0% 511µs ± 1% -9.85% (p=0.000 n=9+10)
GlyphRGBA256Src-8 435µs ± 0% 372µs ± 0% -14.64% (p=0.000 n=9+8)
GlyphNRGBA16Over-8 26.9µs ± 3% 26.0µs ± 3% -3.55% (p=0.000 n=10+9)
GlyphNRGBA16Src-8 18.8µs ± 2% 18.4µs ± 2% -2.21% (p=0.000 n=9+10)
GlyphNRGBA32Over-8 99.1µs ± 2% 95.9µs ± 3% -3.23% (p=0.000 n=10+10)
GlyphNRGBA32Src-8 65.6µs ± 3% 62.8µs ± 2% -4.36% (p=0.000 n=10+10)
GlyphNRGBA64Over-8 376µs ± 4% 370µs ± 2% ~ (p=0.063 n=10+10)
GlyphNRGBA64Src-8 238µs ± 3% 233µs ± 1% -2.21% (p=0.000 n=9+10)
GlyphNRGBA128Over-8 1.52ms ± 2% 1.48ms ± 0% -2.11% (p=0.000 n=10+8)
GlyphNRGBA128Src-8 951µs ± 3% 935µs ± 1% -1.69% (p=0.013 n=10+9)
GlyphNRGBA256Over-8 6.00ms ± 1% 5.87ms ± 3% -2.12% (p=0.002 n=10+10)
GlyphNRGBA256Src-8 3.94ms ± 2% 3.80ms ± 2% -3.64% (p=0.000 n=10+10)
A comparison of the non-SIMD and SIMD versions:
name time/op
FixedAccumulateMask16-8 237ns ± 0%
FixedAccumulateMaskSIMD16-8 80.0ns ± 1%
FloatingAccumulateMask16-8 413ns ± 2%
FloatingAccumulateMaskSIMD16-8 166ns ± 0%
FixedAccumulateMask64-8 3.42µs ± 0%
FixedAccumulateMaskSIMD64-8 1.09µs ± 0%
FloatingAccumulateMask64-8 6.92µs ± 0%
FloatingAccumulateMaskSIMD64-8 2.47µs ± 1%
Change-Id: Ib6980e5975ed2842ff2a372f76dd5f2e95c5526c
Reviewed-on: https://go-review.googlesource.com/30898
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-14 04:48:47 +00:00
Nigel Tao
beb9675609
vector: fix overflow when rasterizing wide lines.
...
Change-Id: Iea92b74ca9533de2ef17534ee3acf4f40c3d03ef
Reviewed-on: https://go-review.googlesource.com/30899
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-14 02:01:44 +00:00
Nigel Tao
8edbaf3f9e
vector: add SIMD versions of xxxAccumulateOpOver.
...
name old time/op new time/op delta
GlyphAlpha16Over-8 3.55µs ± 0% 3.17µs ± 0% -10.58% (p=0.000 n=10+10)
GlyphAlpha32Over-8 6.73µs ± 1% 4.94µs ± 0% -26.55% (p=0.000 n=10+9)
GlyphAlpha64Over-8 16.4µs ± 0% 9.6µs ± 0% -41.30% (p=0.000 n=9+10)
GlyphAlpha128Over-8 47.3µs ± 0% 23.1µs ± 1% -51.09% (p=0.000 n=9+9)
GlyphAlpha256Over-8 159µs ± 0% 69µs ± 0% -56.82% (p=0.000 n=9+8)
A comparison of the non-SIMD and SIMD versions:
name time/op
FixedAccumulateOpOver16-8 579ns ± 0%
FixedAccumulateOpOverSIMD16-8 183ns ± 0%
FloatingAccumulateOpOver16-8 670ns ± 1%
FloatingAccumulateOpOverSIMD16-8 242ns ± 0%
FixedAccumulateOpOver64-8 9.61µs ± 0%
FixedAccumulateOpOverSIMD64-8 2.72µs ± 0%
FloatingAccumulateOpOver64-8 11.1µs ± 0%
FloatingAccumulateOpOverSIMD64-8 3.65µs ± 0%
Change-Id: I08273c40ac5445f39b77a88fb8b6b07fd3e5f84b
Reviewed-on: https://go-review.googlesource.com/30831
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-13 03:04:36 +00:00
Nigel Tao
ae7296db94
vector: generate acc_amd64.s from a template.
...
There are currently 2 instantiations: fixed and floating math.
There will eventually be 6: 2 math types times 3 operators (OpOver,
OpSrc and Mask).
Change-Id: I16db8f3693abe30027ea2f822909980403a6142f
Reviewed-on: https://go-review.googlesource.com/30735
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-11 07:55:43 +00:00
Nigel Tao
746988e7a2
vector: add SIMD versions of xxxAccumulateOpSrc.
...
name old time/op new time/op delta
GlyphAlpha16Src-8 3.37µs ± 0% 3.07µs ± 1% -8.86% (p=0.000 n=9+9)
GlyphAlpha32Src-8 6.01µs ± 1% 4.55µs ± 0% -24.28% (p=0.000 n=10+9)
GlyphAlpha64Src-8 13.2µs ± 0% 8.1µs ± 0% -38.69% (p=0.000 n=10+9)
GlyphAlpha128Src-8 32.9µs ± 0% 16.9µs ± 0% -48.85% (p=0.000 n=10+9)
GlyphAlpha256Src-8 98.0µs ± 0% 43.6µs ± 1% -55.50% (p=0.000 n=10+10)
A comparison of the non-SIMD and SIMD versions:
name time/op
FixedAccumulateOpSrc16-8 368ns ± 0%
FixedAccumulateOpSrcSIMD16-8 86.8ns ± 1%
FloatingAccumulateOpSrc16-8 434ns ± 0%
FloatingAccumulateOpSrcSIMD16-8 119ns ± 0%
FixedAccumulateOpSrc64-8 6.12µs ± 0%
FixedAccumulateOpSrcSIMD64-8 1.17µs ± 0%
FloatingAccumulateOpSrc64-8 7.15µs ± 0%
FloatingAccumulateOpSrcSIMD64-8 1.68µs ± 1%
Change-Id: I58e5c7a3ecd12e536aab8e765e94275453d0eac8
Reviewed-on: https://go-review.googlesource.com/30431
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-10 07:32:32 +00:00
Nigel Tao
dc590effac
vector: add some accumulate tests.
...
Change-Id: I199e1637698572e36b4a3bb83d652baf0d76717f
Reviewed-on: https://go-review.googlesource.com/30110
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-05 23:42:26 +00:00
Benny Siegert
1be1b0af35
tiff: reject TIFF images with unsorted IFD tags.
...
The spec says that these images are invalid. Add a test with an invalid
tiff generated by go-fuzz.
Fixes golang/go#10549
Change-Id: I3fd3ae5e607202b41735a2d930f55cb7997f7a9b
Reviewed-on: https://go-review.googlesource.com/9377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-04 16:59:28 +00:00
Nigel Tao
72141d56a2
vector: re-order some functions.
...
There are no code changes, just a re-ordering so that these files are
consistent with others in this package: OpOver, OpSrc, Mask.
Change-Id: Ib1d46a8e912dae0c760af655e919b77023688189
Reviewed-on: https://go-review.googlesource.com/30111
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-02 02:10:30 +00:00
Nigel Tao
992afa5d48
vector: add a fixed point math implementation.
...
name old time/op new time/op delta
GlyphAlpha16Over-8 4.48µs ± 1% 3.56µs ± 0% -20.70% (p=0.000 n=9+10)
GlyphAlpha16Src-8 4.17µs ± 0% 3.38µs ± 1% -19.09% (p=0.000 n=10+10)
GlyphAlpha32Over-8 9.03µs ± 0% 6.74µs ± 0% -25.33% (p=0.000 n=9+10)
GlyphAlpha32Src-8 7.46µs ± 1% 5.98µs ± 0% -19.80% (p=0.000 n=10+9)
GlyphAlpha64Over-8 21.3µs ± 0% 16.4µs ± 0% -22.84% (p=0.000 n=10+10)
GlyphAlpha64Src-8 16.2µs ± 1% 13.1µs ± 0% -19.33% (p=0.000 n=10+10)
GlyphAlpha128Over-8 59.8µs ± 0% 47.2µs ± 0% -21.11% (p=0.000 n=9+9)
GlyphAlpha128Src-8 41.3µs ± 1% 33.0µs ± 0% -20.26% (p=0.000 n=9+10)
GlyphAlpha256Over-8 197µs ± 0% 158µs ± 0% -19.44% (p=0.000 n=9+10)
GlyphAlpha256Src-8 124µs ± 0% 98µs ± 0% -21.17% (p=0.000 n=9+9)
GlyphAlphaLoose16Over-8 4.73µs ± 0% 3.97µs ± 1% -16.06% (p=0.000 n=10+10)
GlyphAlphaLoose16Src-8 4.41µs ± 0% 3.64µs ± 1% -17.50% (p=0.000 n=10+10)
GlyphAlphaLoose32Over-8 9.62µs ± 0% 8.47µs ± 0% -11.95% (p=0.000 n=10+10)
GlyphAlphaLoose32Src-8 8.25µs ± 0% 7.19µs ± 0% -12.88% (p=0.000 n=9+9)
GlyphAlphaLoose64Over-8 25.6µs ± 0% 22.2µs ± 0% -13.01% (p=0.000 n=9+9)
GlyphAlphaLoose64Src-8 20.2µs ± 0% 17.2µs ± 1% -14.98% (p=0.000 n=10+10)
GlyphAlphaLoose128Over-8 83.4µs ± 1% 68.2µs ± 0% -18.27% (p=0.000 n=10+10)
GlyphAlphaLoose128Src-8 59.8µs ± 0% 47.4µs ± 0% -20.77% (p=0.000 n=10+9)
GlyphAlphaLoose256Over-8 273µs ± 1% 239µs ± 0% -12.52% (p=0.000 n=10+9)
GlyphAlphaLoose256Src-8 187µs ± 0% 155µs ± 1% -16.91% (p=0.000 n=9+10)
GlyphRGBA16Over-8 5.99µs ± 0% 5.24µs ± 1% -12.60% (p=0.000 n=9+10)
GlyphRGBA16Src-8 5.48µs ± 0% 4.68µs ± 0% -14.68% (p=0.000 n=9+10)
GlyphRGBA32Over-8 14.6µs ± 0% 13.5µs ± 0% -7.60% (p=0.000 n=9+9)
GlyphRGBA32Src-8 12.6µs ± 0% 11.4µs ± 0% -9.62% (p=0.000 n=9+9)
GlyphRGBA64Over-8 44.8µs ± 0% 42.2µs ± 0% -5.69% (p=0.000 n=9+9)
GlyphRGBA64Src-8 36.6µs ± 1% 33.5µs ± 1% -8.55% (p=0.000 n=9+9)
GlyphRGBA128Over-8 162µs ± 0% 148µs ± 1% -8.85% (p=0.000 n=10+9)
GlyphRGBA128Src-8 129µs ± 1% 114µs ± 0% -11.61% (p=0.000 n=9+10)
GlyphRGBA256Over-8 588µs ± 0% 573µs ± 0% -2.53% (p=0.000 n=9+10)
GlyphRGBA256Src-8 455µs ± 0% 426µs ± 1% -6.51% (p=0.000 n=9+10)
GlyphNRGBA16Over-8 27.0µs ± 4% 26.3µs ± 2% -2.65% (p=0.001 n=9+10)
GlyphNRGBA16Src-8 19.4µs ± 3% 18.6µs ± 1% -4.35% (p=0.000 n=9+10)
GlyphNRGBA32Over-8 97.4µs ± 3% 96.8µs ± 2% ~ (p=0.447 n=9+10)
GlyphNRGBA32Src-8 66.6µs ± 3% 64.5µs ± 1% -3.21% (p=0.000 n=10+9)
GlyphNRGBA64Over-8 372µs ± 3% 368µs ± 1% ~ (p=0.105 n=10+10)
GlyphNRGBA64Src-8 235µs ± 1% 234µs ± 1% ~ (p=0.130 n=8+8)
GlyphNRGBA128Over-8 1.45ms ± 2% 1.48ms ± 3% +2.06% (p=0.014 n=9+9)
GlyphNRGBA128Src-8 926µs ± 3% 937µs ± 1% ~ (p=0.113 n=10+9)
GlyphNRGBA256Over-8 5.76ms ± 2% 5.90ms ± 3% +2.29% (p=0.001 n=9+10)
GlyphNRGBA256Src-8 3.59ms ± 1% 3.86ms ± 1% +7.46% (p=0.000 n=9+10)
Change-Id: I72f25193b5be4e57af09e9eea4eee50545a34cbf
Reviewed-on: https://go-review.googlesource.com/29972
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-30 06:47:22 +00:00
Nigel Tao
8a20735b0e
vector: sort benchmarks from slowest to fastest.
...
Change-Id: Ia6047f225c7ba4407fe831a49f90d4c74d203651
Reviewed-on: https://go-review.googlesource.com/29973
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-30 06:02:01 +00:00
Nigel Tao
14bbbc8017
vector: add a fast path for RGBA dst images.
...
name old time/op new time/op delta
GlyphRGBA16Over-8 25.1µs ± 2% 6.0µs ± 0% -76.09% (p=0.000 n=10+10)
GlyphRGBA16Src-8 17.3µs ± 2% 5.4µs ± 0% -68.68% (p=0.000 n=10+10)
GlyphRGBA32Over-8 93.2µs ± 2% 14.5µs ± 0% -84.41% (p=0.000 n=10+10)
GlyphRGBA32Src-8 59.3µs ± 2% 12.4µs ± 0% -79.04% (p=0.000 n=9+9)
GlyphRGBA64Over-8 350µs ± 2% 45µs ± 0% -87.21% (p=0.000 n=9+9)
GlyphRGBA64Src-8 223µs ± 2% 37µs ± 0% -83.58% (p=0.000 n=9+9)
GlyphRGBA128Over-8 1.37ms ± 2% 0.16ms ± 1% -88.19% (p=0.000 n=9+10)
GlyphRGBA128Src-8 868µs ± 2% 128µs ± 0% -85.21% (p=0.000 n=10+9)
GlyphRGBA256Over-8 5.50ms ± 3% 0.59ms ± 0% -89.31% (p=0.000 n=10+10)
GlyphRGBA256Src-8 3.47ms ± 2% 0.45ms ± 0% -86.91% (p=0.000 n=9+10)
Change-Id: I3df60e6b7147872367715361c9d1ed52951b22e0
Reviewed-on: https://go-review.googlesource.com/29699
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-27 04:00:57 +00:00
Nigel Tao
0080ac3d2c
vector: add some more tests.
...
These tests are copied from the github.com/google/font-go prototype.
Change-Id: I4523193bd3453974633cbef0576c1203eb013a7d
Reviewed-on: https://go-review.googlesource.com/29697
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-25 03:45:43 +00:00
Nigel Tao
7ea36498ac
vector: allow dst and mask to have different strides.
...
Change-Id: If244dba2c681b11122a7a26b352f9411135f123f
Reviewed-on: https://go-review.googlesource.com/29696
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-25 02:48:45 +00:00
Nigel Tao
b077ed42b3
vector: implement arbitrary dst and src image types.
...
Change-Id: Ib0d0961c69cabc3bb01d7b1d244796f0f713b819
Reviewed-on: https://go-review.googlesource.com/29691
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-24 05:40:50 +00:00
Nigel Tao
50ce1ebf58
vector: add benchmarks.
...
Change-Id: I4946ccc3a915c7e9365cd5fe860da673a2270fbb
Reviewed-on: https://go-review.googlesource.com/29631
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-23 02:06:24 +00:00
Nigel Tao
cd8486aac9
vector: implement DrawOp == draw.Over.
...
Some "TODO: the general case" lines remain.
Change-Id: If66e484a00d5ea3fce9db37d4ee493739648daa3
Reviewed-on: https://go-review.googlesource.com/29495
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-23 01:58:13 +00:00
Nigel Tao
bb355ba442
vector: add CubeTo.
...
Change-Id: Ia64b5b077172303981538de99cc14c5bcc99a3e4
Reviewed-on: https://go-review.googlesource.com/28489
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-08 11:11:11 +00:00
Nigel Tao
714f2e47f7
vector: new package for rasterizing 2-D graphics.
...
Updates golang/go#16904
Change-Id: I4e11e4e859c007c3444655a227ac935c27f3f784
Reviewed-on: https://go-review.googlesource.com/28347
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-04 08:48:55 +00:00
Nigel Tao
112f996332
math/fixed: add Mul methods.
...
Change-Id: Id6f9f5825527b311b5b1aa4ae0923c9551fa076b
Reviewed-on: https://go-review.googlesource.com/27413
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-25 00:04:48 +00:00
Nigel Tao
9f8d0d4587
font/plan9font: look for subfont ".0" suffixes.
...
Change-Id: Id8aadd846311fd621b47912d7b426d6a2d17a594
Reviewed-on: https://go-review.googlesource.com/25560
Reviewed-by: Rob Pike <r@golang.org>
2016-08-07 01:57:26 +00:00
Nigel Tao
c348254d65
webp: make a placeholder package for Go 1.5 and earlier.
...
This lets programs that underscore import this package build on Go 1.5.
Change-Id: Icd977b16eb44389f8ee4640c2ab57e4b6791b1f4
Reviewed-on: https://go-review.googlesource.com/24954
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-16 05:04:44 +00:00
Brad Fitzpatrick
81315f0c68
webp: mark package as requiring Go 1.6 for NYCbCrA
...
See https://build.golang.org/log/1e0572f27630c3a896f17722d89b6cc35d9f52d8
Updates golang/go#11811
Change-Id: I0db67f2c8586b1c36608c6131c803eb26fb87751
Reviewed-on: https://go-review.googlesource.com/24945
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-07-15 18:42:21 +00:00
Nigel Tao
a21e5be7b4
riff: fix some short chunk data bugs.
...
Fixes golang/go#16236
Change-Id: I0e524054d0702a6487ff47d86aed6bf58f4ba3f2
Reviewed-on: https://go-review.googlesource.com/24638
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-07 05:37:58 +00:00
Nigel Tao
8550bb5380
font/inconsolata: new package.
...
Fixes golang/go#16185
Change-Id: Ic7d64428b39be6b39a965fddf8753a2ce36d262c
Reviewed-on: https://go-review.googlesource.com/24482
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-06-30 01:20:08 +00:00
Nigel Tao
c4226c0d9c
font/basicfont: add Descent and Left fields.
...
A face's glyph height (the height of the glyph image) isn't necessarily
the inter-line spacing: f.Ascent + f.Descent isn't always f.Height.
Similarly, a face's glyph image's left side isn't always dot.X.
Change-Id: I86594c52b8d31bf652ac34a695e9270ac635a5bc
Reviewed-on: https://go-review.googlesource.com/24481
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-06-30 00:32:31 +00:00
Nigel Tao
97680175a5
font: add a []byte flavor of string methods.
...
Change-Id: I2506067ba6ac12c275b65c3a52cb38579d4b9dca
Reviewed-on: https://go-review.googlesource.com/23464
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-05-27 00:37:06 +00:00
Nigel Tao
51ddfee6f3
colornames: export variables such as Darkred.
...
Change-Id: I1507d510ffa0ee3c899af652e0d1ab9d42a650d3
Reviewed-on: https://go-review.googlesource.com/23463
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-05-27 00:36:51 +00:00
Nigel Tao
f551d3a6b7
font/plan9font: derive the example's ascent from the metrics.
...
The Face.Metrics method is relatively new.
Also pick up the unicode.7x13.font fix from the upstream plan9port:
https://plan9port-review.googlesource.com/#/c/1490/
Change-Id: Ia6e0feec4ea3c9a35e19d38aa634ca9eb6b2ffa0
Reviewed-on: https://go-review.googlesource.com/21699
Reviewed-by: Rob Pike <r@golang.org>
2016-04-23 08:08:30 +00:00