Rob Pike
05348ab0c8
image/gif: fix buglet in graphics extension.
...
need to ReadFull, not Read, to get extension data.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4576043
2011-06-07 12:19:36 +00:00
Benny Siegert
d01b260e78
image/tiff: support for bit depths other than 8.
...
At the moment, 16-bit samples are reduced to 8 bits, this will
be changed in a separate CL.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4552057
2011-06-06 14:11:29 +10:00
Nigel Tao
b47a38dedb
image/draw: move exp/draw to image/draw and exp/gui.
...
R=r
CC=golang-dev
https://golang.org/cl/4515191
2011-06-05 14:27:38 +10:00
Nigel Tao
f531ef3279
image: rename Contains and ContainsRectangle to In.
...
R=r
CC=golang-dev
https://golang.org/cl/4539104
2011-06-03 13:18:15 +10:00
Nigel Tao
ae5a972d9e
exp/draw: fix clipping bug where sp/mp were not shifted when r.Min was.
...
image: add Rectangle.ContainsRectangle method.
R=r, rsc
CC=golang-dev
https://golang.org/cl/4517130
2011-06-03 11:43:54 +10:00
Nigel Tao
422abf3b8e
image: add a SubImage method.
...
R=r
CC=golang-dev
https://golang.org/cl/4515179
2011-06-02 18:51:41 +10:00
Robert Hencke
3fbd478a8a
pkg: spelling tweaks, I-Z
...
also, a few miscellaneous fixes to files outside pkg
R=golang-dev, dsymonds, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/4517116
2011-05-30 18:02:59 +10:00
Nigel Tao
a479bc8d02
image/png: fix encoding of images that don't start at (0, 0).
...
R=r
CC=golang-dev
https://golang.org/cl/4560049
2011-05-30 10:55:37 +10:00
Rob Pike
4c945c2cfc
image/gif: simplify blockReader.Read.
...
Inverting the tests avoids recursion and simplifies the flow.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4551057
2011-05-24 11:02:44 +10:00
Nigel Tao
0a2650f398
image/jpeg: small memory layout optimization for encoding.
...
Before:
jpeg.BenchmarkEncodeRGBOpaque ... 23.29 MB/s
jpeg.BenchmarkEncodeRGBOpaque ... 23.27 MB/s
jpeg.BenchmarkEncodeRGBOpaque ... 23.17 MB/s
After:
jpeg.BenchmarkEncodeRGBOpaque ... 23.42 MB/s
jpeg.BenchmarkEncodeRGBOpaque ... 23.34 MB/s
jpeg.BenchmarkEncodeRGBOpaque ... 23.33 MB/s
R=rsc
CC=golang-dev
https://golang.org/cl/4538077
2011-05-18 14:39:37 -07:00
Nigel Tao
8e26a644ca
image/jpeg: make writeDQT do fewer array copies.
...
R=rsc, r
CC=golang-dev
https://golang.org/cl/4536069
2011-05-18 10:56:20 -07:00
Nigel Tao
5f7b0bc366
image/jpeg: fix bounds calculation for grayscale JPEG images.
...
Also add grayscale test cases for image/decode_test.
R=r
CC=golang-dev
https://golang.org/cl/4526063
2011-05-17 15:47:14 -07:00
Rob Pike
de7c28fe76
image/gif: enable images with <8 bits per pixel.
...
R=nigeltao
CC=golang-dev
https://golang.org/cl/4552042
2011-05-16 16:00:41 -07:00
Rob Pike
ff1093852f
GIF: support decoding of interlaced images.
...
R=nigeltao
CC=golang-dev
https://golang.org/cl/4535073
2011-05-16 15:17:17 -07:00
Nigel Tao
0d111a62e1
image/jpeg: decode grayscale images, not just color images.
...
Also add an image package test that DecodeConfig returns the same
ColorModel as what Decode would.
R=r, r
CC=golang-dev
https://golang.org/cl/4529065
2011-05-16 10:13:17 -07:00
Benny Siegert
14c59abd76
image/tiff: Reject images with SampleFormat != 1.
...
The TIFF spec says that a baseline TIFF reader must gracefully terminate
when the image has a SampleFormat tag which it does not support.
For baseline compatibility, only SampleFormat=1 (the default) is needed.
Images with other sample formats (e.g. floating-point color values)
are very rare in practice.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4515073
2011-05-12 22:34:48 -04:00
Nigel Tao
51e6aa1e88
image/bmp: implement a BMP decoder.
...
R=r
CC=golang-dev
https://golang.org/cl/4521054
2011-05-11 11:12:45 -07:00
Nigel Tao
67992cae53
image/gif: minor fixes.
...
R=r
CC=golang-dev
https://golang.org/cl/4523054
2011-05-11 11:11:25 -07:00
Nigel Tao
4c1e1b815b
image/jpeg: speed up decoding by inlining the clip function and
...
writing the idct result directly to the image buffer instead of
storing it in an intermediate d.blocks field.
Writing to d.blocks was necessary when decoding to an image.RGBA image,
but now that we decode to a ycbcr.YCbCr we can write each component
directly to the image buffer.
Crude "time ./6.out" scores to decode a specific 2592x1944 JPEG 20
times show a 16% speed-up:
BEFORE
user 0m10.410s
user 0m10.400s
user 0m10.480s
user 0m10.480s
user 0m10.460s
AFTER
user 0m9.050s
user 0m9.050s
user 0m9.050s
user 0m9.070s
user 0m9.020s
R=r
CC=golang-dev
https://golang.org/cl/4523052
2011-05-09 17:25:32 -07:00
Rob Pike
45ea58746b
gif: fix build
...
Had bit test wrong on transparency; no excuses.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4526044
2011-05-09 06:38:04 -07:00
Rob Pike
a54dca8357
image/gif: implement transparency.
...
At least, as I understand it. The spec is unclear about what happens
with a local color map.
R=nigeltao, r2
CC=golang-dev
https://golang.org/cl/4515045
2011-05-08 17:26:16 -07:00
Rob Pike
92834d351e
image/gif: GIF decoder
...
It's incomplete but sufficient to decode 8-bit GIFs without interlacing
or transparency. More to come.
I'll put in more tests as the feature set grows.
R=nigeltao, r2
CC=golang-dev
https://golang.org/cl/4522041
2011-05-07 22:57:42 -07:00
Roger Peppe
da39008a27
image: make AlphaColor.Set conform to usual signature
...
R=nigeltao, r
CC=golang-dev
https://golang.org/cl/4471045
2011-05-05 10:16:59 -07:00
Benny Siegert
d97b8a817b
image/tiff: implement a decoder.
...
The current iteration can decode 8-bit images in
grayscale, paletted, RGB, RGBA and NRGBA mode. LZW compression
is implemented but does not work on my test images.
Deflate (i.e. zlib) compression with or without a horizontal
predictor is supported.
R=nigeltao, nigeltao_gnome
CC=golang-dev, mpl
https://golang.org/cl/4240051
2011-05-04 20:52:55 -07:00
Dmitry Chestnykh
737e96c7f3
image/png: support encoding of paletted images with alpha channel.
...
Encoder now writes tRNS chunk for non-opaque paletted images.
CL includes new test images (basn3a08-trns.[ps]ng).
R=nigeltao, rsc, r
CC=golang-dev
https://golang.org/cl/4432078
2011-05-04 20:46:27 -07:00
Rob Pike
a2354cd4e4
image: fix build
...
accidentally deleted one method
TBR=rsc
R=rsc
CC=golang-dev
https://golang.org/cl/4438090
2011-05-02 15:42:46 -07:00
Rob Pike
2398a74bd8
image: add type-specific Set methods and use them when decoding PNG.
...
This speeds up PNG decode about 20% by avoiding per-pixel interface conversions.
R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/4428080
2011-05-02 15:10:37 -07:00
Brad Fitzpatrick
807ce2719c
jpeg: speed up RGBA encoding ~%50
...
Avoids image.At(), color.RGBA(), opposing 8 bit shifts,
and min function calls in a loop. Not as pretty as before,
but the pure version is still there to revert back to
later if/when the compiler gets better.
before (best of 5)
jpeg.BenchmarkEncodeRGBOpaque 50 64781360 ns/op 18.97 MB/s
after (best of 5)
jpeg.BenchmarkEncodeRGBOpaque 50 42044300 ns/op 29.23 MB/s
(benchmarked on an HP z600; 16 core Xeon E5520 @ 2.27Ghz)
R=r, r2, nigeltao
CC=golang-dev
https://golang.org/cl/4433088
2011-05-02 07:26:40 -07:00
Brad Fitzpatrick
437015bbed
png: speed up opaque RGBA encoding
...
With Linux/8g on a 2006 Mac Mini (1.66 GHz Intel Core Duo,
2KB L1, 2MB L2, 2G main memory), GOMAXPROCS unset:
start:
png.BenchmarkEncodePaletted 50 44772820 ns/op
png.BenchmarkEncodeRGBOpaque 10 208395900 ns/op
png.BenchmarkEncodeRGBA 5 331088000 ns/op
remove interface method calls:
png.BenchmarkEncodePaletted 50 44722880 ns/op
png.BenchmarkEncodeRGBOpaque 10 139042600 ns/op
png.BenchmarkEncodeRGBA 5 334033600 ns/op
flate inline min/max():
png.BenchmarkEncodePaletted 50 40631180 ns/op
png.BenchmarkEncodeRGBOpaque 10 124894900 ns/op
png.BenchmarkEncodeRGBA 5 312099000 ns/op
after adler change:
png.BenchmarkEncodePaletted 50 40181760 ns/op
png.BenchmarkEncodeRGBOpaque 20 121781950 ns/op
png.BenchmarkEncodeRGBA 5 313890800 ns/op
In comparison to 121 ms on this 2006 machine, on my
Core2 Duo 2.66 GHz laptop, the final BenchmarkEncodeRGBOpaque
runs in 27 ms. (these are all for 640x480 images)
R=nigeltao, rsc, r
CC=golang-dev
https://golang.org/cl/4432077
2011-05-02 07:25:53 -07:00
Brad Fitzpatrick
f5fa215d8a
image: png & jpeg encoding benchmarks
...
No code changes in this CL.
R=r
CC=golang-dev
https://golang.org/cl/4445074
2011-04-29 10:42:44 -07:00
Nigel Tao
b6cb4f9bf4
jpeg: decode to a YCbCr image instead of an RGBA image.
...
R=r
CC=golang-dev
https://golang.org/cl/4436053
2011-04-24 19:25:49 +10:00
Nigel Tao
6a186d38d1
src/pkg: make package doc comments consistently start with "Package foo".
...
R=rsc
CC=golang-dev
https://golang.org/cl/4442064
2011-04-20 09:57:05 +10:00
Nigel Tao
5500f027f7
image/jpeg: add an encoder.
...
It is based on changeset 4186064 by Raph Levien <raph@google.com>.
R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4435051
2011-04-19 11:00:47 +10:00
Nigel Tao
4c60569e7c
image: allow "?" wildcards when registering image formats.
...
R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4404041
2011-04-14 09:56:42 +10:00
Nigel Tao
ce89a233a2
image/ycbcr: new package.
...
R=r, rsc, nigeltao_gnome
CC=golang-dev, raph
https://golang.org/cl/4374043
2011-04-12 22:32:03 +10:00
Rob Pike
8a90fd3c72
os: New Open API.
...
We replace the current Open with:
OpenFile(name, flag, perm) // same as old Open
Open(name) // same as old Open(name, O_RDONLY, 0)
Create(name) // same as old Open(name, O_RDWR|O_TRUNC|O_CREAT, 0666)
This CL includes a gofix module and full code updates: all.bash passes.
(There may be a few comments I missed.)
The interesting packages are:
gofix
os
Everything else is automatically generated except for hand tweaks to:
src/pkg/io/ioutil/ioutil.go
src/pkg/io/ioutil/tempfile.go
src/pkg/crypto/tls/generate_cert.go
src/cmd/goyacc/goyacc.go
src/cmd/goyacc/units.y
R=golang-dev, bradfitzwork, rsc, r2
CC=golang-dev
https://golang.org/cl/4357052
2011-04-04 23:42:14 -07:00
Rob Pike
7f9acb53cb
testing: shorten some more tests
...
R=rsc
CC=golang-dev
https://golang.org/cl/4314044
2011-03-26 11:25:22 -07:00
Nigel Tao
7483c6ee3c
image: add a decoding test for common file formats.
...
The test image was converted from doc/video-001.png using the
convert command line tool (ImageMagick 6.5.7-8) at -quality 100.
R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4259047
2011-03-03 20:35:49 +11:00
Mikael Tillenius
ca0d483014
image/png: support for more formats
...
Added support for reading images with grayscale + alpha and
for images with depth 1, 2 or 4.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4174053
2011-02-22 10:04:32 +11:00
Russ Cox
69c4e9380b
use append
...
R=gri, r, r2
CC=golang-dev
https://golang.org/cl/2743042
2010-10-27 19:47:23 -07:00
Brad Fitzpatrick
ad7d24ac4b
image/png: speed up paletted encoding ~25%
...
Avoids a lot of redundant bounds checks.
R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/2678041
2010-10-27 22:48:18 +11:00
Nigel Tao
93159e32e7
image: add an offset to Tiled.
...
R=r, r2
CC=golang-dev
https://golang.org/cl/2469041
2010-10-13 12:05:21 +11:00
Nigel Tao
a3e971d355
image: another build fix regarding ColorImage.
...
R=adg
TBR=adg
CC=golang-dev
https://golang.org/cl/2449041
2010-10-12 14:33:37 +11:00
Nigel Tao
b5a480f035
image: add image.Tiled type, the Go equivalent of Plan9's repl bit.
...
Make ColorImage methods' receiver type be a pointer.
R=r, rsc
CC=golang-dev
https://golang.org/cl/2345043
2010-10-12 13:44:11 +11:00
Andrew Gerrand
03babfc626
Use Errorf where appropriate.
...
R=r, r2
CC=golang-dev
https://golang.org/cl/2308043
2010-10-01 14:14:18 +10:00
Roger Peppe
0f17173f79
exp/draw: add Point.Eq, Point.Mul, Point.Div, Rectangle.Size methods
...
R=nigeltao, nigeltao_golang, rsc
CC=golang-dev, r
https://golang.org/cl/2192048
2010-09-23 10:58:59 +10:00
Nigel Tao
2deee2936c
exp/draw: clip destination rectangle to the image bounds.
...
image: introduce Intersect and Union rectangle methods.
R=r, rog, nigeltao
CC=golang-dev
https://golang.org/cl/2115043
2010-09-09 19:12:54 +10:00
Nigel Tao
832ed355fe
image: change a ColorImage's minimum point from (0, 0) to (-1e9, -1e9).
...
R=r
CC=golang-dev
https://golang.org/cl/2138045
2010-09-07 19:16:59 +10:00
Nigel Tao
2b4218f321
image: introduce Config type and DecodeConfig function, to decode an
...
image's color model and dimensions without allocating and decoding its
actual pixels.
Fixes #695 .
R=r
CC=golang-dev
https://golang.org/cl/2151042
2010-09-03 18:03:08 +10:00
Christian Himpel
5c603dbb75
build: remove unnecessary references to GOBIN and GOROOT
...
All scripts and makefiles assume that GOBIN is correctly set
in PATH.
R=rsc
CC=golang-dev
https://golang.org/cl/2043041
2010-08-30 15:40:56 -04:00