Documentation
¶
Overview ¶
Package bits implements bit reading and writing.
Beyond plain bit reading and writing, it includes reading of ebsp (Encapsulated Byte Sequence Packets) Golomb codes as usid in the AVC/H.264 video coding standard.
Index ¶
- func EBSP2rbsp(ebsp []byte) []byte
- type EBSPReader
- 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) 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) ReadSignedGolomb() (int, error)
- type Reader
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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) 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
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
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) 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
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes bits into underlying io.Writer. Stops at first error