• Nigel Tao's avatar
    image: change the YCbCr image's pixel buffers to start at Rect.Min · ab2ea94c
    Nigel Tao authored
    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
    ab2ea94c
ycbcr.go 3.97 KB