14 years, 2 months ago
(2011-02-23 07:31:48 UTC)
#3
http://codereview.appspot.com/4182081/diff/10006/src/pkg/compress/lzw/reader.go
File src/pkg/compress/lzw/reader.go (right):
http://codereview.appspot.com/4182081/diff/10006/src/pkg/compress/lzw/reader....
src/pkg/compress/lzw/reader.go:36: func nextCodeLSB(d *decoder) (uint16,
os.Error) {
On 2011/02/22 21:13:09, rsc wrote:
> you can make this func (d *decoder) lsb() (uint16, os.Error)
> and refer to it below as (*decoder).lsb.
> that will avoid any clash with encoder functions later.
Done.
> also, whichever of these is untested is probably wrong.
> i expected one of them to need a byte-reverse lookup table
> like in compress/flate.
I suspect that LSB/MSB means something different than what you think it means.
I've added a test case for a PDF LZW stream that I found on the internet.
http://codereview.appspot.com/4182081/diff/10006/src/pkg/compress/lzw/reader....
src/pkg/compress/lzw/reader.go:176: func NewReader(r io.Reader, packingOrder
string, litWidth int) io.ReadCloser {
On 2011/02/22 21:13:09, rsc wrote:
> define a type for packing order
>
> type Order int
> const (
> LSB Order = iota
> MSB
> )
>
Done.
http://codereview.appspot.com/4182081/diff/10006/src/pkg/compress/lzw/reader....
src/pkg/compress/lzw/reader.go:193: pw.CloseWithError(decode(pw,
bufio.NewReader(r), nextCode, uint(litWidth)))
On 2011/02/22 21:13:09, rsc wrote:
> should do what flate does: sniff to see if it already has ReadByte
> to avoid double-buffering
Done.
Issue 4182081: code review 4182081: compress/lzw: implement a decoder.
(Closed)
Created 14 years, 3 months ago by nigeltao
Modified 14 years, 2 months ago
Reviewers:
Base URL:
Comments: 6