]> Cypherpunks repositories - gostls13.git/commitdiff
image/jpeg: move the huffman bit decoder state higher up in the
authorNigel Tao <nigeltao@golang.org>
Sun, 7 Oct 2012 08:32:28 +0000 (19:32 +1100)
committerNigel Tao <nigeltao@golang.org>
Sun, 7 Oct 2012 08:32:28 +0000 (19:32 +1100)
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

src/pkg/image/jpeg/reader.go

index 263ef45aac35ea097524c0c767b8265d700e1067..415b093281dd28c5906a0a15f4b9aad36aa96d6b 100644 (file)
@@ -92,6 +92,7 @@ type Reader interface {
 
 type decoder struct {
        r             Reader
+       b             bits
        width, height int
        img1          *image.Gray
        img3          *image.YCbCr
@@ -100,7 +101,6 @@ type decoder struct {
        comp          [nColorComponent]component
        huff          [maxTc + 1][maxTh + 1]huffman
        quant         [maxTq + 1]block // Quantization tables, in zig-zag order.
-       b             bits
        tmp           [1024]byte
 }