SPSParser.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. #ifndef _SPSPARSER_H_
  2. #define _SPSPARSER_H_
  3. #if defined (__cplusplus)
  4. extern "C" {
  5. #endif
  6. #define QP_MAX_NUM (51 + 6*6) // The maximum supported qp
  7. #define HEVC_MAX_SHORT_TERM_RPS_COUNT 64
  8. #define T_PROFILE_HEVC_MAIN 1
  9. #define T_PROFILE_HEVC_MAIN_10 2
  10. #define T_PROFILE_HEVC_MAIN_STILL_PICTURE 3
  11. #define T_PROFILE_HEVC_REXT 4
  12. /**
  13. * Chromaticity coordinates of the source primaries.
  14. */
  15. enum T_AVColorPrimaries {
  16. AVCOL_PRI_RESERVED0 = 0,
  17. AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
  18. AVCOL_PRI_UNSPECIFIED = 2,
  19. AVCOL_PRI_RESERVED = 3,
  20. AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
  21. AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
  22. AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
  23. AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
  24. AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
  25. AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
  26. AVCOL_PRI_NB, ///< Not part of ABI
  27. };
  28. /**
  29. * Color Transfer Characteristic.
  30. */
  31. enum T_AVColorTransferCharacteristic {
  32. AVCOL_TRC_RESERVED0 = 0,
  33. AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
  34. AVCOL_TRC_UNSPECIFIED = 2,
  35. AVCOL_TRC_RESERVED = 3,
  36. AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
  37. AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
  38. AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
  39. AVCOL_TRC_SMPTE240M = 7,
  40. AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics"
  41. AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)"
  42. AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
  43. AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
  44. AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
  45. AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
  46. AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system
  47. AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system
  48. AVCOL_TRC_NB, ///< Not part of ABI
  49. };
  50. /**
  51. * YUV tColorspace type.
  52. */
  53. enum T_AVColorSpace {
  54. AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
  55. AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
  56. AVCOL_SPC_UNSPECIFIED = 2,
  57. AVCOL_SPC_RESERVED = 3,
  58. AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
  59. AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
  60. AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
  61. AVCOL_SPC_SMPTE240M = 7,
  62. AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
  63. AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
  64. AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
  65. AVCOL_SPC_NB, ///< Not part of ABI
  66. };
  67. enum {
  68. // 7.4.3.1: vps_max_layers_minus1 is in [0, 62].
  69. HEVC_MAX_LAYERS = 63,
  70. // 7.4.3.1: vps_max_sub_layers_minus1 is in [0, 6].
  71. HEVC_MAX_SUB_LAYERS = 7,
  72. // 7.4.3.1: vps_num_layer_sets_minus1 is in [0, 1023].
  73. HEVC_MAX_LAYER_SETS = 1024,
  74. // 7.4.2.1: vps_video_parameter_set_id is u(4).
  75. HEVC_MAX_VPS_COUNT = 16,
  76. // 7.4.3.2.1: sps_seq_parameter_set_id is in [0, 15].
  77. HEVC_MAX_SPS_COUNT = 16,
  78. // 7.4.3.3.1: pps_pic_parameter_set_id is in [0, 63].
  79. HEVC_MAX_PPS_COUNT = 64,
  80. // A.4.2: MaxDpbSize is bounded above by 16.
  81. HEVC_MAX_DPB_SIZE = 16,
  82. // 7.4.3.1: vps_max_dec_pic_buffering_minus1[i] is in [0, MaxDpbSize - 1].
  83. HEVC_MAX_REFS = HEVC_MAX_DPB_SIZE,
  84. // 7.4.3.2.1: num_short_term_ref_pic_sets is in [0, 64].
  85. HEVC_MAX_SHORT_TERM_REF_PIC_SETS = 64,
  86. // 7.4.3.2.1: num_long_term_ref_pics_sps is in [0, 32].
  87. HEVC_MAX_LONG_TERM_REF_PICS = 32,
  88. // A.3: all profiles require that CtbLog2SizeY is in [4, 6].
  89. HEVC_MIN_LOG2_CTB_SIZE = 4,
  90. HEVC_MAX_LOG2_CTB_SIZE = 6,
  91. // E.3.2: cpb_cnt_minus1[i] is in [0, 31].
  92. HEVC_MAX_CPB_CNT = 32,
  93. // A.4.1: in table A.6 the highest level allows a MaxLumaPs of 35 651 584.
  94. HEVC_MAX_LUMA_PS = 35651584,
  95. // A.4.1: pic_width_in_luma_samples and pic_height_in_luma_samples are
  96. // constrained to be not greater than sqrt(MaxLumaPs * 8). Hence height/
  97. // width are bounded above by sqrt(8 * 35651584) = 16888.2 samples.
  98. HEVC_MAX_WIDTH = 16888,
  99. HEVC_MAX_HEIGHT = 16888,
  100. // A.4.1: table A.6 allows at most 22 tile rows for any level.
  101. HEVC_MAX_TILE_ROWS = 22,
  102. // A.4.1: table A.6 allows at most 20 tile columns for any level.
  103. HEVC_MAX_TILE_COLUMNS = 20,
  104. // 7.4.7.1: in the worst case (tiles_enabled_flag and
  105. // entropy_coding_sync_enabled_flag are both set), entry points can be
  106. // placed at the beginning of every Ctb row in every tile, giving an
  107. // upper bound of (num_tile_columns_minus1 + 1) * PicHeightInCtbsY - 1.
  108. // Only a stream with very high resolution and perverse parameters could
  109. // get near that, though, so set a lower limit here with the maximum
  110. // possible value for 4K video (at most 135 16x16 Ctb rows).
  111. HEVC_MAX_ENTRY_POINT_OFFSETS = HEVC_MAX_TILE_COLUMNS * 135,
  112. };
  113. /**
  114. * rational number numerator/denominator
  115. */
  116. typedef struct T_AVRational{
  117. int num; ///< numerator
  118. int den; ///< denominator
  119. } T_AVRational;
  120. /***
  121. * Sequence parameter set
  122. * ¿É²Î¿¼H264±ê×¼µÚ7½ÚºÍ¸½Â¼D E
  123. /***
  124. * Sequence parameter set
  125. * H.264 sequence parameter set, version 7 and above, D E
  126. * [AUTO-TRANSLATED:bd590cb8]
  127. */
  128. #define Extended_SAR 255
  129. /**
  130. * Sequence parameter set
  131. */
  132. typedef struct T_SPS {
  133. unsigned int uiSpsId;
  134. int iProfileIdc;
  135. int iLevelIdc;
  136. int iChromaFormatIdc;
  137. int iTransformBypass; ///< qpprime_y_zero_transform_bypass_flag
  138. int iLog2MaxFrameNum; ///< log2_max_frame_num_minus4 + 4
  139. int iPocType; ///< pic_order_cnt_type
  140. int iLog2MaxPocLsb; ///< log2_max_pic_order_cnt_lsb_minus4
  141. int iDeltaPicOrderAlwaysZeroFlag;
  142. int iOffsetForNonRefPic;
  143. int iOffsetForTopToBottomField;
  144. int iPocCycleLength; ///< num_ref_frames_in_pic_order_cnt_cycle
  145. int iRefFrameCount; ///< num_ref_frames
  146. int iGapsInFrameNumAllowedFlag;
  147. int iMbWidth; ///< pic_width_in_mbs_minus1 + 1
  148. int iMbHeight; ///< pic_height_in_map_units_minus1 + 1
  149. int iFrameMbsOnlyFlag;
  150. int iMbAff; ///< mb_adaptive_frame_field_flag
  151. int iDirect8x8InferenceFlag;
  152. int iCrop; ///< frame_cropping_flag
  153. /* those 4 are already in luma samples */
  154. unsigned int uiCropLeft; ///< frame_cropping_rect_left_offset
  155. unsigned int uiCropRight; ///< frame_cropping_rect_right_offset
  156. unsigned int uiCropTop; ///< frame_cropping_rect_top_offset
  157. unsigned int uiCropBottom; ///< frame_cropping_rect_bottom_offset
  158. int iVuiParametersPresentFlag;
  159. T_AVRational tSar;
  160. int iVideoSignalTypePresentFlag;
  161. int iFullRange;
  162. int iColourDescriptionPresentFlag;
  163. enum T_AVColorPrimaries tColorPrimaries;
  164. enum T_AVColorTransferCharacteristic tColorTrc;
  165. enum T_AVColorSpace tColorspace;
  166. int iTimingInfoPresentFlag;
  167. uint32_t u32NumUnitsInTick;
  168. uint32_t u32TimeScale;
  169. int iFixedFrameRateFlag;
  170. short asOffsetForRefFrame[256]; // FIXME dyn aloc?
  171. int iBitstreamRestrictionFlag;
  172. int iNumReorderFrames;
  173. int iScalingMatrixPresent;
  174. uint8_t aau8ScalingMatrix4[6][16];
  175. uint8_t aau8ScalingMatrix8[6][64];
  176. int iNalHrdParametersPresentFlag;
  177. int iVclHrdParametersPresentFlag;
  178. int iPicStructPresentFlag;
  179. int iTimeOffsetLength;
  180. int iCpbCnt; ///< See H.264 E.1.2
  181. int iInitialCpbRemovalDelayLength; ///< initial_cpb_removal_delay_length_minus1 + 1
  182. int iCpbRemovalDelayLength; ///< cpb_removal_delay_length_minus1 + 1
  183. int iDpbOutputDelayLength; ///< dpb_output_delay_length_minus1 + 1
  184. int iBitDepthLuma; ///< bit_depth_luma_minus8 + 8
  185. int iBitDepthChroma; ///< bit_depth_chroma_minus8 + 8
  186. int iResidualColorTransformFlag; ///< residual_colour_transform_flag
  187. int iConstraintSetFlags; ///< constraint_set[0-3]_flag
  188. int iNew; ///< flag to keep track if the decoder context needs re-init due to changed SPS
  189. } T_SPS;
  190. /**
  191. * Picture parameter set
  192. */
  193. typedef struct T_PPS {
  194. unsigned int uiSpsId;
  195. int iCabac; ///< entropy_coding_mode_flag
  196. int iPicOrderPresent; ///< pic_order_present_flag
  197. int iSliceGroupCount; ///< num_slice_groups_minus1 + 1
  198. int iMbSliceGroupMapType;
  199. unsigned int auiRefCount[2]; ///< num_ref_idx_l0/1_active_minus1 + 1
  200. int iWeightedPred; ///< weighted_pred_flag
  201. int iWeightedBipredIdc;
  202. int iInitQp; ///< pic_init_qp_minus26 + 26
  203. int iInitQs; ///< pic_init_qs_minus26 + 26
  204. int aiChromaQpIndexOffset[2];
  205. int iDeblockingFilterParametersPresent; ///< deblocking_filter_parameters_present_flag
  206. int iConstrainedIntraPred; ///< constrained_intra_pred_flag
  207. int iRedundantPicCntPresent; ///< redundant_pic_cnt_present_flag
  208. int iTransform8x8Mode; ///< transform_8x8_mode_flag
  209. uint8_t aau8ScalingMatrix4[6][16];
  210. uint8_t aau8ScalingMatrix8[6][64];
  211. uint8_t u8ChromaQpTable[2][QP_MAX_NUM+1]; ///< pre-scaled (with aiChromaQpIndexOffset) version of qp_table
  212. int iChromaQpDiff;
  213. } T_PPS;
  214. typedef struct T_HEVCWindow {
  215. unsigned int uiLeftOffset;
  216. unsigned int uiRightOffset;
  217. unsigned int uiTopOffset;
  218. unsigned int uiBottomOffset;
  219. } T_HEVCWindow;
  220. typedef struct T_VUI {
  221. T_AVRational tSar;
  222. int iOverscanInfoPresentFlag;
  223. int iOverscanAppropriateFlag;
  224. int iVideoSignalTypePresentFlag;
  225. int iVideoFormat;
  226. int iVideoFullRangeFlag;
  227. int iColourDescriptionPresentFlag;
  228. uint8_t u8ColourPrimaries;
  229. uint8_t u8TransferCharacteristic;
  230. uint8_t u8MatrixCoeffs;
  231. int iChromaLocInfoPresentFlag;
  232. int iChromaSampleLocTypeTopField;
  233. int iChromaSampleLocTypeBottomField;
  234. int iNeutraChromaIndicationFlag;
  235. int iFieldSeqFlag;
  236. int iFrameFieldInfoPresentFlag;
  237. int iDefaultDisplayWindowFlag;
  238. T_HEVCWindow tDefDispWin;
  239. int iVuiTimingInfoPresentFlag;
  240. uint32_t u32VuiNumUnitsInTick;
  241. uint32_t u32VuiTimeScale;
  242. int iVuiPocProportionalToTimingFlag;
  243. int iVuiNumTicksPocDiffOneMinus1;
  244. int iVuiHrdParametersPresentFlag;
  245. int iBitstreamRestrictionFlag;
  246. int iTilesFixedStructureFlag;
  247. int iMotionVectorsOverPicBoundariesFlag;
  248. int iRestrictedRefPicListsFlag;
  249. int iMinSpatialSegmentationIdc;
  250. int iMaxBytesPerPicDenom;
  251. int iMaxBitsPerMinCuDenom;
  252. int iLog2MaxMvLengthHorizontal;
  253. int iLog2MaxMvLengthVertical;
  254. } T_VUI;
  255. typedef struct T_PTLCommon {
  256. uint8_t u8ProfileSpace;
  257. uint8_t u8TierFlag;
  258. uint8_t u8ProfileIdc;
  259. uint8_t au8ProfileCompatibilityFlag[32];
  260. uint8_t u8LevelIdc;
  261. uint8_t u8ProgressiveSourceFlag;
  262. uint8_t u8InterlacedSourceFlag;
  263. uint8_t u8NonPackedConstraintFlag;
  264. uint8_t u8FrameOnlyConstraintFlag;
  265. } T_PTLCommon;
  266. typedef struct T_PTL {
  267. T_PTLCommon tGeneralPtl;
  268. T_PTLCommon atSubLayerPtl[HEVC_MAX_SUB_LAYERS];
  269. uint8_t au8SubLayerProfilePresentFlag[HEVC_MAX_SUB_LAYERS];
  270. uint8_t au8SubLayerLevelPresentFlag[HEVC_MAX_SUB_LAYERS];
  271. } T_PTL;
  272. typedef struct T_ScalingList {
  273. /* This is a little wasteful, since sizeID 0 only needs 8 coeffs,
  274. * and size ID 3 only has 2 arrays, not 6. */
  275. uint8_t aaau8Sl[4][6][64];
  276. uint8_t aau8SlDc[2][6];
  277. } T_ScalingList;
  278. typedef struct T_ShortTermRPS {
  279. unsigned int uiNumNegativePics;
  280. int iNumDeltaPocs;
  281. int iRpsIdxNumDeltaPocs;
  282. int32_t au32DeltaPoc[32];
  283. uint8_t au8Used[32];
  284. } T_ShortTermRPS;
  285. typedef struct T_HEVCVPS {
  286. uint8_t u8VpsTemporalIdNestingFlag;
  287. int iVpsMaxLayers;
  288. int iVpsMaxSubLayers; ///< vps_max_temporal_layers_minus1 + 1
  289. T_PTL tPtl;
  290. int iVpsSubLayerOrderingInfoPresentFlag;
  291. unsigned int uiVpsMaxDecPicBuffering[HEVC_MAX_SUB_LAYERS];
  292. unsigned int auiVpsNumReorderPics[HEVC_MAX_SUB_LAYERS];
  293. unsigned int auiVpsMaxLatencyIncrease[HEVC_MAX_SUB_LAYERS];
  294. int iVpsMaxLayerId;
  295. int iVpsNumLayerSets; ///< vps_num_layer_sets_minus1 + 1
  296. uint8_t u8VpsTimingInfoPresentFlag;
  297. uint32_t u32VpsNumUnitsInTick;
  298. uint32_t u32VpsTimeScale;
  299. uint8_t u8VpsPocProportionalToTimingFlag;
  300. int iVpsNumTicksPocDiffOne; ///< vps_num_ticks_poc_diff_one_minus1 + 1
  301. int iVpsNumHrdParameters;
  302. } T_HEVCVPS;
  303. typedef struct T_HEVCSPS {
  304. unsigned int uiVpsId;
  305. int iChromaFormatIdc;
  306. uint8_t u8SeparateColourPlaneFlag;
  307. ///< output (i.e. cropped) values
  308. int iIutputWidth, iOutputHeight;
  309. T_HEVCWindow tOutputWindow;
  310. T_HEVCWindow tPicConfWin;
  311. int iBitDepth;
  312. int iBitDepthChroma;
  313. int iPixelShift;
  314. unsigned int uiLog2MaxPocLsb;
  315. int iPcmEnabledFlag;
  316. int iMaxSubLayers;
  317. struct {
  318. int iMaxDecPicBuffering;
  319. int iNumReorderPics;
  320. int iMaxLatencyIncrease;
  321. } stTemporalLayer[HEVC_MAX_SUB_LAYERS];
  322. uint8_t u8temporalIdNestingFlag;
  323. T_VUI tVui;
  324. T_PTL tPtl;
  325. uint8_t u8ScalingListEnableFlag;
  326. T_ScalingList tScalingList;
  327. unsigned int uiNbStRps;
  328. T_ShortTermRPS atStRps[HEVC_MAX_SHORT_TERM_RPS_COUNT];
  329. uint8_t u8AmpEnabledFlag;
  330. uint8_t u8SaoEnabled;
  331. uint8_t u8LongTermRefPicsPresentFlag;
  332. uint16_t au16LtRefPicPocLsbSps[32];
  333. uint8_t au8UsedByCurrPicLtSpsFlag[32];
  334. uint8_t u8NumLongTermRefPicsSps;
  335. struct {
  336. uint8_t u8BitDepth;
  337. uint8_t u8BitDepthChroma;
  338. unsigned int uiLog2MinPcmCbSize;
  339. unsigned int uiLog2MaxPcmCbSize;
  340. uint8_t u8LoopFilterDisableFlag;
  341. } pcm;
  342. uint8_t u8SpsTemporalMvpEnabledFlag;
  343. uint8_t u8SpsStrongIntraMmoothingEnableFlag;
  344. unsigned int uiLog2MinCbSize;
  345. unsigned int uiLog2DiffMaxMinCodingBlockSize;
  346. unsigned int uiLog2MinTbSize;
  347. unsigned int uiLog2MaxTrafoSize;
  348. unsigned int uiLog2CtbSize;
  349. unsigned int uiLog2MinPuSize;
  350. int iMaxTransformHierarchyDepthInter;
  351. int iMaxTransformHierarchyDepthIntra;
  352. int iTransformSkipRotationEnabledFlag;
  353. int iTransformSkipContextEnabledFlag;
  354. int iImplicitRdpcmEnabledFlag;
  355. int iExplicitRdpcmEnabledFlag;
  356. int iIntraSmoothingDisabledFlag;
  357. int iHighPrecisionOffsetsEnabledFlag;
  358. int iPersistentRiceAdaptationEnabledFlag;
  359. ///< coded frame dimension in various units
  360. int iWidth;
  361. int iHeight;
  362. int iCtbWidth;
  363. int iCtbHeight;
  364. int iCtbSize;
  365. int iMinCbWidth;
  366. int iMinCbHeight;
  367. int iMinTbWidth;
  368. int iMinTbHeight;
  369. int iMinPuWidth;
  370. int iMinPuHeight;
  371. int iTbMask;
  372. int aiHshift[3];
  373. int aiVshift[3];
  374. int iQpBdOffset;
  375. int iVuiPresent;
  376. }T_HEVCSPS;
  377. typedef struct {
  378. int pps_pic_parameter_set_id;
  379. int pps_seq_parameter_set_id;
  380. int dependent_slice_segments_enabled_flag;
  381. int output_flag_present_flag;
  382. int num_extra_slice_header_bits;
  383. int sign_data_hiding_enabled_flag;
  384. int cabac_init_present_flag;
  385. int num_ref_idx_l0_default_active_minus1;
  386. int num_ref_idx_l1_default_active_minus1;
  387. int init_qp_minus26;
  388. int constrained_intra_pred_flag;
  389. int transform_skip_enabled_flag;
  390. int cu_qp_delta_enabled_flag;
  391. int diff_cu_qp_delta_depth;
  392. int pps_cb_qp_offset;
  393. int pps_cr_qp_offset;
  394. int pps_slice_chroma_qp_offsets_present_flag;
  395. int weighted_pred_flag;
  396. int weighted_bipred_flag;
  397. int transquant_bypass_enabled_flag;
  398. int tiles_enabled_flag;
  399. int entropy_coding_sync_enabled_flag;
  400. int uniform_spacing_flag;
  401. int loop_filter_across_tiles_enabled_flag;
  402. int pps_loop_filter_across_slices_enabled_flag;
  403. int deblocking_filter_control_present_flag;
  404. int deblocking_filter_override_enabled_flag;
  405. int pps_deblocking_filter_disabled_flag;
  406. int pps_beta_offset_div2;
  407. int pps_tc_offset_div2;
  408. int pps_scaling_list_data_present_flag;
  409. int lists_modification_present_flag;
  410. int log2_parallel_merge_level_minus2;
  411. int slice_segment_header_extension_present_flag;
  412. int pps_extension_present_flag;
  413. int pps_range_extension_flag;
  414. int pps_multilayer_extension_flag;
  415. int pps_3d_extension_flag;
  416. int pps_scc_extension_flag;
  417. int pps_extension_4bits;
  418. // PPS range extension fields
  419. int log2_max_transform_skip_block_size_minus2;
  420. int cross_component_prediction_enabled_flag;
  421. int chroma_qp_offset_list_enabled_flag;
  422. int diff_cu_chroma_qp_offset_depth;
  423. int chroma_qp_offset_list_len_minus1;
  424. int cb_qp_offset_list[6];
  425. int cr_qp_offset_list[6];
  426. int log2_sao_offset_scale_luma;
  427. int log2_sao_offset_scale_chroma;
  428. // 可以根据需要添加更多字段 [AUTO-TRANSLATED:57b9a7c1]
  429. // You can add more fields as needed
  430. } T_HEVC_PPS;
  431. typedef struct T_GetBitContext{
  432. uint8_t *pu8Buf; // buf
  433. int iBufSize; // buf size
  434. int iBitPos; // bit position
  435. int iTotalBit; // bit number
  436. int iCurBitPos; // current bit position
  437. }T_GetBitContext;
  438. int h265ParsePps(T_GetBitContext *ptGetBitContext, T_HEVC_PPS *ptPps);
  439. int h264DecSeqParameterSet(void *pvBuf, T_SPS *ptSps);
  440. int h265DecSeqParameterSet( void *pvBufSrc, T_HEVCSPS *ptSps );
  441. int h265DecVideoParameterSet( void *pvBufSrc, T_HEVCVPS *ptVps );
  442. void h264GetWidthHeight(T_SPS *ptSps, int *piWidth, int *piHeight);
  443. void h265GetWidthHeight(T_HEVCSPS *ptSps, int *piWidth, int *piHeight);
  444. void h264GeFramerate(T_SPS *ptSps, float *pfFramerate);
  445. void h265GeFramerate(T_HEVCVPS *ptVps, T_HEVCSPS *ptSps,float *pfFramerate);
  446. #if defined (__cplusplus)
  447. }
  448. #endif
  449. #endif //_SPS_PPS_H_