Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(201)

Delta Between Two Patch Sets: tiff/reader_test.go

Issue 105750045: code review 105750045: go.image/tiff: fix (TIFF-specific) LZW decompression. (Closed)
Left Patch Set: Created 10 years, 10 months ago
Right Patch Set: diff -r b45f3856d47b https://code.google.com/p/go.image Created 10 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « tiff/reader.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if err != nil { 118 if err != nil {
119 t.Fatal(err) 119 t.Fatal(err)
120 } 120 }
121 121
122 compare(t, img0, img1) 122 compare(t, img0, img1)
123 compare(t, img0, img2) 123 compare(t, img0, img2)
124 compare(t, img0, img3) 124 compare(t, img0, img3)
125 compare(t, img0, img4) 125 compare(t, img0, img4)
126 } 126 }
127 127
128 // TestDecodeLZW tests that decoding a PNG image and a LZW-compressed TIFF image
129 // result in the same pixel data.
130 func TestDecodeLZW(t *testing.T) {
131 img0, err := load("blue-purple-pink.png")
132 if err != nil {
133 t.Fatal(err)
134 }
135 img1, err := load("blue-purple-pink.lzwcompressed.tiff")
136 if err != nil {
137 t.Fatal(err)
138 }
139
140 compare(t, img0, img1)
141 }
142
128 // TestDecompress tests that decoding some TIFF images that use different 143 // TestDecompress tests that decoding some TIFF images that use different
129 // compression formats result in the same pixel data. 144 // compression formats result in the same pixel data.
130 func TestDecompress(t *testing.T) { 145 func TestDecompress(t *testing.T) {
131 var decompressTests = []string{ 146 var decompressTests = []string{
132 "bw-uncompressed.tiff", 147 "bw-uncompressed.tiff",
133 "bw-deflate.tiff", 148 "bw-deflate.tiff",
134 "bw-packbits.tiff", 149 "bw-packbits.tiff",
135 } 150 }
136 var img0 image.Image 151 var img0 image.Image
137 for _, name := range decompressTests { 152 for _, name := range decompressTests {
(...skipping 21 matching lines...) Expand all
159 for i := 0; i < b.N; i++ { 174 for i := 0; i < b.N; i++ {
160 _, err := Decode(r) 175 _, err := Decode(r)
161 if err != nil { 176 if err != nil {
162 b.Fatal("Decode:", err) 177 b.Fatal("Decode:", err)
163 } 178 }
164 } 179 }
165 } 180 }
166 181
167 func BenchmarkDecodeCompressed(b *testing.B) { benchmarkDecode(b, "video-001.t iff") } 182 func BenchmarkDecodeCompressed(b *testing.B) { benchmarkDecode(b, "video-001.t iff") }
168 func BenchmarkDecodeUncompressed(b *testing.B) { benchmarkDecode(b, "video-001-u ncompressed.tiff") } 183 func BenchmarkDecodeUncompressed(b *testing.B) { benchmarkDecode(b, "video-001-u ncompressed.tiff") }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b