Module h264_reader::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

  • Reads H.264 bitstream syntax elements from an RBSP representation (no NAL header byte or emulation prevention three bytes).
  • BufRead adapter which returns RBSP bytes given NAL bytes by removing the NAL header and emulation-prevention-three bytes.

Enums

Traits

Functions

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