H.264 sequence_parameter_sets成员值含义学习笔记

4 篇文章 0 订阅
H.264 sequence_parameter_sets成员值含义学习笔记
 

SPS: sequence parameter sets
它指的是码流对应的 profile.
 
1.1 基线profile(Baseline profile)
遵循基线 profile 的码流应该遵循以下的约束 :
 
a)  只有 I P 切片存在
b) NAL 单元流不应该有范围在 2 4 nal_unit_type , 包括 2 4.
c)  序列参数集 (sps) frame_mbs_only_fag( 之后介绍 ) 应该等于 1
d)  图象参数值 (psp) weighted_pred_flag weighted_bipred_idc 都应该为 0
e)  图象参数值 (psp) entropy_coding_mode_flag 应该等于 0
f)  图象参数值 (psp) num_slice_groups_minus1 应该在 0 7 之间 , 包括 0 7**psp 部分参数含义在关于 psp 的文章中给出。
g)  对于基线 profile 对应的 level 度应该满足 .
 
符合基线 profile 的码流的 profile_idc 被赋 66. 符合一定 level 的基线 Baseline 的解码器应该可以解码所有的 profile_idc 等于 66 的码流或 constrained_set0_flag( 等会介绍 ) 1 而且 level_idc( level 部分介绍 ) 少于或等于一个指定的 level 的码流。
 
1.2 profile(Main profile)
符合主 profile 的码流应该遵循以下的约束 :
 
a)  只有 I,P,B 切片存在 .
b) NAL 单元流不包括 nal_unit_type 值范围在 2-4 之内的值。包括 2 4.
c)  不能允许有随意顺序的切片
d)  图像参数集 (psp) num_slice_groups_minus1 应该只为 0
e)  图像参数集 (psp) redundant_pic_cnt_present_flag 应该只为 0
f)  对于主 profile 所要求的 level 级需要达到。
 
符合主 profile 的码流的 profile_idc 应为 77 。符合指定 level 的主 profile 的解码器应该可以解码所有的 profile_idc 77 的或 constrained_set1_flag 值为 1 level_idc 值小于或等于指定 level 的码流。
 
1.3 扩展profile(Extended profile)
符合扩展 profile 的码流应该遵循以下的约束 :
 
a)  序列参数集的 direct_8x8_inference_flag 值应该为 1
b)  图像参数集的 entropy_coding_mode_flag 值应该为 0
c)  图像参数集的 num_slice_groups_minus1 的值范围为 0 7, 包括 0 7
d)  对于扩展 profile 指定的 level 级应该被达到
 
符合指定 level 级的扩展 profile 的解码器可以解码所有的 profile_idc 值为 88 的或 constrained_set2_flag 值为 1 的,而且 level_idc 小于等于指定 level 级的码流。
 
符合指定 level 级的扩展 profile 的解码器可以解码所有的 profile_idc 值为 66 的或 constrained_set0_flag 值为 1 的,而且 level_idc 小于等于指定 level 级的码流。
constrained_set0_flag 值为 1 的时候,就说明码流应该遵循基线 profile(Baseline profile) 的所有约束 .constrained_set0_flag 值为 0 时,说明码流不一定要遵循基线 profile 的所有约束。
constrained_set1_flag 值为 1 的时候,就说明码流应该遵循主 profile(Main profile) 的所有约束 .constrained_set1_flag 值为 0 时,说明码流不一定要遵循主 profile 的所有约束。
constrained_set2_flag 值为 1 的时候,就说明码流应该遵循扩展 profile(Extended profile) 的所有约束 .constrained_set2_flag 值为 0 时,说明码流不一定要遵循扩展 profile 的所有约束。
注意:当 constraint_set0_flag,constraint_set1_flag constraint_set2_flag 中不只一个值为 1 的话,那么码流必须满足所有相应指明的 profile 约束。
Reserved. Set to 0.
Reserved. Set to 0.
它指的是码流对应的 level .
 
5.1 独立于profilelevel约束
fR 是这样一个变量:
a)  如果图像 n 是一帧, fR 设为 1/172
b)  如果图像 n 是一个场 ,fR 设为 1/(172*2)
 
任何 profile 下的指定的 level 都应该满足如下约束 :
a)  理论上可访问单元 n CPB 中的移除时间满足这样的约束: t(n)-t(n-1) 要比 Max(PicSizeInMbs,MaxMBPS,fR) 值大或相等, MaxMBPS 是说在 level 表中指出的对于图像 n 的值, PicSizeInMbs 是指在图像 n 中的宏块数。
b)  如果图像 n 是一个输出图像而且它不是码流的最后一个输出图象,从 DPB 中取出的连续的输出图象差满足: Dt(n) >= Max(PicSizeInMbs, MaxMBPS, fR), MaxMBPS 是指对于图象 n 来说的相应的值。 PicSizeInMbs 指图象 n 的宏块。
c)  对于可访问单元 0 NumBytesInNALunit 变量的总和少于或等于 256*ChromaFormatFactor*(PicSizeInMbs+MaxMBPS*tr(0)-trn(0)/MinCR MaxMBPS MinCR 是图象 0 level 表中相应的值 ,PicSizeInMbs 是图象 0 的宏块数量。
d)  对于可访问单元 n NumBytesInNALunit 值的总和是小于或等于 256*ChromaFormatFactor*MaxMBPS*(tr(n)-trn(n-1))/MinCR,MaxMBPS MinCR 的值是图像 n level 级表中对应的值。
e) PicWidthInMbs * FrameHeightInMbs <= MaxFS, MaxFS 是在 level 表中指定的值。
f) PicWidthInMbs <= Sqrt(MaxFS * 8)
g) FrameHeightInMbs <= Sqrt(MaxFS * 8)
h) max_dec_frame_buffering <=MaxDpbSize, MaxDpbSize 等于 Min(1024 * MaxDPB / (PicWidthInMbs * FrameHeightInMbs * 256 * ChromaFormatFactor,16) MaxDPB 是对于 1024 字节单元的 MaxDPB 值, max_dec_frame_buffering 也叫做 DPB 大小值。
i)  对于 VCL HRD 参数值 , 至少对于一个 SchedSelIdx 值来说 , 码率 BitRate[SchedSelIdx] <= 1000 * MaxBR CpbSize[SchedSelIdx] <= 1000 * MaxCPB MaxBR MaxCPB 是对于 1000bits/s 1000 位单元对应于 level 级表的值。码流应该为 0 cpb_cnt_minus1 中的一个值,包括 0 cpb_cnt_minus1.CpbSize[SchedSelIdx] 也叫做 CPB 大小值。
j)  对于 NAL HRD 参数来说 ,BitRate[SchSelIdx] <= 1200 * MaxBR CpbSize[SchedSelIdx] <= 1200 * MaxCPB MaxBR MaxCPB 是在 1200bits/s 1200 位的单元值在极限 level 下的值。码流应该满足至少 SchedSelIdx 值从 0 cpb_cnt_minus1 中的一个值。
k)  在亮度帧采样中,垂直运动向量元素范围不能超过 MaxVmvR MaxVmvR 值在 level 极限表中提供
l)  在亮度帧采样单元中,水平运动向量范围不能超过 -2048 2047.75 ,包括 -2048 2047.75
m)  按解码顺序的两个连续的宏愉的运动向量的数量不超过 MaxMvsPer2Mb( 对于当前宏块的最后一个切片和下一个宏块的第一个切片也适用 ),MaxMvsPer2Mb 值在 level 极限表中提供 .
n)  对于任何宏块的 macroblock_layer() 的位数值都不能大于 128 + 2048 * ChromaFormatFactor. 依赖于 entropy_coding_mode_flag 值, macroblock_layer() 的值由如下方式计算
  如果 entropy_coding_mode_flag 值为 0 的话, macroblock_layer() 的值由 macroblock_layer() 的对于一个 macroblock 的语法结构给出
  其他情况下 , 对于一个宏块的 macroblock_layer() 值是由 read_bits(1) 给出的 .
5.2 profile相关的level
对于基线 profile, profile 和扩展 profile 的相应的 level 级约束在 H.264 的文档中有表可查。
seq_parameter_set_id 指定了由图像参数集指明的序列参数集。 seq_parameter_set_id 值应该是从 0 31 ,包括 0 31
注意: 当可用的情况下,编码器应该在 sps 值不同的情况下使用不同的 seq_parameter_set_id 值,而不是变化某一特定值的 seq_parameter_set_id 的参数集的语法结构中的值。
log2_max_frame_num_minus4 指定了变量 MaxFrameNum 的值 , MaxFrameNum = 2(log2_max_frame_num_minus4+4)
log2_max_frame_num_minus 的值应该在 0 12 之间,包括 0 12.
pic_order_cnt_type 指定了解码图像顺序的方法。 pic_order_cnt_type 的值是 0,1,2
pic_order_cnt_type 在当一个编码视频序列有如下限定时不为 2
a)  包含非参考帧的可访问单元,并紧接着一个包含非参考可访问单元
b)  两个可访问单元,它们分别包含两个场中的一个,它们一块儿组成了一个互补的非参考场对,被紧接着一个包括非参考图像的可访问单元。
c)  一个包含非参考场的可访问单元,并紧接着一个包含另一个非参考图像的可访问单元,它们不组成互补的非参考场对。
log2_max_pic_order_cnt_lsb_minus4 指出变量 MaxPicOrderCntLsb 的值,它是在解码过程中使用到的图像顺序计算值 :
MaxPicOrderCntLsb = 2(log2_max_pic_order_cnt_lsb_minus4+4)
log2_max_pic_order_cnt_lsb_minus4 的值为包括 0 12 以及它们之间的值。
delta_pic_order_always_zero_flag 等于 1 的时候表示当 delta_pic_order_cnt[0] delta_pic_order_cnt[1] 在序列的切片头中不存在,并被认为是 0
delta_pic_order_always_zero_flag 值等于 0 时表示 delta_pic_order_cnt[0] 在序列的切片头中存在而 delta_pic_order_cnt[1] 可能在序列的切片头中存在。
offset_for_non_ref_pic 被用来计算一个非参考图像的图像顺序值。 offset_for_non_ref_pic 值取值范围为 (-2)^(31) 2^(31)-1 ,包括边界值。
offset_for_top_to_bottom_field 被用来计算一帧中的下场的图像顺序值。
offset_for_top_to_bottom_field 值的取值范围为 (-2)^(31) (2)^(31)-1 ,包括边界值。
num_ref_frames_in_pic_order_cnt_cycle 在解码过程中被用来计算图像顺序值。
num_ref_frames_in_pic_order_cnt_cycle 0 255 之间取值,包括边界值。
offset_for_ref_frame[i] 是一列 num_ref_frames_in_pic_order_cnt_cycle 中的一个元素,它被在解码过程的解码顺序值中使用。
offset_for_ref_frame[i] 的值为 (-2)^31 (2)^(31)-1 ,包括边界值。
num_ref_frames 指定了长期的和短期的参考帧的最大总数目,互补的参考场对和在解码过程。
gaps_in_frame_num_value_allowed_flag 值指明了 frame_num 允许的值和解码过程中的 frame_num 的差距值。
pic_width_in_mbs_minus1 1 指明了对于每个解码图像中的宽度值。在宏块单元中的图像宽度的变量值为 :
PicWidthInMbs = pic_width_in_mbs_minus1+1;
对于亮度元素来说图像宽度变量的值:
PicWidthInSamplesL = PicWidthInMbs * 16;
对于色度元素来说图像宽度变量的值:
PicWidthInSamplesC = PicWidthInMbs * 8;
pic_height_in_map_units_minus1 指明了解码帧或场中的一个切片组的高度。变量 PicHeightInMapUnits 的值和 PicSizeInMapUnits
PicHeightInMapUnits = pic_height_in_map_units_minus1 + 1;
PicSizeInMapUnits = PicWidthInMbs * PicHeightInMapUnits
frame_mbs_only_flag 等于 0 指明了视频序列的编码图象可能是编码场或编码帧。 frame_mbs_only_flag 等于 1 指明了每个编码视频序列的编码图像都是只含帧宏块的编码帧。
依赖于 frame_mbs_only_flag 的值, pic_height_in_map_units_minus1 如下定义:
frame_mbs_only_flag 等于 0 pic_height_in_map_units_minus1 就是宏块单元的场高
frame_mbs_only_flag 等于 1 pic_height_in_map_units_minus1 就是宏块单元的场宽
FrameHeightInMbs 的值:
FrameheightInMbs = ( 2 - frame_mbs_only_flag ) * PicHeightInMapUnits
mb_adaptive_frame_field_flag 等于 0 表明在一个图像内不能切换使用帧和场宏块。
mb_adaptive_frame_field_flag 等于 1 表示在一帧中有可能使用场和帧的切换,当 mb_adaptive_frame_field_flag 没有设定的时候,应该赋给 0.
direct_8x8_inference_flag 指明了在亮度运动向量生成 B_Skip B_Direct_16x16 B_Direct_8x8 的方法。
frame_mbs_only_flag 0 时, direct_8x8_inference_flag 应为 1
frame_cropping_flag 等于 1 表明在 sps 中下一个使用的帧剪切偏移量参数。 frame_cropping_flag 等于 0 表明帧剪切偏移量不存在。
指明了在一个窗中一帧的采样值。
vui_parameters_present_flag 等于 1 表示 vui_parameters() 在码流中是存在的, vui_parameters_present_flag 等于 0 表明 vui_parameters() 在码流中不存在。
rbsp_stop_one_bit         恒等于 1
rbsp_alignment_zero_bit       恒等于 0.
Note:
       More detail need refer to
       1). Advanced video coding for generic audiovisual services.pdf P63.
       2). Refer to ISOIEC 14496-10-2005-PDAM 3.doc P40
 
 
rbsp_trailing_bits( ) {
C
Descriptor
     rbsp_stop_one_bit /* equal to 1 */
All
f(1)
    while( !byte_aligned( ) )
 
 
        rbsp_alignment_zero_bit /* equal to 0 */
All
f(1)
}
 
 
 
seq_parameter_set_rbsp( ) {
C
Descriptor
    profile_idc
0
u(8)
    constraint_set0_flag
0
u(1)
    constraint_set1_flag
0
u(1)
    constraint_set2_flag
0
u(1)
    constraint_set3_flag
0
u(1)
    reserved_zero_4bits /* equal to 0 * /
0
u(4)
    level_idc
0
u(8)
    seq_parameter_set_id
0
ue(v)
    if( profile_idc = = 83 ) {
 
 
       seq_parameter_set_svc_extension( )  /* specified in Annex F  */
 
 
    }
 
 
    if( profile_idc = = 100 | | profile_idc = = 110 | |
        profile_idc = = 122 | | profile_idc = = 144   | |
        profile_idc = = 83 ) {
 
 
       chroma_format_idc
0
ue(v)
       if( chroma_format_idc = = 3 )
 
 
           residual_colour_transform_flag
0
u(1)
       bit_depth_luma_minus8
0
ue(v)
       bit_depth_chroma_minus8
0
ue(v)
       qpprime_y_zero_transform_bypass_flag
0
u(1)
       seq_scaling_matrix_present_flag
0
u(1)
       if( seq_scaling_matrix_present_flag )
 
 
           for( i = 0; i < 8; i++ ) {
 
 
               seq_scaling_list_present_flag[ i  ]
0
u(1)
               if( seq_scaling_list_present_flag[ i ] )
 
 
                  if( i < 6 )
 
 
                      scaling_list( ScalingList4x4[ i ], 16, 
                                       UseDefaultScalingMatrix4x4Flag[ i ])
0
 
                  else
 
 
                      scaling_list( ScalingList8x8[ i – 6 ], 64,
                                       UseDefaultScalingMatrix8x8Flag[ i – 6 ] )
0
 
           }
 
 
    }
 
 
    log2_max_frame_num_minus4
0
ue(v)
    pic_order_cnt_type
0
ue(v)
    if( pic_order_cnt_type = = 0 )
 
 
        log2_max_pic_order_cnt_lsb_minus4
0
ue(v)
    else if( pic_order_cnt_type = = 1 ) {
 
 
0
u(1)
       offset_for_non_ref_pic
0
se(v)
       offset_for_top_to_bottom_field
0
se(v)
       num_ref_frames_in_pic_order_cnt_cycle
0
ue(v)
       for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
 
 
           offset_for_ref_frame[ i  ]
0
se(v)
    }
 
 
    num_ref_frames
0
ue(v)
    gaps_in_frame_num_value_allowed_flag
0
u(1)
    pic_width_in_mbs_minus1
0
ue(v)
    pic_height_in_map_units_minus1
0
ue(v)
    frame_mbs_only_flag
0
u(1)
    if( !frame_mbs_only_flag )
 
 
       mb_adaptive_frame_field_flag
0
u(1)
     direct_8x8_inference_flag
0
u(1)
     frame_cropping_flag
0
u(1)
    if( frame_cropping_flag ) {
 
 
       frame_crop_left_offset
0
ue(v)
       frame_crop_right_offset
0
ue(v)
       frame_crop_top_offset
0
ue(v)
       frame_crop_bottom_offset
0
ue(v)
    }
 
 
    vui_parameters_present_flag
0
u(1)
    if( vui_parameters_present_flag )
 
 
       vui_parameters( )
0
 
    rbsp_trailing_bits( )
0
 
}
 
 
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值