Skip to main content

Module rbsp

Module rbsp 

Source
Expand description

Decoder that will remove NAL header bytes and Emulation Prevention byte values from encoded NAL Units, to produce the Raw Byte Sequence Payload (RBSP).

The following byte sequences are not allowed to appear in a framed H264 bitstream,

  • 0x00 0x00 0x00
  • 0x00 0x00 0x01
  • 0x00 0x00 0x02
  • 0x00 0x00 0x03

therefore if these byte sequences do appear in the raw bitstream, an ‘escaping’ mechanism (called ‘emulation prevention’ in the spec) is applied by adding a 0x03 byte between the second and third bytes in the above sequence, resulting in the following encoded versions,

  • 0x00 0x00 0x03 0x00
  • 0x00 0x00 0x03 0x01
  • 0x00 0x00 0x03 0x02
  • 0x00 0x00 0x03 0x03

The ByteReader type will accept byte sequences that have had this encoding applied, and will yield byte sequences where the encoding is removed (i.e. the decoder will replace instances of the sequence 0x00 0x00 0x03 with 0x00 0x00).

Structs§

BitReader
Reads H.264 bitstream syntax elements from an RBSP representation (no NAL header byte or emulation prevention three bytes).
ByteReader
BufRead adapter which returns RBSP from NAL bytes.

Enums§

BitReaderError

Traits§

BitRead
Numeric
This trait extends many common integer types (both unsigned and signed) with a few trivial methods so that they can be used with the bitstream handling traits.
Primitive
A trait intended for simple fixed-length primitives (such as ints and floats) which allows them to be read and written to streams of different endiannesses verbatim.

Functions§

decode_nal
Returns RBSP from a NAL by removing the NAL header and emulation-prevention-three bytes.