OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package tiff | 5 package tiff |
6 | 6 |
7 import ( | 7 import ( |
8 "image" | 8 "image" |
9 "io/ioutil" | 9 "io/ioutil" |
10 "os" | 10 "os" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 t.Fatal(err) | 98 t.Fatal(err) |
99 } | 99 } |
100 img2, err := load("video-001-strip-64.tiff") | 100 img2, err := load("video-001-strip-64.tiff") |
101 if err != nil { | 101 if err != nil { |
102 t.Fatal(err) | 102 t.Fatal(err) |
103 } | 103 } |
104 img3, err := load("video-001-tile-64x64.tiff") | 104 img3, err := load("video-001-tile-64x64.tiff") |
105 if err != nil { | 105 if err != nil { |
106 t.Fatal(err) | 106 t.Fatal(err) |
107 } | 107 } |
| 108 img4, err := load("video-001-16bit.tiff") |
| 109 if err != nil { |
| 110 t.Fatal(err) |
| 111 } |
108 | 112 |
109 compare(t, img0, img1) | 113 compare(t, img0, img1) |
110 compare(t, img0, img2) | 114 compare(t, img0, img2) |
111 compare(t, img0, img3) | 115 compare(t, img0, img3) |
| 116 compare(t, img0, img4) |
112 } | 117 } |
113 | 118 |
114 // TestDecompress tests that decoding some TIFF images that use different | 119 // TestDecompress tests that decoding some TIFF images that use different |
115 // compression formats result in the same pixel data. | 120 // compression formats result in the same pixel data. |
116 func TestDecompress(t *testing.T) { | 121 func TestDecompress(t *testing.T) { |
117 var decompressTests = []string{ | 122 var decompressTests = []string{ |
118 "bw-uncompressed.tiff", | 123 "bw-uncompressed.tiff", |
119 "bw-deflate.tiff", | 124 "bw-deflate.tiff", |
120 "bw-packbits.tiff", | 125 "bw-packbits.tiff", |
121 } | 126 } |
(...skipping 23 matching lines...) Expand all Loading... |
145 for i := 0; i < b.N; i++ { | 150 for i := 0; i < b.N; i++ { |
146 _, err := Decode(r) | 151 _, err := Decode(r) |
147 if err != nil { | 152 if err != nil { |
148 b.Fatal("Decode:", err) | 153 b.Fatal("Decode:", err) |
149 } | 154 } |
150 } | 155 } |
151 } | 156 } |
152 | 157 |
153 func BenchmarkDecodeCompressed(b *testing.B) { benchmarkDecode(b, "video-001.t
iff") } | 158 func BenchmarkDecodeCompressed(b *testing.B) { benchmarkDecode(b, "video-001.t
iff") } |
154 func BenchmarkDecodeUncompressed(b *testing.B) { benchmarkDecode(b, "video-001-u
ncompressed.tiff") } | 159 func BenchmarkDecodeUncompressed(b *testing.B) { benchmarkDecode(b, "video-001-u
ncompressed.tiff") } |
OLD | NEW |