codec/mjpeg/jpeg.go: simplified some more indexing

This commit is contained in:
Saxon 2020-01-07 13:14:18 +10:30
parent 0b848cb01b
commit 52f18cdc58
1 changed files with 2 additions and 3 deletions

View File

@ -326,12 +326,11 @@ func writeHeader(p []byte, _type, width, height, nbqTab int, dri uint16, qtable
// Define quantization tables.
binary.BigEndian.PutUint16(p[idx:], 0xff00|codeDQT)
idx += 2
// Calculate table size and create slice for table.
ts := 2 + nbqTab*(1+64)
binary.BigEndian.PutUint16(p[idx:], uint16(ts))
idx += 2
binary.BigEndian.PutUint16(p[idx+2:], uint16(ts))
idx += 4
for i := 0; i < nbqTab; i++ {
p[idx] = byte(i)