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

Delta Between Two Patch Sets: tiff/writer_test.go

Issue 6866051: code review 6866051: tiff: support for writing compressed images. (Closed)
Left Patch Set: Created 11 years, 3 months ago
Right Patch Set: diff -r a0de9da0017e https://code.google.com/p/go.image Created 11 years, 3 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/writer.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 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 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 "bytes" 8 "bytes"
9 "image" 9 "image"
10 "io/ioutil" 10 "io/ioutil"
11 "os" 11 "os"
12 "testing" 12 "testing"
13 ) 13 )
14 14
15 var roundtripTests = []struct { 15 var roundtripTests = []struct {
16 filename string 16 filename string
17 opts *Options 17 opts *Options
18 }{ 18 }{
19 {"video-001.tiff", nil}, 19 {"video-001.tiff", nil},
20 {"bw-packbits.tiff", nil}, 20 {"bw-packbits.tiff", nil},
21 {"video-001.tiff", &Options{Predictor: true}}, 21 {"video-001.tiff", &Options{Predictor: true}},
22 {"video-001.tiff", &Options{Compression: Deflate}},
23 {"video-001.tiff", &Options{Predictor: true, Compression: Deflate}},
22 } 24 }
23 25
24 func openImage(filename string) (image.Image, error) { 26 func openImage(filename string) (image.Image, error) {
25 f, err := os.Open(testdataDir + filename) 27 f, err := os.Open(testdataDir + filename)
26 if err != nil { 28 if err != nil {
27 return nil, err 29 return nil, err
28 } 30 }
29 defer f.Close() 31 defer f.Close()
30 return Decode(f) 32 return Decode(f)
31 } 33 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if err != nil { 76 if err != nil {
75 b.Fatal(err) 77 b.Fatal(err)
76 } 78 }
77 s := img.Bounds().Size() 79 s := img.Bounds().Size()
78 b.SetBytes(int64(s.X * s.Y * 4)) 80 b.SetBytes(int64(s.X * s.Y * 4))
79 b.ResetTimer() 81 b.ResetTimer()
80 for i := 0; i < b.N; i++ { 82 for i := 0; i < b.N; i++ {
81 Encode(ioutil.Discard, img, nil) 83 Encode(ioutil.Discard, img, nil)
82 } 84 }
83 } 85 }
LEFTRIGHT

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