Left: | ||
Right: |
OLD | NEW |
---|---|
1 // Copyright 2014 The Go Authors. All rights reserved. | 1 // Copyright 2014 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 vp8l implements a decoder for the VP8L lossless image format. | 5 // Package vp8l implements a decoder for the VP8L lossless image format. |
6 // | 6 // |
7 // The VP8L specification is at: | 7 // The VP8L specification is at: |
8 // https://developers.google.com/speed/webp/docs/riff_container | 8 // https://developers.google.com/speed/webp/docs/riff_container |
9 package vp8l | 9 package vp8l |
10 | 10 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 ms, err := d.read(n) | 173 ms, err := d.read(n) |
174 if err != nil { | 174 if err != nil { |
175 return err | 175 return err |
176 } | 176 } |
177 maxSymbol = int(ms) + 2 | 177 maxSymbol = int(ms) + 2 |
178 if maxSymbol > len(dst) { | 178 if maxSymbol > len(dst) { |
179 return errInvalidCodeLengths | 179 return errInvalidCodeLengths |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 » prevCodeLength := uint32(0) | 183 » // The spec says that "if code 16 [meaning repeat] is used before |
skal
2014/09/25 07:33:50
is using tabs ok?
nigeltao
2014/09/26 01:08:16
Yes, Go tabs/spaces style is "whatever gofmt outpu
| |
184 » // a non-zero value has been emitted, a value of 8 is repeated." | |
185 » prevCodeLength := uint32(8) | |
186 | |
184 for symbol := 0; symbol < len(dst); { | 187 for symbol := 0; symbol < len(dst); { |
185 if maxSymbol == 0 { | 188 if maxSymbol == 0 { |
186 break | 189 break |
187 } | 190 } |
188 maxSymbol-- | 191 maxSymbol-- |
189 codeLength, err := h.next(d) | 192 codeLength, err := h.next(d) |
190 if err != nil { | 193 if err != nil { |
191 return err | 194 return err |
192 } | 195 } |
193 if codeLength < repeatsCodeLength { | 196 if codeLength < repeatsCodeLength { |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
591 for i := nTransforms - 1; i >= 0; i-- { | 594 for i := nTransforms - 1; i >= 0; i-- { |
592 t := &transforms[i] | 595 t := &transforms[i] |
593 pix = inverseTransforms[t.transformType](t, pix, h) | 596 pix = inverseTransforms[t.transformType](t, pix, h) |
594 } | 597 } |
595 return &image.NRGBA{ | 598 return &image.NRGBA{ |
596 Pix: pix, | 599 Pix: pix, |
597 Stride: 4 * int(originalW), | 600 Stride: 4 * int(originalW), |
598 Rect: image.Rect(0, 0, int(originalW), int(h)), | 601 Rect: image.Rect(0, 0, int(originalW), int(h)), |
599 }, nil | 602 }, nil |
600 } | 603 } |
OLD | NEW |