mirror of https://bitbucket.org/ausocean/av.git
codec/mjpeg/jpeg.go: removed 'mark' function
This commit is contained in:
parent
5a09a5f12d
commit
36bcd361ed
|
@ -272,7 +272,7 @@ func (c *Context) ParsePayload(p []byte, m bool) error {
|
|||
|
||||
if m {
|
||||
// End of image marker.
|
||||
mark(c.buf, codeEOI)
|
||||
c.buf.put16(0xff00 | codeEOI)
|
||||
|
||||
_, err = c.buf.writeTo(c.dst)
|
||||
if err != nil {
|
||||
|
@ -288,10 +288,10 @@ func writeHeader(p *putBuffer, _type, width, height, nbqTab, dri int, qtable []b
|
|||
height <<= 3
|
||||
|
||||
// Indicate start of image.
|
||||
mark(p, codeSOI)
|
||||
p.put16(0xff00 | codeSOI)
|
||||
|
||||
// Write JFIF header.
|
||||
mark(p, codeAPP0)
|
||||
p.put16(0xff00 | codeAPP0)
|
||||
p.put16(jfifHeadLen)
|
||||
p.putBytes([]byte(jfifLabel))
|
||||
p.put16(jfifVer)
|
||||
|
@ -303,13 +303,13 @@ func writeHeader(p *putBuffer, _type, width, height, nbqTab, dri int, qtable []b
|
|||
|
||||
// If we want to define restart interval then write that.
|
||||
if dri != 0 {
|
||||
mark(p, codeDRI)
|
||||
p.put16(0xff00 | codeDRI)
|
||||
p.put16(4)
|
||||
p.put16(uint16(dri))
|
||||
}
|
||||
|
||||
// Define quantization tables.
|
||||
mark(p, codeDQT)
|
||||
p.put16(0xff00 | codeDQT)
|
||||
|
||||
// Calculate table size and create slice for table.
|
||||
ts := 2 + nbqTab*(1+64)
|
||||
|
@ -321,7 +321,7 @@ func writeHeader(p *putBuffer, _type, width, height, nbqTab, dri int, qtable []b
|
|||
}
|
||||
|
||||
// Define huffman table.
|
||||
mark(p, codeDHT)
|
||||
p.put16(0xff00 | codeDHT)
|
||||
lenIdx := p.len
|
||||
p.put16(0)
|
||||
writeHuffman(p, 0, 0, bitsDCLum, valDC)
|
||||
|
@ -331,7 +331,7 @@ func writeHeader(p *putBuffer, _type, width, height, nbqTab, dri int, qtable []b
|
|||
p.put16At(uint16(p.len-lenIdx), lenIdx)
|
||||
|
||||
// Start of frame.
|
||||
mark(p, codeSOF0)
|
||||
p.put16(0xff00 | codeSOF0)
|
||||
|
||||
// Derive sample type.
|
||||
sample := 1
|
||||
|
@ -363,7 +363,7 @@ func writeHeader(p *putBuffer, _type, width, height, nbqTab, dri int, qtable []b
|
|||
p.put8(uint8(mtxNo))
|
||||
|
||||
// Write start of scan.
|
||||
mark(p, codeSOS)
|
||||
p.put16(0xff00 | codeSOS)
|
||||
p.put16(sosLen)
|
||||
p.put8(sosComponentsInScan)
|
||||
|
||||
|
@ -379,12 +379,6 @@ func writeHeader(p *putBuffer, _type, width, height, nbqTab, dri int, qtable []b
|
|||
p.put8(0)
|
||||
}
|
||||
|
||||
// mark writes a marker with code c to the putBuffer p.
|
||||
func mark(p *putBuffer, c byte) {
|
||||
p.put8(0xff)
|
||||
p.put8(c)
|
||||
}
|
||||
|
||||
// writeHuffman write a JPEG huffman table to w.
|
||||
func writeHuffman(p *putBuffer, class, id int, bits, values []byte) {
|
||||
p.put8(uint8(class<<4 | id))
|
||||
|
|
Loading…
Reference in New Issue