Commit d7b7957d authored by Nigel Tao's avatar Nigel Tao

image/jpeg: move the huffman bit decoder state higher up in the

decoder struct, inside the unmappedzero limit, to eliminate some
TESTB instructions in the inner decoding loop.

benchmark          old ns/op    new ns/op    delta
BenchmarkDecode      2943204      2746360   -6.69%

R=r, dave
CC=golang-dev
https://golang.org/cl/6625058
parent 9224b4c8
...@@ -92,6 +92,7 @@ type Reader interface { ...@@ -92,6 +92,7 @@ type Reader interface {
type decoder struct { type decoder struct {
r Reader r Reader
b bits
width, height int width, height int
img1 *image.Gray img1 *image.Gray
img3 *image.YCbCr img3 *image.YCbCr
...@@ -100,7 +101,6 @@ type decoder struct { ...@@ -100,7 +101,6 @@ type decoder struct {
comp [nColorComponent]component comp [nColorComponent]component
huff [maxTc + 1][maxTh + 1]huffman huff [maxTc + 1][maxTh + 1]huffman
quant [maxTq + 1]block // Quantization tables, in zig-zag order. quant [maxTq + 1]block // Quantization tables, in zig-zag order.
b bits
tmp [1024]byte tmp [1024]byte
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment