github.com/cnotch/ipchub@v1.1.0/av/codec/h264/const.go (about) 1 // Copyright (c) 2019,CAOHONGJU All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE file. 4 5 package h264 6 7 /* 8 * Table 7-1 – NAL unit type codes, syntax element categories, and NAL unit type classes in 9 * T-REC-H.264-201704 10 */ 11 // H264 NAL 单元类型 12 const ( 13 NalUnspecified = 0 14 NalSlice = 1 // 不分区非IDR图像的片 15 NalDpa = 2 // 片分区A 16 NalDpb = 3 // 片分区B 17 NalDpc = 4 // 片分区C 18 NalIdrSlice = 5 // IDR图像中的片(I帧) 19 NalSei = 6 // 补充增强信息单元,sei playload可以使用户自定义数据, 那么我们就可以利用它来传输数据 20 NalSps = 7 // 序列参数集 21 NalPps = 8 // 图像参数集 22 NalAud = 9 // 分界符 23 NalEndSequence = 10 // 序列结束 24 NalEndStream = 11 // 码流结束 25 NalFillerData = 12 // 填充 26 NalSpsExt = 13 // 27 NalPrefix = 14 28 NalSubSps = 15 29 NalDps = 16 30 NalReserved17 = 17 31 NalReserved18 = 18 32 NalAuxiliarySlice = 19 33 NalExtenSlice = 20 34 NalDepthExtenSlice = 21 35 NalReserved22 = 22 36 NalReserved23 = 23 37 NalUnspecified24 = 24 38 NalUnspecified25 = 25 39 NalUnspecified26 = 26 40 NalUnspecified27 = 27 41 NalUnspecified28 = 28 42 NalUnspecified29 = 29 43 NalUnspecified30 = 30 44 NalUnspecified31 = 31 45 46 // NAL 在 RTP 包中的扩展 47 NalStapaInRtp = 24 // 单一时间的组合包 48 NalStapbInRtp = 25 // 单一时间的组合包 49 NalMtap16InRtp = 26 // 多个时间的组合包 50 NalMtap24InRtp = 27 // 多个时间的组合包 51 NalFuAInRtp = 28 // 分片的单元 52 NalFuBInRtp = 29 // 分片的单元 53 54 NalTypeBitmask = 0x1F 55 ) 56 57 // Profile 58 const ( 59 ProfileConstrained = (1 << 9) // 8+1; constraint_set1_flag 60 ProfileIntra = (1 << 11) // 8+3; constraint_set3_flag 61 62 ProfileBaseline = 66 63 ProfileConstrainedBaseline = (66 | ProfileConstrained) 64 ProfileMain = 77 65 ProfileExtended = 88 66 ProfileHigh = 100 67 ProfileHigh10 = 110 68 ProfileHigh10Intra = (110 | ProfileIntra) 69 ProfileMultiViewHigh = 118 70 ProfileHigh422 = 122 71 ProfileHigh422Intra = (122 | ProfileIntra) 72 ProfileStereoHigh = 128 73 ProfileHigh444 = 144 74 ProfileHigh444Predictive = 244 75 ProfileHigh444Intra = (244 | ProfileIntra) 76 ProfileCAVLC444 = 44 77 ) 78 79 // 参数集索引 80 const ( 81 ParameterSetSps = iota 82 ParameterSetPps 83 ) 84 85 // 其他常量 86 const ( 87 // 7.4.2.1.1: seq_parameter_set_id is in [0, 31]. 88 MaxSpsCount = 32 89 // 7.4.2.2: pic_parameter_set_id is in [0, 255]. 90 MaxPpsCount = 256 91 92 // A.3: MaxDpbFrames is bounded above by 16. 93 MaxDpbFrames = 16 94 // 7.4.2.1.1: max_num_ref_frames is in [0, MaxDpbFrames], and 95 // each reference frame can have two fields. 96 MaxRefs = 2 * MaxDpbFrames 97 98 // 7.4.3.1: modification_of_pic_nums_idc is not equal to 3 at most 99 // num_ref_idx_lN_active_minus1 + 1 times (that is, once for each 100 // possible reference), then equal to 3 once. 101 MaxRplmCount = MaxRefs + 1 102 103 // 7.4.3.3: in the worst case, we begin with a full short-term 104 // reference picture list. Each picture in turn is moved to the 105 // long-term list (type 3) and then discarded from there (type 2). 106 // Then, we set the length of the long-term list (type 4), mark 107 // the current picture as long-term (type 6) and terminate the 108 // process (type 0). 109 MaxMmcoCount = MaxRefs*2 + 3 110 111 // A.2.1, A.2.3: profiles supporting FMO constrain 112 // num_slice_groups_minus1 to be in [0, 7]. 113 MaxSliceGroups = 8 114 115 // E.2.2: cpb_cnt_minus1 is in [0, 31]. 116 MaxCpbCnt = 32 117 118 // A.3: in table A-1 the highest level allows a MaxFS of 139264. 119 MaxMbPicSize = 139264 120 // A.3.1, A.3.2: PicWidthInMbs and PicHeightInMbs are constrained 121 // to be not greater than sqrt(MaxFS * 8). Hence height/width are 122 // bounded above by sqrt(139264 * 8) = 1055.5 macroblocks. 123 MaxMbWidth = 1055 124 MaxMbHeight = 1055 125 MaxWidth = MaxMbWidth * 16 126 MaxHeight = MaxMbHeight * 16 127 )