Commit 8e26a644 authored by Nigel Tao's avatar Nigel Tao

image/jpeg: make writeDQT do fewer array copies.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4536069
parent 9cd674be
......@@ -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][:])
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment