Documentation ¶
Overview ¶
Package bits implements bit reading and writing including EBSP.
Beyond plain bit reading and writing, it includes reading of ebsp (Encapsulated Byte Sequence Packets) Golomb codes as used in the AVC/H.264 and HEVC video coding standards.
Index ¶
- Variables
- func EBSP2rbsp(ebsp []byte) []byte
- type EBSPReader
- func (r *EBSPReader) IsSeeker() bool
- func (r *EBSPReader) MoreRbspData() (bool, error)
- func (r *EBSPReader) MustRead(n int) uint
- func (r *EBSPReader) MustReadExpGolomb() uint
- func (r *EBSPReader) MustReadFlag() bool
- func (r *EBSPReader) MustReadSignedGolomb() int
- func (r *EBSPReader) NrBitsReadInCurrentByte() int
- func (r *EBSPReader) NrBytesRead() int
- func (r *EBSPReader) Read(n int) (uint, error)
- func (r *EBSPReader) ReadExpGolomb() (uint, error)
- func (r *EBSPReader) ReadFlag() (bool, error)
- func (r *EBSPReader) ReadRbspTrailingBits() error
- func (r *EBSPReader) ReadSignedGolomb() (int, error)
- type Reader
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ErrNotReedSeeker = errors.New("Reader does not support Seek")
Functions ¶
Types ¶
type EBSPReader ¶
type EBSPReader struct {
// contains filtered or unexported fields
}
EBSPReader - Reader that drops start code emulation 0x03 after two bytes of 0x00
func NewEBSPReader ¶
func NewEBSPReader(rd io.Reader) *EBSPReader
NewEBSPReader - return a new Reader.
func (*EBSPReader) IsSeeker ¶ added in v0.12.0
func (r *EBSPReader) IsSeeker() bool
IsSeeker - does reader support Seek
func (*EBSPReader) MoreRbspData ¶ added in v0.12.0
func (r *EBSPReader) MoreRbspData() (bool, error)
MoreRbspData - false if next bit is 1 and last 1 in fullSlice Underlying reader must support ReadSeeker interface to reset after check
func (*EBSPReader) MustRead ¶
func (r *EBSPReader) MustRead(n int) uint
MustRead - read n bits and panic if not possible
func (*EBSPReader) MustReadExpGolomb ¶
func (r *EBSPReader) MustReadExpGolomb() uint
MustReadExpGolomb - Read one unsigned exponential golomb code. Panic if not possible
func (*EBSPReader) MustReadFlag ¶
func (r *EBSPReader) MustReadFlag() bool
MustReadFlag - read 1 bit into flag. Panic if not possible
func (*EBSPReader) MustReadSignedGolomb ¶
func (r *EBSPReader) MustReadSignedGolomb() int
MustReadSignedGolomb - Read one signed exponential golomb code. Panic if not possible
func (*EBSPReader) NrBitsReadInCurrentByte ¶ added in v0.12.0
func (r *EBSPReader) NrBitsReadInCurrentByte() int
NrBitsReadInCurrentByte - how many bits have been read
func (*EBSPReader) NrBytesRead ¶
func (r *EBSPReader) NrBytesRead() int
NrBytesRead - how many bytes read into parser
func (*EBSPReader) Read ¶
func (r *EBSPReader) Read(n int) (uint, error)
Read - read n bits and return error if not possible
func (*EBSPReader) ReadExpGolomb ¶
func (r *EBSPReader) ReadExpGolomb() (uint, error)
ReadExpGolomb - Read one unsigned exponential golomb code
func (*EBSPReader) ReadFlag ¶
func (r *EBSPReader) ReadFlag() (bool, error)
ReadFlag - read 1 bit into flag. Return error if not possible
func (*EBSPReader) ReadRbspTrailingBits ¶ added in v0.12.0
func (r *EBSPReader) ReadRbspTrailingBits() error
ReadRbspTrailingBits - read rbsp_traling_bits. Return false if wrong pattern
func (*EBSPReader) ReadSignedGolomb ¶
func (r *EBSPReader) ReadSignedGolomb() (int, error)
ReadSignedGolomb - Read one signed exponential golomb code
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader - read bits from the given io.Reader
func (*Reader) MustReadFlag ¶
MustReadFlag - read 1 bit into flag and panic if not possible
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes bits into underlying io.Writer. Stops writing at first error. Errors that have occured can later be checked with Error().