1
0
mirror of https://github.com/golang/go synced 2024-11-24 21:10:04 -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.
func (e *encoder) writeDQT() {
markerlen := 2
for _, q := range e.quant {
markerlen += 1 + len(q)
}
markerlen := 2 + int(nQuantIndex)*(1+blockSize)
e.writeMarkerHeader(dqtMarker, markerlen)
for i, q := range e.quant {
for i := range e.quant {
e.writeByte(uint8(i))
e.write(q[:])
e.write(e.quant[i][:])
}
}