Documentation
¶
Overview ¶
Package obu implements tools for working with the Open Bitstream Unit.
Index ¶
Constants ¶
const ( // OBUSequenceHeader av1 sequence_header_obu. OBUSequenceHeader = Type(1) // OBUTemporalDelimiter av1 temporal_delimiter_obu. OBUTemporalDelimiter = Type(2) // OBUFrameHeader av1 frame_header_obu. OBUFrameHeader = Type(3) // OBUTileGroup av1 tile_group_obu. OBUTileGroup = Type(4) // OBUMetadata av1 metadata_obu. OBUMetadata = Type(5) // OBUFrame av1 frame_obu. OBUFrame = Type(6) // OBURedundantFrameHeader av1 redundant_frame_header_obu. OBURedundantFrameHeader = Type(7) // OBUTileList av1 tile_list_obu. OBUTileList = Type(8) // OBUPadding av1 padding_obu. OBUPadding = Type(15) )
OBU types as defined in the AV1 specification. 5.3.1: https://aomediacodec.github.io/av1-spec/av1-spec.pdf#page=39
Variables ¶
var ( // ErrInvalidOBUHeader is returned when an OBU header has forbidden bits set. ErrInvalidOBUHeader = errors.New("invalid OBU header") // ErrShortHeader is returned when an OBU header is not large enough. // This can happen when an extension header is expected but not present. ErrShortHeader = errors.New("OBU header is not large enough") )
var ErrFailedToReadLEB128 = errors.New("payload ended before LEB128 was finished")
ErrFailedToReadLEB128 indicates that a buffer ended before a LEB128 value could be successfully read.
Functions ¶
func ReadLeb128 ¶
ReadLeb128 scans an buffer and decodes a Leb128 value. If the end of the buffer is reached and all MSB are set an error is returned.
func WriteToLeb128 ¶ added in v1.8.4
WriteToLeb128 writes a uint to a LEB128 encoded byte slice.
Types ¶
type ExtensionHeader ¶ added in v1.8.12
ExtensionHeader represents an OBU extension header obu_extension_header(). 5.3.3 https://aomediacodec.github.io/av1-spec/av1-spec.pdf#page=40
func ParseOBUExtensionHeader ¶ added in v1.8.12
func ParseOBUExtensionHeader(headerData byte) ExtensionHeader
ParseOBUExtensionHeader parses an OBU extension header from the given data. 5.3.3 https://aomediacodec.github.io/av1-spec/av1-spec.pdf#page=40
obu_extension_header() { Type
temporal_id f(3)
spatial_id f(2)
extension_header_reserved_3bits f(3)
}
func (*ExtensionHeader) Marshal ¶ added in v1.8.12
func (o *ExtensionHeader) Marshal() byte
Marshal serializes the OBU extension header to a byte slice. 5.3.3 https://aomediacodec.github.io/av1-spec/av1-spec.pdf#page=40
obu_extension_header() { Type
temporal_id f(3)
spatial_id f(2)
extension_header_reserved_3bits f(3)
}
type Header ¶ added in v1.8.12
type Header struct {
Type Type
ExtensionHeader *ExtensionHeader
HasSizeField bool
Reserved1Bit bool
}
Header represents the header of an OBU obu_header(). 5.3.2: https://aomediacodec.github.io/av1-spec/av1-spec.pdf#page=40
func ParseOBUHeader ¶ added in v1.8.12
ParseOBUHeader parses an OBU header from the given data. 5.3.2: https://aomediacodec.github.io/av1-spec/av1-spec.pdf#page=40
obu_header() { Type
obu_forbidden_bit f(1)
obu_type f(4)
obu_extension_flag f(1)
obu_has_size_field f(1)
obu_reserved_1bit f(1)
if ( obu_extension_flag == 1 )
obu_extension_header()
}
}
func (*Header) Marshal ¶ added in v1.8.12
Marshal serializes the OBU header to a byte slice. If the OBU has an extension header, the extension header is serialized as well. 5.3.2: https://aomediacodec.github.io/av1-spec/av1-spec.pdf#page=40
obu_header() { Type
obu_forbidden_bit f(1)
obu_type f(4)
obu_extension_flag f(1)
obu_has_size_field f(1)
obu_reserved_1bit f(1)
if ( obu_extension_flag == 1 )
obu_extension_header()
}
}
type OBU ¶ added in v1.8.12
OBU represents an AV1 OBU. 5.1 https://aomediacodec.github.io/av1-spec/av1-spec.pdf#page=39
func (*OBU) Marshal ¶ added in v1.8.12
Marshal serializes the OBU to low-overhead bitstream format. 5.2 https://aomediacodec.github.io/av1-spec/av1-spec.pdf#page=40