Commit Graph

19 Commits

Author SHA1 Message Date
Nigel Tao
df2aa51d44 draw: tweak the YCbCr to RGBA conversion formula again.
This is the golang.org/x equivalent of the golang.org/cl/36732 change to
the standard library.

Change-Id: I71c09a72e24c8e1c013769a6fed8f9a031724d9d
Reviewed-on: https://go-review.googlesource.com/36733
Run-TryBot: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2017-02-10 23:08:06 +00:00
Nigel Tao
6b7a488d1e draw: tweak the YCbCr to RGBA conversion formula.
This is the golang.org/x equivalent of the golang.org/cl/12220 change to
the standard library.

Change-Id: I220d1398902dec374472ef5b08db8501607cc971
Reviewed-on: https://go-review.googlesource.com/12222
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 05:30:06 +00:00
Nigel Tao
8ed4ff0a33 draw: implement the Over operator.
Change-Id: Id207b8f2fa5233175285800477e60f111ef4af63
Reviewed-on: https://go-review.googlesource.com/8744
Reviewed-by: Rob Pike <r@golang.org>
2015-04-13 23:42:02 +00:00
Nigel Tao
d5c5125b57 draw: update the inlined YCbCr.RGBA code to use 16 bit color.
This matches the standard library change at
https://go-review.googlesource.com/#/c/8073/

Change-Id: I216028e18678a70e449167cd9ab910c63d37adcc
Reviewed-on: https://go-review.googlesource.com/8075
Reviewed-by: Rob Pike <r@golang.org>
2015-03-26 22:31:54 +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
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
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
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
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
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
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
Nigel Tao
0424e74a0e go.image/vp8: implement the normal filter.
The testdata was generated via:
cwebp foo.png -o foo.lossy.webp
dwebp -pgm foo.lossy.webp -o tmp.pgm
convert tmp.pgm foo.lossy.webp.ycbcr.png
rm tmp.pgm

TBR=r
R=r
CC=golang-codereviews
https://golang.org/cl/107330043
2014-06-26 13:29:30 +10:00
Nigel Tao
94ba43c478 go.image/vp8l: new package.
The blue-purple-pink image comes from
http://blog.golang.org/gophercon

The tux and yellow_rose images come from
https://developers.google.com/speed/webp/gallery2 and according to
that page, those images are in the public domain.

The gopher-doc images are http://golang.org/doc/gopher/doc.png
after quantizing its palette to 2/4/16/256 colors.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/109010043
2014-06-17 21:51:57 +10:00
Nigel Tao
a1da419f1a go.image/tiff: fix (TIFF-specific) LZW decompression.
The blue-purple-pink.lzwcompressed.tiff image was created by
"bmp2tiff -c lzw".

LGTM=djd
R=djd
CC=bsiegert, golang-codereviews
https://golang.org/cl/105750045
2014-06-02 14:51:51 +10:00
Nigel Tao
72be9c51b1 go.image/vp8: implement the loop filter.
The testdata files were created by:
cwebp video-001.png -o video-001.webp
dwebp -pgm video-001.webp -o tmp.pgm
convert tmp.pgm video-001.webp.ycbcr.png
rm tmp.pgm

LGTM=r
R=r
CC=chaishushan, golang-codereviews
https://golang.org/cl/91700044
2014-05-27 10:52:02 +10:00
Patrick Riley
38c1f4ffe8 go.image/tiff: Support missing Compression tag
no_compress.tiff is no_rps.tiff that was read in by go.image/tiff and written out again (with a hack to avoid creating the Compression tag on the way out).

$ tiffdump no_compress.tiff
no_compress.tiff:
Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 968 (0x3c8) next 0 (0)
ImageWidth (256) SHORT (3) 1<16>
ImageLength (257) SHORT (3) 1<15>
BitsPerSample (258) SHORT (3) 4<8 8 8 8>
Photometric (262) SHORT (3) 1<2>
StripOffsets (273) LONG (4) 1<8>
SamplesPerPixel (277) SHORT (3) 1<4>
RowsPerStrip (278) SHORT (3) 1<15>
StripByteCounts (279) LONG (4) 1<960>
XResolution (282) RATIONAL (5) 1<72>
YResolution (283) RATIONAL (5) 1<72>
ResolutionUnit (296) SHORT (3) 1<2>
ExtraSamples (338) SHORT (3) 1<2>

LGTM=bsiegert, nigeltao
R=bsiegert, nigeltao
CC=golang-codereviews
https://golang.org/cl/95930044
2014-05-12 16:41:44 +10:00
ChaiShushan
e39b2394e5 go.image/tiff: encoder support Gray/Gray16/Paletted format
Use these commands to generate testdata:

# TIFF Tools
tiff2bw    video-001.tiff video-001-gray.tiff
tiffmedian video-001.tiff video-001-paletted.tiff

# ImageMagick
convert -depth 16 video-001.tiff      video-001-16bit.tiff
convert -depth 16 video-001-gray.tiff video-001-gray-16bit.tiff

R=nigeltao, bsiegert
CC=golang-dev
https://golang.org/cl/13243047
2013-09-13 17:42:53 +10:00
ChaiShushan
de306d5329 go.image/tiff: decoder support tiled tiff format
Use these commands to generate testdata:
tiffcp -s -r 64 video-001.tiff video-001-strip-64.tiff
tiffcp -t -l 64 -w 64 video-001.tiff video-001-tile-64x64.tiff

R=golang-dev, nigeltao, bsiegert
CC=golang-dev
https://golang.org/cl/13453043
2013-09-06 20:07:58 +10:00
Nigel Tao
996c335c4a go.image/{bmp,tiff}: move tiff/testdata to testdata.
Add a "compare to golden PNG" test for BMP and TIFF.

R=rsc
CC=golang-dev
https://golang.org/cl/5601054
2012-01-31 14:02:27 +11:00