codec/mjpeg/jpeg.go: defining consts for SOS header fields

This commit is contained in:
Saxon 2020-01-02 11:20:21 +10:30
parent 6bdfdb1f2a
commit ac23e126e3
1 changed files with 11 additions and 3 deletions

View File

@ -71,13 +71,19 @@ const (
jfifHeadLen = 16 // Length of JFIF header segment excluding APP0 marker.
)
// SOF0 (start of scan) header fields.
// SOF0 (start of frame) header fields.
const (
sofLen = 17
sofPrecision = 8
sofNoOfComponents = 3
)
// SOS (start of scan) header fields.
const (
sosLen = 12
sosComponentsInScan = 3
)
var (
errNoQTable = errors.New("no quantization table")
errReservedQ = errors.New("q value is reserved")
@ -359,8 +365,10 @@ func writeHeader(p *putBuffer, _type, width, height, nbqTab, dri int, qtable []b
// Write start of scan.
mark(p, codeSOS)
p.put16(12)
p.put8(3)
p.put16(sosLen)
p.put8(sosComponentsInScan)
// TODO: find out what remaining fields are.
p.put8(1)
p.put8(0)
p.put8(2)