• Thomas Bonfort's avatar
    image/jpeg: improve performance when encoding *image.YCbCr · 435450bf
    Thomas Bonfort authored
    The existing implementation falls back to using image.At()
    for each pixel when encoding an *image.YCbCr which is
    inefficient and causes many memory allocations.
    
    This change makes the jpeg encoder directly read Y, Cb, and Cr
    pixel values.
    
    benchmark                  old ns/op     new ns/op     delta
    BenchmarkEncodeYCbCr-4     43990846      24201148      -44.99%
    
    benchmark                  old MB/s     new MB/s     speedup
    BenchmarkEncodeYCbCr-4     20.95        38.08        1.82x
    
    Fixes #18487
    
    Change-Id: Iaf2ebc646997e3e1fffa5335f1b0d642e15bd453
    Reviewed-on: https://go-review.googlesource.com/34773
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarNigel Tao <nigeltao@golang.org>
    435450bf
Name
Last commit
Last update
..
color Loading commit data...
draw Loading commit data...
gif Loading commit data...
internal/imageutil Loading commit data...
jpeg Loading commit data...
png Loading commit data...
testdata Loading commit data...
decode_example_test.go Loading commit data...
decode_test.go Loading commit data...
format.go Loading commit data...
geom.go Loading commit data...
geom_test.go Loading commit data...
image.go Loading commit data...
image_test.go Loading commit data...
names.go Loading commit data...
ycbcr.go Loading commit data...
ycbcr_test.go Loading commit data...