mirror of https://bitbucket.org/ausocean/av.git
codec/mjpeg/jpeg.go: defining consts for SOF0 header fields
This commit is contained in:
parent
3f4561da5b
commit
49138ce021
|
@ -55,8 +55,8 @@ const (
|
||||||
// Density units.
|
// Density units.
|
||||||
const (
|
const (
|
||||||
unitNone = iota
|
unitNone = iota
|
||||||
unitPxIN
|
unitPxIN // Pixels per inch.
|
||||||
unitPxCM
|
unitPxCM // Pixels per centimeter.
|
||||||
)
|
)
|
||||||
|
|
||||||
// JFIF header fields.
|
// JFIF header fields.
|
||||||
|
@ -71,6 +71,13 @@ const (
|
||||||
jfifHeadLen = 16 // Length of JFIF header segment excluding APP0 marker.
|
jfifHeadLen = 16 // Length of JFIF header segment excluding APP0 marker.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SOF0 (start of scan) header fields.
|
||||||
|
const (
|
||||||
|
sofLen = 17
|
||||||
|
sofPrecision = 8
|
||||||
|
sofNoOfComponents = 3
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
errNoQTable = errors.New("no quantization table")
|
errNoQTable = errors.New("no quantization table")
|
||||||
errReservedQ = errors.New("q value is reserved")
|
errReservedQ = errors.New("q value is reserved")
|
||||||
|
@ -334,11 +341,13 @@ func writeHeader(p *putBuffer, _type, width, height, nbqTab, dri int, qtable []b
|
||||||
mtxNo = 1
|
mtxNo = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
p.put16(17)
|
p.put16(sofLen)
|
||||||
p.put8(8)
|
p.put8(sofPrecision)
|
||||||
p.put16(uint16(height))
|
p.put16(uint16(height))
|
||||||
p.put16(uint16(width))
|
p.put16(uint16(width))
|
||||||
p.put8(3)
|
p.put8(sofNoOfComponents)
|
||||||
|
|
||||||
|
// TODO: find meaning of these fields.
|
||||||
p.put8(1)
|
p.put8(1)
|
||||||
p.put8(uint8((2 << 4) | sample))
|
p.put8(uint8((2 << 4) | sample))
|
||||||
p.put8(0)
|
p.put8(0)
|
||||||
|
|
Loading…
Reference in New Issue