각 Header Type 에 대한 포스팅 전 NAL 이 무엇인지 끼적여보고자 한다.
NAL unit 는 데이터의 타입을 나타내는 헤더와 RBSP 데이터로 구성된 syntax 이다. 다시 말해, 입력된 데이터가 SPS 를 가지고 있는지, PPS 를 가지고 있는지, IDR 프레임인지, SEI 를 가지고 있는지 등을 헤더 몇 바이트로 확인할 수 있는 구조이다.
이런 구조를 채택한 이유를 생각해보면, 데이터를 디코딩 시작하려 할 때 프레임 데이터나 SEI 는 decoder 가 parsing 할 수 없다. 프레임의 헤더 정보로 초기화를 한 뒤에야 디코딩 가능하다. NAL unit 을 사용함으로써 원하는 패킷부터 decoding 을 할 수 있다.
AVC 에서 사용하는 NAL 타입 코드는 아래와 같다.
다음은 NAL 과 RBSP 의 정의 원문이니 참고.
NAL unit
A syntax structure containing an indication of the type of data to follow and bytes containing that data in the form of an RBSP interspersed as necessary with emulation prevention bytes.
Raw Byte Sequence Payload (RBSP)
A syntactical data structure containing an integer number of bytes encapsulated in a NAL unit that is either null or has the form of a string of data bits containing syntax elements, followed by an RBSP stop bit, and followed by zero or more subsequent bits equal to 0.