codec/mjpeg/jpeg.go: simplified some indexing

This commit is contained in:
Saxon 2020-01-07 13:09:27 +10:30
parent d0e356314d
commit 38c4972a76
1 changed files with 3 additions and 4 deletions

View File

@ -299,12 +299,11 @@ func writeHeader(p []byte, _type, width, height, nbqTab int, dri uint16, qtable
// Indicate start of image.
idx := 0
binary.BigEndian.PutUint16(p[idx:], 0xff00|codeSOI)
idx += 2
// Write JFIF header.
binary.BigEndian.PutUint16(p[idx:], 0xff00|codeAPP0)
binary.BigEndian.PutUint16(p[idx+2:], jfifHeadLen)
idx += 4
binary.BigEndian.PutUint16(p[idx+2:], 0xff00|codeAPP0)
binary.BigEndian.PutUint16(p[idx+4:], jfifHeadLen)
idx += 6
src := []byte(jfifLabel)
copy(p[idx:], src)