mirror of https://bitbucket.org/ausocean/av.git
codec/mjpeg/jpeg.go: simplified copies
This commit is contained in:
parent
52f18cdc58
commit
7fb5ed00a2
|
@ -336,9 +336,7 @@ func writeHeader(p []byte, _type, width, height, nbqTab int, dri uint16, qtable
|
|||
p[idx] = byte(i)
|
||||
idx++
|
||||
|
||||
src := qtable[64*i : (64*i)+64]
|
||||
copy(p[idx:], src)
|
||||
idx += len(src)
|
||||
copy(p[idx:], qtable[64*i:(64*i)+64])
|
||||
}
|
||||
|
||||
// Define huffman table.
|
||||
|
@ -402,13 +400,8 @@ func writeHuffman(p []byte, class, id int, bits, values []byte) int {
|
|||
n += int(bits[i])
|
||||
}
|
||||
|
||||
src := bits[1:17]
|
||||
copy(p[idx:], src)
|
||||
idx += len(src)
|
||||
|
||||
src = values[0:n]
|
||||
copy(p[idx:], src)
|
||||
idx += len(src)
|
||||
idx += copy(p[idx:], bits[1:17])
|
||||
idx += copy(p[idx:], values[0:n])
|
||||
|
||||
return idx
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue