|
|
用户名:yolan 笔名:茫飞 地区: 行业:其他 |
| 日 | 一 | 二 | 三 | 四 | 五 | 六 |
If I still love the way it goes. And if you still believe in me as before. I feel alive in middle tone...... Today I still watch the stars. Together our future lies......
各种痛
感谢送回钱包的好心人
栀子花开
又岁末了
灌个水
H624 element stream 解析SEI SPS PPS示例
前两天把黑客帝国复习一遍, 非常佩服里面那些可以从满屏幕的符号直接看出图像的人,他们看电影的话是不是不用mplayer直接od就可以了呢?
我对照着H264的spec, 两个小时才看了几十个字节, 还有很多不太明白的属性。
0000000 00 00 00 01 06 05 25 c7 a7 d1 a0 3d fc 11 dd aa
0000016 80 00 02 a5 d5 c5 1b 45 6e 63 6f 64 65 72 3a 20
0000032 31 2e 30 30 2e 30 30 2e 30 31 38 36 80 00 00 00
0000048 01 67 42 c0 1e ab 40 40 08 22 00 00 00 01 28 ce
0000064 02 fc 80
(ue(v), se(v)都是哥伦布指数编码, 参见http://en.wikipedia.org/wiki/Exponential-Golomb_coding。 好像在信息论编码里讲过)
0000 0000 0000 0000 0000 0000 0000 0001
start prefix
0000 0110 0000 0101 0010 0101 1100 0111
0:forbidden_zero_bit
00:nal_ref_idc (等于0表示一下几种情况:1.此NAL包含某个non-reference的slice data 2.nal_unit_type equal to 6, 9, 10, 11, or
12.)
0 0110: nal_unit_type (6: 查询表格Table 7-1 – NAL unit type codes, SEI, Supplemental enhancement information RBSP, 后面是
sei_rbsp())
sei_rbsp( ) {
do
sei_message( )
while( more_rbsp_data( ) )
rbsp_trailing_bits( )
}
0000 0101:last_payload_type_byte( 5, the last byte of the payload type of an SEI message )
0010 0101:last_payload_size_byte(37, the last byte of the size of an SEI message.就是说sei_message( )一共37个字节, 不包含
这个和前面的一个字节)
1100 0111以及之后的15个字节: (sei_payload(5, 37)->user_data_unregistered(37))
之后的21个字节: user_data_payload_byte
之后的一个字节为0x80 : rbsp_trailing_bits
下面从offset为44(7+37+1)字节开始分析下一个NAL:
0000 0000 0000 0000 0000 0000 0000 0001
start prefix
0110 0111 0100 0010 1100 0000 0001 1110
0:forbidden_zero_bit
11:nal_ref_idc (3: 表示一下几种情况1.contains a sequence parameter set or a picture
parameter set or a slice of a reference picture or a slice data partition of a reference picture 2.IDR NAL units )
0 0111: nal_unit_type7(Sequence parameter set. Next should be seq_parameter_set_rbsp( ))
0100 0010: profile_idc(66: BaseLine)
1 :constraint_set0_flag (indicates that the bitstream obeys all constraints specified in subclause A.2.1)
1 constraint_set1_flag (indicates that the bitstream obeys all constraints specified in subclause A.2.2)
0 : constraint_set2_flag
0 : constraint_set3_flag (If profile_idc is equal to 66, 77, or 88 and level_idc is equal to 11, constraint_set3_flag
equal to 1 indicates that the
bitstream obeys all constraints specified in Annex A for level 1b and constraint_set3_flag equal to 0 indicates that
the bitstream may or may not obey all constraints specified in Annex A for level 1b)
0000:
00011110: level_idc(30, Level 3.0)
1010 1011 0100 0000 0100 0000 0000 1000 0010 0010
1:seq_parameter_set_id(0, 哥伦布指数编码, 参见9.1 Parsing process for Exp-Golomb codes)
010:log2_max_frame_num_minus4(1, 哥伦布指数编码, 参见9.1, specifies the value of the variable MaxFrameNum that is used in
frame_num related
derivations as follows: MaxFrameNum = 2^( log2_max_frame_num_minus4 + 4 ), 这里是2^5 = 32.The value of
log2_max_frame_num_minus4 shall be in the range of 0 to 12)
1: pic_order_cnt_type(0, 哥伦布指数编码)
011:log2_max_pic_order_cnt_lsb_minus4(2, 哥伦布指数编码, specifies the value of the variable MaxPicOrderCntLsb that is
used in the decoding process for picture order count as specified in subclause 8.2.1.The size of the pic_order_cnt_lsb
syntax element is log2_max_pic_order_cnt_lsb_minus4 + 4 bits 也就是6bits)
010:num_ref_frames(1, 哥伦布指数编码, 表示最多reference一个frame)
0: gaps_in_frame_num_value_allowed_flag(0)
0000 0100 000: pic_width_in_mbs_minus1(31, 哥伦布指数编码, 表示width是16*(31+1)512)
0 0000 1000 00:pic_height_in_map_units_minus1(31, 哥伦布指数编码, 表示height是16*(31+1)512)
1: frame_mbs_only_flag (frame_mbs_only_flag equal to 1 specifies that every coded picture of the coded video sequence is
a coded frame containing only frame macroblocks)
0: direct_8x8_inference_flag
0:frame_cropping_flag(这个用来做cropping, 因为H264要求width, height都16对齐, 假设一个1920x1080的clip, encode时, 是要把
bottom填充的, 变成1920x1088, 现实的时候, 根据frame_crop_left_offset, frame_crop_right_offset, frame_crop_top_offset,
frame_crop_bottom_offset, 比如0, 0, 0, 8, 来显示成1920x1080)
0:vui_parameters_present_flag
10: rbsp_trailing_bits() (加bit 1然后加0, byte对齐)
SPS到这里结束 (13个字节)
下面从offset为57(7+37+1+13)字节开始分析下一个NAL:
0000 0000 0000 0000 0000 0000 0000 0001
start prefix
0010 1000 1100 1110 0000 0010 1111 1100 1000
0:forbidden_zero_bit
01: nal_ref_idc
0 1000:nal_unit_type(8, Picture parameter set, pic_parameter_set_rbsp( ))
1:pic_parameter_set_id(0,Exp-Golomb codes,identifies the picture parameter set that is referred to in the slice header.
The value of pic_parameter_set_id shall be in the range of 0 to 255, inclusive. 我猜这个表示最多有225个PPS).
1:seq_parameter_set_id(0,Exp-Golomb codes,identifies the sequence parameter set that is referred to by the picture
parameter set. The value of seq_parameter_set_id shall be in the range of 0 to 31, inclusive.我猜这个表示最多有31个SPS)
0:entropy_coding_mode_flag (selects the entropy decoding method to be applied for the syntax elements.equal to 0, the
method specified by the left descriptor in the syntax table is applied
(Exp-Golomb coded, see subclause 9.1 or CAVLC, see subclause 9.2)
0:pic_order_present_flag (equal to 1 specifies that the picture order count related syntax elements are present in the
slice headers as specified in subclause 7.3.3. pic_order_present_flag equal to 0 specifies that the picture order count
related syntax elements are not present in the slice headers)
1:num_slice_groups_minus1(0, Exp-Golomb codes. When num_slice_groups_minus1 is equal to 0, all slices of the picture
belong to the same slice group)
1:num_ref_idx_l0_active_minus1(0, Exp-Golomb codes.
1:num_ref_idx_l1_active_minus1(0, Exp-Golomb codes.
0:weighted_pred_flag(0)
00:weighted_bipred_idc(0, Exp-Golomb codes)
00 0010 111 :pic_init_qp_minus26(-11, se(v), signed Exp-Golomb codes, 表示qp=15)
1 : pic_init_qs_minus26(0, se(v), signed, Exp-Golomb codes)
1: chroma_qp_index_offset(0, se(v))
1: deblocking_filter_control_present_flag(1, equal to 1 specifies that a set of syntax elements controlling the
characteristics of the deblocking filter is present in the slice header.)
0:constrained_intra_pred_flag(0)
0: redundant_pic_cnt_present_flag(0)
1000 0000: rbsp_trailing_bits( )
牵牛织女天津四大角和心宿
文学少女出OVA了
学游泳的第十二天