]> Cypherpunks repositories - gostls13.git/commit
image: change the YCbCr image's pixel buffers to start at Rect.Min
authorNigel Tao <nigeltao@golang.org>
Thu, 19 Jan 2012 23:44:22 +0000 (10:44 +1100)
committerNigel Tao <nigeltao@golang.org>
Thu, 19 Jan 2012 23:44:22 +0000 (10:44 +1100)
commitab2ea94c609cb2e6b6dd61ceea93a88a7a66b090
tree5d0e347fb6dec2b806f0c37dc44cdbe8f580169f
parent7f4936a1c5d828b39efea48787bb266f4666d95c
image: change the YCbCr image's pixel buffers to start at Rect.Min
instead of the origin.

This makes YCbCr match the other image types (e.g. RGBA, Gray) in
that an image's bounds is not restricted to the positive quadrant.

Also optimize the YCbCr draw code by hoisting some computation
outside of the loop.

benchmark              old ns/op    new ns/op    delta
draw.BenchmarkYCbCr      2544418      2373558   -6.72%

Like https://golang.org/cl/4681044/ I don't think a gofix is
feasible. People will have to make manual changes. On the other hand,
directly manipulating YCbCr images is relatively rare, compared to
RGBA images, and if other code just uses the jpeg and draw packages
instead of messing directly with a YCbCr's []byte representations,
then things should just continue to work.

R=r
CC=golang-dev
https://golang.org/cl/5558048
src/pkg/image/draw/draw.go
src/pkg/image/image.go
src/pkg/image/jpeg/reader.go
src/pkg/image/ycbcr.go
src/pkg/image/ycbcr_test.go [new file with mode: 0644]