1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:14:47 -07:00

image/jpeg: make writeDQT do fewer array copies.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4536069
This commit is contained in:
Nigel Tao 2011-05-18 10:56:20 -07:00
parent 9cd674be93
commit 8e26a644ca

View File

@ -302,14 +302,11 @@ func (e *encoder) writeMarkerHeader(marker uint8, markerlen int) {
// writeDQT writes the Define Quantization Table marker. // writeDQT writes the Define Quantization Table marker.
func (e *encoder) writeDQT() { func (e *encoder) writeDQT() {
markerlen := 2 markerlen := 2 + int(nQuantIndex)*(1+blockSize)
for _, q := range e.quant {
markerlen += 1 + len(q)
}
e.writeMarkerHeader(dqtMarker, markerlen) e.writeMarkerHeader(dqtMarker, markerlen)
for i, q := range e.quant { for i := range e.quant {
e.writeByte(uint8(i)) e.writeByte(uint8(i))
e.write(q[:]) e.write(e.quant[i][:])
} }
} }