View Full Version : sequence parameter set


terryleung
9th January 2009, 10:51
Hi all,

I am writing a program to extract the sequence_parameter_set_rbsp() from a mp4 file
However, i got into troubles

The mp4dump of the file(avcC box only)

type avcC
configurationVersion = 1 (0x01)
AVCProfileIndication = 66 (0x42)
profile_compatibility = 192 (0xc0)
AVCLevelIndication = 13 (0x0d)
reserved = 63 (0x3f) <6 bits>
lengthSizeMinusOne = 3 (0x3) <2 bits>
reserved1 = 7 (0x7) <3 bits>
numOfSequenceParameterSets = 1 (0x01) <5 bits>
sequenceParameterSetLength = 23 (0x0017)
sequenceParameterSetNALUnit = <23 bytes>
67 42 c0 0d 9a 74 0a 0f d8 08 80 00 00 03 00 80
00 00 0f 47 8a 15 50
numOfPictureParameterSets = 1 (0x01)
pictureParameterSetLength = 4 (0x0004)
pictureParameterSetNALUnit = <4 bytes> 68 ce 3c 80


I try to decode the sequenceParameterSetNALUnit
From my understanding

The first byte 67 is nal unit type where the last 5 bit indicate it is a sequence parameter set
and Then I decode from the second byte as a seq_parameter_set_rbsp() (in ISO/IEC 14496-10:2004 page 31)

After I decoded it, there are a lot of bit that is not used a the bitstream decoding process

I have tried to use x264 to encode a seq parameter set by using the function x264_nal_encode
Then I use my decode function to decode it, and it work very well (without any unused bit)

where is the seq_parameter_set_rbsp located in sequenceParameterSetNALUnit ???

Guest
9th January 2009, 15:04
What do you mean by unused bits? Give the details of the parsing.

Trahald
10th January 2009, 16:22
67 42 c0 0d 9a 74 0a 0f d8 08 80 00 00 03 00 80
00 00 0f 47 8a 15 50
42 == profile_idc 66
c0 == constrained_set0_flag0 and 1 == 1 and 2 and 3 == 0
0d == level 1.3
9a == ( binary 10011010 ) left to right
---> the first '1' exp-golomb xlates to a 0 (seq_parameter_set_id )
---> the 2nd-6th bits '00110' is a 5 (log2_max_frame_num_minus4)
---> the 7th bit '1' is 0 (pic_order_cnt_type )

id continue but im doing it by hand and may make an error

just watch the 00 00 03 in hex you pasted as the 03 is dropped

terryleung
12th January 2009, 03:27
thanks, after i drop the 03, the things work great!