]> Cypherpunks repositories - gostls13.git/commit
image/jpeg: speed up decoding by inlining the clip function and
authorNigel Tao <nigeltao@golang.org>
Tue, 10 May 2011 00:25:32 +0000 (17:25 -0700)
committerNigel Tao <nigeltao@golang.org>
Tue, 10 May 2011 00:25:32 +0000 (17:25 -0700)
commit4c1e1b815b6a1b295914cea0936118b77e7776b1
tree4b8c51654e1122abdb44e4d1ca036b67d05ffdf4
parent499ad9448b0cb275ebf0703b087c2d162c2c5c89
image/jpeg: speed up decoding by inlining the clip function and
writing the idct result directly to the image buffer instead of
storing it in an intermediate d.blocks field.

Writing to d.blocks was necessary when decoding to an image.RGBA image,
but now that we decode to a ycbcr.YCbCr we can write each component
directly to the image buffer.

Crude "time ./6.out" scores to decode a specific 2592x1944 JPEG 20
times show a 16% speed-up:

BEFORE

user 0m10.410s
user 0m10.400s
user 0m10.480s
user 0m10.480s
user 0m10.460s

AFTER

user 0m9.050s
user 0m9.050s
user 0m9.050s
user 0m9.070s
user 0m9.020s

R=r
CC=golang-dev
https://golang.org/cl/4523052
src/pkg/image/jpeg/idct.go
src/pkg/image/jpeg/reader.go