documentation: fixed a heap o' typos
[platform/upstream/gstreamer.git] / gst-libs / gst / codecparsers / gsth265parser.h
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
23 #ifndef __GST_H265_PARSER_H__
24 #define __GST_H265_PARSER_H__
25
26 #ifndef GST_USE_UNSTABLE_API
27 #warning "The H.265 parsing library is unstable API and may change in future."
28 #warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
29 #endif
30
31 #include <gst/gst.h>
32 #include <gst/codecparsers/codecparsers-prelude.h>
33
34 G_BEGIN_DECLS
35
36 #define GST_H265_MAX_SUB_LAYERS   8
37 #define GST_H265_MAX_VPS_COUNT   16
38 #define GST_H265_MAX_SPS_COUNT   16
39 #define GST_H265_MAX_PPS_COUNT   64
40
41 #define GST_H265_IS_B_SLICE(slice)  ((slice)->type == GST_H265_B_SLICE)
42 #define GST_H265_IS_P_SLICE(slice)  ((slice)->type == GST_H265_P_SLICE)
43 #define GST_H265_IS_I_SLICE(slice)  ((slice)->type == GST_H265_I_SLICE)
44
45 /**
46  * GstH265Profile:
47  * @GST_H265_PROFILE_MAIN: Main profile (A.3.2)
48  * @GST_H265_PROFILE_MAIN_10: Main 10 profile (A.3.3)
49  * @GST_H265_PROFILE_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
50  * @GST_H265_PROFILE_MONOCHROME: Monochrome profile (A.3.4)
51  * @GST_H265_PROFILE_MONOCHROME_12: Monochrome 12-bits profile (A.3.4)
52  * @GST_H265_PROFILE_MONOCHROME_16: Monochrome 16-bits profile (A.3.4)
53  * @GST_H265_PROFILE_MAIN_12: Main profile 12-bits (A.3.4)
54  * @GST_H265_PROFILE_MAIN_422_10: Main 4:2:2 profile 10-bits (A.3.4)
55  * @GST_H265_PROFILE_MAIN_422_12: Main 4:2:2 profile 12-bits (A.3.4)
56  * @GST_H265_PROFILE_MAIN_444: Main 4:4:4 profile (A.3.4)
57  * @GST_H265_PROFILE_MAIN_444_10: Main 4:4:4 10-bits profile (A.3.4)
58  * @GST_H265_PROFILE_MAIN_444_12: Main 4:4:4 12-bits profile (A.3.4)
59  * @GST_H265_PROFILE_MAIN_INTRA: Main Intra profile (A.3.4)
60  * @GST_H265_PROFILE_MAIN_10_INTRA: Main Intra 10-bits profile (A.3.4)
61  * @GST_H265_PROFILE_MAIN_12_INTRA: Main Intra 12-bits profile (A.3.4)
62  * @GST_H265_PROFILE_MAIN_422_10_INTRA: Main Intra 4:2:2 10-bits profile (A.3.4)
63  * @GST_H265_PROFILE_MAIN_422_12_INTRA: Main Intra 4:2:2 12-bits profile (A.3.4)
64  * @GST_H265_PROFILE_MAIN_444_INTRA: Main Intra 4:4:4 profile (A.3.4)
65  * @GST_H265_PROFILE_MAIN_444_10_INTRA: Main Intra 4:4:4 10-bits profile (A.3.4)
66  * @GST_H265_PROFILE_MAIN_444_12_INTRA: Main Intra 4:4:4 12-bits profile (A.3.4)
67  * @GST_H265_PROFILE_MAIN_444_16_INTRA: Main Intra 4:4:4 16-bits profile (A.3.4)
68  * @GST_H265_PROFILE_MAIN_444_STILL_PICTURE: Main 4:4:4 Still Picture profile (A.3.4)
69  * @GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE: Main 4:4:4 16-bits Still Picture profile (A.3.4)
70  * @GST_H265_PROFILE_MONOCHROME_10:  Monochrome 10-bits profile (A.3.5) (Since: 1.18)
71  * @GST_H265_PROFILE_HIGH_THROUGHPUT_444: High Throughput 4:4:4 profile (A.3.6) (Since: 1.18)
72  * @GST_H265_PROFILE_HIGH_THROUGHPUT_444_10: High Throughput 4:4:4 10-bits profile (A.3.6) (Since: 1.18)
73  * @GST_H265_PROFILE_HIGH_THROUGHPUT_444_14: High Throughput 4:4:4 14-bits profile (A.3.6) (Since: 1.18)
74  * @GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA: High Throughput 4:4:4 16-bits Intra profile (A.3.6) (Since: 1.18)
75  * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN: Screen-Extended Main profile (A.3.7) (Since: 1.18)
76  * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10: Screen-Extended Main 10-bits profile (A.3.7) (Since: 1.18)
77  * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444: Screen-Extended Main 4:4:4 profile (A.3.7) (Since: 1.18)
78  * @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10: Screen-Extended Main 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
79  * @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444: Screen-Extended High Throughput 4:4:4 profile (A.3.7) (Since: 1.18)
80  * @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10: Screen-Extended High Throughput 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
81  * @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14: Screen-Extended High Throughput 4:4:4 14-bits profile (A.3.7) (Since: 1.18)
82  * @GST_H265_PROFILE_MULTIVIEW_MAIN: Multiview Main profile (G.11.1) (Since: 1.18)
83  * @GST_H265_PROFILE_SCALABLE_MAIN: Scalable Main profile (H.11.1) (Since: 1.18)
84  * @GST_H265_PROFILE_SCALABLE_MAIN_10: Scalable Main 10-bits profile (H.11.1) (Since: 1.18)
85  * @GST_H265_PROFILE_SCALABLE_MONOCHROME: Scalable Monochrome profile (H.11.1) (Since: 1.18)
86  * @GST_H265_PROFILE_SCALABLE_MONOCHROME_12: Scalable Monochrome 12-bits profile (H.11.1) (Since: 1.18)
87  * @GST_H265_PROFILE_SCALABLE_MONOCHROME_16: Scalable Monochrome 16-bits profile (H.11.1) (Since: 1.18)
88  * @GST_H265_PROFILE_SCALABLE_MAIN_444: Scalable Main 4:4:4 profile (H.11.1) (Since: 1.18)
89  * @GST_H265_PROFILE_3D_MAIN: 3D Main 4:4:4 profile (I.11.1) (Since: 1.18)
90  *
91  * H.265 Profiles.
92  *
93  */
94 typedef enum {
95   GST_H265_PROFILE_INVALID              = -1,
96   GST_H265_PROFILE_MAIN                 = 1,
97   GST_H265_PROFILE_MAIN_10              = 2,
98   GST_H265_PROFILE_MAIN_STILL_PICTURE   = 3,
99   GST_H265_PROFILE_MONOCHROME,
100   GST_H265_PROFILE_MONOCHROME_12,
101   GST_H265_PROFILE_MONOCHROME_16,
102   GST_H265_PROFILE_MAIN_12,
103   GST_H265_PROFILE_MAIN_422_10,
104   GST_H265_PROFILE_MAIN_422_12,
105   GST_H265_PROFILE_MAIN_444,
106   GST_H265_PROFILE_MAIN_444_10,
107   GST_H265_PROFILE_MAIN_444_12,
108   GST_H265_PROFILE_MAIN_INTRA,
109   GST_H265_PROFILE_MAIN_10_INTRA,
110   GST_H265_PROFILE_MAIN_12_INTRA,
111   GST_H265_PROFILE_MAIN_422_10_INTRA,
112   GST_H265_PROFILE_MAIN_422_12_INTRA,
113   GST_H265_PROFILE_MAIN_444_INTRA,
114   GST_H265_PROFILE_MAIN_444_10_INTRA,
115   GST_H265_PROFILE_MAIN_444_12_INTRA,
116   GST_H265_PROFILE_MAIN_444_16_INTRA,
117   GST_H265_PROFILE_MAIN_444_STILL_PICTURE,
118   GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE,
119   GST_H265_PROFILE_MONOCHROME_10,
120   GST_H265_PROFILE_HIGH_THROUGHPUT_444,
121   GST_H265_PROFILE_HIGH_THROUGHPUT_444_10,
122   GST_H265_PROFILE_HIGH_THROUGHPUT_444_14,
123   GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA,
124   GST_H265_PROFILE_SCREEN_EXTENDED_MAIN,
125   GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10,
126   GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444,
127   GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10,
128   GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444,
129   GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10,
130   GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14,
131   GST_H265_PROFILE_MULTIVIEW_MAIN,
132   GST_H265_PROFILE_SCALABLE_MAIN,
133   GST_H265_PROFILE_SCALABLE_MAIN_10,
134   GST_H265_PROFILE_SCALABLE_MONOCHROME,
135   GST_H265_PROFILE_SCALABLE_MONOCHROME_12,
136   GST_H265_PROFILE_SCALABLE_MONOCHROME_16,
137   GST_H265_PROFILE_SCALABLE_MAIN_444,
138   GST_H265_PROFILE_3D_MAIN,
139
140   /* end of the profiles */
141   GST_H265_PROFILE_MAX
142 } GstH265Profile;
143
144 /**
145  * GstH265ProfileIDC:
146  * @GST_H265_PROFILE_IDC_MAIN: Main profile (A.3.2)
147  * @GST_H265_PROFILE_IDC_MAIN_10: Main 10 profile (A.3.3)
148  * @GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
149  * @GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION: Format range extensions profile (A.3.5)
150  * @GST_H265_PROFILE_IDC_HIGH_THROUGHPUT: High throughput profiles (A.3.6)
151  * @GST_H265_PROFILE_IDC_MULTIVIEW_MAIN: Multiview Main profiles (G.11.1) (Since: 1.18)
152  * @GST_H265_PROFILE_IDC_SCALABLE_MAIN: Scalable Main and Scalable Main 10 profile (H.11.1) (Since: 1.18)
153  * @GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING: Screen content coding extensions profiles (A.3.7)
154  * @GST_H265_PROFILE_IDC_3D_MAIN: 3D Main profile (I.11.1) (Since: 1.18)
155  * @GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION: Scalable Format range extensions profiles (H.11.1) (Since: 1.18)
156  *
157  * Valid values for the profile_idc field. This is different from
158  * #GstH265Profile as an extension idc can be used to encode a whole variety of
159  * profiles.
160  *
161  */
162 typedef enum {
163   GST_H265_PROFILE_IDC_MAIN                   = 1,
164   GST_H265_PROFILE_IDC_MAIN_10                = 2,
165   GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE     = 3,
166   GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION = 4,
167   GST_H265_PROFILE_IDC_HIGH_THROUGHPUT        = 5,
168   GST_H265_PROFILE_IDC_MULTIVIEW_MAIN         = 6,
169   GST_H265_PROFILE_IDC_SCALABLE_MAIN          = 7,
170   GST_H265_PROFILE_IDC_3D_MAIN                = 8,
171   GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING  = 9,
172   GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION = 10,
173 } GstH265ProfileIDC;
174
175 /**
176  * GstH265NalUnitType:
177  * @GST_H265_NAL_SLICE_TRAIL_N: Slice nal of a non-TSA, non-STSA trailing picture
178  * @GST_H265_NAL_SLICE_TRAIL_R: Slice nal of a non-TSA, non-STSA trailing picture
179  * @GST_H265_NAL_SLICE_TSA_N: Slice nal of a TSA picture
180  * @GST_H265_NAL_SLICE_TSA_R: Slice nal of a TSA picture
181  * @GST_H265_NAL_SLICE_STSA_N: Slice nal of a STSA picture
182  * @GST_H265_NAL_SLICE_STSA_R: Slice nal of a STSA picture
183  * @GST_H265_NAL_SLICE_RADL_N: Slice nal of a RADL picture
184  * @GST_H265_NAL_SLICE_RADL_R: Slice nal of a RADL piicture
185  * @GST_H265_NAL_SLICE_RASL_N: Slice nal of a RASL picture
186  * @GST_H265_NAL_SLICE_RASL_R: Slice nal of a RASL picture
187  * @GST_H265_NAL_SLICE_BLA_W_LP: Slice nal of a BLA picture
188  * @GST_H265_NAL_SLICE_BLA_W_RADL: Slice nal of a BLA picture
189  * @GST_H265_NAL_SLICE_BLA_N_LP: Slice nal of a BLA picture
190  * @GST_H265_NAL_SLICE_IDR_W_RADL: Slice nal of an IDR picture
191  * @GST_H265_NAL_SLICE_IDR_N_LP: Slice nal of an IDR picture
192  * @GST_H265_NAL_SLICE_CRA_NUT: Slice nal of a CRA picture
193  * @GST_H265_NAL_VPS: Video parameter set(VPS) nal unit
194  * @GST_H265_NAL_SPS: Sequence parameter set (SPS) nal unit
195  * @GST_H265_NAL_PPS: Picture parameter set (PPS) nal unit
196  * @GST_H265_NAL_AUD: Access unit (AU) delimiter nal unit
197  * @GST_H265_NAL_EOS: End of sequence (EOS) nal unit
198  * @GST_H265_NAL_EOB: End of bitstream (EOB) nal unit
199  * @GST_H265_NAL_FD: Filler data (FD) nal lunit
200  * @GST_H265_NAL_PREFIX_SEI: Supplemental enhancement information prefix nal unit
201  * @GST_H265_NAL_SUFFIX_SEI: Suppliemental enhancement information suffix nal unit
202  *
203  * Indicates the type of H265 Nal Units
204  */
205 typedef enum
206 {
207   GST_H265_NAL_SLICE_TRAIL_N    = 0,
208   GST_H265_NAL_SLICE_TRAIL_R    = 1,
209   GST_H265_NAL_SLICE_TSA_N      = 2,
210   GST_H265_NAL_SLICE_TSA_R      = 3,
211   GST_H265_NAL_SLICE_STSA_N     = 4,
212   GST_H265_NAL_SLICE_STSA_R     = 5,
213   GST_H265_NAL_SLICE_RADL_N     = 6,
214   GST_H265_NAL_SLICE_RADL_R     = 7,
215   GST_H265_NAL_SLICE_RASL_N     = 8,
216   GST_H265_NAL_SLICE_RASL_R     = 9,
217   GST_H265_NAL_SLICE_BLA_W_LP   = 16,
218   GST_H265_NAL_SLICE_BLA_W_RADL = 17,
219   GST_H265_NAL_SLICE_BLA_N_LP   = 18,
220   GST_H265_NAL_SLICE_IDR_W_RADL = 19,
221   GST_H265_NAL_SLICE_IDR_N_LP   = 20,
222   GST_H265_NAL_SLICE_CRA_NUT    = 21,
223   GST_H265_NAL_VPS              = 32,
224   GST_H265_NAL_SPS              = 33,
225   GST_H265_NAL_PPS              = 34,
226   GST_H265_NAL_AUD              = 35,
227   GST_H265_NAL_EOS              = 36,
228   GST_H265_NAL_EOB              = 37,
229   GST_H265_NAL_FD               = 38,
230   GST_H265_NAL_PREFIX_SEI       = 39,
231   GST_H265_NAL_SUFFIX_SEI       = 40
232 } GstH265NalUnitType;
233
234 #define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MIN 10
235 #define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MAX 15
236
237 #define RESERVED_IRAP_NAL_TYPE_MIN 22
238 #define RESERVED_IRAP_NAL_TYPE_MAX 23
239
240 #define RESERVED_NON_IRAP_NAL_TYPE_MIN 24
241 #define RESERVED_NON_IRAP_NAL_TYPE_MAX 31
242
243 #define RESERVED_NON_VCL_NAL_TYPE_MIN 41
244 #define RESERVED_NON_VCL_NAL_TYPE_MAX 47
245
246 #define UNSPECIFIED_NON_VCL_NAL_TYPE_MIN 48
247 #define UNSPECIFIED_NON_VCL_NAL_TYPE_MAX 63
248
249 /**
250  * GstH265ParserResult:
251  * @GST_H265_PARSER_OK: The parsing succeeded
252  * @GST_H265_PARSER_BROKEN_DATA: The data to parse is broken
253  * @GST_H265_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
254  * @GST_H265_PARSER_ERROR: An error accured when parsing
255  * @GST_H265_PARSER_NO_NAL: No nal found during the parsing
256  * @GST_H265_PARSER_NO_NAL_END: Start of the nal found, but not the end.
257  *
258  * The result of parsing H265 data.
259  */
260 typedef enum
261 {
262   GST_H265_PARSER_OK,
263   GST_H265_PARSER_BROKEN_DATA,
264   GST_H265_PARSER_BROKEN_LINK,
265   GST_H265_PARSER_ERROR,
266   GST_H265_PARSER_NO_NAL,
267   GST_H265_PARSER_NO_NAL_END
268 } GstH265ParserResult;
269
270 /**
271  * GstH265SEIPayloadType:
272  * @GST_H265_SEI_BUF_PERIOD: Buffering Period SEI Message
273  * @GST_H265_SEI_PIC_TIMING: Picture Timing SEI Message
274  * @GST_H265_SEI_REGISTERED_USER_DATA: Registered user data (D.2.5)
275  * @GST_H265_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.3.8)
276  * @GST_H265_SEI_TIME_CODE: Time code SEI message (D.2.27) (Since: 1.16)
277  * @GST_H265_SEI_MASTERING_DISPLAY_COLOUR_VOLUME: Mastering display colour volume information SEI message (D.2.28) (Since: 1.18)
278  * @GST_H265_SEI_CONTENT_LIGHT_LEVEL: Content light level information SEI message (D.2.35) (Since: 1.18)
279  * ...
280  *
281  * The type of SEI message.
282  */
283 typedef enum
284 {
285   GST_H265_SEI_BUF_PERIOD = 0,
286   GST_H265_SEI_PIC_TIMING = 1,
287   GST_H265_SEI_REGISTERED_USER_DATA = 4,
288   GST_H265_SEI_RECOVERY_POINT = 6,
289   GST_H265_SEI_TIME_CODE = 136,
290   GST_H265_SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137,
291   GST_H265_SEI_CONTENT_LIGHT_LEVEL = 144,
292       /* and more...  */
293 } GstH265SEIPayloadType;
294
295 /**
296  * GstH265SEIPicStructType:
297  * @GST_H265_SEI_PIC_STRUCT_FRAME: Picture is a frame
298  * @GST_H265_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame
299  * @GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD: Botom field of frame
300  * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame
301  * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame
302  * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame
303  * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame
304  * @GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should
305  *  be displayed two times consecutively
306  * @GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be
307  *  displayed three times consecutively
308  * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM: top field paired with
309  *  previous bottom field in output order
310  * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP: bottom field paried with
311  *  previous top field in output order
312  * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM: top field paired with next
313  *  bottom field in output order
314  * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP: bottom field paired with
315  *  next top field in output order
316  *
317  * SEI pic_struct type
318  */
319 typedef enum
320 {
321   GST_H265_SEI_PIC_STRUCT_FRAME                         = 0,
322   GST_H265_SEI_PIC_STRUCT_TOP_FIELD                     = 1,
323   GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD                  = 2,
324   GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM                    = 3,
325   GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP                    = 4,
326   GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP                = 5,
327   GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM             = 6,
328   GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING                = 7,
329   GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING                = 8,
330   GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM    = 9,
331   GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP    = 10,
332   GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM        = 11,
333   GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP        = 12
334 } GstH265SEIPicStructType;
335
336 /**
337  * GstH265SliceType:
338  *
339  * Type of Picture slice
340  */
341
342 typedef enum
343 {
344   GST_H265_B_SLICE    = 0,
345   GST_H265_P_SLICE    = 1,
346   GST_H265_I_SLICE    = 2
347 } GstH265SliceType;
348
349 typedef enum
350 {
351   GST_H265_QUANT_MATIX_4X4   = 0,
352   GST_H265_QUANT_MATIX_8X8   = 1,
353   GST_H265_QUANT_MATIX_16X16 = 2,
354   GST_H265_QUANT_MATIX_32X32 = 3
355 } GstH265QuantMatrixSize;
356
357 typedef struct _GstH265Parser                   GstH265Parser;
358
359 typedef struct _GstH265NalUnit                  GstH265NalUnit;
360
361 typedef struct _GstH265VPS                      GstH265VPS;
362 typedef struct _GstH265SPS                      GstH265SPS;
363 typedef struct _GstH265PPS                      GstH265PPS;
364 typedef struct _GstH265ProfileTierLevel         GstH265ProfileTierLevel;
365 typedef struct _GstH265SubLayerHRDParams        GstH265SubLayerHRDParams;
366 typedef struct _GstH265HRDParams                GstH265HRDParams;
367 typedef struct _GstH265VUIParams                GstH265VUIParams;
368 typedef struct _GstH265SPSExtensionParams       GstH265SPSExtensionParams;
369 typedef struct _GstH265PPSExtensionParams       GstH265PPSExtensionParams;
370
371 typedef struct _GstH265ScalingList              GstH265ScalingList;
372 typedef struct _GstH265RefPicListModification   GstH265RefPicListModification;
373 typedef struct _GstH265PredWeightTable          GstH265PredWeightTable;
374 typedef struct _GstH265ShortTermRefPicSet       GstH265ShortTermRefPicSet;
375 typedef struct _GstH265SliceHdr                 GstH265SliceHdr;
376
377 typedef struct _GstH265PicTiming                GstH265PicTiming;
378 typedef struct _GstH265RegisteredUserData       GstH265RegisteredUserData;
379 typedef struct _GstH265BufferingPeriod          GstH265BufferingPeriod;
380 typedef struct _GstH265RecoveryPoint            GstH265RecoveryPoint;
381 typedef struct _GstH265TimeCode                 GstH265TimeCode;
382 typedef struct _GstH265MasteringDisplayColourVolume GstH265MasteringDisplayColourVolume;
383 typedef struct _GstH265ContentLightLevel        GstH265ContentLightLevel;
384 typedef struct _GstH265SEIMessage               GstH265SEIMessage;
385
386 /**
387  * GstH265NalUnit:
388  * @type: A #GstH265NalUnitType
389  * @layer_id: A nal unit layer id
390  * @temporal_id_plus1: A nal unit temporal identifier
391  * @size: The size of the nal unit starting from @offset
392  * @offset: The offset of the actual start of the nal unit
393  * @sc_offset:The offset of the start code of the nal unit
394  * @valid: If the nal unit is valid, which mean it has
395  * already been parsed
396  * @data: The data from which the Nalu has been parsed
397  *
398  * Structure defining the Nal unit headers
399  */
400 struct _GstH265NalUnit
401 {
402   guint8 type;
403   guint8 layer_id;
404   guint8 temporal_id_plus1;
405
406   /* calculated values */
407   guint size;
408   guint offset;
409   guint sc_offset;
410   gboolean valid;
411
412   guint8 *data;
413   guint8 header_bytes;
414 };
415
416 /**
417  * GstH265ProfileTierLevel:
418  * @profile_space: specifies the context for the interpretation of
419  *   general_profile_idc and general_profile_combatibility_flag
420  * @tier_flag: the tier context for the interpretation of general_level_idc
421  * @profile_idc: profile id
422  * @profile_compatibility_flag: compatibility flags
423  * @progressive_source_flag: flag to indicate the type of stream
424  * @interlaced_source_flag: flag to indicate the type of stream
425  * @non_packed_constraint_flag: indicate the presence of frame packing
426  *   arrangement sei message
427  * @frame_only_constraint_flag: recognize the field_seq_flag
428  * @max_12bit_constraint_flag: used to define profile extensions, see Annex A
429  * @max_10bit_constraint_flag: used to define profile extensions, see Annex A
430  * @max_8bit_constraint_flag: used to define profile extensions, see Annex A
431  * @max_422chroma_constraint_flag: used to define profile extensions, see Annex A
432  * @max_420chroma_constraint_flag: used to define profile extensions, see Annex A
433  * @max_monochrome_constraint_flag: used to define profile extensions, see Annex A
434  * @intra_constraint_flag: used to define profile extensions, see Annex A
435  * @one_picture_only_constraint_flag: used to define profile extensions, see Annex A
436  * @lower_bit_rate_constraint_flag: used to define profile extensions, see Annex A
437  * @max_14bit_constraint_flag: used to define profile extensions, see Annex A
438  * @level idc: indicate the level which the CVS confirms
439  * @sub_layer_profile_present_flag: sublayer profile presence ind
440  * @sub_layer_level_present_flag:sublayer level presence indicator.
441  * @sub_layer_profile_space: profile space for sublayers
442  * @sub_layer_tier_flag: tier flags for sublayers.
443  * @sub_layer_profile_idc: conformant profile indicator for sublayers.
444  * @sub_layer_profile_compatibility_flag[6][32]: compatibility flags for sublayers
445  * @sub_layer_progressive_source_flag:progressive stream indicator for sublayer
446  * @sub_layer_interlaced_source_flag: interlaced stream indicator for sublayer
447  * @sub_layer_non_packed_constraint_flag: indicate the presence of
448  *   frame packing arrangement sei message with in sublayers
449  * @sub_layer_frame_only_constraint_flag:recognize the sublayer
450  *   specific field_seq_flag
451  * @sub_layer_level_idc:indicate the sublayer specific level
452  *
453  * Define ProfileTierLevel parameters
454  */
455 struct _GstH265ProfileTierLevel {
456   guint8 profile_space;
457   guint8 tier_flag;
458   guint8 profile_idc;
459
460   guint8 profile_compatibility_flag[32];
461
462   guint8 progressive_source_flag;
463   guint8 interlaced_source_flag;
464   guint8 non_packed_constraint_flag;
465   guint8 frame_only_constraint_flag;
466
467   guint8 max_12bit_constraint_flag;
468   guint8 max_10bit_constraint_flag;
469   guint8 max_8bit_constraint_flag;
470   guint8 max_422chroma_constraint_flag;
471   guint8 max_420chroma_constraint_flag;
472   guint8 max_monochrome_constraint_flag;
473   guint8 intra_constraint_flag;
474   guint8 one_picture_only_constraint_flag;
475   guint8 lower_bit_rate_constraint_flag;
476   guint8 max_14bit_constraint_flag;
477
478   guint8 level_idc;
479
480   guint8 sub_layer_profile_present_flag[6];
481   guint8 sub_layer_level_present_flag[6];
482
483   guint8 sub_layer_profile_space[6];
484   guint8 sub_layer_tier_flag[6];
485   guint8 sub_layer_profile_idc[6];
486   guint8 sub_layer_profile_compatibility_flag[6][32];
487   guint8 sub_layer_progressive_source_flag[6];
488   guint8 sub_layer_interlaced_source_flag[6];
489   guint8 sub_layer_non_packed_constraint_flag[6];
490   guint8 sub_layer_frame_only_constraint_flag[6];
491   guint8 sub_layer_level_idc[6];
492 };
493
494 /**
495  * GstH265SubLayerHRDParams:
496  * @bit_rate_value_minus1:togeter with bit_rate_scale, it specifies
497  *   the maximum input bitrate when the CPB operates at the access
498  *   unit level
499  * @cpb_size_value_minus1: is used together with cpb_size_scale to
500  *   specify the CPB size when the CPB operates at the access unit
501  *   level
502  * @cpb_size_du_value_minus1: is used together with cpb_size_du_scale
503  *   to specify the CPB size when the CPB operates at sub-picture
504  *   level
505  * @bit_rate_du_value_minus1: together with bit_rate_scale, it
506  *   specifies the maximum input bit rate when the CPB operates at the
507  *   sub-picture level
508  * @cbr_flag: indicate whether HSS operates in intermittent bit rate
509  *   mode or constant bit rate mode.
510  *
511  * Defines the Sublayer HRD parameters
512  */
513 struct _GstH265SubLayerHRDParams
514 {
515   guint32 bit_rate_value_minus1[32];
516   guint32 cpb_size_value_minus1[32];
517
518   guint32 cpb_size_du_value_minus1[32];
519   guint32 bit_rate_du_value_minus1[32];
520
521   guint8 cbr_flag[32];
522 };
523
524 /**
525  * GstH265HRDParams:
526  * @nal_hrd_parameters_present_flag: indicate the presence of NAL HRD parameters
527  * @vcl_hrd_parameters_present_flag: indicate the presence of VCL HRD parameters
528  * @sub_pic_hrd_params_present_flag: indicate the presence of sub_pic_hrd_params
529  * @tick_divisor_minus2: is used to specify the clock sub-tick
530  * @du_cpb_removal_delay_increment_length_minus1: specifies the length,
531  *   in bits, of the nal_initial_cpb_removal_delay
532  * @sub_pic_cpb_params_in_pic_timing_sei_flag: specifies the length, in bits, of
533  *   the cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements.
534  * @dpb_output_delay_du_length_minu1: specifies the length, in bits, of the
535  *   dpb_delay_offset and the pic_dpb_output_delay syntax elements
536  * @bit_rate_scale: maximum input bitrate
537  * @cpb_size_scale: CPB size when operates in access unit level
538  * @cpb_size_du_scale: CPB size when operates in sub-picture level
539  * @initial_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
540  *   nal_initial_cpb_removal_delay, nal_initial_cpb_removal_offset,
541  *   vcl_initial_cpb_removal_delay and vcl_initial_cpb_removal_offset.
542  * @au_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
543  *   cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements
544  * @dpb_output_delay_length_minus1: specifies the length, in bits, of the
545  *   dpb_delay_offset and the pic_dpb_output_delay syntax elements
546  * @fixed_pic_rate_general_flag: flag to indicate the presence of constraint
547  *   on the temporal distance between the HRD output times of consecutive
548  *   pictures in output order
549  * @fixed_pic_rate_within_cvs_flag: same as fixed_pic_rate_general_flag
550  * @elemental_duration_in_tc_minus1: temporal distance in clock ticks
551  * @low_delay_hrd_flag: specifies the HRD operational mode
552  * @cpb_cnt_minus1:specifies the number of alternative CPS specifications.
553  * @sublayer_hrd_params: Sublayer HRD parameters.
554  *
555  * Defines the HRD parameters
556  */
557 struct _GstH265HRDParams
558 {
559   guint8 nal_hrd_parameters_present_flag;
560   guint8 vcl_hrd_parameters_present_flag;
561   guint8 sub_pic_hrd_params_present_flag;
562
563   guint8 tick_divisor_minus2;
564   guint8 du_cpb_removal_delay_increment_length_minus1;
565   guint8 sub_pic_cpb_params_in_pic_timing_sei_flag;
566   guint8 dpb_output_delay_du_length_minus1;
567
568   guint8 bit_rate_scale;
569   guint8 cpb_size_scale;
570   guint8 cpb_size_du_scale;
571
572   guint8 initial_cpb_removal_delay_length_minus1;
573   guint8 au_cpb_removal_delay_length_minus1;
574   guint8 dpb_output_delay_length_minus1;
575
576   guint8 fixed_pic_rate_general_flag [7];
577   guint8 fixed_pic_rate_within_cvs_flag [7];
578   guint16 elemental_duration_in_tc_minus1 [7];
579   guint8 low_delay_hrd_flag [7];
580   guint8 cpb_cnt_minus1[7];
581
582   GstH265SubLayerHRDParams sublayer_hrd_params[7];
583 };
584
585 /**
586  * GstH265VPS:
587  * @id: vps id
588  * @base_layer_internal_flag and @base_layer_available_flag:
589  *   specify availability of base layer
590  * @max_layers_minus1: should be zero, but can be other values in future
591  * @max_sub_layers_minus1:specifies the maximum number of temporal sub-layers
592  * @temporal_id_nesting_flag: specifies whether inter prediction is
593  *   additionally restricted
594  * @profile_tier_level: ProfileTierLevel info
595  * @sub_layer_ordering_info_present_flag: indicates the presence of
596  *   vps_max_dec_pic_buffering_minus1, vps_max_num_reorder_pics and
597  *   vps_max_latency_increase_plus1
598  * @max_dec_pic_buffering_minus1: specifies the maximum required size
599  *   of the decoded picture buffer
600  * @max_num_reorder_pics: indicates the maximum allowed number of
601  *   pictures that can precede any picture in the CVS in decoding
602  *   order
603  * @max_latency_increase_plus1: is used to compute the value of
604  *   VpsMaxLatencyPictures
605  * @max_layer_id: specifies the maximum allowed value of nuh_layer_id
606  * @num_layer_sets_minus1: specifies the number of layer sets
607  * @layer_id_included_flag: specifies whether a nuh_layer_id included
608  *   in the layer identifier list
609  * @timing_info_present_flag: indicate the presence of
610  *   num_units_in_tick, time_scale, poc_proportional_to_timing_flag
611  *   and num_hrd_parameters
612  * @num_units_in_tick: number of time units in a tick
613  * @time_scale: number of time units that pass in one second
614  * @poc_proportional_to_timing_flag: indicate whether the picture
615  *   order count is proportional to output timin
616  * @num_ticks_poc_diff_one_minus1: specifies the number of clock ticks
617  *   corresponding to a difference of picture order count values equal
618  *   to 1
619  * @num_hrd_parameters: number of hrd_parameters present
620  * @hrd_layer_set_idx: index to the list of layer hrd params.
621  * @hrd_params: the GstH265HRDParams list
622  *
623  * Defines the VPS parameters
624  */
625 struct _GstH265VPS {
626   guint8 id;
627
628   guint8 base_layer_internal_flag;
629   guint8 base_layer_available_flag;
630
631   guint8 max_layers_minus1;
632   guint8 max_sub_layers_minus1;
633   guint8 temporal_id_nesting_flag;
634
635   GstH265ProfileTierLevel profile_tier_level;
636
637   guint8 sub_layer_ordering_info_present_flag;
638   guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
639   guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
640   guint32 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
641
642   guint8 max_layer_id;
643   guint16 num_layer_sets_minus1;
644
645   guint8 timing_info_present_flag;
646   guint32 num_units_in_tick;
647   guint32 time_scale;
648   guint8 poc_proportional_to_timing_flag;
649   guint32 num_ticks_poc_diff_one_minus1;
650
651   guint16 num_hrd_parameters;
652
653   /* FIXME: following HRD related info should be an array */
654   guint16 hrd_layer_set_idx;
655   guint8 cprms_present_flag;
656   GstH265HRDParams hrd_params;
657
658   guint8 vps_extension;
659
660   gboolean valid;
661 };
662 /**
663  * GstH265ShortTermRefPicSet:
664  * @inter_ref_pic_set_prediction_flag: %TRUE specifies that the stRpsIdx-th candidate
665  *  short-term RPS is predicted from another candidate short-term RPS
666  * @delta_idx_minus1: plus 1 specifies the difference between the value of source and
667  *  candidate short term RPS.
668  * @delta_rps_sign: delta_rps_sign and abs_delta_rps_minus1 together specify
669  *  the value of the variable deltaRps.
670  * @abs_delta_rps_minus1: delta_rps_sign and abs_delta_rps_minus1 together specify
671  *  the value of the variable deltaRps
672  *
673  * Defines the #GstH265ShortTermRefPicSet params
674  */
675 struct _GstH265ShortTermRefPicSet
676 {
677   guint8 inter_ref_pic_set_prediction_flag;
678   guint8 delta_idx_minus1;
679   guint8 delta_rps_sign;
680   guint16 abs_delta_rps_minus1;
681
682   /* calculated values */
683   guint8 NumDeltaPocs;
684   guint8 NumNegativePics;
685   guint8 NumPositivePics;
686   guint8 UsedByCurrPicS0[16];
687   guint8 UsedByCurrPicS1[16];
688   gint32 DeltaPocS0[16];
689   gint32 DeltaPocS1[16];
690 };
691
692 /**
693  * GstH265VUIParams:
694  * @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present.
695  *  %FALSE specifies that aspect_ratio_idc is not present
696  * @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples
697  * @sar_width indicates the horizontal size of the sample aspect ratio
698  * @sar_height indicates the vertical size of the sample aspect ratio
699  * @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwise
700  * @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures
701  *  output are suitable for display using overscan. %FALSE the cropped decoded pictures
702  *  output contain visually important information
703  * @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and
704  *  colour_description_present_flag are present.
705  * @video_format: indicates the representation of the picture
706  * @video_full_range_flag: indicates the black level and range of the luma and chroma signals
707  * @colour_description_present_flag: %TRUE specifies that colour_primaries,
708  *  transfer_characteristics and matrix_coefficients are present
709  * @colour_primaries: indicates the chromaticity coordinates of the source primaries
710  * @transfer_characteristics: indicates the opto-electronic transfer characteristic
711  * @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals
712  * @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and
713  *  chroma_sample_loc_type_bottom_field are present, %FALSE otherwise
714  * @chroma_sample_loc_type_top_field: specify the location of chroma for top field
715  * @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field
716  * @neutral_chroma_indication_flag: %TRUE indicate that the value of chroma samples is equla
717  *  to 1<<(BitDepthchrom-1).
718  * @field_seq_flag: %TRUE indicate field and %FALSE indicate frame
719  * @frame_field_info_present_flag: %TRUE indicate picture timing SEI messages are present for every
720  *   picture and include the pic_struct, source_scan_type, and duplicate_flag syntax elements.
721  * @default_display_window_flag: %TRUE indicate that the default display window parameters present
722  * def_disp_win_left_offset:left offset of display rect
723  * def_disp_win_right_offset: right offset of display rect
724  * def_disp_win_top_offset: top offset of display rect
725  * def_disp_win_bottom_offset: bottom offset of display rect
726  * @timing_info_present_flag: %TRUE specifies that num_units_in_tick,
727  *  time_scale and fixed_frame_rate_flag are present in the bitstream
728  * @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz
729  * @time_scale: is the number of time units that pass in one second
730  * @poc_proportional_to_timing_flag: %TRUE indicates that the picture order count value for each picture
731  *  in the CVS that is not the first picture in the CVS, in decoding order, is proportional to the output
732  *  time of the picture relative to the output time of the first picture in the CVS.
733  * @num_ticks_poc_diff_one_minus1: plus 1 specifies the number of clock ticks corresponding to a
734  *  difference of picture order count values equal to 1
735  * @hrd_parameters_present_flag: %TRUE if hrd parameters present in the bitstream
736  * @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction
737  * parameters are present
738  * @tiles_fixed_structure_flag: %TRUE indicates that each PPS that is active in the CVS has the same value
739  *   of the syntax elements num_tile_columns_minus1, num_tile_rows_minus1, uniform_spacing_flag,
740  *   column_width_minus1, row_height_minus1 and loop_filter_across_tiles_enabled_flag, when present
741  * @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the
742  *  picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more
743  *  samples outside picture boundaries may be used in inter prediction
744  * @restricted_ref_pic_list_flag: %TRUE indicates that all P and B slices (when present) that belong to
745  *  the same picture have an identical reference picture list 0, and that all B slices (when present)
746  *   that belong to the same picture have an identical reference picture list 1
747  * @min_spatial_segmentation_idc: when not equal to 0, establishes a bound on the maximum possible size
748  *  of distinct coded spatial segmentation regions in the pictures of the CVS
749  * @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of
750  *  the VCL NAL units associated with any coded picture in the coded video sequence.
751  * @max_bits_per_min_cu_denom: indicates an upper bound for the number of coded bits of coding_unit
752  *  data for any coding block in any picture of the CVS
753  * @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal
754  * motion vector component
755  * @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical
756  *  motion vector component
757  *
758  * The structure representing the VUI parameters.
759  */
760 struct _GstH265VUIParams
761 {
762   guint8 aspect_ratio_info_present_flag;
763   guint8 aspect_ratio_idc;
764   /* if aspect_ratio_idc == 255 */
765   guint16 sar_width;
766   guint16 sar_height;
767
768   guint8 overscan_info_present_flag;
769   /* if overscan_info_present_flag */
770   guint8 overscan_appropriate_flag;
771
772   guint8 video_signal_type_present_flag;
773   guint8 video_format;
774   guint8 video_full_range_flag;
775   guint8 colour_description_present_flag;
776   guint8 colour_primaries;
777   guint8 transfer_characteristics;
778   guint8 matrix_coefficients;
779
780   guint8 chroma_loc_info_present_flag;
781   guint8 chroma_sample_loc_type_top_field;
782   guint8 chroma_sample_loc_type_bottom_field;
783
784   guint8 neutral_chroma_indication_flag;
785   guint8 field_seq_flag;
786   guint8 frame_field_info_present_flag;
787   guint8 default_display_window_flag;
788   guint32 def_disp_win_left_offset;
789   guint32 def_disp_win_right_offset;
790   guint32 def_disp_win_top_offset;
791   guint32 def_disp_win_bottom_offset;
792
793   guint8 timing_info_present_flag;
794   /* if timing_info_present_flag */
795   guint32 num_units_in_tick;
796   guint32 time_scale;
797   guint8 poc_proportional_to_timing_flag;
798   /* if poc_proportional_to_timing_flag */
799   guint32 num_ticks_poc_diff_one_minus1;
800   guint8 hrd_parameters_present_flag;
801   /*if hrd_parameters_present_flat */
802   GstH265HRDParams hrd_params;
803
804   guint8 bitstream_restriction_flag;
805   /*  if bitstream_restriction_flag */
806   guint8 tiles_fixed_structure_flag;
807   guint8 motion_vectors_over_pic_boundaries_flag;
808   guint8 restricted_ref_pic_lists_flag;
809   guint16 min_spatial_segmentation_idc;
810   guint8 max_bytes_per_pic_denom;
811   guint8 max_bits_per_min_cu_denom;
812   guint8 log2_max_mv_length_horizontal;
813   guint8 log2_max_mv_length_vertical;
814
815   /* calculated values */
816   guint par_n;
817   guint par_d;
818 };
819
820 /**
821  * GstH265SPSExtensionParams:
822  * @transform_skip_rotation_enabled_flag: %TRUE specifies that a rotation is applied to
823  *   the residual data block from intra 4X4 blocks coded using a transform skip operation.
824  * @transform_skip_context_enabled_flag: %TRUE specifies tspecifies that a particular
825  *   context is used for the parsing of the sig_coeff_flag for transform blocks with a skipped
826  *   transform.
827  * @implicit_residual_dpcm_enabled_flag: %TRUE specifies that  the residual modification process
828  *   for blocks using a transform bypass may be used for intra blocks in the CVS
829  * @explicit_residual_dpcm_enabled_flag: %TRUE specifies that the residual modification process
830  *   for blocks using a transform bypass may be used for inter blocks in the CVS
831  * @extended_precision_processing_flag: %TRUE specifies that an extended dynamic range is used
832  *   for coefficient parsing and inverse transform processing
833  * @intra_smoothing_disabled_flag: %TRUE specifies that  the filtering process of neighbouring
834  *   samples is unconditionally disabled for intra prediction
835  * @high_precision_offsets_enabled_flag: %TRUE specifies that weighted prediction offset values
836  *   are signalled using a bit-depth-dependent precision.
837  * @persistent_rice_adaptation_enabled_flag: %TRUE specifies that the Rice parameter derivation
838  *   for the binarization of coeff_abs_level_remaining[] is initialized at the start of each
839  *   sub-block using mode dependent statistics accumulated from previous sub-blocks.
840  * @cabac_bypass_alignment_enabled_flag: %TRUE specifies that a context-based adaptive binary
841  *   arithmetic coding (CABAC) alignment process is used prior to bypass decoding of the syntax
842  *   elements coeff_sign_flag[] and coeff_abs_level_remaining[]
843  *
844  * Defines the GstH265SPSExtensionParams
845  */
846 struct _GstH265SPSExtensionParams {
847   guint8 transform_skip_rotation_enabled_flag;
848   guint8 transform_skip_context_enabled_flag;
849   guint8 implicit_rdpcm_enabled_flag;
850   guint8 explicit_rdpcm_enabled_flag;
851   guint8 extended_precision_processing_flag;
852   guint8 intra_smoothing_disabled_flag;
853   guint8 high_precision_offsets_enabled_flag;
854   guint8 persistent_rice_adaptation_enabled_flag;
855   guint8 cabac_bypass_alignment_enabled_flag;
856 };
857
858 /**
859  * GstH265PPSExtensionParams:
860  * @log2_max_transform_skip_block_size_minus2: plus 2 specifies the maximum transform block size for which
861  *   transform_skip_flag may be present in coded pictures referring to the PPS.
862  * @cross_component_prediction_enabled_flag: equal to 1 specifies that log2_res_scale_abs_plus1 and
863  *   res_scale_sign_flag may be present in the transform unit syntax for pictures referring to the PPS.
864  * @chroma_qp_offset_list_enabled_flag: equal to 1 specifies that the cu_chroma_qp_offset_flag may be
865  *   present in the transform unit syntax.
866  * @diff_cu_chroma_qp_offset_depth: specifies the difference between the luma coding tree block size and
867  *   the minimum luma coding block size of coding units that convey cu_chroma_qp_offset_flag.
868  * @chroma_qp_offset_list_len_minus1: plus 1 specifies the number of cb_qp_offset_list[] and
869  *   cr_qp_offset_list[] syntax elements that are present in the PPS.
870  * @cb_qp_offset_list: specify offsets used in the derivation of qp cb.
871  * @cr_qp_offset_list: specify offsets used in the derivation of qp cr.
872  * @log2_sao_offset_scale_luma: the base 2 logarithm of the scaling parameter that is used to scale sample
873  *   adaptive offset (SAO) offset values for luma samples.
874  * @log2_sao_offset_scale_chroma: the base 2 logarithm of the scaling parameter that is used to scale SAO
875  *   offset values for chroma samples.
876  *
877  * Defines the GstH265SPSExtensionParams
878  */
879 struct _GstH265PPSExtensionParams {
880   guint32 log2_max_transform_skip_block_size_minus2;
881   guint8 cross_component_prediction_enabled_flag;
882   guint8 chroma_qp_offset_list_enabled_flag;
883   guint8 diff_cu_chroma_qp_offset_depth;
884   guint8 chroma_qp_offset_list_len_minus1;
885   gint8 cb_qp_offset_list[6];
886   gint8 cr_qp_offset_list[6];
887   guint8 log2_sao_offset_scale_luma;
888   guint8 log2_sao_offset_scale_chroma;
889 };
890
891 /**
892  * GstH265ScalingList:
893  * @scaling_list_dc_coef_minus8_16x16: this plus 8 specifies the DC
894  *   Coefficient values for 16x16 scaling list
895  * @scaling_list_dc_coef_minus8_32x32: this plus 8 specifies the DC
896  *   Coefficient values for 32x32 scaling list
897  * @scaling_lists_4x4: 4x4 scaling list
898  * @scaling_lists_8x8: 8x8 scaling list
899  * @scaling_lists_16x16: 16x16 scaling list
900  * @guint8 scaling_lists_32x32: 32x32 scaling list
901  *
902  * Defines the GstH265ScalingList
903  */
904 struct _GstH265ScalingList {
905
906   gint16 scaling_list_dc_coef_minus8_16x16[6];
907   gint16 scaling_list_dc_coef_minus8_32x32[2];
908
909   guint8 scaling_lists_4x4 [6][16];
910   guint8 scaling_lists_8x8 [6][64];
911   guint8 scaling_lists_16x16 [6][64];
912   guint8 scaling_lists_32x32 [2][64];
913 };
914
915 /**
916  * GstH265SPS:
917  * @id: The ID of the sequence parameter set
918  * @profile_idc: indicate the profile to which the coded video sequence conforms
919  *
920  * H265 Sequence Parameter Set (SPS)
921  */
922 struct _GstH265SPS
923 {
924   guint8 id;
925
926   GstH265VPS *vps;
927
928   guint8 max_sub_layers_minus1;
929   guint8 temporal_id_nesting_flag;
930
931   GstH265ProfileTierLevel profile_tier_level;
932
933   guint8 chroma_format_idc;
934   guint8 separate_colour_plane_flag;
935   guint16 pic_width_in_luma_samples;
936   guint16 pic_height_in_luma_samples;
937
938   guint8 conformance_window_flag;
939   /* if conformance_window_flag */
940   guint32 conf_win_left_offset;
941   guint32 conf_win_right_offset;
942   guint32 conf_win_top_offset;
943   guint32 conf_win_bottom_offset;
944
945   guint8 bit_depth_luma_minus8;
946   guint8 bit_depth_chroma_minus8;
947   guint8 log2_max_pic_order_cnt_lsb_minus4;
948
949   guint8 sub_layer_ordering_info_present_flag;
950   guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
951   guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
952   guint8 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
953
954   guint8 log2_min_luma_coding_block_size_minus3;
955   guint8 log2_diff_max_min_luma_coding_block_size;
956   guint8 log2_min_transform_block_size_minus2;
957   guint8 log2_diff_max_min_transform_block_size;
958   guint8 max_transform_hierarchy_depth_inter;
959   guint8 max_transform_hierarchy_depth_intra;
960
961   guint8 scaling_list_enabled_flag;
962   /* if scaling_list_enabled_flag */
963   guint8 scaling_list_data_present_flag;
964
965   GstH265ScalingList scaling_list;
966
967   guint8 amp_enabled_flag;
968   guint8 sample_adaptive_offset_enabled_flag;
969   guint8 pcm_enabled_flag;
970   /* if pcm_enabled_flag */
971   guint8 pcm_sample_bit_depth_luma_minus1;
972   guint8 pcm_sample_bit_depth_chroma_minus1;
973   guint8 log2_min_pcm_luma_coding_block_size_minus3;
974   guint8 log2_diff_max_min_pcm_luma_coding_block_size;
975   guint8 pcm_loop_filter_disabled_flag;
976
977   guint8 num_short_term_ref_pic_sets;
978   GstH265ShortTermRefPicSet short_term_ref_pic_set[65];
979
980   guint8 long_term_ref_pics_present_flag;
981   /* if long_term_ref_pics_present_flag */
982   guint8 num_long_term_ref_pics_sps;
983   guint16 lt_ref_pic_poc_lsb_sps[32];
984   guint8 used_by_curr_pic_lt_sps_flag[32];
985
986   guint8 temporal_mvp_enabled_flag;
987   guint8 strong_intra_smoothing_enabled_flag;
988   guint8 vui_parameters_present_flag;
989
990   /* if vui_parameters_present_flat */
991   GstH265VUIParams vui_params;
992
993   guint8 sps_extension_flag;
994
995   /* if sps_extension_present_flag */
996   guint8 sps_range_extension_flag;
997   guint8 sps_multilayer_extension_flag;
998   guint8 sps_3d_extension_flag;
999   guint8 sps_extension_5bits;
1000
1001 /* if sps_range_extension_flag */
1002   GstH265SPSExtensionParams sps_extnsion_params;
1003
1004   /* calculated values */
1005   guint8 chroma_array_type;
1006   gint width, height;
1007   gint crop_rect_width, crop_rect_height;
1008   gint crop_rect_x, crop_rect_y;
1009   gint fps_num, fps_den;
1010   gboolean valid;
1011 };
1012
1013 /**
1014  * GstH265PPS:
1015  *
1016  * H265 Picture Parameter Set
1017  */
1018 struct _GstH265PPS
1019 {
1020   guint id;
1021
1022   GstH265SPS *sps;
1023
1024   guint8 dependent_slice_segments_enabled_flag;
1025   guint8 output_flag_present_flag;
1026   guint8 num_extra_slice_header_bits;
1027   guint8 sign_data_hiding_enabled_flag;
1028   guint8 cabac_init_present_flag;
1029   guint8 num_ref_idx_l0_default_active_minus1;
1030   guint8 num_ref_idx_l1_default_active_minus1;
1031   gint8 init_qp_minus26;
1032   guint8 constrained_intra_pred_flag;
1033   guint8 transform_skip_enabled_flag;
1034   guint8 cu_qp_delta_enabled_flag;
1035   /*if cu_qp_delta_enabled_flag */
1036   guint8 diff_cu_qp_delta_depth;
1037
1038   gint8 cb_qp_offset;
1039   gint8 cr_qp_offset;
1040   guint8 slice_chroma_qp_offsets_present_flag;
1041   guint8 weighted_pred_flag;
1042   guint8 weighted_bipred_flag;
1043   guint8 transquant_bypass_enabled_flag;
1044   guint8 tiles_enabled_flag;
1045   guint8 entropy_coding_sync_enabled_flag;
1046
1047   guint8 num_tile_columns_minus1;
1048   guint8 num_tile_rows_minus1;
1049   guint8 uniform_spacing_flag;
1050   guint32 column_width_minus1[19];
1051   guint32 row_height_minus1[21];
1052   guint8 loop_filter_across_tiles_enabled_flag;
1053
1054   guint8 loop_filter_across_slices_enabled_flag;
1055   guint8 deblocking_filter_control_present_flag;
1056   guint8 deblocking_filter_override_enabled_flag;
1057   guint8 deblocking_filter_disabled_flag;
1058   gint8 beta_offset_div2;
1059   gint8 tc_offset_div2;
1060
1061   guint8 scaling_list_data_present_flag;
1062
1063   GstH265ScalingList scaling_list;
1064
1065   guint8 lists_modification_present_flag;
1066   guint8 log2_parallel_merge_level_minus2;
1067   guint8 slice_segment_header_extension_present_flag;
1068
1069   guint8 pps_extension_flag;
1070
1071   /* if pps_extension_flag*/
1072   guint8 pps_range_extension_flag;
1073   guint8 pps_multilayer_extension_flag;
1074   guint8 pps_3d_extension_flag;
1075   guint8 pps_extension_5bits;
1076
1077   /* if pps_range_extension_flag*/
1078    GstH265PPSExtensionParams pps_extension_params;
1079
1080   /* calculated values */
1081   guint32 PicWidthInCtbsY;
1082   guint32 PicHeightInCtbsY;
1083   gboolean valid;
1084 };
1085
1086 struct _GstH265RefPicListModification
1087 {
1088   guint8 ref_pic_list_modification_flag_l0;
1089   guint32 list_entry_l0[15];
1090   guint8 ref_pic_list_modification_flag_l1;
1091   guint32 list_entry_l1[15];
1092 };
1093
1094 struct _GstH265PredWeightTable
1095 {
1096   guint8 luma_log2_weight_denom;
1097   gint8 delta_chroma_log2_weight_denom;
1098
1099   guint8 luma_weight_l0_flag[15];
1100   guint8  chroma_weight_l0_flag[15];
1101   gint8 delta_luma_weight_l0[15];
1102   gint8 luma_offset_l0[15];
1103   gint8 delta_chroma_weight_l0 [15][2];
1104   gint16 delta_chroma_offset_l0 [15][2];
1105
1106   guint8 luma_weight_l1_flag[15];
1107   guint8 chroma_weight_l1_flag[15];
1108   gint8 delta_luma_weight_l1[15];
1109   gint8 luma_offset_l1[15];
1110   gint8 delta_chroma_weight_l1[15][2];
1111   gint16 delta_chroma_offset_l1[15][2];
1112 };
1113
1114 /**
1115  * GstH265SliceHdr:
1116  * @first_slice_segment_in_pic_flag: equal to 1 if this slice segment is
1117  *   the first slice segment of the picture in decoding order
1118  * @no_output_of_prior_pics_flag: affects the output of previously-decoded pictures
1119  *   in the decoded picture buffer after the decoding of an IDR or a BLA picture
1120  *   that is not the first picture in the bitstream as specified in Annex C
1121  * @pps: a #GstH265PPS
1122  * @dependent_slice_segment_flag: equal to 1 if the value of each slice segment header
1123  *   syntax element that is not present is inferred to be equal to the value of corresponding
1124  *   slice segment header syntax element in the slice header.
1125  * @segment_address: the address of the first CTB in the slice segment
1126  * @type: slice type (B, P, or I)
1127  * @pic_output_flag: affects the decoded picture output and removal processes
1128  *   as specified in Annex C.
1129  * @colour_plane_id: specifies the colour plane associated with the current slice RBSP
1130  *   when separate_colour_plane_flag is equal to 1
1131  * @pic_order_cnt_lsb: the picture order count modulo MaxPicOrderCntLsb for the current picture
1132  * @short_term_ref_pic_set_sps_flag: equal to 1 specifies that the short-term RPS
1133  *   of the current picture is derived based on the active SPS.
1134  * @short_term_ref_pic_sets: a #GstH265ShortTermRefPicSet structure
1135  * @short_term_ref_pic_set_idx: the index of st_ref_pic_set syntax structure
1136  *   that is used for derivation of the short-term RPS of the current picture.
1137  * @num_long_term_sps: the number of entries in the long-term RPS of current picture
1138  *   that are derived based on the syntax in active SPS.
1139  * @num_long_term_pics: the number of entries in the long-term RPS of the current picture
1140  *   that are directly signalled in the slice header.
1141  * @lt_idx_sps: the index of candidate long-term reference pictures
1142  *   specified in the active SPS.
1143  * @poc_lsb_lt: the value of the picture order count modulo MaxPicOrderCntLsb
1144  *   of the each entry in the long-term RPS of the current picture.
1145  * @used_by_curr_pic_lt_flag: equal to 0 if the entry in the long-term RPS
1146  *   of the current picture is not used for reference by the current picture.
1147  * @delta_poc_msb_present_flag: equal to 1 if i-th delta_poc_msb_cycle_lt[] is present.
1148  * @delta_poc_msb_cycle_lt: used to determine the value of the most significant bits
1149  *   of the picture order count value of the i-th entry in the long-term RPS of the current picture.
1150  * @temporal_mvp_enabled_flag: whether temporal motion vector predictors can be used for inter prediction.
1151  * @sao_luma_flag: equal to 1 if SAO is enabled for the luma component in the current slice.
1152  * @sao_chroma_flag: equal to 1 if SAO is enabled for the chroma component in the current slice.
1153  * @num_ref_idx_active_override_flag: equal to 1 specifies that the syntax elements
1154  *   num_ref_idx_l0_active_minus1 and num_ref_idx_l1_active_minus1 are present.
1155  * @num_ref_idx_l0_active_minus1: the maximum reference index for reference picture list 0
1156  *   that may be used to decode the slice.
1157  * @num_ref_idx_l1_active_minus1: the maximum reference index for reference picture list 1
1158  *   that may be used to decode the slice.
1159  * @ref_pic_list_modification: a #GstH265RefPicListModification
1160  * @mvd_l1_zero_flag: equal to 1 if the mvd_coding sytanx structure is not parsed
1161  * @cabac_init_flag: specifies the method for determining the initialization table
1162  *   used in the initialization process for context variables.
1163  * @collocated_from_l0_flag: equal to 1 specifies that the collocated picture
1164  *   used for temporal motion vector prediction is derived from reference picture list 0.
1165  * @collocated_ref_idx: the reference index of the collocated picture
1166  *   used for temporal motion vector prediction.
1167  * @pred_weight_table: a #GstH265PredWeightTable
1168  * @five_minus_max_num_merge_cand: specifies the maximum number of merging motion vector prediction (MVP)
1169  *   candidates supported in the slice.
1170  * @qp_delta: specifies the inital value of QPy to be used for the coding blocks in the slice.
1171  * @cb_qp_offset: a difference to be added to the value of pps_cb_qp_offset.
1172  * @cr_qp_offset: a difference to be added to the value of pps_cr_qp_offset.
1173  * @cu_chroma_qp_offset_enabled_flag: equal to 1 if the cu_chroma_qp_offset_flag
1174  *   may be present in the transform unit syntax. (Since: 1.18)
1175  * @deblocking_filter_override_flag: equal to 1 if deblocking paramertes are present in the slice header.
1176  * @deblocking_filter_disabled_flag: equal to 1 specifies that the operation of
1177  *   the deblocking filter is not applied for the current slice.
1178  * @beta_offset_div2: deblocking parameter offset for beta divided by 2 for the current slice.
1179  * @tc_offset_div2: deblocking parameter offset for tC divided by 2 for the current slice.
1180  * @loop_filter_across_slices_enabled_flag: equal to 1 specifies that in-loop filtering
1181  *   operation may be performed across the left and upper boundaries of the current slice.
1182  * @num_entry_point_offsets: specifies the number of entry_point_offset_minus1 syntax elements
1183  *   in the slice header.
1184  * @offset_len_minus1: specifies the length of the entry_point_minus1 syntax elements
1185  *   in bits.
1186  * @entry_point_offset_minus1: the entry point offset in bytes.
1187  * @NumPocTotalCurr: calculated NumPocTotalCurr which is used for
1188  *   decoding process for reference picture set
1189  * @header_size: the calculated size of the slice_header() in bits.
1190  * @n_emulation_prevention_bytes: number of emulation prevention bytes (EPB)
1191  *   in this slice_header()
1192  * @short_term_ref_pic_set_size: the calculated size of short_term_ref_pic_set()
1193  *   in bits. (Since: 1.18)
1194  */
1195 struct _GstH265SliceHdr
1196 {
1197   guint8 first_slice_segment_in_pic_flag;
1198   guint8 no_output_of_prior_pics_flag;
1199
1200   GstH265PPS *pps;
1201
1202   guint8 dependent_slice_segment_flag;
1203   guint32 segment_address;
1204
1205   guint8 type;
1206
1207   guint8 pic_output_flag;
1208   guint8 colour_plane_id;
1209   guint16 pic_order_cnt_lsb;
1210
1211   guint8  short_term_ref_pic_set_sps_flag;
1212   GstH265ShortTermRefPicSet short_term_ref_pic_sets;
1213   guint8 short_term_ref_pic_set_idx;
1214
1215   guint8 num_long_term_sps;
1216   guint8 num_long_term_pics;
1217   guint8 lt_idx_sps[16];
1218   guint32 poc_lsb_lt[16];
1219   guint8 used_by_curr_pic_lt_flag[16];
1220   guint8 delta_poc_msb_present_flag[16];
1221   guint32 delta_poc_msb_cycle_lt[16];
1222
1223   guint8 temporal_mvp_enabled_flag;
1224   guint8 sao_luma_flag;
1225   guint8 sao_chroma_flag;
1226   guint8 num_ref_idx_active_override_flag;
1227   guint8 num_ref_idx_l0_active_minus1;
1228   guint8 num_ref_idx_l1_active_minus1;
1229
1230   GstH265RefPicListModification ref_pic_list_modification;
1231
1232   guint8 mvd_l1_zero_flag;
1233   guint8 cabac_init_flag;
1234   guint8 collocated_from_l0_flag;
1235   guint8 collocated_ref_idx;
1236
1237   GstH265PredWeightTable pred_weight_table;
1238
1239   guint8 five_minus_max_num_merge_cand;
1240
1241   gint8 qp_delta;
1242   gint8 cb_qp_offset;
1243   gint8 cr_qp_offset;
1244
1245   guint8 cu_chroma_qp_offset_enabled_flag;
1246
1247   guint8 deblocking_filter_override_flag;
1248   guint8 deblocking_filter_disabled_flag;
1249   gint8 beta_offset_div2;
1250   gint8 tc_offset_div2;
1251
1252   guint8 loop_filter_across_slices_enabled_flag;
1253
1254   guint32 num_entry_point_offsets;
1255   guint8 offset_len_minus1;
1256   guint32 *entry_point_offset_minus1;
1257
1258   /* calculated values */
1259
1260   gint NumPocTotalCurr;
1261   /* Size of the slice_header() in bits */
1262   guint header_size;
1263   /* Number of emulation prevention bytes (EPB) in this slice_header() */
1264   guint n_emulation_prevention_bytes;
1265
1266   /* Size of short_term_ref_pic_set() in bits */
1267   guint short_term_ref_pic_set_size;
1268 };
1269
1270 struct _GstH265PicTiming
1271 {
1272   guint8 pic_struct;
1273   guint8 source_scan_type;
1274   guint8 duplicate_flag;
1275
1276   guint8 au_cpb_removal_delay_minus1;
1277   guint8 pic_dpb_output_delay;
1278   guint8 pic_dpb_output_du_delay;
1279   guint32 num_decoding_units_minus1;
1280   guint8 du_common_cpb_removal_delay_flag;
1281   guint8 du_common_cpb_removal_delay_increment_minus1;
1282   guint32 *num_nalus_in_du_minus1;
1283   guint8 *du_cpb_removal_delay_increment_minus1;
1284 };
1285
1286 struct _GstH265BufferingPeriod
1287 {
1288   GstH265SPS *sps;
1289
1290   guint8 irap_cpb_params_present_flag;
1291   guint8 cpb_delay_offset;
1292   guint8 dpb_delay_offset;
1293   guint8 concatenation_flag;
1294   guint8 au_cpb_removal_delay_delta_minus1;
1295
1296   /* seq->vui_parameters->nal_hrd_parameters_present_flag */
1297   guint8 nal_initial_cpb_removal_delay[32];
1298   guint8 nal_initial_cpb_removal_offset[32];
1299   guint8 nal_initial_alt_cpb_removal_delay[32];
1300   guint8 nal_initial_alt_cpb_removal_offset [32];
1301
1302   /* seq->vui_parameters->vcl_hrd_parameters_present_flag */
1303   guint8 vcl_initial_cpb_removal_delay[32];
1304   guint8 vcl_initial_cpb_removal_offset[32];
1305   guint8 vcl_initial_alt_cpb_removal_delay[32];
1306   guint8 vcl_initial_alt_cpb_removal_offset[32];
1307 };
1308
1309 struct _GstH265RecoveryPoint
1310 {
1311   gint32 recovery_poc_cnt;
1312   guint8 exact_match_flag;
1313   guint8 broken_link_flag;
1314 };
1315
1316 struct _GstH265RegisteredUserData
1317 {
1318   guint8 country_code;
1319   guint8 country_code_extension;
1320   const guint8 *data;
1321   guint size;
1322 };
1323
1324
1325 /**
1326  * GstH265TimeCode:
1327  * The time code SEI message provides time code information similar to that
1328  * defined by SMPTE ST 12-1 (2014) for field(s) or frame(s) of the current
1329  * picture.
1330  *
1331  * D.2.27
1332  *
1333  * Since: 1.16
1334  */
1335 struct _GstH265TimeCode
1336 {
1337   guint8 num_clock_ts;
1338   guint8 clock_timestamp_flag[3];
1339   guint8 units_field_based_flag[3];
1340   guint8 counting_type[3];
1341   guint8 full_timestamp_flag[3];
1342   guint8 discontinuity_flag[3];
1343   guint8 cnt_dropped_flag[3];
1344   guint16 n_frames[3];
1345   guint8 seconds_flag[3];
1346   guint8 seconds_value[3];
1347   guint8 minutes_flag[3];
1348   guint8 minutes_value[3];
1349   guint8 hours_flag[3];
1350   guint8 hours_value[3];
1351   guint8 time_offset_length[3];
1352   guint32 time_offset_value[3];
1353 };
1354
1355 /**
1356  * GstH265MasteringDisplayColourVolume:
1357  * The colour volume (primaries, white point and luminance range) of display
1358  * defined by SMPTE ST 2086.
1359  *
1360  * D.2.28
1361  *
1362  * Since: 1.18
1363  */
1364 struct _GstH265MasteringDisplayColourVolume
1365 {
1366   guint16 display_primaries_x[3];
1367   guint16 display_primaries_y[3];
1368   guint16 white_point_x;
1369   guint16 white_point_y;
1370   guint32 max_display_mastering_luminance;
1371   guint32 min_display_mastering_luminance;
1372 };
1373
1374 /**
1375  * GstH265ContentLightLevel:
1376  * The upper bounds for the nominal target brightness light level
1377  * as specified in CEA-861.3
1378  *
1379  * D.2.35
1380  *
1381  * Since: 1.18
1382  */
1383 struct _GstH265ContentLightLevel
1384 {
1385   guint16 max_content_light_level;
1386   guint16 max_pic_average_light_level;
1387 };
1388
1389 struct _GstH265SEIMessage
1390 {
1391   GstH265SEIPayloadType payloadType;
1392
1393   union {
1394     GstH265BufferingPeriod buffering_period;
1395     GstH265PicTiming pic_timing;
1396     GstH265RegisteredUserData registered_user_data;
1397     GstH265RecoveryPoint recovery_point;
1398     GstH265TimeCode time_code;
1399     GstH265MasteringDisplayColourVolume mastering_display_colour_volume;
1400     GstH265ContentLightLevel content_light_level;
1401     /* ... could implement more */
1402   } payload;
1403 };
1404
1405 /**
1406  * GstH265Parser:
1407  *
1408  * H265 NAL Parser (opaque structure).
1409  */
1410 struct _GstH265Parser
1411 {
1412   /*< private >*/
1413   GstH265VPS vps[GST_H265_MAX_VPS_COUNT];
1414   GstH265SPS sps[GST_H265_MAX_SPS_COUNT];
1415   GstH265PPS pps[GST_H265_MAX_PPS_COUNT];
1416   GstH265VPS *last_vps;
1417   GstH265SPS *last_sps;
1418   GstH265PPS *last_pps;
1419 };
1420
1421 GST_CODEC_PARSERS_API
1422 GstH265Parser *     gst_h265_parser_new               (void);
1423
1424 GST_CODEC_PARSERS_API
1425 GstH265ParserResult gst_h265_parser_identify_nalu      (GstH265Parser  * parser,
1426                                                         const guint8   * data,
1427                                                         guint            offset,
1428                                                         gsize            size,
1429                                                         GstH265NalUnit * nalu);
1430
1431 GST_CODEC_PARSERS_API
1432 GstH265ParserResult gst_h265_parser_identify_nalu_unchecked (GstH265Parser * parser,
1433                                                         const guint8   * data,
1434                                                         guint            offset,
1435                                                         gsize            size,
1436                                                         GstH265NalUnit * nalu);
1437
1438 GST_CODEC_PARSERS_API
1439 GstH265ParserResult gst_h265_parser_identify_nalu_hevc (GstH265Parser  * parser,
1440                                                         const guint8   * data,
1441                                                         guint            offset,
1442                                                         gsize            size,
1443                                                         guint8           nal_length_size,
1444                                                         GstH265NalUnit * nalu);
1445
1446 GST_CODEC_PARSERS_API
1447 GstH265ParserResult gst_h265_parser_parse_nal       (GstH265Parser   * parser,
1448                                                      GstH265NalUnit  * nalu);
1449
1450 GST_CODEC_PARSERS_API
1451 GstH265ParserResult gst_h265_parser_parse_slice_hdr (GstH265Parser   * parser,
1452                                                      GstH265NalUnit  * nalu,
1453                                                      GstH265SliceHdr * slice);
1454
1455 GST_CODEC_PARSERS_API
1456 GstH265ParserResult gst_h265_parser_parse_vps       (GstH265Parser   * parser,
1457                                                      GstH265NalUnit  * nalu,
1458                                                      GstH265VPS      * vps);
1459
1460 GST_CODEC_PARSERS_API
1461 GstH265ParserResult gst_h265_parser_parse_sps       (GstH265Parser   * parser,
1462                                                      GstH265NalUnit  * nalu,
1463                                                      GstH265SPS      * sps,
1464                                                      gboolean          parse_vui_params);
1465
1466 GST_CODEC_PARSERS_API
1467 GstH265ParserResult gst_h265_parser_parse_pps       (GstH265Parser   * parser,
1468                                                      GstH265NalUnit  * nalu,
1469                                                      GstH265PPS      * pps);
1470
1471 GST_CODEC_PARSERS_API
1472 GstH265ParserResult gst_h265_parser_parse_sei       (GstH265Parser   * parser,
1473                                                      GstH265NalUnit  * nalu,
1474                                                      GArray **messages);
1475
1476 GST_CODEC_PARSERS_API
1477 void                gst_h265_parser_free            (GstH265Parser  * parser);
1478
1479 GST_CODEC_PARSERS_API
1480 GstH265ParserResult gst_h265_parse_vps              (GstH265NalUnit * nalu,
1481                                                      GstH265VPS     * vps);
1482
1483 GST_CODEC_PARSERS_API
1484 GstH265ParserResult gst_h265_parse_sps              (GstH265Parser  * parser,
1485                                                      GstH265NalUnit * nalu,
1486                                                      GstH265SPS     * sps,
1487                                                      gboolean         parse_vui_params);
1488
1489 GST_CODEC_PARSERS_API
1490 GstH265ParserResult gst_h265_parse_pps              (GstH265Parser  * parser,
1491                                                      GstH265NalUnit * nalu,
1492                                                      GstH265PPS     * pps);
1493
1494 GST_CODEC_PARSERS_API
1495 gboolean            gst_h265_slice_hdr_copy (GstH265SliceHdr       * dst_slice,
1496                                              const GstH265SliceHdr * src_slice);
1497
1498 GST_CODEC_PARSERS_API
1499 void                gst_h265_slice_hdr_free (GstH265SliceHdr * slice_hdr);
1500
1501 GST_CODEC_PARSERS_API
1502 gboolean            gst_h265_sei_copy       (GstH265SEIMessage       * dest_sei,
1503                                              const GstH265SEIMessage * src_sei);
1504
1505 GST_CODEC_PARSERS_API
1506 void                gst_h265_sei_free       (GstH265SEIMessage * sei);
1507
1508 GST_CODEC_PARSERS_API
1509 void    gst_h265_quant_matrix_4x4_get_zigzag_from_raster (guint8 out_quant[16],
1510                                                           const guint8 quant[16]);
1511
1512 GST_CODEC_PARSERS_API
1513 void    gst_h265_quant_matrix_4x4_get_raster_from_zigzag (guint8 out_quant[16],
1514                                                           const guint8 quant[16]);
1515
1516 GST_CODEC_PARSERS_API
1517 void    gst_h265_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64],
1518                                                           const guint8 quant[64]);
1519
1520 GST_CODEC_PARSERS_API
1521 void    gst_h265_quant_matrix_8x8_get_raster_from_zigzag (guint8 out_quant[64],
1522                                                           const guint8 quant[64]);
1523
1524 #define gst_h265_quant_matrix_16x16_get_zigzag_from_raster \
1525         gst_h265_quant_matrix_8x8_get_zigzag_from_raster
1526 #define gst_h265_quant_matrix_16x16_get_raster_from_zigzag \
1527         gst_h265_quant_matrix_8x8_get_raster_from_zigzag
1528 #define gst_h265_quant_matrix_32x32_get_zigzag_from_raster \
1529         gst_h265_quant_matrix_8x8_get_zigzag_from_raster
1530 #define gst_h265_quant_matrix_32x32_get_raster_from_zigzag \
1531         gst_h265_quant_matrix_8x8_get_raster_from_zigzag
1532
1533 GST_CODEC_PARSERS_API
1534 void    gst_h265_quant_matrix_4x4_get_uprightdiagonal_from_raster (guint8 out_quant[16],
1535                                                           const guint8 quant[16]);
1536
1537 GST_CODEC_PARSERS_API
1538 void    gst_h265_quant_matrix_4x4_get_raster_from_uprightdiagonal (guint8 out_quant[16],
1539                                                           const guint8 quant[16]);
1540
1541 GST_CODEC_PARSERS_API
1542 void    gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster (guint8 out_quant[64],
1543                                                           const guint8 quant[64]);
1544
1545 GST_CODEC_PARSERS_API
1546 void    gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal (guint8 out_quant[64],
1547                                                           const guint8 quant[64]);
1548
1549 #define gst_h265_quant_matrix_16x16_get_uprightdiagonal_from_raster \
1550         gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
1551 #define gst_h265_quant_matrix_16x16_get_raster_from_uprightdiagonal\
1552         gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
1553 #define gst_h265_quant_matrix_32x32_get_uprightdiagonal_from_raster \
1554         gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
1555 #define gst_h265_quant_matrix_32x32_get_raster_from_uprightdiagonal\
1556         gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
1557
1558 GST_CODEC_PARSERS_API
1559 GstH265Profile gst_h265_profile_tier_level_get_profile (GstH265ProfileTierLevel * ptl);
1560
1561 G_END_DECLS
1562 #endif