nal_unit_header( ) { | Descriptor |
---|---|
forbidden_zero_bit | f(1) |
nal_unit_type | u(6) |
nuh_layer_id | u(6) |
nuh_temporal_id_plus1 | u(3) |
} |
从图中可以看出hHEVC的nal包结构与h264有明显的不同,hevc加入了nal所在的时间层的ID,取去除了nal_ref_idc,此信息合并到了naltype中,
通常情况下F为0,layerid为0, TID为1。
和264的&0x1f不同。265是 : int type = (code & 0x7E)>>1;
nalu 类型定义
定义 | 描述 | 值 |
---|---|---|
VPS | 视频参数集 | 32 |
SPS | 序列参数集 | 33 |
PPS | 图像参数集 | 34 |
SEI | 补充增强信息 | 39 |
IDR | RADL图像的IDR图像的SS编码数据 | 19 |
non | 被参考的后置图像,且非TSA、非STSA的SS编码数据 | 1 |
VPS
背景:在一些应用场合如广播和多播中,由于SEI中的部分信息会重复出现在SPS中,造成参数重传而引起延迟等问题,因此H.265中增加了视频参数集(Video Parameter Set,VPS)。
作用:VPS主要用于传输视频分级信息,有利于兼容标准在可分级视频编码或多视点视频的扩展。
内容:(1)多个子层和操作点共享的语法元素。(2)会话所需的有关操作点的关键信息,如档次、级别。(3)其它不属于SPS的操作点特性信息,例如与多层或子层相关的虚拟参考解码器HRD参数。
注意:对于一个视频序列,无论它每一层的SPS是否相同,都参考相同的VPS。
HEVC压缩码流结构及SPS,PPS,VPS之间的引用关系
/**
* Table 7-1: NAL unit type codes
*/
enum HEVCNALUnitType {
HEVC_NAL_TRAIL_N = 0,
HEVC_NAL_TRAIL_R = 1,
HEVC_NAL_TSA_N = 2,
HEVC_NAL_TSA_R = 3,
HEVC_NAL_STSA_N = 4,
HEVC_NAL_STSA_R = 5,
HEVC_NAL_RADL_N = 6,
HEVC_NAL_RADL_R = 7,
HEVC_NAL_RASL_N = 8,
HEVC_NAL_RASL_R = 9,
HEVC_NAL_VCL_N10 = 10,
HEVC_NAL_VCL_R11 = 11,
HEVC_NAL_VCL_N12 = 12,
HEVC_NAL_VCL_R13 = 13,
HEVC_NAL_VCL_N14 = 14,
HEVC_NAL_VCL_R15 = 15,
HEVC_NAL_BLA_W_LP = 16,
HEVC_NAL_BLA_W_RADL = 17,
HEVC_NAL_BLA_N_LP = 18,
HEVC_NAL_IDR_W_RADL = 19,
HEVC_NAL_IDR_N_LP = 20,
HEVC_NAL_CRA_NUT = 21,
HEVC_NAL_IRAP_VCL22 = 22,
HEVC_NAL_IRAP_VCL23 = 23,
HEVC_NAL_RSV_VCL24 = 24,
HEVC_NAL_RSV_VCL25 = 25,
HEVC_NAL_RSV_VCL26 = 26,
HEVC_NAL_RSV_VCL27 = 27,
HEVC_NAL_RSV_VCL28 = 28,
HEVC_NAL_RSV_VCL29 = 29,
HEVC_NAL_RSV_VCL30 = 30,
HEVC_NAL_RSV_VCL31 = 31,
HEVC_NAL_VPS = 32,
HEVC_NAL_SPS = 33,
HEVC_NAL_PPS = 34,
HEVC_NAL_AUD = 35,
HEVC_NAL_EOS_NUT = 36,
HEVC_NAL_EOB_NUT = 37,
HEVC_NAL_FD_NUT = 38,
HEVC_NAL_SEI_PREFIX = 39,
HEVC_NAL_SEI_SUFFIX = 40,
};
The format of the MKV CodecPrivate element for HEVC has been aligned with MP4 and GPAC/MP4Box.
The definition of MP4 for HEVC has not been finalized. The version of MP4Box appears to be
aligned with the latest version of the HEVC standard. The configuration_version field should be
kept 0 until CodecPrivate for HEVC have been finalized. Thereafter it shall have the required value of 1.
The CodecPrivate format is flexible and allows storage of arbitrary NAL units.
However it is restricted by MP4 to VPS, SPS and PPS headers and SEI messages that apply to the
whole stream as for example user data. The table below specifies the format:
Value Bits Description
----- ---- -----------
configuration_version 8 The value should be 0 until the format has been finalized. Thereafter is should have the specified value (probably 1). This allows us to recognize (and ignore) non-standard CodecPrivate
general_profile_space 2 Specifies the context for the interpretation of general_profile_idc and general_profile_compatibility_flag
general_tier_flag 1 Specifies the context for the interpretation of general_level_idc
general_profile_idc 5 Defines the profile of the bitstream
general_profile_compatibility_flag 32 Defines profile compatibility, see [2] for interpretation
general_progressive_source_flag 1 Source is progressive, see [2] for interpretation.
general_interlace_source_flag 1 Source is interlaced, see [2] for interpretation.
general_nonpacked_constraint_flag 1 If 1 then no frame packing arrangement SEI messages, see [2] for more information
general_frame_only_constraint_flag 1 If 1 then no fields, see [2] for interpretation
reserved 44 Reserved field, value TBD 0
general_level_idc 8 Defines the level of the bitstream
reserved 4 Reserved Field, value '1111'b
min_spatial_segmentation_idc 12 Maximum possible size of distinct coded spatial segmentation regions in the pictures of the CVS
reserved 6 Reserved Field, value '111111'b
parallelism_type 2 0=unknown, 1=slices, 2=tiles, 3=WPP
reserved 6 Reserved field, value '111111'b
chroma_format_idc 2 See table 6-1, HEVC
reserved 5 Reserved Field, value '11111'b
bit_depth_luma_minus8 3 Bit depth luma minus 8
reserved 5 Reserved Field, value '11111'b
bit_depth_chroma_minus8 3 Bit depth chroma minus 8
reserved 16 Reserved Field, value 0
reserved 2 Reserved Field, value 0
max_sub_layers 3 maximum number of temporal sub-layers
temporal_id_nesting_flag 1 Specifies whether inter prediction is additionally restricted. see [2] for interpretation.
size_nalu_minus_one 2 Size of field NALU Length – 1
num_parameter_sets 8 Number of parameter sets
for (i=0;i
python解析h265
openHevc
x265