Граф коммитов

15 Коммитов

Автор SHA1 Сообщение Дата
Dmitri Shuralyov 4aa0222fac go.mod: update go directive to 1.18
There's no reason for this module to still be assuming the semantics
of Go 1.12. Pick 1.18 as a semi-arbitrary newer version because it's
used by a few other golang.org/x modules, and it's enough to get the
nice new features like module graph pruning, removed // +build lines,
and so on. See https://go.dev/ref/mod#go-mod-file-go.

Done with:

go get go@1.18
go mod tidy
go fix ./...

Using go1.21.1.

Change-Id: Icb6874f531accb433bf7e45e7ef0f65af118bf19
Reviewed-on: https://go-review.googlesource.com/c/image/+/526895
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Nigel Tao <nigeltao@golang.org>
Commit-Queue: Nigel Tao <nigeltao@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Nigel Tao (INACTIVE; USE @golang.org INSTEAD) <nigeltao@google.com>
2023-09-08 23:15:45 +00:00
Russ Cox 99f80d0ecb all: gofmt
Gofmt to update doc comments to the new formatting.

For golang/go#51082.

Change-Id: Iae65e4d8854b66205e4cbcdd1ae0eec48c582496
Reviewed-on: https://go-review.googlesource.com/c/image/+/399615
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-04-12 02:13:10 +00:00
Russ Cox ac19c3e999 all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: Ib758eb8b75286993f3bd83b5004be667846118d4
Reviewed-on: https://go-review.googlesource.com/c/image/+/294419
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-02-20 03:29:44 +00:00
Nigel Tao 58c23975ca ccitt: add the AutoDetectHeight decoding option
Before this commit, the decodeEOL method would usually not advance the
bitReader, if the expected EOL code was not found. But in some
circumstances, it would still advance if it saw a valid decoding mode,
since EOL-decoding and mode-decoding was combined into a single table,
even though EOL was not listed in Table 1 of the "ITU-T Recommendation
T.6" spec. After this commit, EOL's and modes are separate.

Change-Id: If4b83baf8083abdf14462576c56aaeb7cc8ff0f9
Reviewed-on: https://go-review.googlesource.com/c/image/+/211238
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2020-01-19 04:44:24 +00:00
Nigel Tao 9130b4cfad ccitt: accept missing multiple-EOL trailer
The new bw-gopher-truncatedX.ccitt_groupY files were derived from the
existing bw-gopher.ccitt_groupY files, after dropping the final 6
consecutive EOL's or 2 consecutive EOL's (depending on whether Y is 3 or
4) and then padding to a byte boundary with either all 0 bits or all 1
bits (depending on X). Each EOL code is 12 bits long: 0000_0000_0001.

Fixes golang/go#34809

Change-Id: Ibb2d964b5205b28f5e2adb5d30647b92aec53c77
Reviewed-on: https://go-review.googlesource.com/c/image/+/211037
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Horst Rutter <hhrutter@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-14 00:12:46 +00:00
Nigel Tao e7c1f5e7db ccitt: style fixes
This commit applies some style fixes raised in the
https://go-review.googlesource.com/c/image/+/194417 "ccitt: set
bitReader default order to MSB" review.

Having nextBit return uint64, not uint32, removes some type conversions.

Removed a redundant "& 1" computation.

Updated a comment with s/LSB/MSB/, missed in the previous commit.

Restored the semantics of the "nBits" variable. Throughout the package,
there are a number of times where we use paired local variables or
paired struct fields, named "bits" and "nBits". The semantics is that
"bits"' type is uint32 or uint64 that actually holds a variable number
of bits, and "nBits" is that variable number. The previous commit,
writing MSB-first instead of LSB-first, changed the semantics (without
changing the variable name) so that one of those "nBits" variables now
held the index of the next bit, not the number of bits. This commit
restores the semantics: the shift is (7 - nBits), not just nBits.

Change-Id: I9afada9becceeb5642ce2c60eaf7bc0ede0cdd12
Reviewed-on: https://go-review.googlesource.com/c/image/+/199957
Reviewed-by: Horst Rutter <hhrutter@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-09 23:45:06 +00:00
Horst Rutter 69e4b8554b ccitt: set bitReader default order to MSB
Change-Id: I6d5070006e1a2069ce843e640d2c91c6474a352d
Reviewed-on: https://go-review.googlesource.com/c/image/+/194417
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-10 09:41:57 +00:00
Nigel Tao b3c06291d0 ccitt: speed up the highBits function
Also fix s/PackBits/HighBits/ typos in reader_test.go.

name        old time/op  new time/op  delta
HighBits-4  34.8µs ± 2%  11.0µs ± 1%  -68.45%  (p=0.008 n=5+5)

Change-Id: Id5af14536edb66c5313b6fcf711872e5025cb503
Reviewed-on: https://go-review.googlesource.com/c/image/+/191941
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Horst Rutter <hhrutter@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-08-29 23:35:26 +00:00
Nigel Tao 6ea1694466 ccitt: factor out a highBits function
Change-Id: I27775c06a0bb95617e0a809e5902461aea0cafde
Reviewed-on: https://go-review.googlesource.com/c/image/+/191939
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-29 09:36:49 +00:00
Horst Rutter 23ea20f87c ccitt: fix byte align and invert flag
Change-Id: I49955017deb8243b19dc1bb222ff8622ac3ff6af
Reviewed-on: https://go-review.googlesource.com/c/image/+/190677
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2019-08-28 09:01:00 +00:00
Horst Rutter 1bd0cf5764 ccitt: implement bitWriter
Change-Id: I4002e054ef8a167d5b254bd02bdbeb7932d47efc
Reviewed-on: https://go-review.googlesource.com/c/image/+/184958
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2019-07-29 22:57:35 +00:00
Nigel Tao 92942e4437 ccitt: implement NewReader and DecodeIntoGray
The testdata/bw-gopher.png image was derived from
testdata/bw-uncompressed.tiff

The testdata/*ccitt* data was generated from a custom CCITT encoder:
https://go-review.googlesource.com/c/image/+/174139/10/ccitt/writer.go

Updates golang/go#19443

Change-Id: I53b7acd807aa9a627517ede5bc3316d6f1fe4724
Reviewed-on: https://go-review.googlesource.com/c/image/+/182219
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-06-18 12:48:11 +00:00
Nigel Tao f03afa92d3 ccitt: rename fooTable vars to fooDecodeTable
Upcoming commits will also implement an encoder, not just a decoder, and
they might want to generate fooEncodeTable vars.

Change-Id: Ib02548a912a7354f00dace580151fbcfc405be8f
Reviewed-on: https://go-review.googlesource.com/c/image/+/178417
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-23 03:58:34 +00:00
Nigel Tao 61b8692d9a ccitt: don't advance bitReader after invalid code
Change-Id: I721f86aba22a6506b5b7ac162977cd31dc371b0a
Reviewed-on: https://go-review.googlesource.com/c/image/+/177297
Reviewed-by: Horst Rutter <hhrutter@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-05-16 05:27:01 +00:00
Nigel Tao e4e5bf290f ccitt: new package for CCITT images
This initial commit only provides a decoder that generates modes and run
lengths from a bit stream. Future commits will add more features.

Updates golang/go#19443

Change-Id: I7bba1226a69a83e636e407e4d72ffd5630562e6b
Reviewed-on: https://go-review.googlesource.com/c/image/+/174979
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-07 09:27:27 +00:00