gsth265parser.h 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112
  1. /* Gstreamer H.265 bitstream parser
  2. * Copyright (C) 2013 Intel Corporation
  3. * Copyright (C) 2013 Sreerenj Balachandran <sreerenj.balachandran@intel.com>
  4. *
  5. * Contact: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  20. * Boston, MA 02110-1301, USA.
  21. */
  22. #ifndef __GST_H265_PARSER_H__
  23. #define __GST_H265_PARSER_H__
  24. #ifndef GST_USE_UNSTABLE_API
  25. #warning "The H.265 parsing library is unstable API and may change in future."
  26. #warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
  27. #endif
  28. #include <gst/gst.h>
  29. G_BEGIN_DECLS
  30. #define GST_H265_MAX_SUB_LAYERS 8
  31. #define GST_H265_MAX_VPS_COUNT 16
  32. #define GST_H265_MAX_SPS_COUNT 16
  33. #define GST_H265_MAX_PPS_COUNT 64
  34. #define GST_H265_IS_B_SLICE(slice) ((slice)->type == GST_H265_B_SLICE)
  35. #define GST_H265_IS_P_SLICE(slice) ((slice)->type == GST_H265_P_SLICE)
  36. #define GST_H265_IS_I_SLICE(slice) ((slice)->type == GST_H265_I_SLICE)
  37. /**
  38. * GstH265Profile:
  39. * @GST_H265_PROFILE_MAIN: Main profile (A.3.2)
  40. * @GST_H265_PROFILE_MAIN_10: Main 10 profile (A.3.3)
  41. * @GST_H265_PROFILE_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
  42. *
  43. * H.265 Profiles.
  44. *
  45. */
  46. typedef enum {
  47. GST_H265_PROFILE_MAIN = 1,
  48. GST_H265_PROFILE_MAIN_10 = 2,
  49. GST_H265_PROFILE_MAIN_STILL_PICTURE = 3
  50. } GstH265Profile;
  51. /**
  52. * GstH265NalUnitType:
  53. * @GST_H265_NAL_SLICE_TRAIL_N: Slice nal of a non-TSA, non-STSA trailing picture
  54. * @GST_H265_NAL_SLICE_TRAIL_R: Slice nal of a non-TSA, non-STSA trailing picture
  55. * @GST_H265_NAL_SLICE_TSA_N: Slice nal of a TSA picture
  56. * @GST_H265_NAL_SLICE_TSA_R: Slice nal of a TSA picture
  57. * @GST_H265_NAL_SLICE_STSA_N: Slice nal of a STSA picture
  58. * @GST_H265_NAL_SLICE_STSA_R: Slice nal of a STSA picture
  59. * @GST_H265_NAL_SLICE_RADL_N: Slice nal of a RADL picture
  60. * @GST_H265_NAL_SLICE_RADL_R: Slice nal of a RADL piicture
  61. * @GST_H265_NAL_SLICE_RASL_N: Slice nal of a RASL picture
  62. * @GST_H265_NAL_SLICE_RASL_R: Slice nal of a RASL picture
  63. * @GST_H265_NAL_SLICE_BLA_W_LP: Slice nal of a BLA picture
  64. * @GST_H265_NAL_SLICE_BLA_W_RADL: Slice nal of a BLA picture
  65. * @GST_H265_NAL_SLICE_BLA_N_LP: Slice nal of a BLA picture
  66. * @GST_H265_NAL_SLICE_IDR_W_RADL: Slice nal of an IDR picture
  67. * @GST_H265_NAL_SLICE_IDR_N_LP: Slice nal of an IDR picture
  68. * @GST_H265_NAL_SLICE_CRA_NUT: Slice nal of a CRA picture
  69. * @GST_H265_NAL_VPS: Video parameter set(VPS) nal unit
  70. * @GST_H265_NAL_SPS: Sequence parameter set (SPS) nal unit
  71. * @GST_H265_NAL_PPS: Picture parameter set (PPS) nal unit
  72. * @GST_H265_NAL_AUD: Access unit (AU) delimiter nal unit
  73. * @GST_H265_NAL_EOS: End of sequence (EOS) nal unit
  74. * @GST_H265_NAL_EOB: End of bitstream (EOB) nal unit
  75. * @GST_H265_NAL_FD: Filler data (FD) nal lunit
  76. * @GST_H265_NAL_PREFIX_SEI: Supplemental enhancement information prefix nal unit
  77. * @GST_H265_NAL_SUFFIX_SEI: Suppliemental enhancement information suffix nal unit
  78. *
  79. * Indicates the type of H265 Nal Units
  80. */
  81. typedef enum
  82. {
  83. GST_H265_NAL_SLICE_TRAIL_N = 0,
  84. GST_H265_NAL_SLICE_TRAIL_R = 1,
  85. GST_H265_NAL_SLICE_TSA_N = 2,
  86. GST_H265_NAL_SLICE_TSA_R = 3,
  87. GST_H265_NAL_SLICE_STSA_N = 4,
  88. GST_H265_NAL_SLICE_STSA_R = 5,
  89. GST_H265_NAL_SLICE_RADL_N = 6,
  90. GST_H265_NAL_SLICE_RADL_R = 7,
  91. GST_H265_NAL_SLICE_RASL_N = 8,
  92. GST_H265_NAL_SLICE_RASL_R = 9,
  93. GST_H265_NAL_SLICE_BLA_W_LP = 16,
  94. GST_H265_NAL_SLICE_BLA_W_RADL = 17,
  95. GST_H265_NAL_SLICE_BLA_N_LP = 18,
  96. GST_H265_NAL_SLICE_IDR_W_RADL = 19,
  97. GST_H265_NAL_SLICE_IDR_N_LP = 20,
  98. GST_H265_NAL_SLICE_CRA_NUT = 21,
  99. GST_H265_NAL_VPS = 32,
  100. GST_H265_NAL_SPS = 33,
  101. GST_H265_NAL_PPS = 34,
  102. GST_H265_NAL_AUD = 35,
  103. GST_H265_NAL_EOS = 36,
  104. GST_H265_NAL_EOB = 37,
  105. GST_H265_NAL_FD = 38,
  106. GST_H265_NAL_PREFIX_SEI = 39,
  107. GST_H265_NAL_SUFFIX_SEI = 40
  108. } GstH265NalUnitType;
  109. #define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MIN 10
  110. #define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MAX 15
  111. #define RESERVED_IRAP_NAL_TYPE_MIN 22
  112. #define RESERVED_IRAP_NAL_TYPE_MAX 23
  113. #define RESERVED_NON_IRAP_NAL_TYPE_MIN 24
  114. #define RESERVED_NON_IRAP_NAL_TYPE_MAX 31
  115. #define RESERVED_NON_VCL_NAL_TYPE_MIN 41
  116. #define RESERVED_NON_VCL_NAL_TYPE_MAX 47
  117. #define UNSPECIFIED_NON_VCL_NAL_TYPE_MIN 48
  118. #define UNSPECIFIED_NON_VCL_NAL_TYPE_MAX 63
  119. /**
  120. * GstH265ParserResult:
  121. * @GST_H265_PARSER_OK: The parsing succeded
  122. * @GST_H265_PARSER_BROKEN_DATA: The data to parse is broken
  123. * @GST_H265_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
  124. * @GST_H265_PARSER_ERROR: An error accured when parsing
  125. * @GST_H265_PARSER_NO_NAL: No nal found during the parsing
  126. * @GST_H265_PARSER_NO_NAL_END: Start of the nal found, but not the end.
  127. *
  128. * The result of parsing H265 data.
  129. */
  130. typedef enum
  131. {
  132. GST_H265_PARSER_OK,
  133. GST_H265_PARSER_BROKEN_DATA,
  134. GST_H265_PARSER_BROKEN_LINK,
  135. GST_H265_PARSER_ERROR,
  136. GST_H265_PARSER_NO_NAL,
  137. GST_H265_PARSER_NO_NAL_END
  138. } GstH265ParserResult;
  139. /**
  140. * GstH265SEIPayloadType:
  141. * @GST_H265_SEI_BUF_PERIOD: Buffering Period SEI Message
  142. * @GST_H265_SEI_PIC_TIMING: Picture Timing SEI Message
  143. * ...
  144. *
  145. * The type of SEI message.
  146. */
  147. typedef enum
  148. {
  149. GST_H265_SEI_BUF_PERIOD = 0,
  150. GST_H265_SEI_PIC_TIMING = 1
  151. /* and more... */
  152. } GstH265SEIPayloadType;
  153. /**
  154. * GstH265SEIPicStructType:
  155. * @GST_H265_SEI_PIC_STRUCT_FRAME: Picture is a frame
  156. * @GST_H265_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame
  157. * @GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD: Botom field of frame
  158. * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame
  159. * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame
  160. * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame
  161. * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame
  162. * @GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should
  163. * be displayed two times consecutively
  164. * @GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be
  165. * displayed three times consecutively
  166. * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM: top field paired with
  167. * previous bottom field in output order
  168. * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP: bottom field paried with
  169. * previous top field in output order
  170. * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM: top field paired with next
  171. * bottom field in output order
  172. * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP: bottom field paired with
  173. * next top field in output order
  174. *
  175. * SEI pic_struct type
  176. */
  177. typedef enum
  178. {
  179. GST_H265_SEI_PIC_STRUCT_FRAME = 0,
  180. GST_H265_SEI_PIC_STRUCT_TOP_FIELD = 1,
  181. GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD = 2,
  182. GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM = 3,
  183. GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP = 4,
  184. GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5,
  185. GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6,
  186. GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
  187. GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING = 8,
  188. GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM = 9,
  189. GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP = 10,
  190. GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM = 11,
  191. GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP = 12
  192. } GstH265SEIPicStructType;
  193. /**
  194. * GstH265SliceType:
  195. *
  196. * Type of Picture slice
  197. */
  198. typedef enum
  199. {
  200. GST_H265_B_SLICE = 0,
  201. GST_H265_P_SLICE = 1,
  202. GST_H265_I_SLICE = 2
  203. } GstH265SliceType;
  204. typedef enum
  205. {
  206. GST_H265_QUANT_MATIX_4X4 = 0,
  207. GST_H265_QUANT_MATIX_8X8 = 1,
  208. GST_H265_QUANT_MATIX_16X16 = 2,
  209. GST_H265_QUANT_MATIX_32X32 = 3
  210. } GstH265QuantMatrixSize;
  211. typedef struct _GstH265Parser GstH265Parser;
  212. typedef struct _GstH265NalUnit GstH265NalUnit;
  213. typedef struct _GstH265VPS GstH265VPS;
  214. typedef struct _GstH265SPS GstH265SPS;
  215. typedef struct _GstH265PPS GstH265PPS;
  216. typedef struct _GstH265ProfileTierLevel GstH265ProfileTierLevel;
  217. typedef struct _GstH265SubLayerHRDParams GstH265SubLayerHRDParams;
  218. typedef struct _GstH265HRDParams GstH265HRDParams;
  219. typedef struct _GstH265VUIParams GstH265VUIParams;
  220. typedef struct _GstH265ScalingList GstH265ScalingList;
  221. typedef struct _GstH265RefPicListModification GstH265RefPicListModification;
  222. typedef struct _GstH265PredWeightTable GstH265PredWeightTable;
  223. typedef struct _GstH265ShortTermRefPicSet GstH265ShortTermRefPicSet;
  224. typedef struct _GstH265SliceHdr GstH265SliceHdr;
  225. typedef struct _GstH265PicTiming GstH265PicTiming;
  226. typedef struct _GstH265BufferingPeriod GstH265BufferingPeriod;
  227. typedef struct _GstH265SEIMessage GstH265SEIMessage;
  228. /**
  229. * GstH265NalUnit:
  230. * @type: A #GstH265NalUnitType
  231. * @layer_id: A nal unit layer id
  232. * @temporal_id_plus1: A nal unit temporal identifier
  233. * @size: The size of the nal unit starting from @offset
  234. * @offset: The offset of the actual start of the nal unit
  235. * @sc_offset:The offset of the start code of the nal unit
  236. * @valid: If the nal unit is valid, which mean it has
  237. * already been parsed
  238. * @data: The data from which the Nalu has been parsed
  239. *
  240. * Structure defining the Nal unit headers
  241. */
  242. struct _GstH265NalUnit
  243. {
  244. guint8 type;
  245. guint8 layer_id;
  246. guint8 temporal_id_plus1;
  247. /* calculated values */
  248. guint size;
  249. guint offset;
  250. guint sc_offset;
  251. gboolean valid;
  252. guint8 *data;
  253. guint8 header_bytes;
  254. };
  255. /**
  256. * GstH265ProfileTierLevel:
  257. * @profile_space: specifies the context for the interpretation of
  258. * general_profile_idc and general_profile_combatibility_flag
  259. * @tier_flag: the tier context for the interpretation of general_level_idc
  260. * @profile_idc: profile id
  261. * @profile_compatibility_flag: compatibility flags
  262. * @progressive_source_flag: flag to indicate the type of stream
  263. * @interlaced_source_flag: flag to indicate the type of stream
  264. * @non_packed_constraint_flag: indicate the presence of frame packing
  265. * arragement sei message
  266. * @frame_only_constraint_flag: recognize the field_seq_flag
  267. * @level idc: indicate the level which the CVS confirms
  268. * @sub_layer_profile_present_flag: sublayer profile presence ind
  269. * @sub_layer_level_present_flag:sublayer level presence indicator.
  270. * @sub_layer_profile_space: profile space for sublayers
  271. * @sub_layer_tier_flag: tier flags for sublayers.
  272. * @sub_layer_profile_idc: conformant profile indicator for sublayers.
  273. * @sub_layer_profile_compatibility_flag[6][32]: compatibility flags for sublayers
  274. * @sub_layer_progressive_source_flag:progressive stream indicator for sublayer
  275. * @sub_layer_interlaced_source_flag: interlaced stream indicator for sublayer
  276. * @sub_layer_non_packed_constraint_flag: indicate the presence of
  277. * frame packing arrangement sei message with in sublayers
  278. * @sub_layer_frame_only_constraint_flag:recognize the sublayer
  279. * specific field_seq_flag
  280. * @sub_layer_level_idc:indicate the sublayer specific level
  281. *
  282. * Define ProfileTierLevel parameters
  283. */
  284. struct _GstH265ProfileTierLevel {
  285. guint8 profile_space;
  286. guint8 tier_flag;
  287. guint8 profile_idc;
  288. guint8 profile_compatibility_flag[32];
  289. guint8 progressive_source_flag;
  290. guint8 interlaced_source_flag;
  291. guint8 non_packed_constraint_flag;
  292. guint8 frame_only_constraint_flag;
  293. guint8 level_idc;
  294. guint8 sub_layer_profile_present_flag[6];
  295. guint8 sub_layer_level_present_flag[6];
  296. guint8 sub_layer_profile_space[6];
  297. guint8 sub_layer_tier_flag[6];
  298. guint8 sub_layer_profile_idc[6];
  299. guint8 sub_layer_profile_compatibility_flag[6][32];
  300. guint8 sub_layer_progressive_source_flag[6];
  301. guint8 sub_layer_interlaced_source_flag[6];
  302. guint8 sub_layer_non_packed_constraint_flag[6];
  303. guint8 sub_layer_frame_only_constraint_flag[6];
  304. guint8 sub_layer_level_idc[6];
  305. };
  306. /**
  307. * GstH265SubLayerHRDParams:
  308. * @bit_rate_value_minus1:togeter with bit_rate_scale, it specifies
  309. * the maximum input bitrate when the CPB operates at the access
  310. * unit level
  311. * @cpb_size_value_minus1: is used together with cpb_size_scale to
  312. * specify the CPB size when the CPB operates at the access unit
  313. * level
  314. * @cpb_size_du_value_minus1: is used together with cpb_size_du_scale
  315. * to specify the CPB size when the CPB operates at sub-picture
  316. * level
  317. * @bit_rate_du_value_minus1: together with bit_rate_scale, it
  318. * specifies the maximum input bit rate when the CPB operates at the
  319. * sub-picture level
  320. * @cbr_flag: indicate whether HSS operates in intermittent bit rate
  321. * mode or constant bit rate mode.
  322. *
  323. * Defines the Sublayer HRD parameters
  324. */
  325. struct _GstH265SubLayerHRDParams
  326. {
  327. guint32 bit_rate_value_minus1[32];
  328. guint32 cpb_size_value_minus1[32];
  329. guint32 cpb_size_du_value_minus1[32];
  330. guint32 bit_rate_du_value_minus1[32];
  331. guint8 cbr_flag[32];
  332. };
  333. /**
  334. * GstH265HRDParams:
  335. * @nal_hrd_parameters_present_flag: indicate the presence of NAL HRD parameters
  336. * @vcl_hrd_parameters_present_flag: indicate the presence of VCL HRD parameters
  337. * @sub_pic_hrd_params_present_flag: indicate the presence of sub_pic_hrd_params
  338. * @tick_divisor_minus2: is used to specify the clock sub-tick
  339. * @du_cpb_removal_delay_increment_length_minus1: specifies the length,
  340. * in bits, of the nal_initial_cpb_removal_delay
  341. * @sub_pic_cpb_params_in_pic_timing_sei_flag: specifies the length, in bits, of
  342. * the cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements.
  343. * @dpb_output_delay_du_length_minu1: specifies the length, in bits, of the
  344. * dpb_delay_offset and the pic_dpb_output_delay syntax elements
  345. * @bit_rate_scale: maximum input bitrate
  346. * @cpb_size_scale: CPB size when operates in access unit level
  347. * @cpb_size_du_scale: CPB size when operates in sub-picture level
  348. * @initial_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
  349. * nal_initial_cpb_removal_delay, nal_initial_cpb_removal_offset,
  350. * vcl_initial_cpb_removal_delay and vcl_initial_cpb_removal_offset.
  351. * @au_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
  352. * cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements
  353. * @dpb_output_delay_length_minus1: specifies the length, in bits, of the
  354. * dpb_delay_offset and the pic_dpb_output_delay syntax elements
  355. * @fixed_pic_rate_general_flag: flag to indicate the presence of constraint
  356. * on the temporal distance between the HRD output times of consecutive
  357. * pictures in output order
  358. * @fixed_pic_rate_within_cvs_flag: same as fixed_pic_rate_general_flag
  359. * @elemental_duration_in_tc_minus1: temporal distance in clock ticks
  360. * @low_delay_hrd_flag: specifies the HRD operational mode
  361. * @cpb_cnt_minus1:specifies the number of alternative CPS specifications.
  362. * @sublayer_hrd_params: Sublayer HRD parameters.
  363. *
  364. * Defines the HRD parameters
  365. */
  366. struct _GstH265HRDParams
  367. {
  368. guint8 nal_hrd_parameters_present_flag;
  369. guint8 vcl_hrd_parameters_present_flag;
  370. guint8 sub_pic_hrd_params_present_flag;
  371. guint8 tick_divisor_minus2;
  372. guint8 du_cpb_removal_delay_increment_length_minus1;
  373. guint8 sub_pic_cpb_params_in_pic_timing_sei_flag;
  374. guint8 dpb_output_delay_du_length_minus1;
  375. guint8 bit_rate_scale;
  376. guint8 cpb_size_scale;
  377. guint8 cpb_size_du_scale;
  378. guint8 initial_cpb_removal_delay_length_minus1;
  379. guint8 au_cpb_removal_delay_length_minus1;
  380. guint8 dpb_output_delay_length_minus1;
  381. guint8 fixed_pic_rate_general_flag [7];
  382. guint8 fixed_pic_rate_within_cvs_flag [7];
  383. guint16 elemental_duration_in_tc_minus1 [7];
  384. guint8 low_delay_hrd_flag [7];
  385. guint8 cpb_cnt_minus1[7];
  386. GstH265SubLayerHRDParams sublayer_hrd_params[7];
  387. };
  388. /**
  389. * GstH265VPS:
  390. * @id: vps id
  391. * @max_layers_minus1: should be zero, but can be other values in future
  392. * @max_sub_layers_minus1:specifies the maximum number of temporal sub-layers
  393. * @temporal_id_nesting_flag: specifies whether inter prediction is
  394. * additionally restricted
  395. * @profile_tier_level: ProfileTierLevel info
  396. * @sub_layer_ordering_info_present_flag: indicates the presense of
  397. * vps_max_dec_pic_buffering_minus1, vps_max_num_reorder_pics and
  398. * vps_max_latency_increase_plus1
  399. * @max_dec_pic_buffering_minus1: specifies the maximum required size
  400. * of the decoded picture buffer
  401. * @max_num_reorder_pics: indicates the maximum allowed number of
  402. * pictures that can precede any picture in the CVS in decoding
  403. * order
  404. * @max_latency_increase_plus1: is used to compute the value of
  405. * VpsMaxLatencyPictures
  406. * @max_layer_id: specifies the maximum allowed value of nuh_layer_id
  407. * @num_layer_sets_minus1: specifies the number of layer sets
  408. * @layer_id_included_flag: specifies whether a nuh_layer_id included
  409. * in the layer identifier list
  410. * @timing_info_present_flag: indicate the presence of
  411. * num_units_in_tick, time_scale, poc_proportional_to_timing_flag
  412. * and num_hrd_parameters
  413. * @num_units_in_tick: number of time units in a tick
  414. * @time_scale: number of time units that pass in one second
  415. * @poc_proportional_to_timing_flag: indicate whether the picture
  416. * order count is proportional to output timin
  417. * @num_ticks_poc_diff_one_minus1: specifies the number of clock ticks
  418. * corresponding to a difference of picture order count values equal
  419. * to 1
  420. * @num_hrd_parameters: number of hrd_parameters present
  421. * @hrd_layer_set_idx: index to the list of layer hrd params.
  422. * @hrd_params: the GstH265HRDParams list
  423. *
  424. * Defines the VPS parameters
  425. */
  426. struct _GstH265VPS {
  427. guint8 id;
  428. guint8 max_layers_minus1;
  429. guint8 max_sub_layers_minus1;
  430. guint8 temporal_id_nesting_flag;
  431. GstH265ProfileTierLevel profile_tier_level;
  432. guint8 sub_layer_ordering_info_present_flag;
  433. guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
  434. guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
  435. guint32 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
  436. guint8 max_layer_id;
  437. guint16 num_layer_sets_minus1;
  438. guint8 timing_info_present_flag;
  439. guint32 num_units_in_tick;
  440. guint32 time_scale;
  441. guint8 poc_proportional_to_timing_flag;
  442. guint32 num_ticks_poc_diff_one_minus1;
  443. guint16 num_hrd_parameters;
  444. guint16 hrd_layer_set_idx;
  445. guint8 cprms_present_flag;
  446. GstH265HRDParams hrd_params;
  447. guint8 vps_extension;
  448. gboolean valid;
  449. };
  450. /**
  451. * GstH265ShortTermRefPicSet:
  452. * @inter_ref_pic_set_prediction_flag: %TRUE specifies that the stRpsIdx-th candidate
  453. * short-term RPS is predicted from another candidate short-term RPS
  454. * @delta_idx_minus1: plus 1 specifies the difference between the value of source and
  455. * candidate short term RPS.
  456. * @delta_rps_sign: delta_rps_sign and abs_delta_rps_minus1 together specify
  457. * the value of the variable deltaRps.
  458. * @abs_delta_rps_minus1: delta_rps_sign and abs_delta_rps_minus1 together specify
  459. * the value of the variable deltaRps
  460. *
  461. * Defines the #GstH265ShortTermRefPicSet params
  462. */
  463. struct _GstH265ShortTermRefPicSet
  464. {
  465. guint8 inter_ref_pic_set_prediction_flag;
  466. guint8 delta_idx_minus1;
  467. guint8 delta_rps_sign;
  468. guint16 abs_delta_rps_minus1;
  469. /* calculated values */
  470. guint8 NumDeltaPocs;
  471. guint8 NumNegativePics;
  472. guint8 NumPositivePics;
  473. guint8 UsedByCurrPicS0[16];
  474. guint8 UsedByCurrPicS1[16];
  475. gint32 DeltaPocS0[16];
  476. gint32 DeltaPocS1[16];
  477. };
  478. /**
  479. * GstH265VUIParams:
  480. * @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present.
  481. * %FALSE specifies that aspect_ratio_idc is not present
  482. * @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples
  483. * @sar_width indicates the horizontal size of the sample aspect ratio
  484. * @sar_height indicates the vertical size of the sample aspect ratio
  485. * @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwize
  486. * @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures
  487. * output are suitable for display using overscan. %FALSE the cropped decoded pictures
  488. * output contain visually important information
  489. * @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and
  490. * colour_description_present_flag are present.
  491. * @video_format: indicates the representation of the picture
  492. * @video_full_range_flag: indicates the black level and range of the luma and chroma signals
  493. * @colour_description_present_flag: %TRUE specifies that colour_primaries,
  494. * transfer_characteristics and matrix_coefficients are present
  495. * @colour_primaries: indicates the chromaticity coordinates of the source primaries
  496. * @transfer_characteristics: indicates the opto-electronic transfer characteristic
  497. * @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals
  498. * @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and
  499. * chroma_sample_loc_type_bottom_field are present, %FALSE otherwize
  500. * @chroma_sample_loc_type_top_field: specify the location of chroma for top field
  501. * @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field
  502. * @neutral_chroma_indication_flag: %TRUE indicate that the value of chroma samples is equla
  503. * to 1<<(BitDepthchrom-1).
  504. * @field_seq_flag: %TRUE indicate field and %FALSE indicate frame
  505. * @frame_field_info_present_flag: %TRUE indicate picture timing SEI messages are present for every
  506. * picture and include the pic_struct, source_scan_type, and duplicate_flag syntax elements.
  507. * @default_display_window_flag: %TRUE indicate that the default display window parameters present
  508. * def_disp_win_left_offset:left offset of display rect
  509. * def_disp_win_right_offset: right offset of display rect
  510. * def_disp_win_top_offset: top offset of display rect
  511. * def_disp_win_bottom_offset: bottom offset of display rect
  512. * @timing_info_present_flag: %TRUE specifies that num_units_in_tick,
  513. * time_scale and fixed_frame_rate_flag are present in the bitstream
  514. * @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz
  515. * @time_scale: is the number of time units that pass in one second
  516. * @poc_proportional_to_timing_flag: %TRUE indicates that the picture order count value for each picture
  517. * in the CVS that is not the first picture in the CVS, in decoding order, is proportional to the output
  518. * time of the picture relative to the output time of the first picture in the CVS.
  519. * @num_ticks_poc_diff_one_minus1: plus 1 specifies the number of clock ticks corresponding to a
  520. * difference of picture order count values equal to 1
  521. * @hrd_parameters_present_flag: %TRUE if hrd parameters present in the bitstream
  522. * @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction
  523. * parameters are present
  524. * @tiles_fixed_structure_flag: %TRUE indicates that each PPS that is active in the CVS has the same value
  525. * of the syntax elements num_tile_columns_minus1, num_tile_rows_minus1, uniform_spacing_flag,
  526. * column_width_minus1, row_height_minus1 and loop_filter_across_tiles_enabled_flag, when present
  527. * @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the
  528. * picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more
  529. * samples outside picture boundaries may be used in inter prediction
  530. * @restricted_ref_pic_list_flag: %TRUE indicates that all P and B slices (when present) that belong to
  531. * the same picture have an identical reference picture list 0, and that all B slices (when present)
  532. * that belong to the same picture have an identical reference picture list 1
  533. * @min_spatial_segmentation_idc: when not equal to 0, establishes a bound on the maximum possible size
  534. * of distinct coded spatial segmentation regions in the pictures of the CVS
  535. * @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of
  536. * the VCL NAL units associated with any coded picture in the coded video sequence.
  537. * @max_bits_per_min_cu_denom: indicates an upper bound for the number of coded bits of coding_unit
  538. * data for any coding block in any picture of the CVS
  539. * @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal
  540. * motion vector component
  541. * @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical
  542. * motion vector component
  543. *
  544. * The structure representing the VUI parameters.
  545. */
  546. struct _GstH265VUIParams
  547. {
  548. guint8 aspect_ratio_info_present_flag;
  549. guint8 aspect_ratio_idc;
  550. /* if aspect_ratio_idc == 255 */
  551. guint16 sar_width;
  552. guint16 sar_height;
  553. guint8 overscan_info_present_flag;
  554. /* if overscan_info_present_flag */
  555. guint8 overscan_appropriate_flag;
  556. guint8 video_signal_type_present_flag;
  557. guint8 video_format;
  558. guint8 video_full_range_flag;
  559. guint8 colour_description_present_flag;
  560. guint8 colour_primaries;
  561. guint8 transfer_characteristics;
  562. guint8 matrix_coefficients;
  563. guint8 chroma_loc_info_present_flag;
  564. guint8 chroma_sample_loc_type_top_field;
  565. guint8 chroma_sample_loc_type_bottom_field;
  566. guint8 neutral_chroma_indication_flag;
  567. guint8 field_seq_flag;
  568. guint8 frame_field_info_present_flag;
  569. guint8 default_display_window_flag;
  570. guint32 def_disp_win_left_offset;
  571. guint32 def_disp_win_right_offset;
  572. guint32 def_disp_win_top_offset;
  573. guint32 def_disp_win_bottom_offset;
  574. guint8 timing_info_present_flag;
  575. /* if timing_info_present_flag */
  576. guint32 num_units_in_tick;
  577. guint32 time_scale;
  578. guint8 poc_proportional_to_timing_flag;
  579. /* if poc_proportional_to_timing_flag */
  580. guint32 num_ticks_poc_diff_one_minus1;
  581. guint8 hrd_parameters_present_flag;
  582. /*if hrd_parameters_present_flat */
  583. GstH265HRDParams hrd_params;
  584. guint8 bitstream_restriction_flag;
  585. /* if bitstream_restriction_flag */
  586. guint8 tiles_fixed_structure_flag;
  587. guint8 motion_vectors_over_pic_boundaries_flag;
  588. guint8 restricted_ref_pic_lists_flag;
  589. guint16 min_spatial_segmentation_idc;
  590. guint8 max_bytes_per_pic_denom;
  591. guint8 max_bits_per_min_cu_denom;
  592. guint8 log2_max_mv_length_horizontal;
  593. guint8 log2_max_mv_length_vertical;
  594. /* calculated values */
  595. guint par_n;
  596. guint par_d;
  597. };
  598. /**
  599. * GstH265ScalingList:
  600. * @scaling_list_dc_coef_minus8_16x16: this plus 8 specifies the DC
  601. * Coefficient values for 16x16 scaling list
  602. * @scaling_list_dc_coef_minus8_32x32: this plus 8 specifies the DC
  603. * Coefficient values for 32x32 scaling list
  604. * @scaling_lists_4x4: 4x4 scaling list
  605. * @scaling_lists_8x8: 8x8 scaling list
  606. * @scaling_lists_16x16: 16x16 scaling list
  607. * @guint8 scaling_lists_32x32: 32x32 scaling list
  608. *
  609. * Defines the GstH265ScalingList
  610. */
  611. struct _GstH265ScalingList {
  612. gint16 scaling_list_dc_coef_minus8_16x16[6];
  613. gint16 scaling_list_dc_coef_minus8_32x32[2];
  614. guint8 scaling_lists_4x4 [6][16];
  615. guint8 scaling_lists_8x8 [6][64];
  616. guint8 scaling_lists_16x16 [6][64];
  617. guint8 scaling_lists_32x32 [2][64];
  618. };
  619. /**
  620. * GstH265SPS:
  621. * @id: The ID of the sequence parameter set
  622. * @profile_idc: indicate the profile to which the coded video sequence conforms
  623. *
  624. * H265 Sequence Parameter Set (SPS)
  625. */
  626. struct _GstH265SPS
  627. {
  628. guint8 id;
  629. GstH265VPS *vps;
  630. guint8 max_sub_layers_minus1;
  631. guint8 temporal_id_nesting_flag;
  632. GstH265ProfileTierLevel profile_tier_level;
  633. guint8 chroma_format_idc;
  634. guint8 separate_colour_plane_flag;
  635. guint16 pic_width_in_luma_samples;
  636. guint16 pic_height_in_luma_samples;
  637. guint8 conformance_window_flag;
  638. /* if conformance_window_flag */
  639. guint32 conf_win_left_offset;
  640. guint32 conf_win_right_offset;
  641. guint32 conf_win_top_offset;
  642. guint32 conf_win_bottom_offset;
  643. guint8 bit_depth_luma_minus8;
  644. guint8 bit_depth_chroma_minus8;
  645. guint8 log2_max_pic_order_cnt_lsb_minus4;
  646. guint8 sub_layer_ordering_info_present_flag;
  647. guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
  648. guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
  649. guint8 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
  650. guint8 log2_min_luma_coding_block_size_minus3;
  651. guint8 log2_diff_max_min_luma_coding_block_size;
  652. guint8 log2_min_transform_block_size_minus2;
  653. guint8 log2_diff_max_min_transform_block_size;
  654. guint8 max_transform_hierarchy_depth_inter;
  655. guint8 max_transform_hierarchy_depth_intra;
  656. guint8 scaling_list_enabled_flag;
  657. /* if scaling_list_enabled_flag */
  658. guint8 scaling_list_data_present_flag;
  659. GstH265ScalingList scaling_list;
  660. guint8 amp_enabled_flag;
  661. guint8 sample_adaptive_offset_enabled_flag;
  662. guint8 pcm_enabled_flag;
  663. /* if pcm_enabled_flag */
  664. guint8 pcm_sample_bit_depth_luma_minus1;
  665. guint8 pcm_sample_bit_depth_chroma_minus1;
  666. guint8 log2_min_pcm_luma_coding_block_size_minus3;
  667. guint8 log2_diff_max_min_pcm_luma_coding_block_size;
  668. guint8 pcm_loop_filter_disabled_flag;
  669. guint8 num_short_term_ref_pic_sets;
  670. GstH265ShortTermRefPicSet short_term_ref_pic_set[65];
  671. guint8 long_term_ref_pics_present_flag;
  672. /* if long_term_ref_pics_present_flag */
  673. guint8 num_long_term_ref_pics_sps;
  674. guint16 lt_ref_pic_poc_lsb_sps[32];
  675. guint8 used_by_curr_pic_lt_sps_flag[32];
  676. guint8 temporal_mvp_enabled_flag;
  677. guint8 strong_intra_smoothing_enabled_flag;
  678. guint8 vui_parameters_present_flag;
  679. /* if vui_parameters_present_flat */
  680. GstH265VUIParams vui_params;
  681. guint8 sps_extension_flag;
  682. /* calculated values */
  683. guint8 chroma_array_type;
  684. gint width, height;
  685. gint crop_rect_width, crop_rect_height;
  686. gint crop_rect_x, crop_rect_y;
  687. gint fps_num, fps_den;
  688. gboolean valid;
  689. };
  690. /**
  691. * GstH265PPS:
  692. *
  693. * H265 Picture Parameter Set
  694. */
  695. struct _GstH265PPS
  696. {
  697. guint id;
  698. GstH265SPS *sps;
  699. guint8 dependent_slice_segments_enabled_flag;
  700. guint8 output_flag_present_flag;
  701. guint8 num_extra_slice_header_bits;
  702. guint8 sign_data_hiding_enabled_flag;
  703. guint8 cabac_init_present_flag;
  704. guint8 num_ref_idx_l0_default_active_minus1;
  705. guint8 num_ref_idx_l1_default_active_minus1;
  706. gint8 init_qp_minus26;
  707. guint8 constrained_intra_pred_flag;
  708. guint8 transform_skip_enabled_flag;
  709. guint8 cu_qp_delta_enabled_flag;
  710. /*if cu_qp_delta_enabled_flag */
  711. guint8 diff_cu_qp_delta_depth;
  712. gint8 cb_qp_offset;
  713. gint8 cr_qp_offset;
  714. guint8 slice_chroma_qp_offsets_present_flag;
  715. guint8 weighted_pred_flag;
  716. guint8 weighted_bipred_flag;
  717. guint8 transquant_bypass_enabled_flag;
  718. guint8 tiles_enabled_flag;
  719. guint8 entropy_coding_sync_enabled_flag;
  720. guint8 num_tile_columns_minus1;
  721. guint8 num_tile_rows_minus1;
  722. guint8 uniform_spacing_flag;
  723. guint32 column_width_minus1[19];
  724. guint32 row_height_minus1[21];
  725. guint8 loop_filter_across_tiles_enabled_flag;
  726. guint8 loop_filter_across_slices_enabled_flag;
  727. guint8 deblocking_filter_control_present_flag;
  728. guint8 deblocking_filter_override_enabled_flag;
  729. guint8 deblocking_filter_disabled_flag;
  730. gint8 beta_offset_div2;
  731. gint8 tc_offset_div2;
  732. guint8 scaling_list_data_present_flag;
  733. GstH265ScalingList scaling_list;
  734. guint8 lists_modification_present_flag;
  735. guint8 log2_parallel_merge_level_minus2;
  736. guint8 slice_segment_header_extension_present_flag;
  737. guint8 pps_extension_flag;
  738. /* calculated values */
  739. guint32 PicWidthInCtbsY;
  740. guint32 PicHeightInCtbsY;
  741. gboolean valid;
  742. };
  743. struct _GstH265RefPicListModification
  744. {
  745. guint8 ref_pic_list_modification_flag_l0;
  746. guint32 list_entry_l0[15];
  747. guint8 ref_pic_list_modification_flag_l1;
  748. guint32 list_entry_l1[15];
  749. };
  750. struct _GstH265PredWeightTable
  751. {
  752. guint8 luma_log2_weight_denom;
  753. gint8 delta_chroma_log2_weight_denom;
  754. guint8 luma_weight_l0_flag[15];
  755. guint8 chroma_weight_l0_flag[15];
  756. gint8 delta_luma_weight_l0[15];
  757. gint8 luma_offset_l0[15];
  758. gint8 delta_chroma_weight_l0 [15][2];
  759. gint16 delta_chroma_offset_l0 [15][2];
  760. guint8 luma_weight_l1_flag[15];
  761. guint8 chroma_weight_l1_flag[15];
  762. gint8 delta_luma_weight_l1[15];
  763. gint8 luma_offset_l1[15];
  764. gint8 delta_chroma_weight_l1[15][2];
  765. gint16 delta_chroma_offset_l1[15][2];
  766. };
  767. struct _GstH265SliceHdr
  768. {
  769. guint8 first_slice_segment_in_pic_flag;
  770. guint8 no_output_of_prior_pics_flag;
  771. GstH265PPS *pps;
  772. guint8 dependent_slice_segment_flag;
  773. guint32 segment_address;
  774. guint8 type;
  775. guint8 pic_output_flag;
  776. guint8 colour_plane_id;
  777. guint16 pic_order_cnt_lsb;
  778. guint8 short_term_ref_pic_set_sps_flag;
  779. GstH265ShortTermRefPicSet short_term_ref_pic_sets;
  780. guint8 short_term_ref_pic_set_idx;
  781. guint8 num_long_term_sps;
  782. guint8 num_long_term_pics;
  783. guint8 lt_idx_sps[16];
  784. guint32 poc_lsb_lt[16];
  785. guint8 used_by_curr_pic_lt_flag[16];
  786. guint8 delta_poc_msb_present_flag[16];
  787. guint32 delta_poc_msb_cycle_lt[16];
  788. guint8 temporal_mvp_enabled_flag;
  789. guint8 sao_luma_flag;
  790. guint8 sao_chroma_flag;
  791. guint8 num_ref_idx_active_override_flag;
  792. guint8 num_ref_idx_l0_active_minus1;
  793. guint8 num_ref_idx_l1_active_minus1;
  794. GstH265RefPicListModification ref_pic_list_modification;
  795. guint8 mvd_l1_zero_flag;
  796. guint8 cabac_init_flag;
  797. guint8 collocated_from_l0_flag;
  798. guint8 collocated_ref_idx;
  799. GstH265PredWeightTable pred_weight_table;
  800. guint8 five_minus_max_num_merge_cand;
  801. gint8 qp_delta;
  802. gint8 cb_qp_offset;
  803. gint8 cr_qp_offset;
  804. guint8 deblocking_filter_override_flag;
  805. guint8 deblocking_filter_disabled_flag;
  806. gint8 beta_offset_div2;
  807. gint8 tc_offset_div2;
  808. guint8 loop_filter_across_slices_enabled_flag;
  809. guint32 num_entry_point_offsets;
  810. guint8 offset_len_minus1;
  811. guint32 *entry_point_offset_minus1;
  812. /* calculated values */
  813. gint NumPocTotalCurr;
  814. /* Size of the slice_header() in bits */
  815. guint header_size;
  816. /* Number of emulation prevention bytes (EPB) in this slice_header() */
  817. guint n_emulation_prevention_bytes;
  818. };
  819. struct _GstH265PicTiming
  820. {
  821. guint8 pic_struct;
  822. guint8 source_scan_type;
  823. guint8 duplicate_flag;
  824. guint8 au_cpb_removal_delay_minus1;
  825. guint8 pic_dpb_output_delay;
  826. guint8 pic_dpb_output_du_delay;
  827. guint32 num_decoding_units_minus1;
  828. guint8 du_common_cpb_removal_delay_flag;
  829. guint8 du_common_cpb_removal_delay_increment_minus1;
  830. guint32 *num_nalus_in_du_minus1;
  831. guint8 *du_cpb_removal_delay_increment_minus1;
  832. };
  833. struct _GstH265BufferingPeriod
  834. {
  835. GstH265SPS *sps;
  836. guint8 irap_cpb_params_present_flag;
  837. guint8 cpb_delay_offset;
  838. guint8 dpb_delay_offset;
  839. guint8 concatenation_flag;
  840. guint8 au_cpb_removal_delay_delta_minus1;
  841. /* seq->vui_parameters->nal_hrd_parameters_present_flag */
  842. guint8 nal_initial_cpb_removal_delay[32];
  843. guint8 nal_initial_cpb_removal_offset[32];
  844. guint8 nal_initial_alt_cpb_removal_delay[32];
  845. guint8 nal_initial_alt_cpb_removal_offset [32];
  846. /* seq->vui_parameters->vcl_hrd_parameters_present_flag */
  847. guint8 vcl_initial_cpb_removal_delay[32];
  848. guint8 vcl_initial_cpb_removal_offset[32];
  849. guint8 vcl_initial_alt_cpb_removal_delay[32];
  850. guint8 vcl_initial_alt_cpb_removal_offset[32];
  851. };
  852. struct _GstH265SEIMessage
  853. {
  854. GstH265SEIPayloadType payloadType;
  855. union {
  856. GstH265BufferingPeriod buffering_period;
  857. GstH265PicTiming pic_timing;
  858. /* ... could implement more */
  859. } payload;
  860. };
  861. /**
  862. * GstH265Parser:
  863. *
  864. * H265 NAL Parser (opaque structure).
  865. */
  866. struct _GstH265Parser
  867. {
  868. /*< private >*/
  869. GstH265VPS vps[GST_H265_MAX_VPS_COUNT];
  870. GstH265SPS sps[GST_H265_MAX_SPS_COUNT];
  871. GstH265PPS pps[GST_H265_MAX_PPS_COUNT];
  872. GstH265VPS *last_vps;
  873. GstH265SPS *last_sps;
  874. GstH265PPS *last_pps;
  875. };
  876. GstH265Parser * gst_h265_parser_new (void);
  877. GstH265ParserResult gst_h265_parser_identify_nalu (GstH265Parser * parser,
  878. const guint8 * data,
  879. guint offset,
  880. gsize size,
  881. GstH265NalUnit * nalu);
  882. GstH265ParserResult gst_h265_parser_identify_nalu_unchecked (GstH265Parser * parser,
  883. const guint8 * data,
  884. guint offset,
  885. gsize size,
  886. GstH265NalUnit * nalu);
  887. GstH265ParserResult gst_h265_parser_identify_nalu_hevc (GstH265Parser * parser,
  888. const guint8 * data,
  889. guint offset,
  890. gsize size,
  891. guint8 nal_length_size,
  892. GstH265NalUnit * nalu);
  893. GstH265ParserResult gst_h265_parser_parse_nal (GstH265Parser * parser,
  894. GstH265NalUnit * nalu);
  895. GstH265ParserResult gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
  896. GstH265NalUnit * nalu,
  897. GstH265SliceHdr * slice);
  898. GstH265ParserResult gst_h265_parser_parse_vps (GstH265Parser * parser,
  899. GstH265NalUnit * nalu,
  900. GstH265VPS * vps);
  901. GstH265ParserResult gst_h265_parser_parse_sps (GstH265Parser * parser,
  902. GstH265NalUnit * nalu,
  903. GstH265SPS * sps,
  904. gboolean parse_vui_params);
  905. GstH265ParserResult gst_h265_parser_parse_pps (GstH265Parser * parser,
  906. GstH265NalUnit * nalu,
  907. GstH265PPS * pps);
  908. GstH265ParserResult gst_h265_parser_parse_sei (GstH265Parser * parser,
  909. GstH265NalUnit * nalu,
  910. GArray **messages);
  911. void gst_h265_parser_free (GstH265Parser * parser);
  912. GstH265ParserResult gst_h265_parse_vps (GstH265NalUnit * nalu,
  913. GstH265VPS * vps);
  914. GstH265ParserResult gst_h265_parse_sps (GstH265Parser * parser,
  915. GstH265NalUnit * nalu,
  916. GstH265SPS * sps,
  917. gboolean parse_vui_params);
  918. GstH265ParserResult gst_h265_parse_pps (GstH265Parser * parser,
  919. GstH265NalUnit * nalu,
  920. GstH265PPS * pps);
  921. gboolean gst_h265_slice_hdr_copy (GstH265SliceHdr * dst_slice,
  922. const GstH265SliceHdr * src_slice);
  923. void gst_h265_slice_hdr_free (GstH265SliceHdr * slice_hdr);
  924. gboolean gst_h265_sei_copy (GstH265SEIMessage * dest_sei,
  925. const GstH265SEIMessage * src_sei);
  926. void gst_h265_sei_free (GstH265SEIMessage * sei);
  927. void gst_h265_quant_matrix_4x4_get_zigzag_from_raster (guint8 out_quant[16],
  928. const guint8 quant[16]);
  929. void gst_h265_quant_matrix_4x4_get_raster_from_zigzag (guint8 out_quant[16],
  930. const guint8 quant[16]);
  931. void gst_h265_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64],
  932. const guint8 quant[64]);
  933. void gst_h265_quant_matrix_8x8_get_raster_from_zigzag (guint8 out_quant[64],
  934. const guint8 quant[64]);
  935. #define gst_h265_quant_matrix_16x16_get_zigzag_from_raster \
  936. gst_h265_quant_matrix_8x8_get_zigzag_from_raster
  937. #define gst_h265_quant_matrix_16x16_get_raster_from_zigzag \
  938. gst_h265_quant_matrix_8x8_get_raster_from_zigzag
  939. #define gst_h265_quant_matrix_32x32_get_zigzag_from_raster \
  940. gst_h265_quant_matrix_8x8_get_zigzag_from_raster
  941. #define gst_h265_quant_matrix_32x32_get_raster_from_zigzag \
  942. gst_h265_quant_matrix_8x8_get_raster_from_zigzag
  943. void gst_h265_quant_matrix_4x4_get_uprightdiagonal_from_raster (guint8 out_quant[16],
  944. const guint8 quant[16]);
  945. void gst_h265_quant_matrix_4x4_get_raster_from_uprightdiagonal (guint8 out_quant[16],
  946. const guint8 quant[16]);
  947. void gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster (guint8 out_quant[64],
  948. const guint8 quant[64]);
  949. void gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal (guint8 out_quant[64],
  950. const guint8 quant[64]);
  951. #define gst_h265_quant_matrix_16x16_get_uprightdiagonal_from_raster \
  952. gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
  953. #define gst_h265_quant_matrix_16x16_get_raster_from_uprightdiagonal\
  954. gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
  955. #define gst_h265_quant_matrix_32x32_get_uprightdiagonal_from_raster \
  956. gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
  957. #define gst_h265_quant_matrix_32x32_get_raster_from_uprightdiagonal\
  958. gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
  959. G_END_DECLS
  960. #endif