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).
BitWriter
Writes H.264 bitstream syntax elements to RBSP writer.
ByteReader
BufRead adapter which returns RBSP from NAL bytes.
ByteWriter
Write adapter which inserts emulation-prevention-three bytes into RBSP.

Enums§

BitReaderError

Traits§

BitRead
Reads H.26x bitstream elements as specified in H.264 section 7.2.
BitWrite
Writes H.26x bitstream syntax elements.
Integer
Primitive

Functions§

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