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 * 71 * H.265 Profiles. 72 * 73 */ 74 typedef enum { 75 GST_H265_PROFILE_INVALID = -1, 76 GST_H265_PROFILE_MAIN = 1, 77 GST_H265_PROFILE_MAIN_10 = 2, 78 GST_H265_PROFILE_MAIN_STILL_PICTURE = 3, 79 GST_H265_PROFILE_MONOCHROME, 80 GST_H265_PROFILE_MONOCHROME_12, 81 GST_H265_PROFILE_MONOCHROME_16, 82 GST_H265_PROFILE_MAIN_12, 83 GST_H265_PROFILE_MAIN_422_10, 84 GST_H265_PROFILE_MAIN_422_12, 85 GST_H265_PROFILE_MAIN_444, 86 GST_H265_PROFILE_MAIN_444_10, 87 GST_H265_PROFILE_MAIN_444_12, 88 GST_H265_PROFILE_MAIN_INTRA, 89 GST_H265_PROFILE_MAIN_10_INTRA, 90 GST_H265_PROFILE_MAIN_12_INTRA, 91 GST_H265_PROFILE_MAIN_422_10_INTRA, 92 GST_H265_PROFILE_MAIN_422_12_INTRA, 93 GST_H265_PROFILE_MAIN_444_INTRA, 94 GST_H265_PROFILE_MAIN_444_10_INTRA, 95 GST_H265_PROFILE_MAIN_444_12_INTRA, 96 GST_H265_PROFILE_MAIN_444_16_INTRA, 97 GST_H265_PROFILE_MAIN_444_STILL_PICTURE, 98 GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE, 99 } GstH265Profile; 100 101 /** 102 * GstH265ProfileIDC: 103 * @GST_H265_PROFILE_IDC_MAIN: Main profile (A.3.2) 104 * @GST_H265_PROFILE_IDC_MAIN_10: Main 10 profile (A.3.3) 105 * @GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4) 106 * @GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION: Format range extensions profile (A.3.5) 107 * @GST_H265_PROFILE_IDC_HIGH_THROUGHPUT: High throughput profiles (A.3.6) 108 * @GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING: Screen content coding extensions profiles (A.3.7) 109 * 110 * Valid values for the profile_idc field. This is different from 111 * #GstH265Profile as an extension idc can be used to encode a whole variety of 112 * profiles. 113 * 114 */ 115 typedef enum { 116 GST_H265_PROFILE_IDC_MAIN = 1, 117 GST_H265_PROFILE_IDC_MAIN_10 = 2, 118 GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3, 119 GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION = 4, 120 GST_H265_PROFILE_IDC_HIGH_THROUGHPUT = 5, 121 GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING = 9, 122 } GstH265ProfileIDC; 123 124 /** 125 * GstH265NalUnitType: 126 * @GST_H265_NAL_SLICE_TRAIL_N: Slice nal of a non-TSA, non-STSA trailing picture 127 * @GST_H265_NAL_SLICE_TRAIL_R: Slice nal of a non-TSA, non-STSA trailing picture 128 * @GST_H265_NAL_SLICE_TSA_N: Slice nal of a TSA picture 129 * @GST_H265_NAL_SLICE_TSA_R: Slice nal of a TSA picture 130 * @GST_H265_NAL_SLICE_STSA_N: Slice nal of a STSA picture 131 * @GST_H265_NAL_SLICE_STSA_R: Slice nal of a STSA picture 132 * @GST_H265_NAL_SLICE_RADL_N: Slice nal of a RADL picture 133 * @GST_H265_NAL_SLICE_RADL_R: Slice nal of a RADL piicture 134 * @GST_H265_NAL_SLICE_RASL_N: Slice nal of a RASL picture 135 * @GST_H265_NAL_SLICE_RASL_R: Slice nal of a RASL picture 136 * @GST_H265_NAL_SLICE_BLA_W_LP: Slice nal of a BLA picture 137 * @GST_H265_NAL_SLICE_BLA_W_RADL: Slice nal of a BLA picture 138 * @GST_H265_NAL_SLICE_BLA_N_LP: Slice nal of a BLA picture 139 * @GST_H265_NAL_SLICE_IDR_W_RADL: Slice nal of an IDR picture 140 * @GST_H265_NAL_SLICE_IDR_N_LP: Slice nal of an IDR picture 141 * @GST_H265_NAL_SLICE_CRA_NUT: Slice nal of a CRA picture 142 * @GST_H265_NAL_VPS: Video parameter set(VPS) nal unit 143 * @GST_H265_NAL_SPS: Sequence parameter set (SPS) nal unit 144 * @GST_H265_NAL_PPS: Picture parameter set (PPS) nal unit 145 * @GST_H265_NAL_AUD: Access unit (AU) delimiter nal unit 146 * @GST_H265_NAL_EOS: End of sequence (EOS) nal unit 147 * @GST_H265_NAL_EOB: End of bitstream (EOB) nal unit 148 * @GST_H265_NAL_FD: Filler data (FD) nal lunit 149 * @GST_H265_NAL_PREFIX_SEI: Supplemental enhancement information prefix nal unit 150 * @GST_H265_NAL_SUFFIX_SEI: Suppliemental enhancement information suffix nal unit 151 * 152 * Indicates the type of H265 Nal Units 153 */ 154 typedef enum 155 { 156 GST_H265_NAL_SLICE_TRAIL_N = 0, 157 GST_H265_NAL_SLICE_TRAIL_R = 1, 158 GST_H265_NAL_SLICE_TSA_N = 2, 159 GST_H265_NAL_SLICE_TSA_R = 3, 160 GST_H265_NAL_SLICE_STSA_N = 4, 161 GST_H265_NAL_SLICE_STSA_R = 5, 162 GST_H265_NAL_SLICE_RADL_N = 6, 163 GST_H265_NAL_SLICE_RADL_R = 7, 164 GST_H265_NAL_SLICE_RASL_N = 8, 165 GST_H265_NAL_SLICE_RASL_R = 9, 166 GST_H265_NAL_SLICE_BLA_W_LP = 16, 167 GST_H265_NAL_SLICE_BLA_W_RADL = 17, 168 GST_H265_NAL_SLICE_BLA_N_LP = 18, 169 GST_H265_NAL_SLICE_IDR_W_RADL = 19, 170 GST_H265_NAL_SLICE_IDR_N_LP = 20, 171 GST_H265_NAL_SLICE_CRA_NUT = 21, 172 GST_H265_NAL_VPS = 32, 173 GST_H265_NAL_SPS = 33, 174 GST_H265_NAL_PPS = 34, 175 GST_H265_NAL_AUD = 35, 176 GST_H265_NAL_EOS = 36, 177 GST_H265_NAL_EOB = 37, 178 GST_H265_NAL_FD = 38, 179 GST_H265_NAL_PREFIX_SEI = 39, 180 GST_H265_NAL_SUFFIX_SEI = 40 181 } GstH265NalUnitType; 182 183 #define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MIN 10 184 #define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MAX 15 185 186 #define RESERVED_IRAP_NAL_TYPE_MIN 22 187 #define RESERVED_IRAP_NAL_TYPE_MAX 23 188 189 #define RESERVED_NON_IRAP_NAL_TYPE_MIN 24 190 #define RESERVED_NON_IRAP_NAL_TYPE_MAX 31 191 192 #define RESERVED_NON_VCL_NAL_TYPE_MIN 41 193 #define RESERVED_NON_VCL_NAL_TYPE_MAX 47 194 195 #define UNSPECIFIED_NON_VCL_NAL_TYPE_MIN 48 196 #define UNSPECIFIED_NON_VCL_NAL_TYPE_MAX 63 197 198 /** 199 * GstH265ParserResult: 200 * @GST_H265_PARSER_OK: The parsing succeded 201 * @GST_H265_PARSER_BROKEN_DATA: The data to parse is broken 202 * @GST_H265_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found 203 * @GST_H265_PARSER_ERROR: An error accured when parsing 204 * @GST_H265_PARSER_NO_NAL: No nal found during the parsing 205 * @GST_H265_PARSER_NO_NAL_END: Start of the nal found, but not the end. 206 * 207 * The result of parsing H265 data. 208 */ 209 typedef enum 210 { 211 GST_H265_PARSER_OK, 212 GST_H265_PARSER_BROKEN_DATA, 213 GST_H265_PARSER_BROKEN_LINK, 214 GST_H265_PARSER_ERROR, 215 GST_H265_PARSER_NO_NAL, 216 GST_H265_PARSER_NO_NAL_END 217 } GstH265ParserResult; 218 219 /** 220 * GstH265SEIPayloadType: 221 * @GST_H265_SEI_BUF_PERIOD: Buffering Period SEI Message 222 * @GST_H265_SEI_PIC_TIMING: Picture Timing SEI Message 223 * @GST_H265_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.3.8) 224 * @GST_H265_SEI_TIME_CODE: Time code SEI message (D.2.27) (Since: 1.16) 225 * ... 226 * 227 * The type of SEI message. 228 */ 229 typedef enum 230 { 231 GST_H265_SEI_BUF_PERIOD = 0, 232 GST_H265_SEI_PIC_TIMING = 1, 233 GST_H265_SEI_RECOVERY_POINT = 6, 234 GST_H265_SEI_TIME_CODE = 136, 235 /* and more... */ 236 } GstH265SEIPayloadType; 237 238 /** 239 * GstH265SEIPicStructType: 240 * @GST_H265_SEI_PIC_STRUCT_FRAME: Picture is a frame 241 * @GST_H265_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame 242 * @GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD: Botom field of frame 243 * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame 244 * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame 245 * @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame 246 * @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame 247 * @GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should 248 * be displayed two times consecutively 249 * @GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be 250 * displayed three times consecutively 251 * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM: top field paired with 252 * previous bottom field in output order 253 * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP: bottom field paried with 254 * previous top field in output order 255 * @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM: top field paired with next 256 * bottom field in output order 257 * @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP: bottom field paired with 258 * next top field in output order 259 * 260 * SEI pic_struct type 261 */ 262 typedef enum 263 { 264 GST_H265_SEI_PIC_STRUCT_FRAME = 0, 265 GST_H265_SEI_PIC_STRUCT_TOP_FIELD = 1, 266 GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD = 2, 267 GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM = 3, 268 GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP = 4, 269 GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, 270 GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, 271 GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING = 7, 272 GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING = 8, 273 GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM = 9, 274 GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP = 10, 275 GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM = 11, 276 GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP = 12 277 } GstH265SEIPicStructType; 278 279 /** 280 * GstH265SliceType: 281 * 282 * Type of Picture slice 283 */ 284 285 typedef enum 286 { 287 GST_H265_B_SLICE = 0, 288 GST_H265_P_SLICE = 1, 289 GST_H265_I_SLICE = 2 290 } GstH265SliceType; 291 292 typedef enum 293 { 294 GST_H265_QUANT_MATIX_4X4 = 0, 295 GST_H265_QUANT_MATIX_8X8 = 1, 296 GST_H265_QUANT_MATIX_16X16 = 2, 297 GST_H265_QUANT_MATIX_32X32 = 3 298 } GstH265QuantMatrixSize; 299 300 typedef struct _GstH265Parser GstH265Parser; 301 302 typedef struct _GstH265NalUnit GstH265NalUnit; 303 304 typedef struct _GstH265VPS GstH265VPS; 305 typedef struct _GstH265SPS GstH265SPS; 306 typedef struct _GstH265PPS GstH265PPS; 307 typedef struct _GstH265ProfileTierLevel GstH265ProfileTierLevel; 308 typedef struct _GstH265SubLayerHRDParams GstH265SubLayerHRDParams; 309 typedef struct _GstH265HRDParams GstH265HRDParams; 310 typedef struct _GstH265VUIParams GstH265VUIParams; 311 312 typedef struct _GstH265ScalingList GstH265ScalingList; 313 typedef struct _GstH265RefPicListModification GstH265RefPicListModification; 314 typedef struct _GstH265PredWeightTable GstH265PredWeightTable; 315 typedef struct _GstH265ShortTermRefPicSet GstH265ShortTermRefPicSet; 316 typedef struct _GstH265SliceHdr GstH265SliceHdr; 317 318 typedef struct _GstH265PicTiming GstH265PicTiming; 319 typedef struct _GstH265BufferingPeriod GstH265BufferingPeriod; 320 typedef struct _GstH265RecoveryPoint GstH265RecoveryPoint; 321 typedef struct _GstH265TimeCode GstH265TimeCode; 322 typedef struct _GstH265SEIMessage GstH265SEIMessage; 323 324 /** 325 * GstH265NalUnit: 326 * @type: A #GstH265NalUnitType 327 * @layer_id: A nal unit layer id 328 * @temporal_id_plus1: A nal unit temporal identifier 329 * @size: The size of the nal unit starting from @offset 330 * @offset: The offset of the actual start of the nal unit 331 * @sc_offset:The offset of the start code of the nal unit 332 * @valid: If the nal unit is valid, which mean it has 333 * already been parsed 334 * @data: The data from which the Nalu has been parsed 335 * 336 * Structure defining the Nal unit headers 337 */ 338 struct _GstH265NalUnit 339 { 340 guint8 type; 341 guint8 layer_id; 342 guint8 temporal_id_plus1; 343 344 /* calculated values */ 345 guint size; 346 guint offset; 347 guint sc_offset; 348 gboolean valid; 349 350 guint8 *data; 351 guint8 header_bytes; 352 }; 353 354 /** 355 * GstH265ProfileTierLevel: 356 * @profile_space: specifies the context for the interpretation of 357 * general_profile_idc and general_profile_combatibility_flag 358 * @tier_flag: the tier context for the interpretation of general_level_idc 359 * @profile_idc: profile id 360 * @profile_compatibility_flag: compatibility flags 361 * @progressive_source_flag: flag to indicate the type of stream 362 * @interlaced_source_flag: flag to indicate the type of stream 363 * @non_packed_constraint_flag: indicate the presence of frame packing 364 * arragement sei message 365 * @frame_only_constraint_flag: recognize the field_seq_flag 366 * @max_12bit_constraint_flag: used to define profile extensions, see Annex A 367 * @max_10bit_constraint_flag: used to define profile extensions, see Annex A 368 * @max_8bit_constraint_flag: used to define profile extensions, see Annex A 369 * @max_422chroma_constraint_flag: used to define profile extensions, see Annex A 370 * @max_420chroma_constraint_flag: used to define profile extensions, see Annex A 371 * @max_monochrome_constraint_flag: used to define profile extensions, see Annex A 372 * @intra_constraint_flag: used to define profile extensions, see Annex A 373 * @one_picture_only_constraint_flag: used to define profile extensions, see Annex A 374 * @lower_bit_rate_constraint_flag: used to define profile extensions, see Annex A 375 * @max_14bit_constraint_flag: used to define profile extensions, see Annex A 376 * @level idc: indicate the level which the CVS confirms 377 * @sub_layer_profile_present_flag: sublayer profile presence ind 378 * @sub_layer_level_present_flag:sublayer level presence indicator. 379 * @sub_layer_profile_space: profile space for sublayers 380 * @sub_layer_tier_flag: tier flags for sublayers. 381 * @sub_layer_profile_idc: conformant profile indicator for sublayers. 382 * @sub_layer_profile_compatibility_flag[6][32]: compatibility flags for sublayers 383 * @sub_layer_progressive_source_flag:progressive stream indicator for sublayer 384 * @sub_layer_interlaced_source_flag: interlaced stream indicator for sublayer 385 * @sub_layer_non_packed_constraint_flag: indicate the presence of 386 * frame packing arrangement sei message with in sublayers 387 * @sub_layer_frame_only_constraint_flag:recognize the sublayer 388 * specific field_seq_flag 389 * @sub_layer_level_idc:indicate the sublayer specific level 390 * 391 * Define ProfileTierLevel parameters 392 */ 393 struct _GstH265ProfileTierLevel { 394 guint8 profile_space; 395 guint8 tier_flag; 396 guint8 profile_idc; 397 398 guint8 profile_compatibility_flag[32]; 399 400 guint8 progressive_source_flag; 401 guint8 interlaced_source_flag; 402 guint8 non_packed_constraint_flag; 403 guint8 frame_only_constraint_flag; 404 405 guint8 max_12bit_constraint_flag; 406 guint8 max_10bit_constraint_flag; 407 guint8 max_8bit_constraint_flag; 408 guint8 max_422chroma_constraint_flag; 409 guint8 max_420chroma_constraint_flag; 410 guint8 max_monochrome_constraint_flag; 411 guint8 intra_constraint_flag; 412 guint8 one_picture_only_constraint_flag; 413 guint8 lower_bit_rate_constraint_flag; 414 guint8 max_14bit_constraint_flag; 415 416 guint8 level_idc; 417 418 guint8 sub_layer_profile_present_flag[6]; 419 guint8 sub_layer_level_present_flag[6]; 420 421 guint8 sub_layer_profile_space[6]; 422 guint8 sub_layer_tier_flag[6]; 423 guint8 sub_layer_profile_idc[6]; 424 guint8 sub_layer_profile_compatibility_flag[6][32]; 425 guint8 sub_layer_progressive_source_flag[6]; 426 guint8 sub_layer_interlaced_source_flag[6]; 427 guint8 sub_layer_non_packed_constraint_flag[6]; 428 guint8 sub_layer_frame_only_constraint_flag[6]; 429 guint8 sub_layer_level_idc[6]; 430 }; 431 432 /** 433 * GstH265SubLayerHRDParams: 434 * @bit_rate_value_minus1:togeter with bit_rate_scale, it specifies 435 * the maximum input bitrate when the CPB operates at the access 436 * unit level 437 * @cpb_size_value_minus1: is used together with cpb_size_scale to 438 * specify the CPB size when the CPB operates at the access unit 439 * level 440 * @cpb_size_du_value_minus1: is used together with cpb_size_du_scale 441 * to specify the CPB size when the CPB operates at sub-picture 442 * level 443 * @bit_rate_du_value_minus1: together with bit_rate_scale, it 444 * specifies the maximum input bit rate when the CPB operates at the 445 * sub-picture level 446 * @cbr_flag: indicate whether HSS operates in intermittent bit rate 447 * mode or constant bit rate mode. 448 * 449 * Defines the Sublayer HRD parameters 450 */ 451 struct _GstH265SubLayerHRDParams 452 { 453 guint32 bit_rate_value_minus1[32]; 454 guint32 cpb_size_value_minus1[32]; 455 456 guint32 cpb_size_du_value_minus1[32]; 457 guint32 bit_rate_du_value_minus1[32]; 458 459 guint8 cbr_flag[32]; 460 }; 461 462 /** 463 * GstH265HRDParams: 464 * @nal_hrd_parameters_present_flag: indicate the presence of NAL HRD parameters 465 * @vcl_hrd_parameters_present_flag: indicate the presence of VCL HRD parameters 466 * @sub_pic_hrd_params_present_flag: indicate the presence of sub_pic_hrd_params 467 * @tick_divisor_minus2: is used to specify the clock sub-tick 468 * @du_cpb_removal_delay_increment_length_minus1: specifies the length, 469 * in bits, of the nal_initial_cpb_removal_delay 470 * @sub_pic_cpb_params_in_pic_timing_sei_flag: specifies the length, in bits, of 471 * the cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements. 472 * @dpb_output_delay_du_length_minu1: specifies the length, in bits, of the 473 * dpb_delay_offset and the pic_dpb_output_delay syntax elements 474 * @bit_rate_scale: maximum input bitrate 475 * @cpb_size_scale: CPB size when operates in access unit level 476 * @cpb_size_du_scale: CPB size when operates in sub-picture level 477 * @initial_cpb_removal_delay_length_minus1: specifies the length, in bits, of the 478 * nal_initial_cpb_removal_delay, nal_initial_cpb_removal_offset, 479 * vcl_initial_cpb_removal_delay and vcl_initial_cpb_removal_offset. 480 * @au_cpb_removal_delay_length_minus1: specifies the length, in bits, of the 481 * cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements 482 * @dpb_output_delay_length_minus1: specifies the length, in bits, of the 483 * dpb_delay_offset and the pic_dpb_output_delay syntax elements 484 * @fixed_pic_rate_general_flag: flag to indicate the presence of constraint 485 * on the temporal distance between the HRD output times of consecutive 486 * pictures in output order 487 * @fixed_pic_rate_within_cvs_flag: same as fixed_pic_rate_general_flag 488 * @elemental_duration_in_tc_minus1: temporal distance in clock ticks 489 * @low_delay_hrd_flag: specifies the HRD operational mode 490 * @cpb_cnt_minus1:specifies the number of alternative CPS specifications. 491 * @sublayer_hrd_params: Sublayer HRD parameters. 492 * 493 * Defines the HRD parameters 494 */ 495 struct _GstH265HRDParams 496 { 497 guint8 nal_hrd_parameters_present_flag; 498 guint8 vcl_hrd_parameters_present_flag; 499 guint8 sub_pic_hrd_params_present_flag; 500 501 guint8 tick_divisor_minus2; 502 guint8 du_cpb_removal_delay_increment_length_minus1; 503 guint8 sub_pic_cpb_params_in_pic_timing_sei_flag; 504 guint8 dpb_output_delay_du_length_minus1; 505 506 guint8 bit_rate_scale; 507 guint8 cpb_size_scale; 508 guint8 cpb_size_du_scale; 509 510 guint8 initial_cpb_removal_delay_length_minus1; 511 guint8 au_cpb_removal_delay_length_minus1; 512 guint8 dpb_output_delay_length_minus1; 513 514 guint8 fixed_pic_rate_general_flag [7]; 515 guint8 fixed_pic_rate_within_cvs_flag [7]; 516 guint16 elemental_duration_in_tc_minus1 [7]; 517 guint8 low_delay_hrd_flag [7]; 518 guint8 cpb_cnt_minus1[7]; 519 520 GstH265SubLayerHRDParams sublayer_hrd_params[7]; 521 }; 522 523 /** 524 * GstH265VPS: 525 * @id: vps id 526 * @base_layer_internal_flag and @base_layer_available_flag: 527 * specify availability of base layer 528 * @max_layers_minus1: should be zero, but can be other values in future 529 * @max_sub_layers_minus1:specifies the maximum number of temporal sub-layers 530 * @temporal_id_nesting_flag: specifies whether inter prediction is 531 * additionally restricted 532 * @profile_tier_level: ProfileTierLevel info 533 * @sub_layer_ordering_info_present_flag: indicates the presense of 534 * vps_max_dec_pic_buffering_minus1, vps_max_num_reorder_pics and 535 * vps_max_latency_increase_plus1 536 * @max_dec_pic_buffering_minus1: specifies the maximum required size 537 * of the decoded picture buffer 538 * @max_num_reorder_pics: indicates the maximum allowed number of 539 * pictures that can precede any picture in the CVS in decoding 540 * order 541 * @max_latency_increase_plus1: is used to compute the value of 542 * VpsMaxLatencyPictures 543 * @max_layer_id: specifies the maximum allowed value of nuh_layer_id 544 * @num_layer_sets_minus1: specifies the number of layer sets 545 * @layer_id_included_flag: specifies whether a nuh_layer_id included 546 * in the layer identifier list 547 * @timing_info_present_flag: indicate the presence of 548 * num_units_in_tick, time_scale, poc_proportional_to_timing_flag 549 * and num_hrd_parameters 550 * @num_units_in_tick: number of time units in a tick 551 * @time_scale: number of time units that pass in one second 552 * @poc_proportional_to_timing_flag: indicate whether the picture 553 * order count is proportional to output timin 554 * @num_ticks_poc_diff_one_minus1: specifies the number of clock ticks 555 * corresponding to a difference of picture order count values equal 556 * to 1 557 * @num_hrd_parameters: number of hrd_parameters present 558 * @hrd_layer_set_idx: index to the list of layer hrd params. 559 * @hrd_params: the GstH265HRDParams list 560 * 561 * Defines the VPS parameters 562 */ 563 struct _GstH265VPS { 564 guint8 id; 565 566 guint8 base_layer_internal_flag; 567 guint8 base_layer_available_flag; 568 569 guint8 max_layers_minus1; 570 guint8 max_sub_layers_minus1; 571 guint8 temporal_id_nesting_flag; 572 573 GstH265ProfileTierLevel profile_tier_level; 574 575 guint8 sub_layer_ordering_info_present_flag; 576 guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS]; 577 guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS]; 578 guint32 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS]; 579 580 guint8 max_layer_id; 581 guint16 num_layer_sets_minus1; 582 583 guint8 timing_info_present_flag; 584 guint32 num_units_in_tick; 585 guint32 time_scale; 586 guint8 poc_proportional_to_timing_flag; 587 guint32 num_ticks_poc_diff_one_minus1; 588 589 guint16 num_hrd_parameters; 590 591 /* FIXME: following HRD related info should be an array */ 592 guint16 hrd_layer_set_idx; 593 guint8 cprms_present_flag; 594 GstH265HRDParams hrd_params; 595 596 guint8 vps_extension; 597 598 gboolean valid; 599 }; 600 /** 601 * GstH265ShortTermRefPicSet: 602 * @inter_ref_pic_set_prediction_flag: %TRUE specifies that the stRpsIdx-th candidate 603 * short-term RPS is predicted from another candidate short-term RPS 604 * @delta_idx_minus1: plus 1 specifies the difference between the value of source and 605 * candidate short term RPS. 606 * @delta_rps_sign: delta_rps_sign and abs_delta_rps_minus1 together specify 607 * the value of the variable deltaRps. 608 * @abs_delta_rps_minus1: delta_rps_sign and abs_delta_rps_minus1 together specify 609 * the value of the variable deltaRps 610 * 611 * Defines the #GstH265ShortTermRefPicSet params 612 */ 613 struct _GstH265ShortTermRefPicSet 614 { 615 guint8 inter_ref_pic_set_prediction_flag; 616 guint8 delta_idx_minus1; 617 guint8 delta_rps_sign; 618 guint16 abs_delta_rps_minus1; 619 620 /* calculated values */ 621 guint8 NumDeltaPocs; 622 guint8 NumNegativePics; 623 guint8 NumPositivePics; 624 guint8 UsedByCurrPicS0[16]; 625 guint8 UsedByCurrPicS1[16]; 626 gint32 DeltaPocS0[16]; 627 gint32 DeltaPocS1[16]; 628 }; 629 630 /** 631 * GstH265VUIParams: 632 * @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present. 633 * %FALSE specifies that aspect_ratio_idc is not present 634 * @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples 635 * @sar_width indicates the horizontal size of the sample aspect ratio 636 * @sar_height indicates the vertical size of the sample aspect ratio 637 * @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwise 638 * @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures 639 * output are suitable for display using overscan. %FALSE the cropped decoded pictures 640 * output contain visually important information 641 * @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and 642 * colour_description_present_flag are present. 643 * @video_format: indicates the representation of the picture 644 * @video_full_range_flag: indicates the black level and range of the luma and chroma signals 645 * @colour_description_present_flag: %TRUE specifies that colour_primaries, 646 * transfer_characteristics and matrix_coefficients are present 647 * @colour_primaries: indicates the chromaticity coordinates of the source primaries 648 * @transfer_characteristics: indicates the opto-electronic transfer characteristic 649 * @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals 650 * @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and 651 * chroma_sample_loc_type_bottom_field are present, %FALSE otherwise 652 * @chroma_sample_loc_type_top_field: specify the location of chroma for top field 653 * @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field 654 * @neutral_chroma_indication_flag: %TRUE indicate that the value of chroma samples is equla 655 * to 1<<(BitDepthchrom-1). 656 * @field_seq_flag: %TRUE indicate field and %FALSE indicate frame 657 * @frame_field_info_present_flag: %TRUE indicate picture timing SEI messages are present for every 658 * picture and include the pic_struct, source_scan_type, and duplicate_flag syntax elements. 659 * @default_display_window_flag: %TRUE indicate that the default display window parameters present 660 * def_disp_win_left_offset:left offset of display rect 661 * def_disp_win_right_offset: right offset of display rect 662 * def_disp_win_top_offset: top offset of display rect 663 * def_disp_win_bottom_offset: bottom offset of display rect 664 * @timing_info_present_flag: %TRUE specifies that num_units_in_tick, 665 * time_scale and fixed_frame_rate_flag are present in the bitstream 666 * @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz 667 * @time_scale: is the number of time units that pass in one second 668 * @poc_proportional_to_timing_flag: %TRUE indicates that the picture order count value for each picture 669 * in the CVS that is not the first picture in the CVS, in decoding order, is proportional to the output 670 * time of the picture relative to the output time of the first picture in the CVS. 671 * @num_ticks_poc_diff_one_minus1: plus 1 specifies the number of clock ticks corresponding to a 672 * difference of picture order count values equal to 1 673 * @hrd_parameters_present_flag: %TRUE if hrd parameters present in the bitstream 674 * @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction 675 * parameters are present 676 * @tiles_fixed_structure_flag: %TRUE indicates that each PPS that is active in the CVS has the same value 677 * of the syntax elements num_tile_columns_minus1, num_tile_rows_minus1, uniform_spacing_flag, 678 * column_width_minus1, row_height_minus1 and loop_filter_across_tiles_enabled_flag, when present 679 * @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the 680 * picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more 681 * samples outside picture boundaries may be used in inter prediction 682 * @restricted_ref_pic_list_flag: %TRUE indicates that all P and B slices (when present) that belong to 683 * the same picture have an identical reference picture list 0, and that all B slices (when present) 684 * that belong to the same picture have an identical reference picture list 1 685 * @min_spatial_segmentation_idc: when not equal to 0, establishes a bound on the maximum possible size 686 * of distinct coded spatial segmentation regions in the pictures of the CVS 687 * @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of 688 * the VCL NAL units associated with any coded picture in the coded video sequence. 689 * @max_bits_per_min_cu_denom: indicates an upper bound for the number of coded bits of coding_unit 690 * data for any coding block in any picture of the CVS 691 * @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal 692 * motion vector component 693 * @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical 694 * motion vector component 695 * 696 * The structure representing the VUI parameters. 697 */ 698 struct _GstH265VUIParams 699 { 700 guint8 aspect_ratio_info_present_flag; 701 guint8 aspect_ratio_idc; 702 /* if aspect_ratio_idc == 255 */ 703 guint16 sar_width; 704 guint16 sar_height; 705 706 guint8 overscan_info_present_flag; 707 /* if overscan_info_present_flag */ 708 guint8 overscan_appropriate_flag; 709 710 guint8 video_signal_type_present_flag; 711 guint8 video_format; 712 guint8 video_full_range_flag; 713 guint8 colour_description_present_flag; 714 guint8 colour_primaries; 715 guint8 transfer_characteristics; 716 guint8 matrix_coefficients; 717 718 guint8 chroma_loc_info_present_flag; 719 guint8 chroma_sample_loc_type_top_field; 720 guint8 chroma_sample_loc_type_bottom_field; 721 722 guint8 neutral_chroma_indication_flag; 723 guint8 field_seq_flag; 724 guint8 frame_field_info_present_flag; 725 guint8 default_display_window_flag; 726 guint32 def_disp_win_left_offset; 727 guint32 def_disp_win_right_offset; 728 guint32 def_disp_win_top_offset; 729 guint32 def_disp_win_bottom_offset; 730 731 guint8 timing_info_present_flag; 732 /* if timing_info_present_flag */ 733 guint32 num_units_in_tick; 734 guint32 time_scale; 735 guint8 poc_proportional_to_timing_flag; 736 /* if poc_proportional_to_timing_flag */ 737 guint32 num_ticks_poc_diff_one_minus1; 738 guint8 hrd_parameters_present_flag; 739 /*if hrd_parameters_present_flat */ 740 GstH265HRDParams hrd_params; 741 742 guint8 bitstream_restriction_flag; 743 /* if bitstream_restriction_flag */ 744 guint8 tiles_fixed_structure_flag; 745 guint8 motion_vectors_over_pic_boundaries_flag; 746 guint8 restricted_ref_pic_lists_flag; 747 guint16 min_spatial_segmentation_idc; 748 guint8 max_bytes_per_pic_denom; 749 guint8 max_bits_per_min_cu_denom; 750 guint8 log2_max_mv_length_horizontal; 751 guint8 log2_max_mv_length_vertical; 752 753 /* calculated values */ 754 guint par_n; 755 guint par_d; 756 }; 757 758 /** 759 * GstH265ScalingList: 760 * @scaling_list_dc_coef_minus8_16x16: this plus 8 specifies the DC 761 * Coefficient values for 16x16 scaling list 762 * @scaling_list_dc_coef_minus8_32x32: this plus 8 specifies the DC 763 * Coefficient values for 32x32 scaling list 764 * @scaling_lists_4x4: 4x4 scaling list 765 * @scaling_lists_8x8: 8x8 scaling list 766 * @scaling_lists_16x16: 16x16 scaling list 767 * @guint8 scaling_lists_32x32: 32x32 scaling list 768 * 769 * Defines the GstH265ScalingList 770 */ 771 struct _GstH265ScalingList { 772 773 gint16 scaling_list_dc_coef_minus8_16x16[6]; 774 gint16 scaling_list_dc_coef_minus8_32x32[2]; 775 776 guint8 scaling_lists_4x4 [6][16]; 777 guint8 scaling_lists_8x8 [6][64]; 778 guint8 scaling_lists_16x16 [6][64]; 779 guint8 scaling_lists_32x32 [2][64]; 780 }; 781 782 /** 783 * GstH265SPS: 784 * @id: The ID of the sequence parameter set 785 * @profile_idc: indicate the profile to which the coded video sequence conforms 786 * 787 * H265 Sequence Parameter Set (SPS) 788 */ 789 struct _GstH265SPS 790 { 791 guint8 id; 792 793 GstH265VPS *vps; 794 795 guint8 max_sub_layers_minus1; 796 guint8 temporal_id_nesting_flag; 797 798 GstH265ProfileTierLevel profile_tier_level; 799 800 guint8 chroma_format_idc; 801 guint8 separate_colour_plane_flag; 802 guint16 pic_width_in_luma_samples; 803 guint16 pic_height_in_luma_samples; 804 805 guint8 conformance_window_flag; 806 /* if conformance_window_flag */ 807 guint32 conf_win_left_offset; 808 guint32 conf_win_right_offset; 809 guint32 conf_win_top_offset; 810 guint32 conf_win_bottom_offset; 811 812 guint8 bit_depth_luma_minus8; 813 guint8 bit_depth_chroma_minus8; 814 guint8 log2_max_pic_order_cnt_lsb_minus4; 815 816 guint8 sub_layer_ordering_info_present_flag; 817 guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS]; 818 guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS]; 819 guint8 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS]; 820 821 guint8 log2_min_luma_coding_block_size_minus3; 822 guint8 log2_diff_max_min_luma_coding_block_size; 823 guint8 log2_min_transform_block_size_minus2; 824 guint8 log2_diff_max_min_transform_block_size; 825 guint8 max_transform_hierarchy_depth_inter; 826 guint8 max_transform_hierarchy_depth_intra; 827 828 guint8 scaling_list_enabled_flag; 829 /* if scaling_list_enabled_flag */ 830 guint8 scaling_list_data_present_flag; 831 832 GstH265ScalingList scaling_list; 833 834 guint8 amp_enabled_flag; 835 guint8 sample_adaptive_offset_enabled_flag; 836 guint8 pcm_enabled_flag; 837 /* if pcm_enabled_flag */ 838 guint8 pcm_sample_bit_depth_luma_minus1; 839 guint8 pcm_sample_bit_depth_chroma_minus1; 840 guint8 log2_min_pcm_luma_coding_block_size_minus3; 841 guint8 log2_diff_max_min_pcm_luma_coding_block_size; 842 guint8 pcm_loop_filter_disabled_flag; 843 844 guint8 num_short_term_ref_pic_sets; 845 GstH265ShortTermRefPicSet short_term_ref_pic_set[65]; 846 847 guint8 long_term_ref_pics_present_flag; 848 /* if long_term_ref_pics_present_flag */ 849 guint8 num_long_term_ref_pics_sps; 850 guint16 lt_ref_pic_poc_lsb_sps[32]; 851 guint8 used_by_curr_pic_lt_sps_flag[32]; 852 853 guint8 temporal_mvp_enabled_flag; 854 guint8 strong_intra_smoothing_enabled_flag; 855 guint8 vui_parameters_present_flag; 856 857 /* if vui_parameters_present_flat */ 858 GstH265VUIParams vui_params; 859 860 guint8 sps_extension_flag; 861 862 /* calculated values */ 863 guint8 chroma_array_type; 864 gint width, height; 865 gint crop_rect_width, crop_rect_height; 866 gint crop_rect_x, crop_rect_y; 867 gint fps_num, fps_den; 868 gboolean valid; 869 }; 870 871 /** 872 * GstH265PPS: 873 * 874 * H265 Picture Parameter Set 875 */ 876 struct _GstH265PPS 877 { 878 guint id; 879 880 GstH265SPS *sps; 881 882 guint8 dependent_slice_segments_enabled_flag; 883 guint8 output_flag_present_flag; 884 guint8 num_extra_slice_header_bits; 885 guint8 sign_data_hiding_enabled_flag; 886 guint8 cabac_init_present_flag; 887 guint8 num_ref_idx_l0_default_active_minus1; 888 guint8 num_ref_idx_l1_default_active_minus1; 889 gint8 init_qp_minus26; 890 guint8 constrained_intra_pred_flag; 891 guint8 transform_skip_enabled_flag; 892 guint8 cu_qp_delta_enabled_flag; 893 /*if cu_qp_delta_enabled_flag */ 894 guint8 diff_cu_qp_delta_depth; 895 896 gint8 cb_qp_offset; 897 gint8 cr_qp_offset; 898 guint8 slice_chroma_qp_offsets_present_flag; 899 guint8 weighted_pred_flag; 900 guint8 weighted_bipred_flag; 901 guint8 transquant_bypass_enabled_flag; 902 guint8 tiles_enabled_flag; 903 guint8 entropy_coding_sync_enabled_flag; 904 905 guint8 num_tile_columns_minus1; 906 guint8 num_tile_rows_minus1; 907 guint8 uniform_spacing_flag; 908 guint32 column_width_minus1[19]; 909 guint32 row_height_minus1[21]; 910 guint8 loop_filter_across_tiles_enabled_flag; 911 912 guint8 loop_filter_across_slices_enabled_flag; 913 guint8 deblocking_filter_control_present_flag; 914 guint8 deblocking_filter_override_enabled_flag; 915 guint8 deblocking_filter_disabled_flag; 916 gint8 beta_offset_div2; 917 gint8 tc_offset_div2; 918 919 guint8 scaling_list_data_present_flag; 920 921 GstH265ScalingList scaling_list; 922 923 guint8 lists_modification_present_flag; 924 guint8 log2_parallel_merge_level_minus2; 925 guint8 slice_segment_header_extension_present_flag; 926 927 guint8 pps_extension_flag; 928 929 /* calculated values */ 930 guint32 PicWidthInCtbsY; 931 guint32 PicHeightInCtbsY; 932 gboolean valid; 933 }; 934 935 struct _GstH265RefPicListModification 936 { 937 guint8 ref_pic_list_modification_flag_l0; 938 guint32 list_entry_l0[15]; 939 guint8 ref_pic_list_modification_flag_l1; 940 guint32 list_entry_l1[15]; 941 }; 942 943 struct _GstH265PredWeightTable 944 { 945 guint8 luma_log2_weight_denom; 946 gint8 delta_chroma_log2_weight_denom; 947 948 guint8 luma_weight_l0_flag[15]; 949 guint8 chroma_weight_l0_flag[15]; 950 gint8 delta_luma_weight_l0[15]; 951 gint8 luma_offset_l0[15]; 952 gint8 delta_chroma_weight_l0 [15][2]; 953 gint16 delta_chroma_offset_l0 [15][2]; 954 955 guint8 luma_weight_l1_flag[15]; 956 guint8 chroma_weight_l1_flag[15]; 957 gint8 delta_luma_weight_l1[15]; 958 gint8 luma_offset_l1[15]; 959 gint8 delta_chroma_weight_l1[15][2]; 960 gint16 delta_chroma_offset_l1[15][2]; 961 }; 962 963 struct _GstH265SliceHdr 964 { 965 guint8 first_slice_segment_in_pic_flag; 966 guint8 no_output_of_prior_pics_flag; 967 968 GstH265PPS *pps; 969 970 guint8 dependent_slice_segment_flag; 971 guint32 segment_address; 972 973 guint8 type; 974 975 guint8 pic_output_flag; 976 guint8 colour_plane_id; 977 guint16 pic_order_cnt_lsb; 978 979 guint8 short_term_ref_pic_set_sps_flag; 980 GstH265ShortTermRefPicSet short_term_ref_pic_sets; 981 guint8 short_term_ref_pic_set_idx; 982 983 guint8 num_long_term_sps; 984 guint8 num_long_term_pics; 985 guint8 lt_idx_sps[16]; 986 guint32 poc_lsb_lt[16]; 987 guint8 used_by_curr_pic_lt_flag[16]; 988 guint8 delta_poc_msb_present_flag[16]; 989 guint32 delta_poc_msb_cycle_lt[16]; 990 991 guint8 temporal_mvp_enabled_flag; 992 guint8 sao_luma_flag; 993 guint8 sao_chroma_flag; 994 guint8 num_ref_idx_active_override_flag; 995 guint8 num_ref_idx_l0_active_minus1; 996 guint8 num_ref_idx_l1_active_minus1; 997 998 GstH265RefPicListModification ref_pic_list_modification; 999 1000 guint8 mvd_l1_zero_flag; 1001 guint8 cabac_init_flag; 1002 guint8 collocated_from_l0_flag; 1003 guint8 collocated_ref_idx; 1004 1005 GstH265PredWeightTable pred_weight_table; 1006 1007 guint8 five_minus_max_num_merge_cand; 1008 1009 gint8 qp_delta; 1010 gint8 cb_qp_offset; 1011 gint8 cr_qp_offset; 1012 1013 guint8 deblocking_filter_override_flag; 1014 guint8 deblocking_filter_disabled_flag; 1015 gint8 beta_offset_div2; 1016 gint8 tc_offset_div2; 1017 1018 guint8 loop_filter_across_slices_enabled_flag; 1019 1020 guint32 num_entry_point_offsets; 1021 guint8 offset_len_minus1; 1022 guint32 *entry_point_offset_minus1; 1023 1024 /* calculated values */ 1025 1026 gint NumPocTotalCurr; 1027 /* Size of the slice_header() in bits */ 1028 guint header_size; 1029 /* Number of emulation prevention bytes (EPB) in this slice_header() */ 1030 guint n_emulation_prevention_bytes; 1031 }; 1032 1033 struct _GstH265PicTiming 1034 { 1035 guint8 pic_struct; 1036 guint8 source_scan_type; 1037 guint8 duplicate_flag; 1038 1039 guint8 au_cpb_removal_delay_minus1; 1040 guint8 pic_dpb_output_delay; 1041 guint8 pic_dpb_output_du_delay; 1042 guint32 num_decoding_units_minus1; 1043 guint8 du_common_cpb_removal_delay_flag; 1044 guint8 du_common_cpb_removal_delay_increment_minus1; 1045 guint32 *num_nalus_in_du_minus1; 1046 guint8 *du_cpb_removal_delay_increment_minus1; 1047 }; 1048 1049 struct _GstH265BufferingPeriod 1050 { 1051 GstH265SPS *sps; 1052 1053 guint8 irap_cpb_params_present_flag; 1054 guint8 cpb_delay_offset; 1055 guint8 dpb_delay_offset; 1056 guint8 concatenation_flag; 1057 guint8 au_cpb_removal_delay_delta_minus1; 1058 1059 /* seq->vui_parameters->nal_hrd_parameters_present_flag */ 1060 guint8 nal_initial_cpb_removal_delay[32]; 1061 guint8 nal_initial_cpb_removal_offset[32]; 1062 guint8 nal_initial_alt_cpb_removal_delay[32]; 1063 guint8 nal_initial_alt_cpb_removal_offset [32]; 1064 1065 /* seq->vui_parameters->vcl_hrd_parameters_present_flag */ 1066 guint8 vcl_initial_cpb_removal_delay[32]; 1067 guint8 vcl_initial_cpb_removal_offset[32]; 1068 guint8 vcl_initial_alt_cpb_removal_delay[32]; 1069 guint8 vcl_initial_alt_cpb_removal_offset[32]; 1070 }; 1071 1072 struct _GstH265RecoveryPoint 1073 { 1074 gint32 recovery_poc_cnt; 1075 guint8 exact_match_flag; 1076 guint8 broken_link_flag; 1077 }; 1078 1079 /** 1080 * GstH265TimeCode: 1081 * The time code SEI message provides time code information similar to that 1082 * defined by SMPTE ST 12-1 (2014) for field(s) or frame(s) of the current 1083 * picture. 1084 * 1085 * D.2.27 1086 * 1087 * Since: 1.16 1088 */ 1089 struct _GstH265TimeCode 1090 { 1091 guint8 num_clock_ts; 1092 guint8 clock_timestamp_flag[3]; 1093 guint8 units_field_based_flag[3]; 1094 guint8 counting_type[3]; 1095 guint8 full_timestamp_flag[3]; 1096 guint8 discontinuity_flag[3]; 1097 guint8 cnt_dropped_flag[3]; 1098 guint16 n_frames[3]; 1099 guint8 seconds_flag[3]; 1100 guint8 seconds_value[3]; 1101 guint8 minutes_flag[3]; 1102 guint8 minutes_value[3]; 1103 guint8 hours_flag[3]; 1104 guint8 hours_value[3]; 1105 guint8 time_offset_length[3]; 1106 guint32 time_offset_value[3]; 1107 }; 1108 1109 struct _GstH265SEIMessage 1110 { 1111 GstH265SEIPayloadType payloadType; 1112 1113 union { 1114 GstH265BufferingPeriod buffering_period; 1115 GstH265PicTiming pic_timing; 1116 GstH265RecoveryPoint recovery_point; 1117 GstH265TimeCode time_code; 1118 /* ... could implement more */ 1119 } payload; 1120 }; 1121 1122 /** 1123 * GstH265Parser: 1124 * 1125 * H265 NAL Parser (opaque structure). 1126 */ 1127 struct _GstH265Parser 1128 { 1129 /*< private >*/ 1130 GstH265VPS vps[GST_H265_MAX_VPS_COUNT]; 1131 GstH265SPS sps[GST_H265_MAX_SPS_COUNT]; 1132 GstH265PPS pps[GST_H265_MAX_PPS_COUNT]; 1133 GstH265VPS *last_vps; 1134 GstH265SPS *last_sps; 1135 GstH265PPS *last_pps; 1136 }; 1137 1138 GST_CODEC_PARSERS_API 1139 GstH265Parser * gst_h265_parser_new (void); 1140 1141 GST_CODEC_PARSERS_API 1142 GstH265ParserResult gst_h265_parser_identify_nalu (GstH265Parser * parser, 1143 const guint8 * data, 1144 guint offset, 1145 gsize size, 1146 GstH265NalUnit * nalu); 1147 1148 GST_CODEC_PARSERS_API 1149 GstH265ParserResult gst_h265_parser_identify_nalu_unchecked (GstH265Parser * parser, 1150 const guint8 * data, 1151 guint offset, 1152 gsize size, 1153 GstH265NalUnit * nalu); 1154 1155 GST_CODEC_PARSERS_API 1156 GstH265ParserResult gst_h265_parser_identify_nalu_hevc (GstH265Parser * parser, 1157 const guint8 * data, 1158 guint offset, 1159 gsize size, 1160 guint8 nal_length_size, 1161 GstH265NalUnit * nalu); 1162 1163 GST_CODEC_PARSERS_API 1164 GstH265ParserResult gst_h265_parser_parse_nal (GstH265Parser * parser, 1165 GstH265NalUnit * nalu); 1166 1167 GST_CODEC_PARSERS_API 1168 GstH265ParserResult gst_h265_parser_parse_slice_hdr (GstH265Parser * parser, 1169 GstH265NalUnit * nalu, 1170 GstH265SliceHdr * slice); 1171 1172 GST_CODEC_PARSERS_API 1173 GstH265ParserResult gst_h265_parser_parse_vps (GstH265Parser * parser, 1174 GstH265NalUnit * nalu, 1175 GstH265VPS * vps); 1176 1177 GST_CODEC_PARSERS_API 1178 GstH265ParserResult gst_h265_parser_parse_sps (GstH265Parser * parser, 1179 GstH265NalUnit * nalu, 1180 GstH265SPS * sps, 1181 gboolean parse_vui_params); 1182 1183 GST_CODEC_PARSERS_API 1184 GstH265ParserResult gst_h265_parser_parse_pps (GstH265Parser * parser, 1185 GstH265NalUnit * nalu, 1186 GstH265PPS * pps); 1187 1188 GST_CODEC_PARSERS_API 1189 GstH265ParserResult gst_h265_parser_parse_sei (GstH265Parser * parser, 1190 GstH265NalUnit * nalu, 1191 GArray **messages); 1192 1193 GST_CODEC_PARSERS_API 1194 void gst_h265_parser_free (GstH265Parser * parser); 1195 1196 GST_CODEC_PARSERS_API 1197 GstH265ParserResult gst_h265_parse_vps (GstH265NalUnit * nalu, 1198 GstH265VPS * vps); 1199 1200 GST_CODEC_PARSERS_API 1201 GstH265ParserResult gst_h265_parse_sps (GstH265Parser * parser, 1202 GstH265NalUnit * nalu, 1203 GstH265SPS * sps, 1204 gboolean parse_vui_params); 1205 1206 GST_CODEC_PARSERS_API 1207 GstH265ParserResult gst_h265_parse_pps (GstH265Parser * parser, 1208 GstH265NalUnit * nalu, 1209 GstH265PPS * pps); 1210 1211 GST_CODEC_PARSERS_API 1212 gboolean gst_h265_slice_hdr_copy (GstH265SliceHdr * dst_slice, 1213 const GstH265SliceHdr * src_slice); 1214 1215 GST_CODEC_PARSERS_API 1216 void gst_h265_slice_hdr_free (GstH265SliceHdr * slice_hdr); 1217 1218 GST_CODEC_PARSERS_API 1219 gboolean gst_h265_sei_copy (GstH265SEIMessage * dest_sei, 1220 const GstH265SEIMessage * src_sei); 1221 1222 GST_CODEC_PARSERS_API 1223 void gst_h265_sei_free (GstH265SEIMessage * sei); 1224 1225 GST_CODEC_PARSERS_API 1226 void gst_h265_quant_matrix_4x4_get_zigzag_from_raster (guint8 out_quant[16], 1227 const guint8 quant[16]); 1228 1229 GST_CODEC_PARSERS_API 1230 void gst_h265_quant_matrix_4x4_get_raster_from_zigzag (guint8 out_quant[16], 1231 const guint8 quant[16]); 1232 1233 GST_CODEC_PARSERS_API 1234 void gst_h265_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64], 1235 const guint8 quant[64]); 1236 1237 GST_CODEC_PARSERS_API 1238 void gst_h265_quant_matrix_8x8_get_raster_from_zigzag (guint8 out_quant[64], 1239 const guint8 quant[64]); 1240 1241 #define gst_h265_quant_matrix_16x16_get_zigzag_from_raster \ 1242 gst_h265_quant_matrix_8x8_get_zigzag_from_raster 1243 #define gst_h265_quant_matrix_16x16_get_raster_from_zigzag \ 1244 gst_h265_quant_matrix_8x8_get_raster_from_zigzag 1245 #define gst_h265_quant_matrix_32x32_get_zigzag_from_raster \ 1246 gst_h265_quant_matrix_8x8_get_zigzag_from_raster 1247 #define gst_h265_quant_matrix_32x32_get_raster_from_zigzag \ 1248 gst_h265_quant_matrix_8x8_get_raster_from_zigzag 1249 1250 GST_CODEC_PARSERS_API 1251 void gst_h265_quant_matrix_4x4_get_uprightdiagonal_from_raster (guint8 out_quant[16], 1252 const guint8 quant[16]); 1253 1254 GST_CODEC_PARSERS_API 1255 void gst_h265_quant_matrix_4x4_get_raster_from_uprightdiagonal (guint8 out_quant[16], 1256 const guint8 quant[16]); 1257 1258 GST_CODEC_PARSERS_API 1259 void gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster (guint8 out_quant[64], 1260 const guint8 quant[64]); 1261 1262 GST_CODEC_PARSERS_API 1263 void gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal (guint8 out_quant[64], 1264 const guint8 quant[64]); 1265 1266 #define gst_h265_quant_matrix_16x16_get_uprightdiagonal_from_raster \ 1267 gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster 1268 #define gst_h265_quant_matrix_16x16_get_raster_from_uprightdiagonal\ 1269 gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal 1270 #define gst_h265_quant_matrix_32x32_get_uprightdiagonal_from_raster \ 1271 gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster 1272 #define gst_h265_quant_matrix_32x32_get_raster_from_uprightdiagonal\ 1273 gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal 1274 1275 GST_CODEC_PARSERS_API 1276 GstH265Profile gst_h265_profile_tier_level_get_profile (GstH265ProfileTierLevel * ptl); 1277 1278 G_END_DECLS 1279 #endif 1280