Coverage Report

Created: 2025-02-15 06:25

/src/wireshark/epan/dissectors/packet-h265.c
Line
Count
Source (jump to first uncovered line)
1
/* packet-h265.c
2
* Routines for H.265 dissection
3
* Copyright 2018, Asaf Kave <kave.asaf[at]gmail.com>
4
* Based on the H.264 dissector, thanks!
5
*
6
* Wireshark - Network traffic analyzer
7
* By Gerald Combs <gerald@wireshark.org>
8
* Copyright 1998 Gerald Combs
9
*
10
* SPDX-License-Identifier: GPL-2.0-or-later
11
*
12
* References:
13
* https://tools.ietf.org/html/rfc7798
14
* http://www.itu.int/rec/T-REC-H.265/en
15
*/
16
17
#include "config.h"
18
19
20
#include <epan/packet.h>
21
#include <epan/expert.h>
22
#include <epan/prefs.h>
23
#include <epan/tfs.h>
24
#include "packet-h265.h"
25
#include "math.h"
26
27
void proto_register_h265(void);
28
void proto_reg_handoff_h265(void);
29
30
/* Initialize the protocol and registered fields */
31
static int proto_h265;
32
static int hf_h265_type;
33
static int hf_h265_nal_unit_type;
34
static int hf_h265_nuh_layer_id;
35
static int hf_h265_nuh_temporal_id_plus1;
36
static int hf_h265_nal_f_bit;
37
static int hf_h265_start_bit;
38
static int hf_h265_end_bit;
39
static int hf_h265_rbsp_stop_bit;
40
static int hf_h265_rbsp_trailing_bits;
41
42
/* SDP */
43
static int hf_h265_sdp_parameter_sprop_vps;
44
static int hf_h265_sdp_parameter_sprop_sps;
45
static int hf_h265_sdp_parameter_sprop_pps;
46
47
/*vps*/
48
static int hf_h265_vps_video_parameter_set_id;
49
static int hf_h265_vps_base_layer_internal_flag;
50
static int hf_h265_vps_base_layer_available_flag;
51
static int hf_h265_vps_max_layers_minus1;
52
static int hf_h265_vps_max_sub_layers_minus1;
53
static int hf_h265_vps_temporal_id_nesting_flag;
54
static int hf_h265_vps_reserved_0xffff_16bits;
55
static int hf_h265_vps_sub_layer_ordering_info_present_flag;
56
static int hf_h265_vps_max_dec_pic_buffering_minus1;
57
static int hf_h265_vps_max_num_reorder_pics;
58
static int hf_h265_vps_max_latency_increase_plus1;
59
static int hf_h265_vps_max_layer_id;
60
static int hf_h265_vps_num_layer_sets_minus1;
61
static int hf_h265_layer_id_included_flag;
62
static int hf_h265_vps_timing_info_present_flag;
63
static int hf_h265_vps_num_units_in_tick;
64
static int hf_h265_vps_time_scale;
65
static int hf_h265_vps_poc_proportional_to_timing_flag;
66
static int hf_h265_vps_num_ticks_poc_diff_one_minus1;
67
static int hf_h265_vps_num_hrd_parameters;
68
static int hf_h265_hrd_layer_set_idx;
69
static int hf_h265_cprms_present_flag;
70
static int hf_h265_vps_extension_flag;
71
static int hf_h265_vps_extension_data_flag;
72
73
/* profile_tier_level  */
74
static int hf_h265_general_profile_space;
75
static int hf_h265_general_tier_flag;
76
static int hf_h265_general_profile_idc;
77
static int hf_h265_general_profile_compatibility_flags;
78
static int hf_h265_general_progressive_source_flag;
79
static int hf_h265_general_interlaced_source_flag;
80
static int hf_h265_general_non_packed_constraint_flag;
81
static int hf_h265_general_frame_only_constraint_flag;
82
static int hf_h265_general_max_12bit_constraint_flag;
83
static int hf_h265_general_max_10bit_constraint_flag;
84
static int hf_h265_general_max_8bit_constraint_flag;
85
static int hf_h265_general_max_422chroma_constraint_flag;
86
static int hf_h265_general_max_420chroma_constraint_flag;
87
static int hf_h265_general_max_monochrome_constraint_flag;
88
static int hf_h265_general_intra_constraint_flag;
89
static int hf_h265_general_one_picture_only_constraint_flag;
90
static int hf_h265_general_lower_bit_rate_constraint_flag;
91
static int hf_h265_general_max_14bit_constraint_flag;
92
static int hf_h265_general_reserved_zero_33bits;
93
static int hf_h265_general_reserved_zero_34bits;
94
static int hf_h265_general_reserved_zero_7bits;
95
static int hf_h265_general_reserved_zero_35bits;
96
static int hf_h265_general_reserved_zero_43bits;
97
static int hf_h265_general_inbld_flag;
98
static int hf_h265_general_reserved_zero_bit;
99
static int hf_h265_general_level_idc;
100
static int hf_h265_sub_layer_profile_present_flag;
101
static int hf_h265_sub_layer_level_present_flag;
102
static int hf_h265_reserved_zero_2bits;
103
static int hf_h265_sub_layer_profile_space;
104
static int hf_h265_sub_layer_tier_flag;
105
static int hf_h265_sub_layer_profile_idc;
106
static int hf_h265_sub_layer_profile_compatibility_flag;
107
static int hf_h265_sub_layer_progressive_source_flag;
108
static int hf_h265_sub_layer_interlaced_source_flag;
109
static int hf_h265_sub_layer_non_packed_constraint_flag;
110
static int hf_h265_sub_layer_frame_only_constraint_flag;
111
static int hf_h265_sub_layer_max_12bit_constraint_flag;
112
static int hf_h265_sub_layer_max_10bit_constraint_flag;
113
static int hf_h265_sub_layer_max_8bit_constraint_flag;
114
static int hf_h265_sub_layer_max_422chroma_constraint_flag;
115
static int hf_h265_sub_layer_max_420chroma_constraint_flag;
116
static int hf_h265_sub_layer_max_monochrome_constraint_flag;
117
static int hf_h265_sub_layer_intra_constraint_flag;
118
static int hf_h265_sub_layer_one_picture_only_constraint_flag;
119
static int hf_h265_sub_layer_lower_bit_rate_constraint_flag;
120
static int hf_h265_sub_layer_max_14bit_constraint_flag;
121
static int hf_h265_sub_layer_reserved_zero_33bits;
122
static int hf_h265_sub_layer_reserved_zero_34bits;
123
static int hf_h265_sub_layer_reserved_zero_7bits;
124
static int hf_h265_sub_layer_reserved_zero_35bits;
125
static int hf_h265_sub_layer_reserved_zero_43bits;
126
static int hf_h265_sub_layer_inbld_flag;
127
static int hf_h265_sub_layer_reserved_zero_bit;
128
static int hf_h265_sub_layer_level_idc;
129
130
/* hrd_parameters */
131
static int hf_h265_nal_hrd_parameters_present_flag;
132
static int hf_h265_vcl_hrd_parameters_present_flag;
133
static int hf_h265_sub_pic_hrd_params_present_flag;
134
static int hf_h265_tick_divisor_minus2;
135
static int hf_h265_du_cpb_removal_delay_increment_length_minus1;
136
static int hf_h265_sub_pic_cpb_params_in_pic_timing_sei_flag;
137
static int hf_h265_dpb_output_delay_du_length_minus1;
138
static int hf_h265_bit_rate_scale;
139
static int hf_h265_cpb_size_scale;
140
static int hf_h265_cpb_size_du_scale;
141
static int hf_h265_initial_cpb_removal_delay_length_minus1;
142
static int hf_h265_au_cpb_removal_delay_length_minus1;
143
static int hf_h265_dpb_output_delay_length_minus1;
144
static int hf_h265_fixed_pic_rate_general_flag;
145
static int hf_h265_fixed_pic_rate_within_cvs_flag;
146
static int hf_h265_elemental_duration_in_tc_minus1;
147
static int hf_h265_low_delay_hrd_flag;
148
static int hf_h265_cpb_cnt_minus1;
149
/* sub-layer hrd_parameters */
150
static int hf_h265_bit_rate_value_minus1;
151
static int hf_h265_cpb_size_value_minus1;
152
static int hf_h265_cpb_size_du_value_minus1;
153
static int hf_h265_bit_rate_du_value_minus1;
154
static int hf_h265_cbr_flag;
155
156
/*sps*/
157
static int hf_h265_sps_video_parameter_set_id;
158
static int hf_h265_sps_max_sub_layers_minus1;
159
static int hf_h265_sps_temporal_id_nesting_flag;
160
static int hf_h265_sps_seq_parameter_set_id;
161
static int hf_h265_chroma_format_idc;
162
static int hf_h265_separate_colour_plane_flag;
163
static int hf_h265_pic_width_in_luma_samples;
164
static int hf_h265_pic_height_in_luma_samples;
165
static int hf_h265_conformance_window_flag;
166
static int hf_h265_conf_win_left_offset;
167
static int hf_h265_conf_win_right_offset;
168
static int hf_h265_conf_win_top_offset;
169
static int hf_h265_conf_win_bottom_offset;
170
static int hf_h265_bit_depth_luma_minus8;
171
static int hf_h265_bit_depth_chroma_minus8;
172
static int hf_h265_log2_max_pic_order_cnt_lsb_minus4;
173
static int hf_h265_sps_sub_layer_ordering_info_present_flag;
174
static int hf_h265_sps_max_dec_pic_buffering_minus1;
175
static int hf_h265_sps_max_num_reorder_pics;
176
static int hf_h265_sps_max_latency_increase_plus1;
177
static int hf_h265_log2_min_luma_coding_block_size_minus3;
178
static int hf_h265_log2_diff_max_min_luma_coding_block_size;
179
static int hf_h265_log2_min_luma_transform_block_size_minus2;
180
static int hf_h265_log2_diff_max_min_luma_transform_block_size;
181
static int hf_h265_max_transform_hierarchy_depth_inter;
182
static int hf_h265_max_transform_hierarchy_depth_intra;
183
static int hf_h265_scaling_list_enabled_flag;
184
static int hf_h265_sps_scaling_list_data_present_flag;
185
static int hf_h265_amp_enabled_flag;
186
static int hf_h265_sample_adaptive_offset_enabled_flag;
187
static int hf_h265_pcm_enabled_flag;
188
static int hf_h265_pcm_sample_bit_depth_luma_minus1;
189
static int hf_h265_pcm_sample_bit_depth_chroma_minus1;
190
static int hf_h265_log2_min_pcm_luma_coding_block_size_minus3;
191
static int hf_h265_log2_diff_max_min_pcm_luma_coding_block_size;
192
static int hf_h265_pcm_loop_filter_disabled_flag;
193
static int hf_h265_num_short_term_ref_pic_sets;
194
static int hf_h265_long_term_ref_pics_present_flag;
195
static int hf_h265_num_long_term_ref_pics_sps;
196
static int hf_h265_lt_ref_pic_poc_lsb_sps;
197
static int hf_h265_used_by_curr_pic_lt_sps_flag;
198
static int hf_h265_sps_temporal_mvp_enabled_flag;
199
static int hf_h265_strong_intra_smoothing_enabled_flag;
200
static int hf_h265_vui_parameters_present_flag;
201
static int hf_h265_sps_extension_present_flag;
202
static int hf_h265_sps_range_extension_flag;
203
static int hf_h265_sps_multilayer_extension_flag;
204
static int hf_h265_sps_3d_extension_flag;
205
static int hf_h265_sps_scc_extension_flag;
206
static int hf_h265_sps_extension_4bits;
207
static int hf_h265_sps_extension_data_flag;
208
/* scaling_list_data */
209
static int hf_h265_scaling_list_pred_mode_flag;
210
static int hf_h265_scaling_list_pred_matrix_id_delta;
211
static int hf_h265_scaling_list_dc_coef_minus8;
212
static int hf_h265_scaling_list_delta_coef;
213
/* st_ref_pic_set */
214
static int hf_h265_inter_ref_pic_set_prediction_flag;
215
static int hf_h265_delta_idx_minus1;
216
static int hf_h265_delta_rps_sign;
217
static int hf_h265_abs_delta_rps_minus1;
218
static int hf_h265_used_by_curr_pic_flag;
219
static int hf_h265_use_delta_flag;
220
static int hf_h265_num_negative_pics;
221
static int hf_h265_num_positive_pics;
222
static int hf_h265_delta_poc_s0_minus1;
223
static int hf_h265_used_by_curr_pic_s0_flag;
224
static int hf_h265_delta_poc_s1_minus1;
225
static int hf_h265_used_by_curr_pic_s1_flag;
226
/* sps_range_extension */
227
static int hf_h265_transform_skip_rotation_enabled_flag;
228
static int hf_h265_transform_skip_context_enabled_flag;
229
static int hf_h265_implicit_rdpcm_enabled_flag;
230
static int hf_h265_explicit_rdpcm_enabled_flag;
231
static int hf_h265_extended_precision_processing_flag;
232
static int hf_h265_intra_smoothing_disabled_flag;
233
static int hf_h265_high_precision_offsets_enabled_flag;
234
static int hf_h265_persistent_rice_adaptation_enabled_flag;
235
static int hf_h265_cabac_bypass_alignment_enabled_flag;
236
/* sps_scc_extension */
237
static int hf_h265_sps_curr_pic_ref_enabled_flag;
238
static int hf_h265_palette_mode_enabled_flag;
239
static int hf_h265_palette_max_size;
240
static int hf_h265_delta_palette_max_predictor_size;
241
static int hf_h265_sps_palette_predictor_initializers_present_flag;
242
static int hf_h265_sps_num_palette_predictor_initializers_minus1;
243
static int hf_h265_sps_palette_predictor_initializer;
244
static int hf_h265_motion_vector_resolution_control_idc;
245
static int hf_h265_intra_boundary_filtering_disabled_flag;
246
247
/* PPS */
248
static int hf_h265_pps_pic_parameter_set_id;
249
static int hf_h265_pps_seq_parameter_set_id;
250
static int hf_h265_dependent_slice_segments_enabled_flag;
251
static int hf_h265_output_flag_present_flag;
252
static int hf_h265_num_extra_slice_header_bits;
253
static int hf_h265_sign_data_hiding_enabled_flag;
254
static int hf_h265_cabac_init_present_flag;
255
static int hf_h265_num_ref_idx_l0_default_active_minus1;
256
static int hf_h265_num_ref_idx_l1_default_active_minus1;
257
static int hf_h265_init_qp_minus26;
258
static int hf_h265_constrained_intra_pred_flag;
259
static int hf_h265_transform_skip_enabled_flag;
260
static int hf_h265_cu_qp_delta_enabled_flag;
261
static int hf_h265_diff_cu_qp_delta_depth;
262
static int hf_h265_pps_cb_qp_offset;
263
static int hf_h265_pps_cr_qp_offset;
264
static int hf_h265_pps_slice_chroma_qp_offsets_present_flag;
265
static int hf_h265_weighted_pred_flag;
266
static int hf_h265_weighted_bipred_flag;
267
static int hf_h265_transquant_bypass_enabled_flag;
268
static int hf_h265_tiles_enabled_flag;
269
static int hf_h265_entropy_coding_sync_enabled_flag;
270
static int hf_h265_num_tile_columns_minus1;
271
static int hf_h265_num_tile_rows_minus1;
272
static int hf_h265_uniform_spacing_flag;
273
static int hf_h265_column_width_minus1;
274
static int hf_h265_row_height_minus1;
275
static int hf_h265_loop_filter_across_tiles_enabled_flag;
276
static int hf_h265_pps_loop_filter_across_slices_enabled_flag;
277
static int hf_h265_deblocking_filter_control_present_flag;
278
static int hf_h265_deblocking_filter_override_enabled_flag;
279
static int hf_h265_pps_deblocking_filter_disabled_flag;
280
static int hf_h265_pps_beta_offset_div2;
281
static int hf_h265_pps_tc_offset_div2;
282
static int hf_h265_pps_scaling_list_data_present_flag;
283
static int hf_h265_lists_modification_present_flag;
284
static int hf_h265_log2_parallel_merge_level_minus2;
285
static int hf_h265_slice_segment_header_extension_present_flag;
286
static int hf_h265_pps_extension_present_flag;
287
static int hf_h265_pps_range_extension_flag;
288
static int hf_h265_pps_multilayer_extension_flag;
289
static int hf_h265_pps_3d_extension_flag;
290
static int hf_h265_pps_scc_extension_flag;
291
static int hf_h265_pps_extension_4bits;
292
static int hf_h265_pps_extension_data_flag;
293
/*pps_range_extension*/
294
static int hf_h265_log2_max_transform_skip_block_size_minus2;
295
static int hf_h265_cross_component_prediction_enabled_flag;
296
static int hf_h265_chroma_qp_offset_list_enabled_flag;
297
static int hf_h265_diff_cu_chroma_qp_offset_depth;
298
static int hf_h265_chroma_qp_offset_list_len_minus1;
299
static int hf_h265_cb_qp_offset_list;
300
static int hf_h265_cr_qp_offset_list;
301
static int hf_h265_log2_sao_offset_scale_luma;
302
static int hf_h265_log2_sao_offset_scale_chroma;
303
/*pps_scc_extension*/
304
static int hf_h265_pps_curr_pic_ref_enabled_flag;
305
static int hf_h265_residual_adaptive_colour_transform_enabled_flag;
306
static int hf_h265_pps_slice_act_qp_offsets_present_flag;
307
static int hf_h265_pps_act_y_qp_offset_plus5;
308
static int hf_h265_pps_act_cb_qp_offset_plus5;
309
static int hf_h265_pps_act_cr_qp_offset_plus3;
310
static int hf_h265_pps_palette_predictor_initializers_present_flag;
311
static int hf_h265_pps_num_palette_predictor_initializers;
312
static int hf_h265_monochrome_palette_flag;
313
static int hf_h265_luma_bit_depth_entry_minus8;
314
static int hf_h265_chroma_bit_depth_entry_minus8;
315
static int hf_h265_pps_palette_predictor_initializer;
316
317
/* VUI parameters */
318
static int hf_h265_aspect_ratio_info_present_flag;
319
static int hf_h265_aspect_ratio_idc;
320
static int hf_h265_sar_width;
321
static int hf_h265_sar_height;
322
static int hf_h265_overscan_info_present_flag;
323
static int hf_h265_overscan_appropriate_flag;
324
static int hf_h265_video_signal_type_present_flag;
325
static int hf_h265_video_format;
326
static int hf_h265_video_full_range_flag;
327
static int hf_h265_colour_description_present_flag;
328
static int hf_h265_colour_primaries;
329
static int hf_h265_transfer_characteristics;
330
static int hf_h265_matrix_coeffs;
331
static int hf_h265_chroma_loc_info_present_flag;
332
static int hf_h265_chroma_sample_loc_type_top_field;
333
static int hf_h265_chroma_sample_loc_type_bottom_field;
334
static int hf_h265_neutral_chroma_indication_flag;
335
static int hf_h265_field_seq_flag;
336
static int hf_h265_frame_field_info_present_flag;
337
static int hf_h265_default_display_window_flag;
338
static int hf_h265_def_disp_win_left_offset;
339
static int hf_h265_def_disp_win_right_offset;
340
static int hf_h265_def_disp_win_top_offset;
341
static int hf_h265_def_disp_win_bottom_offset;
342
static int hf_h265_vui_timing_info_present_flag;
343
static int hf_h265_vui_num_units_in_tick;
344
static int hf_h265_vui_time_scale;
345
static int hf_h265_vui_poc_proportional_to_timing_flag;
346
static int hf_h265_vui_num_ticks_poc_diff_one_minus1;
347
static int hf_h265_vui_hrd_parameters_present_flag;
348
static int hf_h265_bitstream_restriction_flag;
349
static int hf_h265_tiles_fixed_structure_flag;
350
static int hf_h265_motion_vectors_over_pic_boundaries_flag;
351
static int hf_h265_restricted_ref_pic_lists_flag;
352
static int hf_h265_min_spatial_segmentation_idc;
353
static int hf_h265_max_bytes_per_pic_denom;
354
static int hf_h265_max_bits_per_min_cu_denom;
355
static int hf_h265_log2_max_mv_length_horizontal;
356
static int hf_h265_log2_max_mv_length_vertical;
357
358
/* slice_segment_header */
359
static int hf_h265_slice_pic_parameter_set_id;
360
static int hf_h265_slice_segment_address;
361
static int hf_h265_slice_type;
362
363
/* SEI */
364
static int hf_h265_payloadsize;
365
static int hf_h265_payloadtype;
366
367
/* access unit delimiter */
368
static int hf_h265_pic_type;
369
370
/* Initialize the subtree pointers */
371
static int ett_h265;
372
static int ett_h265_profile;
373
static int ett_h265_nal;
374
static int ett_h265_fu;
375
static int ett_h265_stream;
376
377
static int ett_h265_sps_multilayer_extension;
378
static int ett_h265_sps_3d_extension;
379
static int ett_h265_pps_multilayer_extension;
380
static int ett_h265_pps_3d_extension;
381
static int ett_h265_access_unit_delimiter_rbsp;
382
static int ett_h265_sei_rbsp;
383
static int ett_h265_filler_data_rbsp;
384
static int ett_h265_end_of_seq_rbsp;
385
static int ett_h265_end_of_bitstream_rbsp;
386
static int ett_h265_profile_tier_level;
387
static int ett_h265_ref_pic_set;
388
static int ett_h265_vui_parameters;
389
static int ett_h265_hrd_parameters;
390
static int ett_h265_sprop_parameters;
391
392
static expert_field ei_h265_undecoded;
393
static expert_field ei_h265_format_specific_parameter;
394
static expert_field ei_h265_oversized_exp_golomb_code;
395
static expert_field ei_h265_value_to_large;
396
397
static dissector_handle_t h265_handle;
398
399
static bool dependent_slice_segments_enabled_flag;
400
static unsigned num_extra_slice_header_bits;
401
static unsigned log2_min_luma_coding_block_size_minus3;
402
static unsigned log2_diff_max_min_luma_coding_block_size;
403
static unsigned pic_width_in_luma_samples;
404
static unsigned pic_height_in_luma_samples;
405
406
/* syntax tables in subclause 7.3 is equal to
407
* ue(v), me(v), se(v), or te(v).
408
*/
409
typedef enum {
410
  H265_UE_V = 0,
411
  H265_ME_V = 1,
412
  H265_SE_V = 2,
413
  H265_TE_V = 3
414
} h265_golomb_descriptors;
415
416
417
static const true_false_string h265_f_bit_vals = {
418
  "Bit errors or other syntax violations",
419
  "No bit errors or other syntax violations"
420
};
421
422
static const true_false_string h265_start_bit_vals = {
423
  "the first packet of FU-A picture",
424
  "Not the first packet of FU-A picture"
425
};
426
427
static const true_false_string h265_end_bit_vals = {
428
  "the last packet of FU-A picture",
429
  "Not the last packet of FU-A picture"
430
};
431
432
static const value_string h265_type_values[] = {
433
  { 0,   "TRAIL_N - Coded slice segment of a non-TSA, non-STSA trailing picture" },
434
  { 1,   "TRAIL_R - Coded slice segment of a non-TSA, non-STSA trailing picture" },
435
  { 2,   "TSA_N - Coded slice segment of a TSA picture" },
436
  { 3,   "TSA_R - Coded slice segment of a TSA picture" },
437
  { 4,   "STSA_N - Coded slice segment of an STSA picture" },
438
  { 5,   "STSA_R - Coded slice segment of an STSA picture" },
439
  { 6,   "RADL_N - Coded slice segment of a RADL picture" },
440
  { 7,   "RADL_R - Coded slice segment of a RADL picture" },
441
  { 8,   "RASL_N - Coded slice segment of a RASL picture" },
442
  { 9,   "RASL_R - Coded slice segment of a RASL picture" },
443
  { 10,  "RSV_VCL_N10 - Reserved non-IRAP SLNR VCL NAL unit types" },
444
  { 11,  "RSV_VCL_R11 - Reserved non-IRAP sub-layer reference VCL NAL unit types" },
445
  { 12,  "RSV_VCL_N12 - Reserved non-IRAP SLNR VCL NAL unit types" },
446
  { 13,  "RSV_VCL_R13 - Reserved non-IRAP sub-layer reference VCL NAL unit types" },
447
  { 14,  "RSV_VCL_N14 - Reserved non-IRAP SLNR VCL NAL unit types" },
448
  { 15,  "RSV_VCL_R15 - Reserved non-IRAP sub-layer reference VCL NAL unit types" },
449
  { 16,  "BLA_W_LP - Coded slice segment of a BLA picture" },
450
  { 17,  "BLA_W_RADL - Coded slice segment of a BLA picture" },
451
  { 18,  "BLA_N_LP - Coded slice segment of a BLA picture" },
452
  { 19,  "IDR_W_RADL - Coded slice segment of an IDR picture" },
453
  { 20,  "IDR_N_LP - Coded slice segment of an IDR picture" },
454
  { 21,  "CRA_NUT - Coded slice segment of a CRA picture" },
455
  { 22,  "RSV_IRAP_VCL22 - Reserved IRAP VCL NAL unit types" },
456
  { 23,  "RSV_IRAP_VCL23 - Reserved IRAP VCL NAL unit types" },
457
  { 24,  "RSV_VCL24 - Reserved non-IRAP VCL NAL unit types" },
458
  { 25,  "RSV_VCL25 - Reserved non-IRAP VCL NAL unit types" },
459
  { 26,  "RSV_VCL26 - Reserved non-IRAP VCL NAL unit types" },
460
  { 27,  "RSV_VCL27 - Reserved non-IRAP VCL NAL unit types" },
461
  { 28,  "RSV_VCL28 - Reserved non-IRAP VCL NAL unit types" },
462
  { 29,  "RSV_VCL29 - Reserved non-IRAP VCL NAL unit types" },
463
  { 30,  "RSV_VCL30 - Reserved non-IRAP VCL NAL unit types" },
464
  { 31,  "RSV_VCL31 - Reserved non-IRAP VCL NAL unit types" },
465
  { 32,  "VPS_NUT - Video parameter set" },
466
  { 33,  "SPS_NUT - Sequence parameter set" },
467
  { 34,  "PPS_NUT - Picture parameter set" },
468
  { 35,  "AUD_NUT - Access unit delimiter" },
469
  { 36,  "EOS_NUT - End of sequence" },
470
  { 37,  "EOB_NUT - End of bitstream" },
471
  { 38,  "FD_NUT - Filler data" },
472
  { 39,  "PREFIX_SEI_NUT - Supplemental enhancement information" },
473
  { 40,  "SUFFIX_SEI_NUT - Supplemental enhancement information" },
474
  { 41,  "RSV_NVCL41 - Reserved" },
475
  { 42,  "RSV_NVCL42 - Reserved" },
476
  { 43,  "RSV_NVCL43 - Reserved" },
477
  { 44,  "RSV_NVCL44 - Reserved" },
478
  { 45,  "RSV_NVCL45 - Reserved" },
479
  { 46,  "RSV_NVCL46 - Reserved" },
480
  { 47,  "RSV_NVCL47 - Reserved" },
481
  { 48,  "APS -  Aggregation Packets" },
482
  { 49,  "FU - Fragmentation Units" },
483
  { 50,  "PACI - PACI Packets" },
484
  { 51,  "UNSPEC51 - Unspecified" },
485
  { 52,  "UNSPEC52 - Unspecified" },
486
  { 53,  "UNSPEC53 - Unspecified" },
487
  { 54,  "UNSPEC54 - Unspecified" },
488
  { 55,  "UNSPEC55 - Unspecified" },
489
  { 56,  "UNSPEC56 - Unspecified" },
490
  { 57,  "UNSPEC57 - Unspecified" },
491
  { 58,  "UNSPEC58 - Unspecified" },
492
  { 59,  "UNSPEC59 - Unspecified" },
493
  { 60,  "UNSPEC60 - Unspecified" },
494
  { 61,  "UNSPEC61 - Unspecified" },
495
  { 62,  "UNSPEC62 - Unspecified" },
496
  { 63,  "UNSPEC63 - Unspecified" },
497
  { 0, NULL }
498
};
499
500
static const value_string h265_type_summary_values[] = {
501
  { 0,   "TRAIL_N" },
502
  { 1,   "TRAIL_R" },
503
  { 2,   "TSA_N" },
504
  { 3,   "TSA_R" },
505
  { 4,   "STSA_N" },
506
  { 5,   "STSA_R" },
507
  { 6,   "RADL_N" },
508
  { 7,   "RADL_R" },
509
  { 8,   "RASL_N" },
510
  { 9,   "RASL_R" },
511
  { 10,  "RSV_VCL_N10" },
512
  { 11,  "RSV_VCL_R11" },
513
  { 12,  "RSV_VCL_N12" },
514
  { 13,  "RSV_VCL_R13" },
515
  { 14,  "RSV_VCL_N14" },
516
  { 15,  "RSV_VCL_R15" },
517
  { 16,  "BLA_W_LP" },
518
  { 17,  "BLA_W_RADL" },
519
  { 18,  "BLA_N_LP" },
520
  { 19,  "IDR_W_RADL" },
521
  { 20,  "IDR_N_LP" },
522
  { 21,  "CRA_NUT" },
523
  { 22,  "RSV_IRAP_VCL22" },
524
  { 23,  "RSV_IRAP_VCL23" },
525
  { 24,  "RSV_VCL24" },
526
  { 25,  "RSV_VCL25" },
527
  { 26,  "RSV_VCL26" },
528
  { 27,  "RSV_VCL27" },
529
  { 28,  "RSV_VCL28" },
530
  { 29,  "RSV_VCL29" },
531
  { 30,  "RSV_VCL30" },
532
  { 31,  "RSV_VCL31" },
533
  { 32,  "VPS_NUT" },
534
  { 33,  "SPS_NUT" },
535
  { 34,  "PPS_NUT" },
536
  { 35,  "AUD_NUT" },
537
  { 36,  "EOS_NUT" },
538
  { 37,  "EOB_NUT" },
539
  { 38,  "FD_NUT" },
540
  { 39,  "PREFIX_SEI_NUT" },
541
  { 40,  "SUFFIX_SEI_NUT" },
542
  { 41,  "RSV_NVCL41" },
543
  { 42,  "RSV_NVCL42" },
544
  { 43,  "RSV_NVCL43" },
545
  { 44,  "RSV_NVCL44" },
546
  { 45,  "RSV_NVCL45" },
547
  { 46,  "RSV_NVCL46" },
548
  { 47,  "RSV_NVCL47" },
549
  { 48,  "APS" },
550
  { 49,  "FU" },
551
  { 50,  "PACI" },
552
  { 51,  "UNSPEC51" },
553
  { 52,  "UNSPEC52" },
554
  { 53,  "UNSPEC53" },
555
  { 54,  "UNSPEC54" },
556
  { 55,  "UNSPEC55" },
557
  { 56,  "UNSPEC56" },
558
  { 57,  "UNSPEC57" },
559
  { 58,  "UNSPEC58" },
560
  { 59,  "UNSPEC59" },
561
  { 60,  "UNSPEC60" },
562
  { 61,  "UNSPEC61" },
563
  { 62,  "UNSPEC62" },
564
  { 63,  "UNSPEC63" },
565
  { 0, NULL }
566
};
567
568
/* A.3 Profiles */
569
static const value_string h265_profile_idc_values[] = {
570
  { 1,  "Main profile" },
571
  { 2,  "Main 10 and Main 10 Still Picture profiles" },
572
  { 3,  "Main Still Picture profile" },
573
  { 4,  "Format range extensions profiles" },
574
  { 5,  "High throughput profiles" },
575
  { 9,  "Screen content coding extensions profiles" },
576
  { 0, NULL }
577
};
578
579
/* Table A.7-Tier and level limits for the video profiles */
580
/* XXX - this looks as if the values are 10 times the level value
581
 * in Table A.7. */
582
static const value_string h265_level_main_tier_bitrate_values[] = {
583
  { 10,   "128 kb/s" },
584
  { 20,   "1.5 Mb/s" },
585
  { 21,   "3 Mb/s" },
586
  { 30,   "6 Mb/s" },
587
  { 31,   "10 Mb/s" },
588
  { 40,   "12 Mb/s" },
589
  { 41,   "20 Mb/s" },
590
  { 50,   "25 Mb/s" },
591
  { 51,   "40 Mb/s" },
592
  { 52,   "60 Mb/s" },
593
  { 60,   "60 Mb/s" },
594
  { 61,   "120 Mb/s" },
595
  { 62,   "240 Mb/s" },
596
  { 0, NULL }
597
};
598
/*High tier*/
599
static const value_string h265_level_high_tier_bitrate_values[] = {
600
  { 40,   "30 Mb/s" },
601
  { 41,   "50 Mb/s" },
602
  { 50,   "100 Mb/s" },
603
  { 51,   "160 Mb/s" },
604
  { 52,   "240 Mb/s" },
605
  { 60,   "240 Mb/s" },
606
  { 61,   "480 Mb/s" },
607
  { 62,   "800 Mb/s" },
608
  { 0, NULL }
609
};
610
611
/* Table 7-7 - Name association to slice_type */
612
static const value_string h265_slice_type_vals[] = {
613
  { 0,    "B (B slice)" },
614
  { 1,    "P (P slice)" },
615
  { 2,    "I (I slice)" },
616
  { 0, NULL }
617
};
618
619
/* D.2 SEI payload syntax */
620
static const value_string h265_sei_payload_vals[] = {
621
  { 0,   "buffering_period" },
622
  { 1,   "pic_timing" },
623
  { 2,   "pan_scan_rect" },
624
  { 3,   "filler_payload" },
625
  { 4,   "user_data_registered_itu_t_t35" },
626
  { 5,   "user_data_unregistered" },
627
  { 6,   "recovery_point" },
628
  { 9,   "scene_info" },
629
  { 15,   "picture_snapshot" },
630
  { 16,   "progressive_refinement_segment_start" },
631
  { 17,   "progressive_refinement_segment_end" },
632
  { 19,   "film_grain_characteristics" },
633
  { 23,   "tone_mapping_info" },
634
  { 45,   "frame_packing_arrangement" },
635
  { 47,   "display_orientation" },
636
  { 56,   "green_metadata" }, /* specified in ISO/IEC 23001-11 */
637
  { 128,   "structure_of_pictures_info" },
638
  { 129,   "active_parameter_sets" },
639
  { 130,   "decoding_unit_info" },
640
  { 131,   "temporal_sub_layer_zero_idx" },
641
  { 133,   "scalable_nesting" },
642
  { 134,   "region_refresh_info" },
643
  { 135,   "no_display" },
644
  { 136,   "time_code" },
645
  { 137,   "mastering_display_colour_volume" },
646
  { 138,   "segmented_rect_frame_packing_arrangement" },
647
  { 139,   "temporal_motion_constrained_tile_sets" },
648
  { 140,   "chroma_resampling_filter_hint" },
649
  { 141,   "knee_function_info" },
650
  { 142,   "colour_remapping_info" },
651
  { 143,   "deinterlaced_field_identification" },
652
  { 144,   "content_light_level_info" },
653
  { 145,   "dependent_rap_indication" },
654
  { 146,   "coded_region_completion" },
655
  { 147,   "alternative_transfer_characteristics" },
656
  { 148,   "ambient_viewing_environment" },
657
  { 149,   "content_colour_volume" },
658
  { 150,   "equirectangular_projection" },
659
  { 151,   "cubemap_projection" },
660
  { 154,   "sphere_rotation" },
661
  { 155,   "regionwise_packing" },
662
  { 156,   "omni_viewport" },
663
  { 157,   "regional_nesting" },
664
  { 158,   "mcts_extraction_info_sets" },
665
  { 159,   "mcts_extraction_info_nesting" },
666
  { 160,   "layers_not_present" }, /* specified in Annex F */
667
  { 161,   "inter_layer_constrained_tile_sets" }, /* specified in Annex F */
668
  { 162,   "bsp_nesting" }, /* specified in Annex F */
669
  { 163,   "bsp_initial_arrival_time" }, /* specified in Annex F */
670
  { 164,   "sub_bitstream_property" }, /* specified in Annex F */
671
  { 165,   "alpha_channel_info" }, /* specified in Annex F */
672
  { 166,   "overlay_info" }, /* specified in Annex F */
673
  { 167,   "temporal_mv_prediction_constraints" }, /* specified in Annex F */
674
  { 168,   "frame_field_info" }, /* specified in Annex F */
675
  { 176,   "three_dimensional_reference_displays_info" }, /* specified in Annex G */
676
  { 177,   "depth_representation_info" }, /* specified in Annex G */
677
  { 178,   "multiview_scene_info" }, /* specified in Annex G */
678
  { 179,   "multiview_acquisition_info" }, /* specified in Annex G */
679
  { 180,   "multiview_view_position" }, /* specified in Annex G */
680
  { 181,   "alternative_depth_info" }, /* specified in Annex I */
681
  { 0, NULL }
682
};
683
684
/* Table 7-2 - Interpretation of pic_type */
685
static const value_string h265_pic_type_vals[] = {
686
  { 0,    "I" },
687
  { 1,    "P, I" },
688
  { 2,    "B, P, I" },
689
  { 0, NULL }
690
};
691
692
/* Ref 7.3.2.2 Sequence parameter set RBSP syntax
693
 * num_short_term_ref_pic_sets specifies the number of st_ref_pic_set( ) syntax structures included in the SPS. The value
694
 * of num_short_term_ref_pic_sets shall be in the range of 0 to 64, inclusive
695
 */
696
0
#define H265_MAX_NUM_SHORT_TERM_REF_PIC_SETS 64
697
698
static int
699
dissect_h265(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
700
static int
701
dissect_h265_profile_tier_level(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int offset, bool profilePresentFlag, int vps_max_sub_layers_minus1);
702
static int
703
dissect_h265_hrd_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, int bit_offset, bool commonInfPresentFlag, unsigned maxNumSubLayersMinus1);
704
static int
705
dissect_h265_scaling_list_data(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset);
706
static int
707
dissect_h265_st_ref_pic_set(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset, int stRpsIdx, int num_short_term_ref_pic_sets, int32_t NumDeltaPocs[H265_MAX_NUM_SHORT_TERM_REF_PIC_SETS]);
708
static int
709
dissect_h265_vui_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int bit_offset, uint8_t sps_max_sub_layers_minus1);
710
static int
711
dissect_h265_sps_range_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset);
712
static int
713
dissect_h265_sps_multilayer_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset);
714
static int
715
dissect_h265_sps_3d_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset);
716
static int
717
dissect_h265_sps_scc_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset, unsigned chroma_format_idc, unsigned bit_depth_luma_minus8, unsigned bit_depth_chroma_minus8);
718
static int
719
dissect_h265_pps_range_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset, unsigned transform_skip_enabled_flag);
720
static int
721
dissect_h265_pps_scc_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset);
722
static int
723
dissect_h265_pps_multilayer_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset);
724
static int
725
dissect_h265_pps_3d_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset);
726
static int
727
dissect_h265_sei_message(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset, uint8_t nal_unit_type);
728
729
#if 0
730
/* byte_aligned( ) is specified as follows.
731
* - If the current position in the bitstream is on a byte boundary, i.e.,
732
*   the next bit in the bitstream is the first bit in a byte,
733
*   the return value of byte_aligned( ) is equal to true.
734
* - Otherwise, the return value of byte_aligned( ) is equal to false.
735
*/
736
static bool
737
h265_byte_aligned(int bit_offset)
738
{
739
  if (bit_offset & 0x3)
740
    return false;
741
742
  return true;
743
}
744
745
/* more_data_in_payload( ) is specified as follows:
746
* - If byte_aligned( ) is equal to true and the current position in the sei_payload( ) syntax structure is
747
* 8 * payloadSize bits from the beginning of the sei_payload( ) syntax structure, the return value of
748
* more_data_in_payload( ) is equal to false.
749
* - Otherwise, the return value of more_data_in_payload( ) is equal to true.
750
*/
751
static bool
752
h265_more_data_in_payload(int bit_start, int bit_offset, int payloadSize)
753
{
754
  if (h265_byte_aligned(bit_offset) && bit_start + 8 * payloadSize == bit_offset)
755
    return false;
756
757
  return true;
758
}
759
760
/* payload_extension_present( ) is specified as follows:
761
* - If the current position in the sei_payload( ) syntax structure is not the position of the last (least significant, right-
762
* most) bit that is equal to 1 that is less than 8 * payloadSize bits from the beginning of the syntax structure (i.e.,
763
* the position of the payload_bit_equal_to_one syntax element), the return value of payload_extension_present( ) is equal to true.
764
* - Otherwise, the return value of payload_extension_present( )
765
* is equal to false.
766
*/
767
static bool
768
h265_payload_extension_present(tvbuff_t* tvb, int bit_start, int bit_offset, int payloadSize)
769
{
770
  if (bit_start + 8 * payloadSize > bit_offset && tvb_get_bits8(tvb, bit_offset, 1))
771
    return true;
772
773
  return false;
774
}
775
#endif
776
777
/* Expect a tvb and a bit offset into the tvb
778
* returns the value and bit_offset
779
*
780
* This supports 32 bit output values. If the exp-Golomb coded value overflows
781
* the 32 bit type, it will return the actual bit offset but clamp the value
782
* and add an expert info.
783
*/
784
0
#define cVALS(x) (const value_string*)(x)
785
786
static uint32_t
787
dissect_h265_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, packet_info *pinfo, int *start_bit_offset, h265_golomb_descriptors descriptor)
788
/*(tvbuff_t *tvb, int *start_bit_offset) */
789
0
{
790
0
  proto_item *ti;
791
792
0
  int      leading_zero_bits, bit_offset, start_offset;
793
0
  uint32_t codenum, mask, value, tmp;
794
0
  int32_t  se_value = 0;
795
0
  int      b;
796
0
  char    *str;
797
0
  int      bit;
798
0
  int      i;
799
0
  bool overflow = false;
800
0
  header_field_info *hf_field = NULL;
801
802
0
  start_offset = *start_bit_offset >> 3;
803
804
0
  if (hf_index > 0) {
805
0
    hf_field = proto_registrar_get_nth(hf_index);
806
0
  }
807
808
0
  if (hf_field) {
809
    /* Allow only int32_t for se(v), uint32_t for others. */
810
0
    switch (descriptor) {
811
0
    case H265_SE_V:
812
0
      DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_INT32);
813
0
      break;
814
815
0
    default:
816
0
      DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_UINT32);
817
0
      break;
818
0
    }
819
0
  }
820
821
0
  bit_offset = *start_bit_offset;
822
823
  /* prepare the string */
824
0
  str = (char *)wmem_alloc(pinfo->pool, 256);
825
0
  str[0] = '\0';
826
0
  for (bit = 0; bit<((int)(bit_offset & 0x07)); bit++) {
827
0
    if (bit && (!(bit % 4))) {
828
0
      (void) g_strlcat(str, " ", 256);
829
0
    }
830
0
    (void) g_strlcat(str, ".", 256);
831
0
  }
832
833
834
0
  leading_zero_bits = -1;
835
0
  for (b = 0; !b; leading_zero_bits++) {
836
0
    if (bit && (!(bit % 4))) {
837
0
      (void) g_strlcat(str, " ", 256);
838
0
    }
839
0
    if (bit && (!(bit % 8))) {
840
0
      (void) g_strlcat(str, " ", 256);
841
0
    }
842
0
    b = tvb_get_bits8(tvb, bit_offset, 1);
843
0
    if (b != 0) {
844
0
      (void) g_strlcat(str, "1", 256);
845
0
    }
846
0
    else {
847
0
      (void) g_strlcat(str, "0", 256);
848
0
    }
849
0
    bit++;
850
0
    bit_offset++;
851
0
  }
852
853
  /* XXX: This could be handled in the general case and reduce code
854
   * duplication.  */
855
0
  if (leading_zero_bits == 0) {
856
0
    codenum = 0;
857
0
    *start_bit_offset = bit_offset;
858
0
    for (; bit % 8; bit++) {
859
0
      if (bit && (!(bit % 4))) {
860
0
        (void) g_strlcat(str, " ", 256);
861
0
      }
862
0
      (void) g_strlcat(str, ".", 256);
863
0
    }
864
0
    if (hf_field) {
865
0
      (void) g_strlcat(str, " = ", 256);
866
0
      (void) g_strlcat(str, hf_field->name, 256);
867
0
      switch (descriptor) {
868
0
      case H265_SE_V:
869
        /* if the syntax element is coded as se(v),
870
        * the value of the syntax element is derived by invoking the
871
        * mapping process for signed Exp-Golomb codes as specified in
872
        * subclause 9.1.1 with codeNum as the input.
873
        */
874
0
        if (hf_field->type == FT_INT32) {
875
0
          if (hf_field->strings) {
876
0
            proto_tree_add_int_format(tree, hf_index, tvb, start_offset, 1, codenum,
877
0
              "%s: %s (%d)",
878
0
              str,
879
0
              val_to_str_const(codenum, cVALS(hf_field->strings), "Unknown "),
880
0
              codenum);
881
0
          }
882
0
          else {
883
0
            switch (hf_field->display) {
884
0
            case BASE_DEC:
885
0
              proto_tree_add_int_format(tree, hf_index, tvb, start_offset, 1, codenum,
886
0
                "%s: %d",
887
0
                str,
888
0
                codenum);
889
0
              break;
890
0
            default:
891
0
              DISSECTOR_ASSERT_NOT_REACHED();
892
0
              break;
893
0
            }
894
0
          }
895
0
        }
896
0
        return codenum;
897
0
      default:
898
0
        break;
899
0
      }
900
0
      if (hf_field->type == FT_UINT32) {
901
0
        if (hf_field->strings) {
902
0
          proto_tree_add_uint_format(tree, hf_index, tvb, start_offset, 1, codenum,
903
0
            "%s: %s (%u)",
904
0
            str,
905
0
            val_to_str_const(codenum, cVALS(hf_field->strings), "Unknown "),
906
0
            codenum);
907
0
        }
908
0
        else {
909
0
          switch (hf_field->display) {
910
0
          case BASE_DEC:
911
0
            proto_tree_add_uint_format(tree, hf_index, tvb, start_offset, 1, codenum,
912
0
              "%s: %u",
913
0
              str,
914
0
              codenum);
915
0
            break;
916
0
          case BASE_HEX:
917
0
            proto_tree_add_uint_format(tree, hf_index, tvb, start_offset, 1, codenum,
918
0
              "%s: 0x%x",
919
0
              str,
920
0
              codenum);
921
0
            break;
922
0
          default:
923
0
            DISSECTOR_ASSERT_NOT_REACHED();
924
0
            break;
925
0
          }
926
0
        }
927
0
      }
928
0
      else {
929
        /* Only allow uint32_t */
930
0
        DISSECTOR_ASSERT_NOT_REACHED();
931
0
      }
932
0
    }
933
0
    return codenum;
934
0
  }
935
936
  /*
937
  Syntax elements coded as ue(v), me(v), or se(v) are Exp-Golomb-coded. Syntax elements coded as te(v) are truncated
938
  Exp-Golomb-coded. The parsing process for these syntax elements begins with reading the bits starting at the current
939
  location in the bitstream up to and including the first non-zero bit, and counting the number of leading bits that are
940
  equal to 0. This process is specified as follows:
941
  leadingZeroBits = -1;
942
  for (b = 0; !b; leadingZeroBits++)
943
  b = read_bits( 1 )
944
  The variable codeNum is then assigned as follows:
945
  codeNum = 2leadingZeroBits - 1 + read_bits( leadingZeroBits )
946
  where the value returned from read_bits( leadingZeroBits ) is interpreted as a binary representation of an unsigned
947
  integer with most significant bit written first.
948
  */
949
0
  if (leading_zero_bits > 32) {
950
0
    overflow = true;
951
0
    codenum = UINT32_MAX;
952
0
    if (descriptor == H265_SE_V) {
953
      /* For signed, must read the last bit to get the sign. */
954
0
      value = tvb_get_bits32(tvb, bit_offset + 32*(leading_zero_bits / 32), leading_zero_bits % 32, ENC_BIG_ENDIAN);
955
0
      if (value % 2) {
956
0
        se_value = INT32_MIN;
957
0
      } else {
958
0
        se_value = INT32_MAX;
959
0
      }
960
0
    }
961
0
  } else if (leading_zero_bits == 32) {
962
0
    value = tvb_get_bits32(tvb, bit_offset, leading_zero_bits, ENC_BIG_ENDIAN);
963
0
    codenum = UINT32_MAX;
964
    /* One one value doesn't overflow a 32 bit integer, but they're
965
     * different for unsigned and signed (because codenum UINT32_MAX maps
966
     * to INT32_MAX + 1 and UINT32_MAX + 1 maps to INT32_MIN.) */
967
0
    if (descriptor == H265_SE_V) {
968
0
      if (value != 1) {
969
0
        overflow = true;
970
0
      }
971
0
      if (value % 2) {
972
0
        se_value = INT32_MIN;
973
0
      } else {
974
0
        se_value = INT32_MAX;
975
0
      }
976
0
    } else {
977
0
      if (value != 0) {
978
0
        overflow = true;
979
0
      }
980
0
    }
981
0
    mask = 1U << 31;
982
0
  } else { /* Non-overflow general case */
983
0
    if (leading_zero_bits > 16)
984
0
      value = tvb_get_bits32(tvb, bit_offset, leading_zero_bits, ENC_BIG_ENDIAN);
985
0
    else if (leading_zero_bits > 8)
986
0
      value = tvb_get_bits16(tvb, bit_offset, leading_zero_bits, ENC_BIG_ENDIAN);
987
0
    else
988
0
      value = tvb_get_bits8(tvb, bit_offset, leading_zero_bits);
989
990
0
    codenum = 1;
991
0
    codenum = codenum << leading_zero_bits;
992
0
    mask = codenum >> 1;
993
0
    codenum = (codenum - 1) + value;
994
995
0
    if (descriptor == H265_SE_V) {
996
      /* if the syntax element is coded as se(v),
997
      * the value of the syntax element is derived by invoking the
998
      * mapping process for signed Exp-Golomb codes as specified in
999
      * subclause 9.1.1 with codeNum as the input.
1000
      *      k+1
1001
      * (-1)    Ceil( k/2 )
1002
      */
1003
0
      se_value = (codenum + 1) >> 1;
1004
0
      if (!(codenum & 1)) {
1005
0
        se_value = -se_value;
1006
0
      }
1007
0
    }
1008
1009
0
  }
1010
1011
0
  bit_offset = bit_offset + leading_zero_bits;
1012
1013
0
  if (overflow) {
1014
0
    *start_bit_offset = bit_offset;
1015
    /* We will probably get a BoundsError later in the packet. */
1016
0
    if (descriptor == H265_SE_V) {
1017
0
      ti = proto_tree_add_int_format_value(tree, hf_index, tvb, start_offset, (bit_offset >> 3) - start_offset + 1, codenum, "Invalid value (%d leading zero bits), clamped to %" PRId32, leading_zero_bits, se_value);
1018
0
      expert_add_info(NULL, ti, &ei_h265_oversized_exp_golomb_code);
1019
0
      return se_value;
1020
0
    } else {
1021
0
      ti = proto_tree_add_uint_format_value(tree, hf_index, tvb, start_offset, (bit_offset >> 3) - start_offset + 1, codenum, "Invalid value (%d leading zero bits), clamped to %" PRIu32, leading_zero_bits, codenum);
1022
0
      expert_add_info(NULL, ti, &ei_h265_oversized_exp_golomb_code);
1023
0
      return codenum;
1024
0
    }
1025
0
  }
1026
1027
  /* read the bits for the int */
1028
0
  for (i = 0; i<leading_zero_bits; i++) {
1029
0
    if (bit && (!(bit % 4))) {
1030
0
      (void) g_strlcat(str, " ", 256);
1031
0
    }
1032
0
    if (bit && (!(bit % 8))) {
1033
0
      (void) g_strlcat(str, " ", 256);
1034
0
    }
1035
0
    bit++;
1036
0
    tmp = value & mask;
1037
0
    if (tmp != 0) {
1038
0
      (void) g_strlcat(str, "1", 256);
1039
0
    }
1040
0
    else {
1041
0
      (void) g_strlcat(str, "0", 256);
1042
0
    }
1043
0
    mask = mask >> 1;
1044
0
  }
1045
0
  for (; bit % 8; bit++) {
1046
0
    if (bit && (!(bit % 4))) {
1047
0
      (void) g_strlcat(str, " ", 256);
1048
0
    }
1049
0
    (void) g_strlcat(str, ".", 256);
1050
0
  }
1051
1052
0
  if (hf_field) {
1053
0
    (void) g_strlcat(str, " = ", 256);
1054
0
    (void) g_strlcat(str, hf_field->name, 256);
1055
0
    switch (descriptor) {
1056
0
    case H265_SE_V:
1057
0
      (void) g_strlcat(str, "(se(v))", 256);
1058
      /* if the syntax element is coded as se(v),
1059
      * the value of the syntax element is derived by invoking the
1060
      * mapping process for signed Exp-Golomb codes as specified in
1061
      * subclause 9.1.1 with codeNum as the input.
1062
      */
1063
0
      break;
1064
0
    default:
1065
0
      break;
1066
0
    }
1067
0
    if (hf_field->type == FT_UINT32) {
1068
0
      if (hf_field->strings) {
1069
0
        proto_tree_add_uint_format(tree, hf_index, tvb, start_offset, 1, codenum,
1070
0
          "%s: %s (%u)",
1071
0
          str,
1072
0
          val_to_str_const(codenum, cVALS(hf_field->strings), "Unknown "),
1073
0
          codenum);
1074
0
      }
1075
0
      else {
1076
0
        switch (hf_field->display) {
1077
0
        case BASE_DEC:
1078
0
          proto_tree_add_uint_format(tree, hf_index, tvb, start_offset, 1, codenum,
1079
0
            "%s: %u",
1080
0
            str,
1081
0
            codenum);
1082
0
          break;
1083
0
        case BASE_HEX:
1084
0
          proto_tree_add_uint_format(tree, hf_index, tvb, start_offset, 1, codenum,
1085
0
            "%s: 0x%x",
1086
0
            str,
1087
0
            codenum);
1088
0
          break;
1089
0
        default:
1090
0
          DISSECTOR_ASSERT_NOT_REACHED();
1091
0
          break;
1092
0
        }
1093
0
      }
1094
0
    }
1095
0
    else if (hf_field->type == FT_INT32) {
1096
0
      if (hf_field->strings) {
1097
0
        proto_tree_add_int_format(tree, hf_index, tvb, start_offset, 1, codenum,
1098
0
          "%s: %s (%d)",
1099
0
          str,
1100
0
          val_to_str_const(codenum, cVALS(hf_field->strings), "Unknown "),
1101
0
          se_value);
1102
0
      }
1103
0
      else {
1104
0
        switch (hf_field->display) {
1105
0
        case BASE_DEC:
1106
0
          proto_tree_add_int_format(tree, hf_index, tvb, start_offset, 1, codenum,
1107
0
            "%s: %d",
1108
0
            str,
1109
0
            se_value);
1110
0
          break;
1111
0
        default:
1112
0
          DISSECTOR_ASSERT_NOT_REACHED();
1113
0
          break;
1114
0
        }
1115
0
      }
1116
0
      *start_bit_offset = bit_offset;
1117
0
      return se_value;
1118
1119
0
    }
1120
0
    else {
1121
0
      DISSECTOR_ASSERT_NOT_REACHED();
1122
0
    }
1123
0
  }
1124
1125
0
  *start_bit_offset = bit_offset;
1126
0
  return codenum;
1127
0
}
1128
1129
1130
static bool
1131
more_rbsp_data(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, int bit_offset)
1132
0
{
1133
0
  int    offset;
1134
0
  int    remaining_length;
1135
0
  int    last_one_bit;
1136
0
  uint8_t b = 0;
1137
1138
  /* XXX might not be the best way of doing things but:
1139
  * Serch from the end of the tvb for the first '1' bit
1140
  * assuming that it's the RTBSP stop bit
1141
  */
1142
1143
  /* Set offset to the byte we are treating */
1144
0
  offset = bit_offset >> 3;
1145
0
  remaining_length = tvb_reported_length_remaining(tvb, offset);
1146
  /* If there is more then 2 bytes left there *should* be more data */
1147
0
  if (remaining_length>2) {
1148
0
    return true;
1149
0
  }
1150
  /* Start from last bit */
1151
0
  last_one_bit = (tvb_reported_length(tvb) << 3);
1152
1153
0
  for (b = 0; !b; ) {
1154
0
    last_one_bit--;
1155
0
    b = tvb_get_bits8(tvb, last_one_bit, 1);
1156
0
  }
1157
1158
0
  if (last_one_bit == bit_offset) {
1159
0
    return false;
1160
0
  }
1161
1162
0
  return true;
1163
0
}
1164
1165
/* 7.3.2.11 RBSP trailing bits syntax */
1166
static int
1167
dissect_h265_rbsp_trailing_bits(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, int bit_offset)
1168
0
{
1169
0
  int remaining_bits = 0;
1170
1171
0
  proto_tree_add_bits_item(tree, hf_h265_rbsp_stop_bit, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1172
0
  bit_offset++;
1173
1174
0
  if ((bit_offset & 0x7) != 0) {
1175
0
    remaining_bits = 8 - (bit_offset & 0x7);
1176
0
    proto_tree_add_bits_item(tree, hf_h265_rbsp_trailing_bits, tvb, bit_offset, remaining_bits, ENC_BIG_ENDIAN);
1177
0
  }
1178
1179
0
  return bit_offset + remaining_bits;
1180
0
}
1181
1182
/* Ref 7.3.2.1 Video parameter set RBSP syntax */
1183
static void
1184
dissect_h265_video_parameter_set_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
1185
0
{
1186
  //proto_item *level_item;
1187
0
  int         bit_offset;
1188
0
  proto_tree *profile_tier_level_tree, *hrd_parameters_tree;
1189
1190
0
  bit_offset = offset << 3;
1191
1192
0
  proto_tree_add_bits_item(tree, hf_h265_vps_video_parameter_set_id, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
1193
0
  bit_offset = bit_offset + 4;
1194
1195
0
  proto_tree_add_bits_item(tree, hf_h265_vps_base_layer_internal_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1196
0
  bit_offset = bit_offset + 1;
1197
1198
0
  proto_tree_add_bits_item(tree, hf_h265_vps_base_layer_available_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1199
0
  bit_offset = bit_offset + 1;
1200
1201
0
  proto_tree_add_bits_item(tree, hf_h265_vps_max_layers_minus1, tvb, bit_offset, 6, ENC_BIG_ENDIAN);
1202
0
  bit_offset = bit_offset + 6;
1203
1204
0
  uint8_t vps_max_sub_layers_minus1 = tvb_get_bits8(tvb, bit_offset, 3);
1205
0
  proto_tree_add_bits_item(tree, hf_h265_vps_max_sub_layers_minus1, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
1206
0
  bit_offset = bit_offset + 3;
1207
1208
0
  proto_tree_add_bits_item(tree, hf_h265_vps_temporal_id_nesting_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1209
0
  bit_offset = bit_offset + 1;
1210
1211
0
  proto_tree_add_bits_item(tree, hf_h265_vps_reserved_0xffff_16bits, tvb, bit_offset, 16, ENC_BIG_ENDIAN);
1212
0
  bit_offset = bit_offset + 16;
1213
1214
0
  offset = bit_offset >> 3;
1215
0
  profile_tier_level_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_h265_profile_tier_level, NULL, "Profile, tier and level");
1216
0
  offset = dissect_h265_profile_tier_level(profile_tier_level_tree, tvb, pinfo, offset, 1, vps_max_sub_layers_minus1);
1217
0
  bit_offset = offset << 3;
1218
1219
0
  uint8_t vps_sub_layer_ordering_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1220
0
  proto_tree_add_item(tree, hf_h265_vps_sub_layer_ordering_info_present_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
1221
0
  bit_offset = bit_offset + 1;
1222
1223
0
  for (int i = (vps_sub_layer_ordering_info_present_flag ? 0 : vps_max_sub_layers_minus1);
1224
0
    i <= vps_max_sub_layers_minus1; i++) {
1225
0
    dissect_h265_exp_golomb_code(tree, hf_h265_vps_max_dec_pic_buffering_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1226
0
    dissect_h265_exp_golomb_code(tree, hf_h265_vps_max_num_reorder_pics, tvb, pinfo, &bit_offset, H265_UE_V);
1227
0
    dissect_h265_exp_golomb_code(tree, hf_h265_vps_max_latency_increase_plus1, tvb, pinfo, &bit_offset, H265_UE_V);
1228
0
  }
1229
1230
0
  uint8_t vps_max_layer_id = tvb_get_bits8(tvb, bit_offset, 6);
1231
0
  proto_tree_add_bits_item(tree, hf_h265_vps_max_layer_id, tvb, bit_offset, 6, ENC_BIG_ENDIAN);
1232
0
  bit_offset = bit_offset + 6;
1233
1234
0
  uint32_t  vps_num_layer_sets_minus1 = dissect_h265_exp_golomb_code(tree, hf_h265_vps_num_layer_sets_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1235
0
  for (unsigned i = 1; i <= vps_num_layer_sets_minus1; i++)
1236
0
    for (int j = 0; j <= vps_max_layer_id; j++) {
1237
0
      proto_tree_add_bits_item(tree, hf_h265_layer_id_included_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1238
0
      bit_offset = bit_offset + 1;
1239
0
    }
1240
1241
0
  uint8_t vps_timing_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1242
0
  proto_tree_add_bits_item(tree, hf_h265_vps_timing_info_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1243
0
  bit_offset = bit_offset + 1;
1244
1245
0
  if (vps_timing_info_present_flag) {
1246
0
    proto_tree_add_bits_item(tree, hf_h265_vps_num_units_in_tick, tvb, bit_offset, 32, ENC_BIG_ENDIAN);
1247
0
    bit_offset = bit_offset + 32;
1248
0
    proto_tree_add_bits_item(tree, hf_h265_vps_time_scale, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1249
0
    bit_offset = bit_offset + 32;
1250
0
    uint8_t vps_poc_proportional_to_timing_flag = tvb_get_bits8(tvb, bit_offset, 1);
1251
0
    proto_tree_add_bits_item(tree, hf_h265_vps_poc_proportional_to_timing_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1252
0
    bit_offset = bit_offset + 1;
1253
1254
0
    if (vps_poc_proportional_to_timing_flag) {
1255
0
      dissect_h265_exp_golomb_code(tree, hf_h265_vps_num_ticks_poc_diff_one_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1256
0
    }
1257
0
    uint32_t  vps_num_hrd_parameters = dissect_h265_exp_golomb_code(tree, hf_h265_vps_num_hrd_parameters, tvb, pinfo, &bit_offset, H265_UE_V);
1258
0
    for (unsigned i = 0; i < vps_num_hrd_parameters; i++) {
1259
0
       dissect_h265_exp_golomb_code(tree, hf_h265_hrd_layer_set_idx, tvb, pinfo, &bit_offset, H265_UE_V);
1260
0
       if (i > 0) {
1261
0
         bool cprms_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1262
0
         proto_tree_add_bits_item(tree, hf_h265_cprms_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1263
0
         bit_offset = bit_offset + 1;
1264
1265
0
         offset = bit_offset >> 3;
1266
0
         hrd_parameters_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_h265_hrd_parameters, NULL, "HRD parameters");
1267
0
         bit_offset = offset << 3;
1268
1269
0
         bit_offset = dissect_h265_hrd_parameters(hrd_parameters_tree, tvb, pinfo, bit_offset, cprms_present_flag, vps_max_sub_layers_minus1);
1270
0
       }
1271
0
    }
1272
0
  }
1273
1274
0
  uint8_t vps_extension_flag = tvb_get_bits8(tvb, bit_offset, 1);
1275
0
  proto_tree_add_bits_item(tree, hf_h265_vps_extension_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1276
0
  bit_offset = bit_offset + 1;
1277
1278
0
  if (vps_extension_flag) {
1279
0
    while (more_rbsp_data(tree, tvb, pinfo, bit_offset)) {
1280
0
      proto_tree_add_bits_item(tree, hf_h265_vps_extension_data_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1281
0
      bit_offset = bit_offset + 1;
1282
0
    }
1283
0
  }
1284
0
  dissect_h265_rbsp_trailing_bits(tree, tvb, pinfo, bit_offset);
1285
0
}
1286
1287
static void
1288
dissect_h265_seq_parameter_set_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
1289
0
{
1290
0
  int         bit_offset;
1291
0
  uint8_t   i, sps_max_sub_layers_minus1, sps_extension_4bits = 0;
1292
0
  uint32_t    num_short_term_ref_pic_sets, num_long_term_ref_pics_sps, log2_max_pic_order_cnt_lsb_minus4, bit_depth_luma_minus8, bit_depth_chroma_minus8;
1293
0
  bool  sps_sub_layer_ordering_info_present_flag = 0, scaling_list_enabled_flag = 0, sps_scaling_list_data_present_flag = 0,
1294
0
    pcm_enabled_flag = 0, long_term_ref_pics_present_flag = 0, vui_parameters_present_flag = 0, sps_extension_present_flag = 0,
1295
0
    sps_range_extension_flag = 0, sps_multilayer_extension_flag = 0, sps_3d_extension_flag = 0, sps_scc_extension_flag = 0;
1296
0
  int32_t NumDeltaPocs[H265_MAX_NUM_SHORT_TERM_REF_PIC_SETS] = { 0 }; // num_negative_pics + num_positive_pics;
1297
0
  proto_tree *profile_tier_level_tree, *vui_parameters_tree;
1298
1299
0
  sps_max_sub_layers_minus1 = tvb_get_bits8(tvb, offset << 3, 8) >> 1 & 0x07;
1300
0
  proto_tree_add_item(tree, hf_h265_sps_video_parameter_set_id, tvb, offset,  1, ENC_BIG_ENDIAN);
1301
0
  proto_tree_add_item(tree, hf_h265_sps_max_sub_layers_minus1, tvb, offset, 1, ENC_BIG_ENDIAN);
1302
0
  proto_tree_add_item(tree, hf_h265_sps_temporal_id_nesting_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
1303
0
  offset++;
1304
1305
0
  profile_tier_level_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_h265_profile_tier_level, NULL, "Profile, tier and level");
1306
0
  offset = dissect_h265_profile_tier_level(profile_tier_level_tree, tvb, pinfo, offset, 1, sps_max_sub_layers_minus1);
1307
1308
0
  bit_offset = offset << 3;
1309
1310
0
  dissect_h265_exp_golomb_code(tree, hf_h265_sps_seq_parameter_set_id, tvb, pinfo, &bit_offset, H265_UE_V);
1311
0
  unsigned chroma_format_idc = dissect_h265_exp_golomb_code(tree, hf_h265_chroma_format_idc, tvb, pinfo, &bit_offset, H265_UE_V);
1312
0
  if (chroma_format_idc == 3)
1313
0
  {
1314
0
    proto_tree_add_bits_item(tree, hf_h265_separate_colour_plane_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1315
0
    bit_offset++;
1316
0
  }
1317
0
  pic_width_in_luma_samples = dissect_h265_exp_golomb_code(tree, hf_h265_pic_width_in_luma_samples, tvb, pinfo, &bit_offset, H265_UE_V);
1318
0
  pic_height_in_luma_samples = dissect_h265_exp_golomb_code(tree, hf_h265_pic_height_in_luma_samples, tvb, pinfo, &bit_offset, H265_UE_V);
1319
1320
0
  bool conformance_window_flag = tvb_get_bits8(tvb, bit_offset, 1);
1321
0
  proto_tree_add_bits_item(tree, hf_h265_conformance_window_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1322
0
  bit_offset++;
1323
0
  if (conformance_window_flag) {
1324
0
    dissect_h265_exp_golomb_code(tree, hf_h265_conf_win_left_offset, tvb, pinfo, &bit_offset, H265_UE_V);
1325
0
    dissect_h265_exp_golomb_code(tree, hf_h265_conf_win_right_offset, tvb, pinfo, &bit_offset, H265_UE_V);
1326
0
    dissect_h265_exp_golomb_code(tree, hf_h265_conf_win_top_offset, tvb, pinfo, &bit_offset, H265_UE_V);
1327
0
    dissect_h265_exp_golomb_code(tree, hf_h265_conf_win_bottom_offset, tvb, pinfo, &bit_offset, H265_UE_V);
1328
0
  }
1329
0
  bit_depth_luma_minus8 = dissect_h265_exp_golomb_code(tree, hf_h265_bit_depth_luma_minus8, tvb, pinfo, &bit_offset, H265_UE_V);
1330
0
  bit_depth_chroma_minus8 = dissect_h265_exp_golomb_code(tree, hf_h265_bit_depth_chroma_minus8, tvb, pinfo, &bit_offset, H265_UE_V);
1331
0
  log2_max_pic_order_cnt_lsb_minus4 = dissect_h265_exp_golomb_code(tree, hf_h265_log2_max_pic_order_cnt_lsb_minus4, tvb, pinfo, &bit_offset, H265_UE_V);
1332
1333
0
  sps_sub_layer_ordering_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1334
0
  proto_tree_add_bits_item(tree, hf_h265_sps_sub_layer_ordering_info_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1335
0
  bit_offset++;
1336
1337
0
  for (i = (sps_sub_layer_ordering_info_present_flag ? 0 : sps_max_sub_layers_minus1);
1338
0
    i <= sps_max_sub_layers_minus1; i++) {
1339
0
    dissect_h265_exp_golomb_code(tree, hf_h265_sps_max_dec_pic_buffering_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1340
0
    dissect_h265_exp_golomb_code(tree, hf_h265_sps_max_num_reorder_pics, tvb, pinfo, &bit_offset, H265_UE_V);
1341
0
    dissect_h265_exp_golomb_code(tree, hf_h265_sps_max_latency_increase_plus1, tvb, pinfo, &bit_offset, H265_UE_V);
1342
0
  }
1343
  // data between packets TODO: move to "conversations"
1344
0
  log2_min_luma_coding_block_size_minus3 =
1345
0
  dissect_h265_exp_golomb_code(tree, hf_h265_log2_min_luma_coding_block_size_minus3, tvb, pinfo, &bit_offset, H265_UE_V);
1346
  // data between packets TODO: move to "conversations"
1347
0
  log2_diff_max_min_luma_coding_block_size =
1348
0
  dissect_h265_exp_golomb_code(tree, hf_h265_log2_diff_max_min_luma_coding_block_size, tvb, pinfo, &bit_offset, H265_UE_V);
1349
0
  dissect_h265_exp_golomb_code(tree, hf_h265_log2_min_luma_transform_block_size_minus2, tvb, pinfo, &bit_offset, H265_UE_V);
1350
0
  dissect_h265_exp_golomb_code(tree, hf_h265_log2_diff_max_min_luma_transform_block_size, tvb, pinfo, &bit_offset, H265_UE_V);
1351
0
  dissect_h265_exp_golomb_code(tree, hf_h265_max_transform_hierarchy_depth_inter, tvb, pinfo, &bit_offset, H265_UE_V);
1352
0
  dissect_h265_exp_golomb_code(tree, hf_h265_max_transform_hierarchy_depth_intra, tvb, pinfo, &bit_offset, H265_UE_V);
1353
1354
0
  scaling_list_enabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
1355
0
  proto_tree_add_bits_item(tree, hf_h265_scaling_list_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1356
0
  bit_offset++;
1357
1358
0
  if (scaling_list_enabled_flag) {
1359
0
    sps_scaling_list_data_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1360
0
    proto_tree_add_bits_item(tree, hf_h265_sps_scaling_list_data_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1361
0
    bit_offset++;
1362
0
    if (sps_scaling_list_data_present_flag)
1363
0
      bit_offset = dissect_h265_scaling_list_data(tree, tvb, pinfo, bit_offset);
1364
0
  }
1365
1366
0
  proto_tree_add_bits_item(tree, hf_h265_amp_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1367
0
  bit_offset++;
1368
1369
0
  proto_tree_add_bits_item(tree, hf_h265_sample_adaptive_offset_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1370
0
  bit_offset++;
1371
1372
0
  pcm_enabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
1373
0
  proto_tree_add_bits_item(tree, hf_h265_pcm_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1374
0
  bit_offset++;
1375
1376
0
  if (pcm_enabled_flag) {
1377
1378
0
    proto_tree_add_bits_item(tree, hf_h265_pcm_sample_bit_depth_luma_minus1, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
1379
0
    bit_offset = bit_offset + 4;
1380
1381
0
    proto_tree_add_bits_item(tree, hf_h265_pcm_sample_bit_depth_chroma_minus1, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
1382
0
    bit_offset = bit_offset + 4;
1383
1384
0
    dissect_h265_exp_golomb_code(tree, hf_h265_log2_min_pcm_luma_coding_block_size_minus3, tvb, pinfo, &bit_offset, H265_UE_V);
1385
1386
0
    dissect_h265_exp_golomb_code(tree, hf_h265_log2_diff_max_min_pcm_luma_coding_block_size, tvb, pinfo, &bit_offset, H265_UE_V);
1387
1388
0
    proto_tree_add_bits_item(tree, hf_h265_pcm_loop_filter_disabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1389
0
    bit_offset++;
1390
0
  }
1391
1392
0
  num_short_term_ref_pic_sets = dissect_h265_exp_golomb_code(tree, hf_h265_num_short_term_ref_pic_sets, tvb, pinfo, &bit_offset, H265_UE_V);
1393
0
  if (num_short_term_ref_pic_sets > H265_MAX_NUM_SHORT_TERM_REF_PIC_SETS) {
1394
0
    proto_tree_add_expert(tree, pinfo, &ei_h265_value_to_large, tvb, bit_offset>>3, 1);
1395
0
    return;
1396
0
  }
1397
0
  for (i = 0; i < num_short_term_ref_pic_sets; i++)
1398
0
    bit_offset = dissect_h265_st_ref_pic_set(tree, tvb, pinfo, bit_offset, i, num_short_term_ref_pic_sets, NumDeltaPocs);
1399
1400
0
  long_term_ref_pics_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1401
0
  proto_tree_add_bits_item(tree, hf_h265_long_term_ref_pics_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1402
0
  bit_offset++;
1403
1404
0
  if (long_term_ref_pics_present_flag) {
1405
1406
0
    num_long_term_ref_pics_sps = dissect_h265_exp_golomb_code(tree, hf_h265_num_long_term_ref_pics_sps, tvb, pinfo, &bit_offset, H265_UE_V);
1407
0
    for (i = 0; i < num_long_term_ref_pics_sps; i++) {
1408
1409
0
      proto_tree_add_bits_item(tree, hf_h265_lt_ref_pic_poc_lsb_sps, tvb, bit_offset, log2_max_pic_order_cnt_lsb_minus4 + 4, ENC_BIG_ENDIAN);
1410
0
      bit_offset = bit_offset + log2_max_pic_order_cnt_lsb_minus4 + 4;
1411
1412
0
      proto_tree_add_bits_item(tree, hf_h265_used_by_curr_pic_lt_sps_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1413
0
      bit_offset++;
1414
0
    }
1415
0
  }
1416
0
  proto_tree_add_bits_item(tree, hf_h265_sps_temporal_mvp_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1417
0
  bit_offset++;
1418
1419
0
  proto_tree_add_bits_item(tree, hf_h265_strong_intra_smoothing_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1420
0
  bit_offset++;
1421
1422
0
  vui_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1423
0
  proto_tree_add_bits_item(tree, hf_h265_vui_parameters_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1424
0
  bit_offset++;
1425
1426
0
  if (vui_parameters_present_flag)
1427
0
  {
1428
0
    vui_parameters_tree = proto_tree_add_subtree(tree, tvb, bit_offset >> 3, 1, ett_h265_vui_parameters, NULL, "VUI parameters");
1429
0
    bit_offset = dissect_h265_vui_parameters(vui_parameters_tree, tvb, pinfo, bit_offset, sps_max_sub_layers_minus1);
1430
0
  }
1431
1432
0
  sps_extension_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1433
0
  proto_tree_add_bits_item(tree, hf_h265_sps_extension_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1434
0
  bit_offset++;
1435
1436
0
  if (sps_extension_present_flag)
1437
0
  {
1438
0
    sps_range_extension_flag = tvb_get_bits8(tvb, bit_offset, 1);
1439
0
    proto_tree_add_bits_item(tree, hf_h265_sps_range_extension_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1440
0
    bit_offset++;
1441
1442
0
    sps_multilayer_extension_flag = tvb_get_bits8(tvb, bit_offset, 1);
1443
0
    proto_tree_add_bits_item(tree, hf_h265_sps_multilayer_extension_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1444
0
    bit_offset++;
1445
1446
0
    sps_3d_extension_flag = tvb_get_bits8(tvb, bit_offset, 1);
1447
0
    proto_tree_add_bits_item(tree, hf_h265_sps_3d_extension_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1448
0
    bit_offset++;
1449
1450
0
    sps_scc_extension_flag = tvb_get_bits8(tvb, bit_offset, 1);
1451
0
    proto_tree_add_bits_item(tree, hf_h265_sps_scc_extension_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1452
0
    bit_offset++;
1453
1454
0
    sps_extension_4bits = tvb_get_bits8(tvb, bit_offset, 4);
1455
0
    proto_tree_add_bits_item(tree, hf_h265_sps_extension_4bits, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
1456
0
    bit_offset = bit_offset + 4;
1457
0
  }
1458
0
  if (sps_range_extension_flag)
1459
0
    bit_offset = dissect_h265_sps_range_extension(tree, tvb, pinfo, bit_offset);
1460
0
  if (sps_multilayer_extension_flag)
1461
0
    bit_offset = dissect_h265_sps_multilayer_extension(tree, tvb, pinfo, bit_offset); /* specified in Annex F */
1462
0
  if (sps_3d_extension_flag)
1463
0
    bit_offset = dissect_h265_sps_3d_extension(tree, tvb, pinfo, bit_offset); /* specified in Annex I */
1464
0
  if (sps_scc_extension_flag)
1465
0
    bit_offset = dissect_h265_sps_scc_extension(tree, tvb, pinfo, bit_offset, chroma_format_idc, bit_depth_luma_minus8, bit_depth_chroma_minus8);
1466
0
  if (sps_extension_4bits)
1467
0
    while (more_rbsp_data(tree, tvb, pinfo, bit_offset)) {
1468
0
      proto_tree_add_bits_item(tree, hf_h265_sps_extension_data_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1469
0
      bit_offset++;
1470
0
    }
1471
0
  dissect_h265_rbsp_trailing_bits(tree, tvb, pinfo, bit_offset);
1472
0
}
1473
1474
/* Ref 7.3.2.3 Picture parameter set RBSP syntax */
1475
static void
1476
dissect_h265_pic_parameter_set_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
1477
0
{
1478
0
  int bit_offset;
1479
0
  unsigned num_tile_columns_minus1, num_tile_rows_minus1, i;
1480
0
  bool cu_qp_delta_enabled_flag, tiles_enabled_flag, uniform_spacing_flag;
1481
0
  bool deblocking_filter_control_present_flag, pps_deblocking_filter_disabled_flag;
1482
0
  bool pps_scaling_list_data_present_flag, pps_extension_present_flag;
1483
0
  bool pps_range_extension_flag = 0, pps_multilayer_extension_flag = 0, pps_3d_extension_flag = 0,
1484
0
    pps_scc_extension_flag = 0, pps_extension_4bits = 0, transform_skip_enabled_flag = 0;
1485
1486
0
  bit_offset = offset << 3;
1487
1488
0
  dissect_h265_exp_golomb_code(tree, hf_h265_pps_pic_parameter_set_id, tvb, pinfo, &bit_offset, H265_UE_V);
1489
0
  dissect_h265_exp_golomb_code(tree, hf_h265_pps_seq_parameter_set_id, tvb, pinfo, &bit_offset, H265_UE_V);
1490
1491
  // data between packets TODO: move to "conversations"
1492
0
  dependent_slice_segments_enabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
1493
1494
0
  proto_tree_add_bits_item(tree, hf_h265_dependent_slice_segments_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1495
0
  bit_offset++;
1496
1497
0
  proto_tree_add_bits_item(tree, hf_h265_output_flag_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1498
0
  bit_offset++;
1499
1500
  // data between packets TODO: move to "conversations"
1501
0
  num_extra_slice_header_bits = tvb_get_bits8(tvb, bit_offset, 3);
1502
0
  proto_tree_add_bits_item(tree, hf_h265_num_extra_slice_header_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
1503
0
  bit_offset = bit_offset + 3;
1504
1505
0
  proto_tree_add_bits_item(tree, hf_h265_sign_data_hiding_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1506
0
  bit_offset++;
1507
1508
0
  proto_tree_add_bits_item(tree, hf_h265_cabac_init_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1509
0
  bit_offset++;
1510
1511
0
  dissect_h265_exp_golomb_code(tree, hf_h265_num_ref_idx_l0_default_active_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1512
0
  dissect_h265_exp_golomb_code(tree, hf_h265_num_ref_idx_l1_default_active_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1513
0
  dissect_h265_exp_golomb_code(tree, hf_h265_init_qp_minus26, tvb, pinfo, &bit_offset, H265_SE_V);
1514
1515
0
  proto_tree_add_bits_item(tree, hf_h265_constrained_intra_pred_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1516
0
  bit_offset++;
1517
1518
0
  transform_skip_enabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
1519
0
  proto_tree_add_bits_item(tree, hf_h265_transform_skip_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1520
0
  bit_offset++;
1521
1522
0
  cu_qp_delta_enabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
1523
0
  proto_tree_add_bits_item(tree, hf_h265_cu_qp_delta_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1524
0
  bit_offset++;
1525
1526
0
  if (cu_qp_delta_enabled_flag) {
1527
0
    dissect_h265_exp_golomb_code(tree, hf_h265_diff_cu_qp_delta_depth, tvb, pinfo, &bit_offset, H265_UE_V);
1528
0
  }
1529
1530
0
  dissect_h265_exp_golomb_code(tree, hf_h265_pps_cb_qp_offset, tvb, pinfo, &bit_offset, H265_SE_V);
1531
0
  dissect_h265_exp_golomb_code(tree, hf_h265_pps_cr_qp_offset, tvb, pinfo, &bit_offset, H265_SE_V);
1532
1533
0
  proto_tree_add_bits_item(tree, hf_h265_pps_slice_chroma_qp_offsets_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1534
0
  bit_offset++;
1535
1536
0
  proto_tree_add_bits_item(tree, hf_h265_weighted_pred_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1537
0
  bit_offset++;
1538
1539
0
  proto_tree_add_bits_item(tree, hf_h265_weighted_bipred_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1540
0
  bit_offset++;
1541
1542
0
  proto_tree_add_bits_item(tree, hf_h265_transquant_bypass_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1543
0
  bit_offset++;
1544
1545
0
  tiles_enabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
1546
0
  proto_tree_add_bits_item(tree, hf_h265_tiles_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1547
0
  bit_offset++;
1548
1549
0
  proto_tree_add_bits_item(tree, hf_h265_entropy_coding_sync_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1550
0
  bit_offset++;
1551
1552
0
  if (tiles_enabled_flag) {
1553
1554
0
    num_tile_columns_minus1 = dissect_h265_exp_golomb_code(tree, hf_h265_num_tile_columns_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1555
0
    num_tile_rows_minus1 = dissect_h265_exp_golomb_code(tree, hf_h265_num_tile_rows_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1556
1557
0
    uniform_spacing_flag = tvb_get_bits8(tvb, bit_offset, 1);
1558
0
    proto_tree_add_bits_item(tree, hf_h265_uniform_spacing_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1559
0
    bit_offset++;
1560
0
    if (!uniform_spacing_flag) {
1561
0
      for (i = 0; i < num_tile_columns_minus1; i++)
1562
0
        dissect_h265_exp_golomb_code(tree, hf_h265_column_width_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1563
0
      for (i = 0; i < num_tile_rows_minus1; i++)
1564
0
        dissect_h265_exp_golomb_code(tree, hf_h265_row_height_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
1565
0
    }
1566
1567
0
    proto_tree_add_bits_item(tree, hf_h265_loop_filter_across_tiles_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1568
0
    bit_offset++;
1569
0
  }
1570
1571
0
  proto_tree_add_bits_item(tree, hf_h265_pps_loop_filter_across_slices_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1572
0
  bit_offset++;
1573
1574
0
  deblocking_filter_control_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1575
0
  proto_tree_add_bits_item(tree, hf_h265_deblocking_filter_control_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1576
0
  bit_offset++;
1577
1578
0
  if (deblocking_filter_control_present_flag) {
1579
0
    proto_tree_add_bits_item(tree, hf_h265_deblocking_filter_override_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1580
0
    bit_offset++;
1581
1582
0
    pps_deblocking_filter_disabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
1583
0
    proto_tree_add_bits_item(tree, hf_h265_pps_deblocking_filter_disabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1584
0
    bit_offset++;
1585
1586
0
    if (!pps_deblocking_filter_disabled_flag) {
1587
1588
0
      dissect_h265_exp_golomb_code(tree, hf_h265_pps_beta_offset_div2, tvb, pinfo, &bit_offset, H265_SE_V);
1589
0
      dissect_h265_exp_golomb_code(tree, hf_h265_pps_tc_offset_div2, tvb, pinfo, &bit_offset, H265_SE_V);
1590
1591
0
    }
1592
0
  }
1593
1594
0
  pps_scaling_list_data_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1595
0
  proto_tree_add_bits_item(tree, hf_h265_pps_scaling_list_data_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1596
0
  bit_offset++;
1597
1598
0
  if (pps_scaling_list_data_present_flag) {
1599
0
    bit_offset = dissect_h265_scaling_list_data(tree, tvb, pinfo, bit_offset);
1600
0
  }
1601
1602
0
  proto_tree_add_bits_item(tree, hf_h265_lists_modification_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1603
0
  bit_offset++;
1604
1605
0
  dissect_h265_exp_golomb_code(tree, hf_h265_log2_parallel_merge_level_minus2, tvb, pinfo, &bit_offset, H265_UE_V);
1606
1607
0
  proto_tree_add_bits_item(tree, hf_h265_slice_segment_header_extension_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1608
0
  bit_offset++;
1609
1610
0
  pps_extension_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1611
0
  proto_tree_add_bits_item(tree, hf_h265_pps_extension_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1612
0
  bit_offset++;
1613
1614
0
  if (pps_extension_present_flag) {
1615
0
    pps_range_extension_flag = tvb_get_bits8(tvb, bit_offset, 1);
1616
0
    proto_tree_add_bits_item(tree, hf_h265_pps_range_extension_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1617
0
    bit_offset++;
1618
1619
0
    pps_multilayer_extension_flag = tvb_get_bits8(tvb, bit_offset, 1);
1620
0
    proto_tree_add_bits_item(tree, hf_h265_pps_multilayer_extension_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1621
0
    bit_offset++;
1622
1623
0
    pps_3d_extension_flag = tvb_get_bits8(tvb, bit_offset, 1);
1624
0
    proto_tree_add_bits_item(tree, hf_h265_pps_3d_extension_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1625
0
    bit_offset++;
1626
1627
0
    pps_scc_extension_flag = tvb_get_bits8(tvb, bit_offset, 1);
1628
0
    proto_tree_add_bits_item(tree, hf_h265_pps_scc_extension_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1629
0
    bit_offset++;
1630
1631
0
    pps_extension_4bits = tvb_get_bits8(tvb, bit_offset, 1);
1632
0
    proto_tree_add_bits_item(tree, hf_h265_pps_extension_4bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1633
0
    bit_offset++;
1634
0
  }
1635
1636
0
  if (pps_range_extension_flag)
1637
0
    bit_offset = dissect_h265_pps_range_extension(tree, tvb, pinfo, bit_offset, transform_skip_enabled_flag);
1638
0
  if (pps_multilayer_extension_flag)
1639
0
    bit_offset = dissect_h265_pps_multilayer_extension(tree, tvb, pinfo, bit_offset); /* specified in Annex F */
1640
0
  if (pps_3d_extension_flag)
1641
0
    bit_offset = dissect_h265_pps_3d_extension(tree, tvb, pinfo, bit_offset); /* specified in Annex I */
1642
0
  if (pps_scc_extension_flag)
1643
0
    bit_offset = dissect_h265_pps_scc_extension(tree, tvb, pinfo, bit_offset);
1644
0
  if (pps_extension_4bits)
1645
0
    while (more_rbsp_data(tree, tvb, pinfo, bit_offset)) {
1646
0
      proto_tree_add_bits_item(tree, hf_h265_pps_extension_data_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1647
0
      bit_offset++;
1648
0
    }
1649
0
  dissect_h265_rbsp_trailing_bits(tree, tvb, pinfo, bit_offset);
1650
0
}
1651
1652
/* Ref 7.3.2.4 Supplemental enhancement information RBSP syntax */
1653
static void
1654
dissect_h265_sei_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset, uint8_t nal_unit_type)
1655
0
{
1656
0
  proto_tree *sei_rbsp_tree;
1657
0
  sei_rbsp_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_h265_sei_rbsp, NULL, "Supplemental enhancement information RBSP");
1658
1659
0
  int bit_offset;
1660
1661
0
  bit_offset = offset << 3;
1662
1663
0
  do
1664
0
  {
1665
0
    bit_offset = dissect_h265_sei_message(sei_rbsp_tree, tvb, pinfo, bit_offset, nal_unit_type);
1666
0
  } while (more_rbsp_data(sei_rbsp_tree, tvb, pinfo, bit_offset));
1667
1668
0
  dissect_h265_rbsp_trailing_bits(sei_rbsp_tree, tvb, pinfo, bit_offset);
1669
0
}
1670
1671
/* Ref 7.3.2.5 Access unit delimiter RBSP syntax */
1672
static void
1673
dissect_h265_access_unit_delimiter_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
1674
0
{
1675
0
  int bit_offset = offset << 3;
1676
1677
0
  proto_tree *access_unit_delimiter_rbsp_tree;
1678
0
  access_unit_delimiter_rbsp_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_h265_access_unit_delimiter_rbsp, NULL, "Access unit delimiter RBSP");
1679
1680
  /* pic_type u(3) */
1681
0
  proto_tree_add_bits_item(access_unit_delimiter_rbsp_tree, hf_h265_pic_type, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
1682
0
  bit_offset += 3;
1683
1684
  /* rbsp_trailing_bits */
1685
0
  dissect_h265_rbsp_trailing_bits(access_unit_delimiter_rbsp_tree, tvb, pinfo, bit_offset);
1686
0
}
1687
1688
/* Ref 7.3.2.6 End of sequence RBSP syntax*/
1689
static void
1690
dissect_h265_end_of_seq_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
1691
0
{
1692
0
  proto_tree *end_of_seq_rbsp_tree;
1693
0
  end_of_seq_rbsp_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_h265_end_of_seq_rbsp, NULL, "End of sequence RBSP");
1694
0
  proto_tree_add_expert(end_of_seq_rbsp_tree, pinfo, &ei_h265_undecoded, tvb, offset, -1);
1695
0
}
1696
1697
/* Ref  7.3.2.7 End of bitstream RBSP syntax*/
1698
static void
1699
dissect_h265_end_of_bitstream_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
1700
0
{
1701
0
  proto_tree *end_of_bitstream_rbsp_tree;
1702
0
  end_of_bitstream_rbsp_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_h265_end_of_bitstream_rbsp, NULL, "End of bitstream RBSP");
1703
0
  proto_tree_add_expert(end_of_bitstream_rbsp_tree, pinfo, &ei_h265_undecoded, tvb, offset, -1);
1704
0
}
1705
1706
/* Ref 7.3.2.8 Filler data RBSP syntax */
1707
static void
1708
dissect_h265_filler_data_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset)
1709
0
{
1710
0
  proto_tree *filler_data_rbsp_tree;
1711
0
  filler_data_rbsp_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_h265_filler_data_rbsp, NULL, "Filler data RBSP");
1712
0
  proto_tree_add_expert(filler_data_rbsp_tree, pinfo, &ei_h265_undecoded, tvb, offset, -1);
1713
0
}
1714
1715
/* Ref 7.3.3 Profile, tier and level syntax */
1716
static int
1717
dissect_h265_profile_tier_level(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo _U_, int offset, bool profilePresentFlag, int vps_max_sub_layers_minus1)
1718
0
{
1719
0
  proto_item *general_level_idc_item;
1720
0
  uint32_t    general_profile_idc, general_level_idc;
1721
0
  uint32_t    sub_layer_profile_idc[32] = { 0 };
1722
0
  bool general_tier_flag = 0;
1723
0
  bool general_profile_compatibility_flag[32] = { 0 };
1724
0
  bool sub_layer_profile_present_flag[32] = { 0 };
1725
0
  bool sub_layer_level_present_flag[32] = { 0 };
1726
0
  bool sub_layer_profile_compatibility_flag[32][32] = { { 0 } };
1727
1728
0
  if (profilePresentFlag) {
1729
0
    proto_tree_add_item(tree, hf_h265_general_profile_space, tvb, offset, 1, ENC_BIG_ENDIAN);
1730
0
    proto_tree_add_item_ret_boolean(tree, hf_h265_general_tier_flag, tvb, offset, 1, ENC_BIG_ENDIAN, &general_tier_flag);
1731
0
    proto_tree_add_item_ret_uint(tree, hf_h265_general_profile_idc, tvb, offset, 1, ENC_BIG_ENDIAN, &general_profile_idc);
1732
0
    offset++;
1733
1734
0
    proto_tree_add_item(tree, hf_h265_general_profile_compatibility_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
1735
1736
0
    int bit_offset = offset << 3;
1737
0
    for (int j = 0; j < 32; j++)
1738
0
      general_profile_compatibility_flag[j] = tvb_get_bits8(tvb, bit_offset + j, 1);
1739
0
    bit_offset = bit_offset + 32;
1740
1741
0
    proto_tree_add_bits_item(tree, hf_h265_general_progressive_source_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1742
0
    bit_offset++;
1743
0
    proto_tree_add_bits_item(tree, hf_h265_general_interlaced_source_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1744
0
    bit_offset++;
1745
0
    proto_tree_add_bits_item(tree, hf_h265_general_non_packed_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1746
0
    bit_offset++;
1747
0
    proto_tree_add_bits_item(tree, hf_h265_general_frame_only_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1748
0
    bit_offset++;
1749
1750
0
    if (general_profile_idc == 4 || general_profile_compatibility_flag[4] ||
1751
0
      general_profile_idc == 5 || general_profile_compatibility_flag[5] ||
1752
0
      general_profile_idc == 6 || general_profile_compatibility_flag[6] ||
1753
0
      general_profile_idc == 7 || general_profile_compatibility_flag[7] ||
1754
0
      general_profile_idc == 8 || general_profile_compatibility_flag[8] ||
1755
0
      general_profile_idc == 9 || general_profile_compatibility_flag[9] ||
1756
0
      general_profile_idc == 10 || general_profile_compatibility_flag[10]) {
1757
      /* The number of bits in this syntax structure is not affected by this condition */
1758
0
      proto_tree_add_bits_item(tree, hf_h265_general_max_12bit_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1759
0
      bit_offset++;
1760
0
      proto_tree_add_bits_item(tree, hf_h265_general_max_10bit_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1761
0
      bit_offset++;
1762
0
      proto_tree_add_bits_item(tree, hf_h265_general_max_8bit_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1763
0
      bit_offset++;
1764
0
      proto_tree_add_bits_item(tree, hf_h265_general_max_422chroma_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1765
0
      bit_offset++;
1766
0
      proto_tree_add_bits_item(tree, hf_h265_general_max_420chroma_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1767
0
      bit_offset++;
1768
0
      proto_tree_add_bits_item(tree, hf_h265_general_max_monochrome_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1769
0
      bit_offset++;
1770
0
      proto_tree_add_bits_item(tree, hf_h265_general_intra_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1771
0
      bit_offset++;
1772
0
      proto_tree_add_bits_item(tree, hf_h265_general_one_picture_only_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1773
0
      bit_offset++;
1774
0
      proto_tree_add_bits_item(tree, hf_h265_general_lower_bit_rate_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1775
0
      bit_offset++;
1776
0
      if (general_profile_idc == 5 || general_profile_compatibility_flag[5] ||
1777
0
        general_profile_idc == 9 || general_profile_compatibility_flag[9] ||
1778
0
        general_profile_idc == 10 || general_profile_compatibility_flag[10]) {
1779
0
        proto_tree_add_bits_item(tree, hf_h265_general_max_14bit_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1780
0
        bit_offset++;
1781
0
        proto_tree_add_bits_item(tree, hf_h265_general_reserved_zero_33bits, tvb, bit_offset, 33, ENC_BIG_ENDIAN);
1782
0
        bit_offset = bit_offset + 33;
1783
0
      }
1784
0
      else {
1785
0
        proto_tree_add_bits_item(tree, hf_h265_general_reserved_zero_34bits, tvb, bit_offset, 34, ENC_BIG_ENDIAN);
1786
0
        bit_offset = bit_offset + 34;
1787
0
      }
1788
0
    }
1789
0
    else if (general_profile_idc == 2 || general_profile_compatibility_flag[2]) {
1790
0
      proto_tree_add_bits_item(tree, hf_h265_general_reserved_zero_7bits, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
1791
0
      bit_offset = bit_offset + 7;
1792
0
      proto_tree_add_bits_item(tree, hf_h265_general_one_picture_only_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1793
0
      bit_offset++;
1794
0
      proto_tree_add_bits_item(tree, hf_h265_general_reserved_zero_35bits, tvb, bit_offset, 35, ENC_BIG_ENDIAN);
1795
0
      bit_offset = bit_offset + 35;
1796
0
    }
1797
0
    else {
1798
0
      proto_tree_add_bits_item(tree, hf_h265_general_reserved_zero_43bits, tvb, bit_offset, 43, ENC_BIG_ENDIAN);
1799
0
      bit_offset = bit_offset + 43;
1800
0
    }
1801
1802
0
    if ((general_profile_idc >= 1 && general_profile_idc <= 5) ||
1803
0
      general_profile_idc == 9 ||
1804
0
      general_profile_compatibility_flag[1] || general_profile_compatibility_flag[2] ||
1805
0
      general_profile_compatibility_flag[3] || general_profile_compatibility_flag[4] ||
1806
0
      general_profile_compatibility_flag[5] || general_profile_compatibility_flag[9])
1807
0
      /* The number of bits in this syntax structure is not affected by this condition */ {
1808
0
      proto_tree_add_bits_item(tree, hf_h265_general_inbld_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1809
0
    }
1810
0
    else {
1811
0
      proto_tree_add_bits_item(tree, hf_h265_general_reserved_zero_bit, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1812
0
    }
1813
0
    bit_offset++;
1814
1815
0
    general_level_idc_item = proto_tree_add_item_ret_uint(tree, hf_h265_general_level_idc, tvb, bit_offset >> 3, 1, ENC_BIG_ENDIAN, &general_level_idc);
1816
0
    if (general_tier_flag) {
1817
0
      proto_item_append_text(general_level_idc_item, " [Level %.1f %s]", ((double)general_level_idc / 30), val_to_str_const(general_level_idc / 3, h265_level_high_tier_bitrate_values, "Unknown"));
1818
0
    }
1819
0
    else {
1820
0
      proto_item_append_text(general_level_idc_item, " [Level %.1f %s]", ((double)general_level_idc / 30), val_to_str_const(general_level_idc / 3, h265_level_main_tier_bitrate_values, "Unknown"));
1821
0
    }
1822
0
    bit_offset += 8;
1823
1824
0
    for (int i = 0; i < vps_max_sub_layers_minus1; i++) {
1825
0
      sub_layer_profile_present_flag[i] = tvb_get_bits8(tvb, bit_offset, 1);
1826
0
      proto_tree_add_bits_item(tree, hf_h265_sub_layer_profile_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1827
0
      bit_offset++;
1828
0
      proto_tree_add_bits_item(tree, hf_h265_sub_layer_level_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1829
0
      bit_offset++;
1830
0
    }
1831
1832
0
    if (vps_max_sub_layers_minus1 > 0)
1833
0
      for (int i = vps_max_sub_layers_minus1; i < 8; i++) {
1834
0
        proto_tree_add_bits_item(tree, hf_h265_reserved_zero_2bits, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
1835
0
        bit_offset = bit_offset + 2;
1836
0
      }
1837
1838
0
    for (int i = 0; i < vps_max_sub_layers_minus1; i++) {
1839
0
      if (sub_layer_profile_present_flag[i]) {
1840
0
        proto_tree_add_item(tree, hf_h265_sub_layer_profile_space, tvb, bit_offset >> 3, 1, ENC_BIG_ENDIAN);
1841
0
        proto_tree_add_item(tree, hf_h265_sub_layer_tier_flag, tvb, bit_offset >> 3, 1, ENC_BIG_ENDIAN);
1842
0
        proto_tree_add_item(tree, hf_h265_sub_layer_profile_idc, tvb, bit_offset >> 3, 1, ENC_BIG_ENDIAN);
1843
0
        sub_layer_profile_idc[i] = tvb_get_bits8(tvb, (bit_offset >> 3) + 3, 5);
1844
1845
0
        bit_offset = bit_offset + 8;
1846
1847
0
        for (int j = 0; j < 32; j++) {
1848
0
          sub_layer_profile_compatibility_flag[i][j] = tvb_get_bits8(tvb, bit_offset, 1);
1849
0
        }
1850
0
        proto_tree_add_item(tree, hf_h265_sub_layer_profile_compatibility_flag, tvb, bit_offset >> 3, 4, ENC_BIG_ENDIAN);
1851
0
        bit_offset = bit_offset + 32;
1852
1853
0
        proto_tree_add_bits_item(tree, hf_h265_sub_layer_progressive_source_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1854
0
        bit_offset++;
1855
0
        proto_tree_add_bits_item(tree, hf_h265_sub_layer_interlaced_source_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1856
0
        bit_offset++;
1857
0
        proto_tree_add_bits_item(tree, hf_h265_sub_layer_non_packed_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1858
0
        bit_offset++;
1859
0
        proto_tree_add_bits_item(tree, hf_h265_sub_layer_frame_only_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1860
0
        bit_offset++;
1861
1862
0
        if (sub_layer_profile_idc[i] == 4 || sub_layer_profile_compatibility_flag[i][4] ||
1863
0
          sub_layer_profile_idc[i] == 5 || sub_layer_profile_compatibility_flag[i][5] ||
1864
0
          sub_layer_profile_idc[i] == 6 || sub_layer_profile_compatibility_flag[i][6] ||
1865
0
          sub_layer_profile_idc[i] == 7 || sub_layer_profile_compatibility_flag[i][7] ||
1866
0
          sub_layer_profile_idc[i] == 8 || sub_layer_profile_compatibility_flag[i][8] ||
1867
0
          sub_layer_profile_idc[i] == 9 || sub_layer_profile_compatibility_flag[i][9] ||
1868
0
          sub_layer_profile_idc[i] == 10 || sub_layer_profile_compatibility_flag[i][10]) {
1869
          /* The number of bits in this syntax structure is not affected by this condition */
1870
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_max_12bit_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1871
0
          bit_offset++;
1872
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_max_10bit_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1873
0
          bit_offset++;
1874
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_max_8bit_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1875
0
          bit_offset++;
1876
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_max_422chroma_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1877
0
          bit_offset++;
1878
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_max_420chroma_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1879
0
          bit_offset++;
1880
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_max_monochrome_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1881
0
          bit_offset++;
1882
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_intra_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1883
0
          bit_offset++;
1884
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_one_picture_only_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1885
0
          bit_offset++;
1886
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_lower_bit_rate_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1887
0
          bit_offset++;
1888
1889
0
          if (sub_layer_profile_idc[i] == 5 ||
1890
0
            sub_layer_profile_compatibility_flag[i][5]) {
1891
0
            proto_tree_add_bits_item(tree, hf_h265_sub_layer_max_14bit_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1892
0
            proto_tree_add_bits_item(tree, hf_h265_sub_layer_reserved_zero_33bits, tvb, bit_offset + 1, 33, ENC_BIG_ENDIAN);
1893
0
            bit_offset = bit_offset + 34;
1894
0
          }
1895
0
          else {
1896
0
            proto_tree_add_bits_item(tree, hf_h265_sub_layer_reserved_zero_34bits, tvb, bit_offset + 1, 33, ENC_BIG_ENDIAN);
1897
0
            bit_offset = bit_offset + 34;
1898
0
          }
1899
0
        }
1900
0
        else if (sub_layer_profile_idc[i] == 2 ||
1901
0
          sub_layer_profile_compatibility_flag[i][2]) {
1902
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_reserved_zero_7bits, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
1903
0
          bit_offset = bit_offset + 7;
1904
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_one_picture_only_constraint_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1905
0
          bit_offset++;
1906
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_reserved_zero_35bits, tvb, bit_offset, 35, ENC_BIG_ENDIAN);
1907
0
          bit_offset = bit_offset + 35;
1908
0
        }
1909
0
        else {
1910
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_reserved_zero_43bits, tvb, bit_offset, 43, ENC_BIG_ENDIAN);
1911
0
          bit_offset = bit_offset + 43;
1912
0
        }
1913
0
        if ((sub_layer_profile_idc[i] >= 1 && sub_layer_profile_idc[i] <= 5) ||
1914
0
          sub_layer_profile_idc[i] == 9 ||
1915
0
          sub_layer_profile_compatibility_flag[i][1] ||
1916
0
          sub_layer_profile_compatibility_flag[i][2] ||
1917
0
          sub_layer_profile_compatibility_flag[i][3] ||
1918
0
          sub_layer_profile_compatibility_flag[i][4] ||
1919
0
          sub_layer_profile_compatibility_flag[i][5] ||
1920
0
          sub_layer_profile_compatibility_flag[i][9]) {
1921
          /* The number of bits in this syntax structure is not affected by this condition */
1922
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_inbld_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1923
0
          bit_offset++;
1924
0
        }
1925
0
        else {
1926
0
          proto_tree_add_bits_item(tree, hf_h265_sub_layer_reserved_zero_bit, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1927
0
          bit_offset++;
1928
0
        }
1929
0
      }
1930
0
      if (sub_layer_level_present_flag[i]) {
1931
0
        proto_tree_add_item(tree, hf_h265_sub_layer_level_idc, tvb, bit_offset >> 3, 1, ENC_BIG_ENDIAN);
1932
0
        bit_offset = bit_offset + 8;
1933
0
      }
1934
0
    }
1935
0
    offset = bit_offset >> 3;
1936
0
  }
1937
1938
0
  return offset;
1939
0
}
1940
1941
/* 7.3.6 Slice segment header syntax */
1942
/* Just parse a few bits same as in H.264 */
1943
/* TODO: if need more info from slice header, do more parsing */
1944
static int
1945
dissect_h265_slice_segment_header(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, int bit_offset, uint8_t nal_unit_type)
1946
0
{
1947
0
  bool first_slice_segment_in_pic_flag = 0, /*no_output_of_prior_pics_flag = 0,*/ dependent_slice_segment_flag = 0;
1948
1949
0
  unsigned MinCbLog2SizeY = log2_min_luma_coding_block_size_minus3 + 3;
1950
0
  unsigned CtbLog2SizeY = MinCbLog2SizeY + log2_diff_max_min_luma_coding_block_size;
1951
0
  unsigned CtbSizeY = 1 << CtbLog2SizeY;
1952
0
  double PicWidthInCtbsY = ceil(pic_width_in_luma_samples / CtbSizeY);
1953
0
        double PicHeightInCtbsY = ceil(pic_height_in_luma_samples / CtbSizeY);
1954
0
        double PicSizeInCtbsY = PicWidthInCtbsY * PicHeightInCtbsY;
1955
0
  unsigned nBits = (unsigned)(ceil(log2(PicSizeInCtbsY)));
1956
0
  unsigned i;
1957
1958
0
  first_slice_segment_in_pic_flag = tvb_get_bits8(tvb, bit_offset, 1);
1959
0
  bit_offset++;
1960
1961
0
  if (nal_unit_type >= str_to_val("BLA_W_LP", h265_type_summary_values, 16) &&
1962
0
    nal_unit_type <= str_to_val("RSV_IRAP_VCL23", h265_type_summary_values, 23)) {
1963
    /*no_output_of_prior_pics_flag = tvb_get_bits8(tvb, bit_offset, 1);*/
1964
0
    bit_offset++;
1965
0
  }
1966
1967
0
  dissect_h265_exp_golomb_code(tree, hf_h265_slice_pic_parameter_set_id, tvb, pinfo, &bit_offset, H265_UE_V);
1968
1969
0
  if (!first_slice_segment_in_pic_flag) {
1970
0
    if (dependent_slice_segments_enabled_flag){
1971
0
      dependent_slice_segment_flag = tvb_get_bits8(tvb, bit_offset, 1);
1972
0
      bit_offset++;
1973
0
    }
1974
0
    proto_tree_add_bits_item(tree, hf_h265_slice_segment_address, tvb, bit_offset, nBits, ENC_BIG_ENDIAN);
1975
0
    bit_offset = bit_offset + nBits;
1976
0
  }
1977
1978
0
  if (!dependent_slice_segment_flag) {
1979
0
    for (i = 0; i < num_extra_slice_header_bits; i++) {
1980
      /* slice_reserved_flag[i] u(1) */
1981
0
      bit_offset++;
1982
0
    }
1983
0
    dissect_h265_exp_golomb_code(tree, hf_h265_slice_type, tvb, pinfo, &bit_offset, H265_UE_V);
1984
0
  }
1985
1986
0
  return bit_offset;
1987
0
}
1988
1989
/* 7.3.2.9 Slice segment layer RBSP syntax */
1990
static void
1991
dissect_h265_slice_segment_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset, uint8_t nal_unit_type)
1992
0
{
1993
0
  int bit_offset;
1994
1995
0
  bit_offset = offset << 3;
1996
1997
  /* slice_segment_header( ) */
1998
0
  dissect_h265_slice_segment_header(tree, tvb, pinfo, bit_offset, nal_unit_type);
1999
  /* slice_segment_data( ) */
2000
  /* rbsp_slice_segment_trailing_bits( ) */
2001
0
}
2002
2003
/* 7.3.4 Scaling list data syntax */
2004
static int
2005
dissect_h265_scaling_list_data(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo _U_, int bit_offset)
2006
0
{
2007
0
  bool scaling_list_pred_mode_flag[4][6] = { { 0 } };
2008
  /*int32_t ScalingList[4][6][64] = { 0 };*/
2009
0
  int sizeId, matrixId, nextCoef, coefNum, i;
2010
0
  int32_t scaling_list_dc_coef_minus8, scaling_list_delta_coef;
2011
0
  for (sizeId = 0; sizeId < 4; sizeId++)
2012
0
    for (matrixId = 0; matrixId < 6; matrixId += (sizeId == 3) ? 3 : 1) {
2013
0
      scaling_list_pred_mode_flag[sizeId][matrixId] = tvb_get_bits8(tvb, bit_offset, 1);
2014
0
      proto_tree_add_bits_item(tree, hf_h265_scaling_list_pred_mode_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2015
0
      bit_offset++;
2016
0
      if (!scaling_list_pred_mode_flag[sizeId][matrixId])
2017
0
        dissect_h265_exp_golomb_code(tree, hf_h265_scaling_list_pred_matrix_id_delta, tvb, pinfo, &bit_offset, H265_UE_V);
2018
0
      else {
2019
0
        nextCoef = 8;
2020
0
        coefNum = MIN(64, (1 << (4 + (sizeId << 1))));
2021
0
        if (sizeId > 1) {
2022
0
          scaling_list_dc_coef_minus8 = dissect_h265_exp_golomb_code(tree, hf_h265_scaling_list_dc_coef_minus8, tvb, pinfo, &bit_offset, H265_SE_V);
2023
0
          nextCoef = scaling_list_dc_coef_minus8 + 8;
2024
0
        }
2025
0
        for (i = 0; i < coefNum; i++) {
2026
0
          scaling_list_delta_coef = dissect_h265_exp_golomb_code(tree, hf_h265_scaling_list_delta_coef, tvb, pinfo, &bit_offset, H265_SE_V);
2027
0
          nextCoef = (nextCoef + scaling_list_delta_coef + 256) % 256;
2028
          /*ScalingList[sizeId][matrixId][i] = nextCoef;*/
2029
0
        }
2030
0
      }
2031
0
    }
2032
0
  return bit_offset;
2033
0
}
2034
2035
/* D.2.1 General SEI message syntax */
2036
static int
2037
dissect_h265_sei_payload(proto_tree* tree _U_, tvbuff_t* tvb _U_, packet_info* pinfo _U_, int bit_offset, unsigned payloadType _U_, unsigned payloadSize, uint8_t nal_unit_type _U_)
2038
0
{
2039
  //int bit_start = bit_offset;
2040
#if 0
2041
  if (nal_unit_type == str_to_val("PREFIX_SEI_NUT", h265_type_summary_values, 39)) {
2042
    if (payloadType == 0)
2043
      buffering_period(payloadSize);
2044
    else if (payloadType == 1)
2045
      pic_timing(payloadSize);
2046
    else if (payloadType == 2)
2047
      pan_scan_rect(payloadSize);
2048
    else if (payloadType == 3)
2049
      filler_payload(payloadSize);
2050
    else if (payloadType == 4)
2051
      user_data_registered_itu_t_t35(payloadSize);
2052
    else if (payloadType == 5)
2053
      user_data_unregistered(payloadSize);
2054
    else if (payloadType == 6)
2055
      recovery_point(payloadSize);
2056
    else if (payloadType == 9)
2057
      scene_info(payloadSize);
2058
    else if (payloadType == 15)
2059
      picture_snapshot(payloadSize);
2060
    else if (payloadType == 16)
2061
      progressive_refinement_segment_start(payloadSize);
2062
    else if (payloadType == 17)
2063
      progressive_refinement_segment_end(payloadSize);
2064
    else if (payloadType == 19)
2065
      film_grain_characteristics(payloadSize);
2066
    else if (payloadType == 22)
2067
      post_filter_hint(payloadSize);
2068
    else if (payloadType == 23)
2069
      tone_mapping_info(payloadSize);
2070
    else if (payloadType == 45)
2071
      frame_packing_arrangement(payloadSize);
2072
    else if (payloadType == 47)
2073
      display_orientation(payloadSize);
2074
    else if (payloadType == 56)
2075
      green_metadata(payloadSize); /* specified in ISO/IEC 23001-11 */
2076
    else if (payloadType == 128)
2077
      structure_of_pictures_info(payloadSize);
2078
    else if (payloadType == 129)
2079
      active_parameter_sets(payloadSize);
2080
    else if (payloadType == 130)
2081
      decoding_unit_info(payloadSize);
2082
    else if (payloadType == 131)
2083
      temporal_sub_layer_zero_idx(payloadSize);
2084
    else if (payloadType == 133)
2085
      scalable_nesting(payloadSize);
2086
    else if (payloadType == 134)
2087
      region_refresh_info(payloadSize);
2088
    else if (payloadType == 135)
2089
      no_display(payloadSize);
2090
    else if (payloadType == 136)
2091
      time_code(payloadSize);
2092
    else if (payloadType == 137)
2093
      mastering_display_colour_volume(payloadSize);
2094
    else if (payloadType == 138)
2095
      segmented_rect_frame_packing_arrangement(payloadSize);
2096
    else if (payloadType == 139)
2097
      temporal_motion_constrained_tile_sets(payloadSize);
2098
    else if (payloadType == 140)
2099
      chroma_resampling_filter_hint(payloadSize);
2100
    else if (payloadType == 141)
2101
      knee_function_info(payloadSize);
2102
    else if (payloadType == 142)
2103
      colour_remapping_info(payloadSize);
2104
    else if (payloadType == 143)
2105
      deinterlaced_field_identification(payloadSize);
2106
    else if (payloadType == 144)
2107
      content_light_level_info(payloadSize);
2108
    else if (payloadType == 145)
2109
      dependent_rap_indication(payloadSize);
2110
    else if (payloadType == 146)
2111
      coded_region_completion(payloadSize);
2112
    else if (payloadType == 147)
2113
      alternative_transfer_characteristics(payloadSize);
2114
    else if (payloadType == 148)
2115
      ambient_viewing_environment(payloadSize);
2116
    else if (payloadType == 149)
2117
      content_colour_volume(payloadSize);
2118
    else if (payloadType == 150)
2119
      equirectangular_projection(payloadSize);
2120
    else if (payloadType == 151)
2121
      cubemap_projection(payloadSize);
2122
    else if (payloadType == 154)
2123
      sphere_rotation(payloadSize);
2124
    else if (payloadType == 155)
2125
      regionwise_packing(payloadSize);
2126
    else if (payloadType == 156)
2127
      omni_viewport(payloadSize);
2128
    else if (payloadType == 157)
2129
      regional_nesting(payloadSize);
2130
    else if (payloadType == 158)
2131
      mcts_extraction_info_sets(payloadSize);
2132
    else if (payloadType == 159)
2133
      mcts_extraction_info_nesting(payloadSize);
2134
    else if (payloadType == 160)
2135
      layers_not_present(payloadSize); /* specified in Annex F */
2136
    else if (payloadType == 161)
2137
      inter_layer_constrained_tile_sets(payloadSize); /* specified in Annex F */
2138
    else if (payloadType == 162)
2139
      bsp_nesting(payloadSize); /* specified in Annex F */
2140
    else if (payloadType == 163)
2141
      bsp_initial_arrival_time(payloadSize); /* specified in Annex F */
2142
    else if (payloadType == 164)
2143
      sub_bitstream_property(payloadSize); /* specified in Annex F */
2144
    else if (payloadType == 165)
2145
      alpha_channel_info(payloadSize); /* specified in Annex F */
2146
    else if (payloadType == 166)
2147
      overlay_info(payloadSize); /* specified in Annex F */
2148
    else if (payloadType == 167)
2149
      temporal_mv_prediction_constraints(payloadSize); /* specified in Annex F */
2150
    else if (payloadType == 168)
2151
      frame_field_info(payloadSize); /* specified in Annex F */
2152
    else if (payloadType == 176)
2153
      three_dimensional_reference_displays_info(payloadSize); /* specified in Annex G */
2154
    else if (payloadType == 177)
2155
      depth_representation_info(payloadSize); /* specified in Annex G */
2156
    else if (payloadType == 178)
2157
      multiview_scene_info(payloadSize); /* specified in Annex G */
2158
    else if (payloadType == 179)
2159
      multiview_acquisition_info(payloadSize); /* specified in Annex G */
2160
    else if (payloadType == 180)
2161
      multiview_view_position(payloadSize); /* specified in Annex G */
2162
    else if (payloadType == 181)
2163
      alternative_depth_info(payloadSize); /* specified in Annex I */
2164
    else
2165
      reserved_sei_message(payloadSize);
2166
  }
2167
  else /* nal_unit_type == SUFFIX_SEI_NUT */ {
2168
    if (payloadType == 3)
2169
      filler_payload(payloadSize);
2170
    else if (payloadType == 4)
2171
      user_data_registered_itu_t_t35(payloadSize);
2172
    else if (payloadType == 5)
2173
      user_data_unregistered(payloadSize);
2174
    else if (payloadType == 17)
2175
      progressive_refinement_segment_end(payloadSize);
2176
    else if (payloadType == 22)
2177
      post_filter_hint(payloadSize);
2178
    else if (payloadType == 132)
2179
      decoded_picture_hash(payloadSize);
2180
    else if (payloadType == 146)
2181
      coded_region_completion(payloadSize);
2182
    else
2183
      reserved_sei_message(payloadSize);
2184
  }
2185
  if (h265_more_data_in_payload(bit_start, bit_offset, payloadSize)) {
2186
    if (h265_payload_extension_present(tvb, bit_start, bit_offset, payloadSize)) {
2187
      /*reserved_payload_extension_data u(v) */
2188
      unsigned nEarlierBits = bit_offset - bit_start;
2189
      unsigned v_bits = 8 * payloadSize - nEarlierBits - nPayloadZeroBits - 1;
2190
      bit_offset = bit_offset + v_bits;
2191
    }
2192
    /* payload_bit_equal_to_one (equal to 1) f(1) */
2193
    bit_offset++;
2194
    while (!h265_byte_aligned(bit_offset)) {
2195
      /* payload_bit_equal_to_zero (equal to 0) f(1)*/
2196
      bit_offset++;
2197
    }
2198
  }
2199
#else
2200
0
  bit_offset = bit_offset + (payloadSize << 3);
2201
0
#endif
2202
0
  return bit_offset;
2203
0
}
2204
2205
/* 7.3.5 Supplemental enhancement information message syntax */
2206
static int
2207
dissect_h265_sei_message(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset, uint8_t nal_unit_type)
2208
0
{
2209
0
  unsigned payloadType = 0, last_payload_type_byte, payloadSize, last_payload_size_byte;
2210
0
  int     start_bit_offset, length;
2211
2212
0
  start_bit_offset = bit_offset;
2213
2214
0
  while (tvb_get_bits8(tvb, bit_offset, 8) == 0xFF) {
2215
0
    bit_offset = bit_offset + 8;
2216
0
    payloadType += 255;
2217
0
  }
2218
2219
0
  last_payload_type_byte = tvb_get_bits8(tvb, bit_offset, 8);
2220
0
  bit_offset = bit_offset + 8;
2221
2222
0
  payloadType += last_payload_type_byte;
2223
0
  length = (bit_offset - start_bit_offset) >> 3;
2224
2225
0
  proto_tree_add_uint(tree, hf_h265_payloadtype, tvb, start_bit_offset >> 3, length, payloadType);
2226
2227
0
  payloadSize = 0;
2228
0
  start_bit_offset = bit_offset;
2229
0
  while (tvb_get_bits8(tvb, bit_offset, 8) == 0xFF) {
2230
0
    bit_offset = bit_offset + 8;
2231
0
    payloadSize += 255;
2232
0
  }
2233
2234
0
  last_payload_size_byte = tvb_get_bits8(tvb, bit_offset, 8);
2235
0
  bit_offset = bit_offset + 8;
2236
2237
0
  payloadSize += last_payload_size_byte;
2238
0
  length = (bit_offset - start_bit_offset) >> 3;
2239
0
  proto_tree_add_uint(tree, hf_h265_payloadsize, tvb, start_bit_offset >> 3, length, payloadSize);
2240
2241
0
  bit_offset = dissect_h265_sei_payload(tree, tvb, pinfo, bit_offset, payloadType, payloadSize, nal_unit_type);
2242
2243
0
  return bit_offset;
2244
0
}
2245
2246
/* 7.3.7 Short-term reference picture set syntax */
2247
static int
2248
dissect_h265_st_ref_pic_set(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo _U_, int bit_offset, int stRpsIdx, int num_short_term_ref_pic_sets, int32_t NumDeltaPocs[H265_MAX_NUM_SHORT_TERM_REF_PIC_SETS])
2249
0
{
2250
0
  int j;
2251
0
  unsigned i;
2252
0
  uint32_t num_negative_pics, num_positive_pics;
2253
0
  bool inter_ref_pic_set_prediction_flag = 0;
2254
0
  bool used_by_curr_pic_flag;
2255
0
  int RefRpsIdx;
2256
0
  int delta_idx_minus1 = 0;
2257
0
  tree = proto_tree_add_subtree_format(tree, tvb, bit_offset >> 3, 1, ett_h265_ref_pic_set, NULL, "ref_pic_set %d", stRpsIdx);
2258
2259
0
  if (stRpsIdx != 0) {
2260
0
    inter_ref_pic_set_prediction_flag = tvb_get_bits8(tvb, bit_offset, 1);
2261
0
    proto_tree_add_bits_item(tree, hf_h265_inter_ref_pic_set_prediction_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2262
0
    bit_offset++;
2263
0
  }
2264
0
  if (inter_ref_pic_set_prediction_flag) {
2265
0
    if (stRpsIdx == num_short_term_ref_pic_sets) {
2266
0
      delta_idx_minus1 = dissect_h265_exp_golomb_code(tree, hf_h265_delta_idx_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2267
0
    }
2268
0
    proto_tree_add_bits_item(tree, hf_h265_delta_rps_sign, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2269
0
    bit_offset++;
2270
0
    dissect_h265_exp_golomb_code(tree, hf_h265_abs_delta_rps_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2271
0
    RefRpsIdx = stRpsIdx - (delta_idx_minus1 + 1);
2272
0
    for (j = 0; j <= NumDeltaPocs[RefRpsIdx]; j++) {
2273
0
      used_by_curr_pic_flag = tvb_get_bits8(tvb, bit_offset, 1);
2274
0
      proto_tree_add_bits_item(tree, hf_h265_used_by_curr_pic_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2275
0
      bit_offset++;
2276
0
      if (!used_by_curr_pic_flag) {
2277
0
        proto_tree_add_bits_item(tree, hf_h265_use_delta_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2278
0
        bit_offset++;
2279
0
      }
2280
0
    }
2281
0
    NumDeltaPocs[stRpsIdx] = NumDeltaPocs[RefRpsIdx];
2282
0
  }
2283
0
  else {
2284
0
    num_negative_pics = dissect_h265_exp_golomb_code(tree, hf_h265_num_negative_pics, tvb, pinfo, &bit_offset, H265_UE_V);
2285
0
    num_positive_pics = dissect_h265_exp_golomb_code(tree, hf_h265_num_positive_pics, tvb, pinfo, &bit_offset, H265_UE_V);
2286
0
    NumDeltaPocs[stRpsIdx] = num_negative_pics + num_positive_pics;
2287
0
    for (i = 0; i < num_negative_pics; i++) {
2288
0
      dissect_h265_exp_golomb_code(tree, hf_h265_delta_poc_s0_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2289
0
      proto_tree_add_bits_item(tree, hf_h265_used_by_curr_pic_s0_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2290
0
      bit_offset++;
2291
0
    }
2292
0
    for (i = 0; i < num_positive_pics; i++) {
2293
0
      dissect_h265_exp_golomb_code(tree, hf_h265_delta_poc_s1_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2294
0
      proto_tree_add_bits_item(tree, hf_h265_used_by_curr_pic_s1_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2295
0
      bit_offset++;
2296
0
    }
2297
0
  }
2298
0
  return bit_offset;
2299
0
}
2300
2301
/* E.2.3 Sub-layer HRD parameters syntax */
2302
static int
2303
dissect_h265_sub_layer_hrd_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, int bit_offset, unsigned subLayerId _U_, uint32_t CpbCnt, bool sub_pic_hrd_params_present_flag)
2304
0
{
2305
  /*The variable CpbCnt is set equal to cpb_cnt_minus1[ subLayerId ] + 1.*/
2306
0
  unsigned i;
2307
0
  for (i = 0; i < CpbCnt; i++) {
2308
0
    dissect_h265_exp_golomb_code(tree, hf_h265_bit_rate_value_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2309
0
    dissect_h265_exp_golomb_code(tree, hf_h265_cpb_size_value_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2310
0
    if (sub_pic_hrd_params_present_flag) {
2311
0
      dissect_h265_exp_golomb_code(tree, hf_h265_cpb_size_du_value_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2312
0
      dissect_h265_exp_golomb_code(tree, hf_h265_bit_rate_du_value_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2313
0
    }
2314
0
    proto_tree_add_bits_item(tree, hf_h265_cbr_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2315
0
    bit_offset++;
2316
0
  }
2317
0
  return bit_offset;
2318
0
}
2319
2320
/* E.2.2 HRD parameters syntax */
2321
static int
2322
dissect_h265_hrd_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, int bit_offset, bool commonInfPresentFlag, unsigned maxNumSubLayersMinus1)
2323
0
{
2324
0
  unsigned subLayerId;
2325
0
  bool nal_hrd_parameters_present_flag = 0, vcl_hrd_parameters_present_flag = 0, sub_pic_hrd_params_present_flag = 0;
2326
0
  bool fixed_pic_rate_general_flag[32] = { 0 };
2327
0
  bool fixed_pic_rate_within_cvs_flag[32] = { 0 };
2328
0
  bool low_delay_hrd_flag[32] = { 0 };
2329
0
  uint32_t cpb_cnt_minus1[32] = { 0 };
2330
2331
0
  if (commonInfPresentFlag) {
2332
2333
0
    nal_hrd_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2334
0
    proto_tree_add_bits_item(tree, hf_h265_nal_hrd_parameters_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2335
0
    bit_offset++;
2336
2337
0
    vcl_hrd_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2338
0
    proto_tree_add_bits_item(tree, hf_h265_vcl_hrd_parameters_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2339
0
    bit_offset++;
2340
2341
0
    if (nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag) {
2342
2343
0
      sub_pic_hrd_params_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2344
0
      proto_tree_add_bits_item(tree, hf_h265_sub_pic_hrd_params_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2345
0
      bit_offset++;
2346
2347
0
      if (sub_pic_hrd_params_present_flag) {
2348
0
        proto_tree_add_bits_item(tree, hf_h265_tick_divisor_minus2, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
2349
0
        bit_offset = bit_offset + 8;
2350
2351
0
        proto_tree_add_bits_item(tree, hf_h265_du_cpb_removal_delay_increment_length_minus1, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2352
0
        bit_offset = bit_offset + 5;
2353
2354
0
        proto_tree_add_bits_item(tree, hf_h265_sub_pic_cpb_params_in_pic_timing_sei_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2355
0
        bit_offset++;
2356
2357
0
        proto_tree_add_bits_item(tree, hf_h265_dpb_output_delay_du_length_minus1, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2358
0
        bit_offset = bit_offset + 5;
2359
2360
0
      }
2361
2362
0
      proto_tree_add_bits_item(tree, hf_h265_bit_rate_scale, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2363
0
      bit_offset = bit_offset + 4;
2364
2365
0
      proto_tree_add_bits_item(tree, hf_h265_cpb_size_scale, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2366
0
      bit_offset = bit_offset + 4;
2367
2368
0
      if (sub_pic_hrd_params_present_flag) {
2369
2370
0
        proto_tree_add_bits_item(tree, hf_h265_cpb_size_du_scale, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2371
0
        bit_offset = bit_offset + 4;
2372
0
      }
2373
2374
0
      proto_tree_add_bits_item(tree, hf_h265_initial_cpb_removal_delay_length_minus1, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2375
0
      bit_offset = bit_offset + 5;
2376
2377
0
      proto_tree_add_bits_item(tree, hf_h265_au_cpb_removal_delay_length_minus1, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2378
0
      bit_offset = bit_offset + 5;
2379
2380
0
      proto_tree_add_bits_item(tree, hf_h265_dpb_output_delay_length_minus1, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2381
0
      bit_offset = bit_offset + 5;
2382
0
    }
2383
0
  }
2384
0
  for (subLayerId = 0; subLayerId <= maxNumSubLayersMinus1; subLayerId++) {
2385
2386
0
    fixed_pic_rate_general_flag[subLayerId] = tvb_get_bits8(tvb, bit_offset, 1);
2387
0
    proto_tree_add_bits_item(tree, hf_h265_fixed_pic_rate_general_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2388
0
    bit_offset++;
2389
2390
0
    if (!fixed_pic_rate_general_flag[subLayerId]) {
2391
2392
0
      fixed_pic_rate_within_cvs_flag[subLayerId] = tvb_get_bits8(tvb, bit_offset, 1);
2393
0
      proto_tree_add_bits_item(tree, hf_h265_fixed_pic_rate_within_cvs_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2394
0
      bit_offset++;
2395
0
    }
2396
0
    if (fixed_pic_rate_within_cvs_flag[subLayerId]) {
2397
2398
0
      dissect_h265_exp_golomb_code(tree, hf_h265_elemental_duration_in_tc_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2399
0
    }
2400
0
    else {
2401
2402
0
      low_delay_hrd_flag[subLayerId] = tvb_get_bits8(tvb, bit_offset, 1);
2403
0
      proto_tree_add_bits_item(tree, hf_h265_low_delay_hrd_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2404
0
      bit_offset++;
2405
0
    }
2406
0
    if (!low_delay_hrd_flag[subLayerId]) {
2407
2408
0
      cpb_cnt_minus1[subLayerId] = dissect_h265_exp_golomb_code(tree, hf_h265_cpb_cnt_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2409
0
    }
2410
0
    if (nal_hrd_parameters_present_flag) {
2411
2412
0
      dissect_h265_sub_layer_hrd_parameters(tree, tvb, pinfo, bit_offset, subLayerId, cpb_cnt_minus1[subLayerId] + 1, sub_pic_hrd_params_present_flag);
2413
0
    }
2414
0
    if (vcl_hrd_parameters_present_flag) {
2415
2416
0
      dissect_h265_sub_layer_hrd_parameters(tree, tvb, pinfo, bit_offset, subLayerId, cpb_cnt_minus1[subLayerId] + 1, sub_pic_hrd_params_present_flag);
2417
0
    }
2418
0
  }
2419
0
  return bit_offset;
2420
0
}
2421
2422
0
#define EXTENDED_SAR 255
2423
2424
/* Table E-2 - Meaning of video_format */
2425
static const value_string h265_video_format_vals[] = {
2426
  { 0,   "Component" },
2427
  { 1,   "PAL" },
2428
  { 2,   "NTSC" },
2429
  { 3,   "SECAM" },
2430
  { 4,   "MAC" },
2431
  { 5,   "Unspecified video format" },
2432
  { 0, NULL }
2433
};
2434
2435
/* E.2.1 VUI parameters syntax */
2436
static int
2437
dissect_h265_vui_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int bit_offset, uint8_t sps_max_sub_layers_minus1)
2438
0
{
2439
0
  uint8_t aspect_ratio_info_present_flag, aspect_ratio_idc, overscan_info_present_flag;
2440
0
  uint8_t video_signal_type_present_flag, colour_description_present_flag, chroma_loc_info_present_flag;
2441
0
  uint8_t bitstream_restriction_flag, default_display_window_flag, vui_timing_info_present_flag;
2442
0
  uint8_t vui_poc_proportional_to_timing_flag, vui_hrd_parameters_present_flag;
2443
2444
  /* vui_parameters( ) {
2445
  * aspect_ratio_info_present_flag 0 u(1)
2446
  */
2447
0
  aspect_ratio_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2448
0
  proto_tree_add_bits_item(tree, hf_h265_aspect_ratio_info_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2449
0
  bit_offset++;
2450
2451
0
  if (aspect_ratio_info_present_flag) {
2452
    /* aspect_ratio_idc 0 u(8) */
2453
0
    aspect_ratio_idc = tvb_get_bits8(tvb, bit_offset, 8);
2454
0
    proto_tree_add_bits_item(tree, hf_h265_aspect_ratio_idc, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
2455
0
    bit_offset = bit_offset + 8;
2456
2457
0
    if (aspect_ratio_idc == EXTENDED_SAR) {
2458
      /* sar_width 0 u(16) */
2459
0
      proto_tree_add_bits_item(tree, hf_h265_sar_width, tvb, bit_offset, 16, ENC_BIG_ENDIAN);
2460
0
      bit_offset = bit_offset + 16;
2461
2462
      /* sar_height 0 u(16) */
2463
0
      proto_tree_add_bits_item(tree, hf_h265_sar_height, tvb, bit_offset, 16, ENC_BIG_ENDIAN);
2464
0
      bit_offset = bit_offset + 16;
2465
0
    }
2466
0
  }
2467
  /* overscan_info_present_flag 0 u(1) */
2468
0
  overscan_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2469
0
  proto_tree_add_bits_item(tree, hf_h265_overscan_info_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2470
0
  bit_offset++;
2471
2472
0
  if (overscan_info_present_flag) {
2473
    /* overscan_appropriate_flag 0 u(1) */
2474
0
    proto_tree_add_bits_item(tree, hf_h265_overscan_appropriate_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2475
0
    bit_offset++;
2476
0
  }
2477
2478
  /* video_signal_type_present_flag 0 u(1) */
2479
0
  video_signal_type_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2480
0
  proto_tree_add_bits_item(tree, hf_h265_video_signal_type_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2481
0
  bit_offset++;
2482
2483
0
  if (video_signal_type_present_flag) {
2484
    /* video_format 0 u(3) > */
2485
0
    proto_tree_add_bits_item(tree, hf_h265_video_format, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2486
0
    bit_offset = bit_offset + 3;
2487
2488
    /* video_full_range_flag 0 u(1)*/
2489
0
    proto_tree_add_bits_item(tree, hf_h265_video_full_range_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2490
0
    bit_offset++;
2491
2492
    /* colour_description_present_flag 0 u(1) */
2493
0
    colour_description_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2494
0
    proto_tree_add_bits_item(tree, hf_h265_colour_description_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2495
0
    bit_offset++;
2496
2497
0
    if (colour_description_present_flag) {
2498
      /* colour_primaries 0 u(8) */
2499
0
      proto_tree_add_bits_item(tree, hf_h265_colour_primaries, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
2500
0
      bit_offset = bit_offset + 8;
2501
2502
      /* transfer_characteristics 0 u(8) */
2503
0
      proto_tree_add_bits_item(tree, hf_h265_transfer_characteristics, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
2504
0
      bit_offset = bit_offset + 8;
2505
2506
      /* matrix_coefficients 0 u(8)*/
2507
0
      proto_tree_add_bits_item(tree, hf_h265_matrix_coeffs, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
2508
0
      bit_offset = bit_offset + 8;
2509
0
    }
2510
0
  }
2511
2512
  /* chroma_loc_info_present_flag 0 u(1) */
2513
0
  chroma_loc_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2514
0
  proto_tree_add_bits_item(tree, hf_h265_chroma_loc_info_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2515
0
  bit_offset++;
2516
2517
0
  if (chroma_loc_info_present_flag) {
2518
    /* chroma_sample_loc_type_top_field 0 ue(v) */
2519
0
    dissect_h265_exp_golomb_code(tree, hf_h265_chroma_sample_loc_type_top_field, tvb, pinfo, &bit_offset, H265_UE_V);
2520
2521
    /* chroma_sample_loc_type_bottom_field 0 ue(v) */
2522
0
    dissect_h265_exp_golomb_code(tree, hf_h265_chroma_sample_loc_type_bottom_field, tvb, pinfo, &bit_offset, H265_UE_V);
2523
0
  }
2524
2525
  /* neutral_chroma_indication_flag u(1) */
2526
0
  proto_tree_add_bits_item(tree, hf_h265_neutral_chroma_indication_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2527
0
  bit_offset++;
2528
2529
  /* field_seq_flag u(1) */
2530
0
  proto_tree_add_bits_item(tree, hf_h265_field_seq_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2531
0
  bit_offset++;
2532
2533
  /* frame_field_info_present_flag u(1) */
2534
0
  proto_tree_add_bits_item(tree, hf_h265_frame_field_info_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2535
0
  bit_offset++;
2536
2537
  /* default_display_window_flag u(1) */
2538
0
  default_display_window_flag = tvb_get_bits8(tvb, bit_offset, 1);
2539
0
  proto_tree_add_bits_item(tree, hf_h265_default_display_window_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2540
0
  bit_offset++;
2541
2542
0
  if (default_display_window_flag) {
2543
    /* def_disp_win_left_offset ue(v) */
2544
0
    dissect_h265_exp_golomb_code(tree, hf_h265_def_disp_win_left_offset, tvb, pinfo, &bit_offset, H265_UE_V);
2545
2546
    /* def_disp_win_right_offset ue(v) */
2547
0
    dissect_h265_exp_golomb_code(tree, hf_h265_def_disp_win_right_offset, tvb, pinfo, &bit_offset, H265_UE_V);
2548
2549
    /* def_disp_win_top_offset ue(v) */
2550
0
    dissect_h265_exp_golomb_code(tree, hf_h265_def_disp_win_top_offset, tvb, pinfo, &bit_offset, H265_UE_V);
2551
2552
    /* def_disp_win_bottom_offset ue(v) */
2553
0
    dissect_h265_exp_golomb_code(tree, hf_h265_def_disp_win_bottom_offset, tvb, pinfo, &bit_offset, H265_UE_V);
2554
0
  }
2555
2556
  /* vui_timing_info_present_flag u(1) */
2557
0
  vui_timing_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2558
0
  proto_tree_add_bits_item(tree, hf_h265_vui_timing_info_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2559
0
  bit_offset++;
2560
2561
0
  if (vui_timing_info_present_flag) {
2562
    /* vui_num_units_in_tick u(32) */
2563
0
    proto_tree_add_bits_item(tree, hf_h265_vui_num_units_in_tick, tvb, bit_offset, 32, ENC_BIG_ENDIAN);
2564
0
    bit_offset = bit_offset + 32;
2565
2566
    /* vui_time_scale u(32) */
2567
0
    proto_tree_add_bits_item(tree, hf_h265_vui_time_scale, tvb, bit_offset, 32, ENC_BIG_ENDIAN);
2568
0
    bit_offset = bit_offset + 32;
2569
2570
    /* vui_poc_proportional_to_timing_flag u(1) */
2571
0
    vui_poc_proportional_to_timing_flag = tvb_get_bits8(tvb, bit_offset, 1);
2572
0
    proto_tree_add_bits_item(tree, hf_h265_vui_poc_proportional_to_timing_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2573
0
    bit_offset++;
2574
2575
0
    if (vui_poc_proportional_to_timing_flag) {
2576
      /* vui_num_ticks_poc_diff_one_minus1 ue(v) */
2577
0
      dissect_h265_exp_golomb_code(tree, hf_h265_vui_num_ticks_poc_diff_one_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2578
0
    }
2579
2580
    /* vui_hrd_parameters_present_flag u(1) */
2581
0
    vui_hrd_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2582
0
    proto_tree_add_bits_item(tree, hf_h265_vui_hrd_parameters_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2583
0
    bit_offset++;
2584
2585
0
    if (vui_hrd_parameters_present_flag) {
2586
0
      dissect_h265_hrd_parameters(tree, tvb, pinfo, bit_offset, 1, sps_max_sub_layers_minus1);
2587
0
    }
2588
0
  }
2589
2590
  /* bitstream_restriction_flag 0 u(1) */
2591
0
  bitstream_restriction_flag = tvb_get_bits8(tvb, bit_offset, 1);
2592
0
  proto_tree_add_bits_item(tree, hf_h265_bitstream_restriction_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2593
0
  bit_offset++;
2594
2595
0
  if (bitstream_restriction_flag) {
2596
    /* tiles_fixed_structure_flag u(1) */
2597
0
    proto_tree_add_bits_item(tree, hf_h265_tiles_fixed_structure_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2598
0
    bit_offset++;
2599
2600
    /* motion_vectors_over_pic_boundaries_flag u(1) */
2601
0
    proto_tree_add_bits_item(tree, hf_h265_motion_vectors_over_pic_boundaries_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2602
0
    bit_offset++;
2603
2604
    /* restricted_ref_pic_lists_flag u(1) */
2605
0
    proto_tree_add_bits_item(tree, hf_h265_restricted_ref_pic_lists_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2606
0
    bit_offset++;
2607
2608
    /* min_spatial_segmentation_idc ue(v) */
2609
0
    dissect_h265_exp_golomb_code(tree, hf_h265_min_spatial_segmentation_idc, tvb, pinfo, &bit_offset, H265_UE_V);
2610
2611
    /* max_bytes_per_pic_denom ue(v) */
2612
0
    dissect_h265_exp_golomb_code(tree, hf_h265_max_bytes_per_pic_denom, tvb, pinfo, &bit_offset, H265_UE_V);
2613
2614
    /* max_bits_per_min_cu_denom ue(v) */
2615
0
    dissect_h265_exp_golomb_code(tree, hf_h265_max_bits_per_min_cu_denom, tvb, pinfo, &bit_offset, H265_UE_V);
2616
2617
    /* log2_max_mv_length_horizontal ue(v) */
2618
0
    dissect_h265_exp_golomb_code(tree, hf_h265_log2_max_mv_length_horizontal, tvb, pinfo, &bit_offset, H265_UE_V);
2619
2620
    /* log2_max_mv_length_vertical ue(v) */
2621
0
    dissect_h265_exp_golomb_code(tree, hf_h265_log2_max_mv_length_vertical, tvb, pinfo, &bit_offset, H265_UE_V);
2622
0
  }
2623
2624
0
  return bit_offset;
2625
0
}
2626
2627
/* 7.3.2.2.2 Sequence parameter set range extension syntax */
2628
static int
2629
dissect_h265_sps_range_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo _U_, int bit_offset)
2630
0
{
2631
0
  proto_tree_add_bits_item(tree, hf_h265_transform_skip_rotation_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2632
0
  bit_offset++;
2633
2634
0
  proto_tree_add_bits_item(tree, hf_h265_transform_skip_context_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2635
0
  bit_offset++;
2636
2637
0
  proto_tree_add_bits_item(tree, hf_h265_implicit_rdpcm_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2638
0
  bit_offset++;
2639
2640
0
  proto_tree_add_bits_item(tree, hf_h265_explicit_rdpcm_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2641
0
  bit_offset++;
2642
2643
0
  proto_tree_add_bits_item(tree, hf_h265_extended_precision_processing_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2644
0
  bit_offset++;
2645
2646
0
  proto_tree_add_bits_item(tree, hf_h265_intra_smoothing_disabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2647
0
  bit_offset++;
2648
2649
0
  proto_tree_add_bits_item(tree, hf_h265_high_precision_offsets_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2650
0
  bit_offset++;
2651
2652
0
  proto_tree_add_bits_item(tree, hf_h265_persistent_rice_adaptation_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2653
0
  bit_offset++;
2654
2655
0
  proto_tree_add_bits_item(tree, hf_h265_cabac_bypass_alignment_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2656
0
  bit_offset++;
2657
2658
0
  return bit_offset;
2659
0
}
2660
2661
/* F.7.3.2.2.4 Sequence parameter set multilayer extension syntax */
2662
static int
2663
dissect_h265_sps_multilayer_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset)
2664
0
{
2665
0
  proto_tree *sps_multilayer_extension_tree;
2666
0
  sps_multilayer_extension_tree = proto_tree_add_subtree(tree, tvb, bit_offset >> 3, 1, ett_h265_sps_multilayer_extension, NULL, "sps_multilayer_extension");
2667
0
  proto_tree_add_expert(sps_multilayer_extension_tree, pinfo, &ei_h265_undecoded, tvb, bit_offset >> 3, -1);
2668
0
  return bit_offset;
2669
0
}
2670
2671
/* I.7.3.2.2.5 Sequence parameter set 3D extension syntax */
2672
static int
2673
dissect_h265_sps_3d_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset)
2674
0
{
2675
0
  proto_tree *sps_3d_extension_tree;
2676
0
  sps_3d_extension_tree = proto_tree_add_subtree(tree, tvb, bit_offset >> 3, 1, ett_h265_sps_3d_extension, NULL, "sps_3d_extension");
2677
0
  proto_tree_add_expert(sps_3d_extension_tree, pinfo, &ei_h265_undecoded, tvb, bit_offset >> 3, -1);
2678
0
  return bit_offset;
2679
0
}
2680
2681
/* 7.3.2.2.3 Sequence parameter set screen content coding extension syntax */
2682
static int
2683
dissect_h265_sps_scc_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo _U_, int bit_offset, unsigned chroma_format_idc, unsigned bit_depth_luma_minus8, unsigned bit_depth_chroma_minus8)
2684
0
{
2685
0
  unsigned BitDepthY = 8 + bit_depth_luma_minus8, BitDepthC = 8 + bit_depth_chroma_minus8;
2686
0
  bool palette_mode_enabled_flag, sps_palette_predictor_initializers_present_flag;
2687
0
  uint32_t sps_num_palette_predictor_initializers_minus1;
2688
0
  uint32_t numComps, comp, i;
2689
2690
0
  proto_tree_add_bits_item(tree, hf_h265_sps_curr_pic_ref_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2691
0
  bit_offset++;
2692
2693
0
  palette_mode_enabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
2694
0
  proto_tree_add_bits_item(tree, hf_h265_palette_mode_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2695
0
  bit_offset++;
2696
2697
0
  if (palette_mode_enabled_flag) {
2698
0
    dissect_h265_exp_golomb_code(tree, hf_h265_palette_max_size, tvb, pinfo, &bit_offset, H265_UE_V);
2699
0
    dissect_h265_exp_golomb_code(tree, hf_h265_delta_palette_max_predictor_size, tvb, pinfo, &bit_offset, H265_UE_V);
2700
2701
0
    sps_palette_predictor_initializers_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2702
0
    proto_tree_add_bits_item(tree, hf_h265_sps_palette_predictor_initializers_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2703
0
    bit_offset++;
2704
0
    if (sps_palette_predictor_initializers_present_flag) {
2705
0
      sps_num_palette_predictor_initializers_minus1 = dissect_h265_exp_golomb_code(tree, hf_h265_sps_num_palette_predictor_initializers_minus1, tvb, pinfo, &bit_offset, H265_UE_V);
2706
0
      numComps = (chroma_format_idc == 0) ? 1 : 3;
2707
0
      for (comp = 0; comp < numComps; comp++)
2708
0
        for (i = 0; i <= sps_num_palette_predictor_initializers_minus1; i++) {
2709
0
          if (comp == 0) {
2710
0
            proto_tree_add_bits_item(tree, hf_h265_sps_palette_predictor_initializer, tvb, bit_offset, (1 << BitDepthY) - 1, ENC_BIG_ENDIAN);
2711
0
            bit_offset = bit_offset + (1 << BitDepthY) - 1;
2712
0
          }
2713
0
          else {
2714
0
            proto_tree_add_bits_item(tree, hf_h265_sps_palette_predictor_initializer, tvb, bit_offset, (1 << BitDepthC) - 1, ENC_BIG_ENDIAN);
2715
0
            bit_offset = bit_offset + (1 << BitDepthC) - 1;
2716
0
          }
2717
0
        }
2718
0
    }
2719
0
  }
2720
2721
0
  proto_tree_add_bits_item(tree, hf_h265_motion_vector_resolution_control_idc, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2722
0
  bit_offset = bit_offset + 2;
2723
2724
0
  proto_tree_add_bits_item(tree, hf_h265_intra_boundary_filtering_disabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2725
0
  bit_offset++;
2726
2727
0
  return bit_offset;
2728
0
}
2729
2730
/* 7.3.2.3.2 Picture parameter set range extension syntax */
2731
static int
2732
dissect_h265_pps_range_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo _U_, int bit_offset, unsigned transform_skip_enabled_flag)
2733
0
{
2734
0
  bool chroma_qp_offset_list_enabled_flag;
2735
0
        int offset;
2736
0
  unsigned i, chroma_qp_offset_list_len_minus1;
2737
2738
0
  if (transform_skip_enabled_flag) {
2739
0
    offset = bit_offset >> 3;
2740
2741
0
    dissect_h265_exp_golomb_code(tree, hf_h265_log2_max_transform_skip_block_size_minus2, tvb, pinfo, &offset, H265_UE_V);
2742
2743
0
    bit_offset = offset << 3;
2744
0
  }
2745
2746
0
  proto_tree_add_bits_item(tree, hf_h265_cross_component_prediction_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2747
0
  bit_offset++;
2748
2749
0
  chroma_qp_offset_list_enabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
2750
0
  proto_tree_add_bits_item(tree, hf_h265_chroma_qp_offset_list_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2751
0
  bit_offset++;
2752
2753
0
  offset = bit_offset >> 3;
2754
2755
0
  if (chroma_qp_offset_list_enabled_flag) {
2756
0
    dissect_h265_exp_golomb_code(tree, hf_h265_diff_cu_chroma_qp_offset_depth, tvb, pinfo, &offset, H265_UE_V);
2757
0
    chroma_qp_offset_list_len_minus1 = dissect_h265_exp_golomb_code(tree, hf_h265_chroma_qp_offset_list_len_minus1, tvb, pinfo, &offset, H265_UE_V);
2758
2759
0
    for (i = 0; i <= chroma_qp_offset_list_len_minus1; i++) {
2760
0
      dissect_h265_exp_golomb_code(tree, hf_h265_cb_qp_offset_list, tvb, pinfo, &offset, H265_SE_V);
2761
0
      dissect_h265_exp_golomb_code(tree, hf_h265_cr_qp_offset_list, tvb, pinfo, &offset, H265_SE_V);
2762
0
    }
2763
0
  }
2764
2765
0
  dissect_h265_exp_golomb_code(tree, hf_h265_log2_sao_offset_scale_luma, tvb, pinfo, &offset, H265_UE_V);
2766
0
  dissect_h265_exp_golomb_code(tree, hf_h265_log2_sao_offset_scale_chroma, tvb, pinfo, &offset, H265_UE_V);
2767
2768
0
  bit_offset = offset << 3;
2769
2770
0
  return bit_offset;
2771
0
}
2772
2773
/* 7.3.2.3.3 Picture parameter set screen content coding extension syntax */
2774
static int
2775
dissect_h265_pps_scc_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo _U_, int bit_offset)
2776
0
{
2777
0
  int offset;
2778
0
  unsigned pps_num_palette_predictor_initializers, numComps, comp, i;
2779
0
  bool residual_adaptive_colour_transform_enabled_flag, pps_palette_predictor_initializers_present_flag,
2780
0
    monochrome_palette_flag;
2781
0
  uint32_t luma_bit_depth_entry_minus8 = 0, chroma_bit_depth_entry_minus8 = 0;
2782
2783
0
  proto_tree_add_bits_item(tree, hf_h265_pps_curr_pic_ref_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2784
0
  bit_offset++;
2785
2786
0
  residual_adaptive_colour_transform_enabled_flag = tvb_get_bits8(tvb, bit_offset, 1);
2787
0
  proto_tree_add_bits_item(tree, hf_h265_residual_adaptive_colour_transform_enabled_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2788
0
  bit_offset++;
2789
2790
0
  if (residual_adaptive_colour_transform_enabled_flag) {
2791
0
    proto_tree_add_bits_item(tree, hf_h265_pps_slice_act_qp_offsets_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2792
0
    bit_offset++;
2793
2794
0
    offset = bit_offset >> 3;
2795
2796
0
    dissect_h265_exp_golomb_code(tree, hf_h265_pps_act_y_qp_offset_plus5, tvb, pinfo, &offset, H265_SE_V);
2797
0
    dissect_h265_exp_golomb_code(tree, hf_h265_pps_act_cb_qp_offset_plus5, tvb, pinfo, &offset, H265_SE_V);
2798
0
    dissect_h265_exp_golomb_code(tree, hf_h265_pps_act_cr_qp_offset_plus3, tvb, pinfo, &offset, H265_SE_V);
2799
2800
0
    bit_offset = offset << 3;
2801
0
  }
2802
2803
0
  pps_palette_predictor_initializers_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
2804
0
  proto_tree_add_bits_item(tree, hf_h265_pps_palette_predictor_initializers_present_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2805
0
  bit_offset++;
2806
2807
0
  if (pps_palette_predictor_initializers_present_flag) {
2808
0
    offset = bit_offset >> 3;
2809
2810
0
    pps_num_palette_predictor_initializers = dissect_h265_exp_golomb_code(tree, hf_h265_pps_num_palette_predictor_initializers, tvb, pinfo, &offset, H265_SE_V);
2811
0
    if (pps_num_palette_predictor_initializers > 0) {
2812
2813
0
      bit_offset = offset << 3;
2814
2815
0
      monochrome_palette_flag = tvb_get_bits8(tvb, bit_offset, 1);
2816
0
      proto_tree_add_bits_item(tree, hf_h265_monochrome_palette_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2817
0
      bit_offset++;
2818
2819
0
      offset = bit_offset >> 3;
2820
2821
0
      luma_bit_depth_entry_minus8 = dissect_h265_exp_golomb_code(tree, hf_h265_luma_bit_depth_entry_minus8, tvb, pinfo, &offset, H265_UE_V);
2822
2823
0
      if (!monochrome_palette_flag) {
2824
0
        chroma_bit_depth_entry_minus8 = dissect_h265_exp_golomb_code(tree, hf_h265_chroma_bit_depth_entry_minus8, tvb, pinfo, &offset, H265_UE_V);
2825
0
      }
2826
2827
0
      numComps = monochrome_palette_flag ? 1 : 3;
2828
0
      for (comp = 0; comp < numComps; comp++)
2829
0
        for (i = 0; i < pps_num_palette_predictor_initializers; i++) {
2830
0
          bit_offset = offset << 3;
2831
2832
0
          if (comp == 0) {
2833
0
            proto_tree_add_bits_item(tree, hf_h265_pps_palette_predictor_initializer, tvb, bit_offset, luma_bit_depth_entry_minus8 + 8, ENC_BIG_ENDIAN);
2834
0
            bit_offset = bit_offset + luma_bit_depth_entry_minus8 + 8;
2835
0
          }
2836
0
          else {
2837
0
            proto_tree_add_bits_item(tree, hf_h265_pps_palette_predictor_initializer, tvb, bit_offset, chroma_bit_depth_entry_minus8 + 8, ENC_BIG_ENDIAN);
2838
0
            bit_offset = bit_offset + chroma_bit_depth_entry_minus8 + 8;
2839
0
          }
2840
2841
0
          offset = bit_offset >> 3;
2842
0
        }
2843
0
    }
2844
2845
0
    bit_offset = offset << 3;
2846
0
  }
2847
2848
0
  return bit_offset;
2849
0
}
2850
2851
/* F.7.3.2.3.4 Picture parameter set multilayer extension syntax */
2852
static int
2853
dissect_h265_pps_multilayer_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset)
2854
0
{
2855
0
  proto_tree *pps_multilayer_extension_tree;
2856
0
  pps_multilayer_extension_tree = proto_tree_add_subtree(tree, tvb, bit_offset >> 3, 1, ett_h265_pps_multilayer_extension, NULL, "pps_multilayer_extension");
2857
0
  proto_tree_add_expert(pps_multilayer_extension_tree, pinfo, &ei_h265_undecoded, tvb, bit_offset >> 3, -1);
2858
2859
0
  return bit_offset;
2860
0
}
2861
2862
/* I.7.3.2.3.7 Picture parameter set 3D extension syntax */
2863
static int
2864
dissect_h265_pps_3d_extension(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, int bit_offset)
2865
0
{
2866
0
  proto_tree *pps_3d_extension_tree;
2867
0
  pps_3d_extension_tree = proto_tree_add_subtree(tree, tvb, bit_offset >> 3, 1, ett_h265_pps_3d_extension, NULL, "pps_3d_extension");
2868
0
  proto_tree_add_expert(pps_3d_extension_tree, pinfo, &ei_h265_undecoded, tvb, bit_offset >> 3, -1);
2869
2870
0
  return bit_offset;
2871
0
}
2872
2873
2874
static tvbuff_t *
2875
dissect_h265_unescap_nal_unit(tvbuff_t *tvb, packet_info *pinfo, int offset)
2876
0
{
2877
0
  tvbuff_t *tvb_rbsp;
2878
0
  int       length = tvb_reported_length_remaining(tvb, offset);
2879
0
  int       NumBytesInRBSP = 0;
2880
0
  int       i;
2881
0
  uint8_t   *buff;
2882
2883
0
  buff = (char *)wmem_alloc(pinfo->pool, length);
2884
0
  for (i = 0; i < length; i++) {
2885
0
    if ((i + 2 < length) && (tvb_get_ntoh24(tvb, offset) == 0x000003)) {
2886
0
      buff[NumBytesInRBSP++] = tvb_get_uint8(tvb, offset);
2887
0
      buff[NumBytesInRBSP++] = tvb_get_uint8(tvb, offset + 1);
2888
0
      i += 2;
2889
0
      offset += 3;
2890
0
    }
2891
0
    else {
2892
0
      buff[NumBytesInRBSP++] = tvb_get_uint8(tvb, offset);
2893
0
      offset++;
2894
0
    }
2895
0
  }
2896
2897
0
  tvb_rbsp = tvb_new_child_real_data(tvb, buff, NumBytesInRBSP, NumBytesInRBSP);
2898
0
  add_new_data_source(pinfo, tvb_rbsp, "Unescaped RSP Data");
2899
2900
0
  return tvb_rbsp;
2901
0
}
2902
2903
void
2904
dissect_h265_format_specific_parameter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo)
2905
0
{
2906
0
  int         offset = 0;
2907
0
  proto_item *item;
2908
0
  proto_tree *h265_nal_tree;
2909
0
  uint8_t    type;
2910
0
  tvbuff_t   *rbsp_tvb;
2911
2912
0
  type = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN) >> 9 & 0x3F;
2913
2914
  /* Unescape NAL unit */
2915
0
  rbsp_tvb = dissect_h265_unescap_nal_unit(tvb, pinfo, offset + 2);
2916
2917
0
  switch (type) {
2918
0
  case 32: /* VPS_NUT - Video parameter set */
2919
0
    item = proto_tree_add_item(tree, hf_h265_sdp_parameter_sprop_vps, tvb, offset, -1, ENC_NA);
2920
0
    h265_nal_tree = proto_item_add_subtree(item, ett_h265_sprop_parameters);
2921
0
    dissect_h265_video_parameter_set_rbsp(h265_nal_tree, rbsp_tvb, pinfo, 0);
2922
0
    break;
2923
0
  case 33: /* SPS_NUT - Sequence parameter set*/
2924
0
    item = proto_tree_add_item(tree, hf_h265_sdp_parameter_sprop_sps, tvb, offset, -1, ENC_NA);
2925
0
    h265_nal_tree = proto_item_add_subtree(item, ett_h265_sprop_parameters);
2926
0
    dissect_h265_seq_parameter_set_rbsp(h265_nal_tree, rbsp_tvb, pinfo, 0);
2927
0
    break;
2928
0
  case 34: /* PPS_NUT - Picture parameter set */
2929
0
    item = proto_tree_add_item(tree, hf_h265_sdp_parameter_sprop_pps, tvb, offset, -1, ENC_NA);
2930
0
    h265_nal_tree = proto_item_add_subtree(item, ett_h265_sprop_parameters);
2931
0
    dissect_h265_pic_parameter_set_rbsp(h265_nal_tree, rbsp_tvb, pinfo, 0);
2932
0
    break;
2933
0
  default:
2934
0
    proto_tree_add_expert(tree, pinfo, &ei_h265_format_specific_parameter, tvb, offset, -1);
2935
0
    break;
2936
0
  }
2937
0
}
2938
2939
/* Code to actually dissect the packets */
2940
static int
2941
dissect_h265(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2942
0
{
2943
0
  int         offset = 0;
2944
0
  proto_item *item;
2945
0
  proto_tree *h265_tree, *h265_nal_tree, *stream_tree, *fua_tree;
2946
0
  uint8_t    type;
2947
0
  tvbuff_t   *rbsp_tvb;
2948
2949
2950
  /* Make entries in Protocol column and Info column on summary display */
2951
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "H.265");
2952
2953
0
  uint16_t h265_nalu_hextet = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
2954
0
  type = h265_nalu_hextet >> 9 & 0x3F;
2955
2956
0
  col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
2957
0
    val_to_str(type, h265_type_summary_values, "Unknown Type (%u)"));
2958
2959
  /* if (tree) */ {
2960
0
    item = proto_tree_add_item(tree, proto_h265, tvb, 0, -1, ENC_NA);
2961
0
    h265_tree = proto_item_add_subtree(item, ett_h265);
2962
2963
    /* if the type is 49, it would be draw another title */
2964
0
    if (type == 49)
2965
0
      h265_nal_tree = proto_tree_add_subtree(h265_tree, tvb, offset, 2, ett_h265_nal, NULL, "FU identifier");
2966
0
    else
2967
0
      h265_nal_tree = proto_tree_add_subtree(h265_tree, tvb, offset, 2, ett_h265_nal, NULL, "NAL unit header or first two bytes of the payload");
2968
2969
    /*   decode the HEVC payload header according to section 4:
2970
    0                   1
2971
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
2972
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2973
    |F|   Type    |  LayerId  | TID |
2974
    +-------------+-----------------+
2975
    Forbidden zero (F): 1 bit
2976
    NAL unit type (Type): 6 bits
2977
    NUH layer ID (LayerId): 6 bits
2978
    NUH temporal ID plus 1 (TID): 3 bits
2979
    */
2980
2981
0
    proto_tree_add_item(h265_nal_tree, hf_h265_nal_f_bit, tvb, offset, 2, ENC_BIG_ENDIAN);
2982
0
    proto_tree_add_item(h265_nal_tree, hf_h265_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2983
0
    proto_tree_add_item(h265_nal_tree, hf_h265_nuh_layer_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2984
0
    proto_tree_add_item(h265_nal_tree, hf_h265_nuh_temporal_id_plus1, tvb, offset, 2, ENC_BIG_ENDIAN);
2985
2986
0
    offset++;
2987
0
    offset++;
2988
0
    if (type == 48) { // Aggregation Packets (APs)
2989
2990
0
    }
2991
0
    else if (type == 49) { // Fragmentation Units
2992
0
      fua_tree = proto_tree_add_subtree(h265_tree, tvb, offset, 1, ett_h265_fu, NULL, "FU Header");
2993
0
      proto_tree_add_item(fua_tree, hf_h265_start_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
2994
0
      proto_tree_add_item(fua_tree, hf_h265_end_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
2995
0
      proto_tree_add_item(fua_tree, hf_h265_nal_unit_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2996
0
      if ((tvb_get_uint8(tvb, offset) & 0x80) == 0x80) {
2997
0
        type = tvb_get_uint8(tvb, offset) & 0x1f;
2998
0
        col_append_fstr(pinfo->cinfo, COL_INFO, " Start:%s",
2999
0
          val_to_str(type, h265_type_summary_values, "Unknown Type (%u)"));
3000
0
        offset++;
3001
0
      }
3002
0
      else
3003
0
      {
3004
0
        if ((tvb_get_uint8(tvb, offset) & 0x40) == 0x40) {
3005
0
          col_append_str(pinfo->cinfo, COL_INFO, " End");
3006
0
        }
3007
0
        return offset;
3008
0
      }
3009
0
    }
3010
0
    else if (type == 50) { //PACI Packets
3011
3012
0
    }
3013
3014
    /* Unescape NAL unit */
3015
0
    rbsp_tvb = dissect_h265_unescap_nal_unit(tvb, pinfo, offset);
3016
3017
0
    stream_tree = proto_tree_add_subtree(h265_tree, tvb, offset, -1, ett_h265_stream, NULL, "H265 NAL Unit Payload");
3018
0
    switch (type) {
3019
0
    case 0:
3020
0
    case 1: /* Coded slice segment of a non-TSA, non-STSA trailing picture */
3021
0
    case 2:
3022
0
    case 3: /*  Coded slice segment of a TSA picture */
3023
0
    case 4:
3024
0
    case 5: /* Coded slice segment of an STSA picture */
3025
0
    case 6:
3026
0
    case 7: /* Coded slice segment of a RADL picture */
3027
0
    case 8:
3028
0
    case 9: /* Coded slice segment of a RASL picture */
3029
0
      dissect_h265_slice_segment_layer_rbsp(stream_tree, rbsp_tvb, pinfo, 0, type);
3030
0
      break;
3031
0
    case 10:
3032
0
    case 12:
3033
0
    case 14: /* Reserved non-IRAP SLNR VCL NAL unit types */
3034
0
    case 11:
3035
0
    case 13:
3036
0
    case 15: /* Reserved non-IRAP sub-layer reference VCL NAL unit types */
3037
0
      break;
3038
0
    case 16:
3039
0
    case 17:
3040
0
    case 18: /* Coded slice segment of a BLA picture */
3041
0
    case 19:
3042
0
    case 20:  /* Coded slice segment of an IDR picture */
3043
0
    case 21: /* CRA_NUT - Coded slice segment of a CRA picture */
3044
0
      dissect_h265_slice_segment_layer_rbsp(stream_tree, rbsp_tvb, pinfo, 0, type);
3045
0
      break;
3046
    //case 22..31
3047
0
    case 32 : /* VPS_NUT - Video parameter set */
3048
0
      dissect_h265_video_parameter_set_rbsp(stream_tree, rbsp_tvb, pinfo, 0);
3049
0
      break;
3050
0
    case 33: /* SPS_NUT - Sequence parameter set*/
3051
0
      dissect_h265_seq_parameter_set_rbsp(stream_tree, rbsp_tvb, pinfo, 0);
3052
0
      break;
3053
0
    case 34: /* PPS_NUT - Picture parameter set */
3054
0
      dissect_h265_pic_parameter_set_rbsp(stream_tree, rbsp_tvb, pinfo, 0);
3055
0
      break;
3056
0
    case 35:  /*AUD_NUT - Access unit delimiter*/
3057
0
      dissect_h265_access_unit_delimiter_rbsp(stream_tree, rbsp_tvb, pinfo, 0);
3058
0
      break;
3059
0
    case 36:  /*EOS_NUT - End of sequence*/
3060
0
      dissect_h265_end_of_seq_rbsp(stream_tree, rbsp_tvb, pinfo, 0);
3061
0
      break;
3062
0
    case 37: /*EOB_NUT - End of bitstream*/
3063
0
      dissect_h265_end_of_bitstream_rbsp(stream_tree, rbsp_tvb, pinfo, 0);
3064
0
      break;
3065
0
    case 38:  /*FD_NUT - Filler data*/
3066
0
      dissect_h265_filler_data_rbsp(stream_tree, rbsp_tvb, pinfo, 0);
3067
0
      break;
3068
0
    case 39:  /*PREFIX_SEI_NUT - Supplemental enhancement information*/
3069
0
    case 40:  /*SUFFIX_SEI_NUT - Supplemental enhancement information*/
3070
0
      dissect_h265_sei_rbsp(stream_tree, rbsp_tvb, pinfo, 0, type);
3071
0
      break;
3072
3073
0
    case 49:       /* FU - Fragmentation Units */
3074
0
      break;
3075
0
    case 50:       /* PACI - PACI Packets */
3076
0
      break;
3077
0
    }
3078
0
  } /* if (tree) */
3079
0
  return tvb_captured_length(tvb);
3080
0
}
3081
3082
/* Annex B "Byte stream format" */
3083
static int
3084
dissect_h265_bytestream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3085
0
{
3086
0
  tvbuff_t *next_tvb; //, *rbsp_tvb;
3087
0
  int offset = 0, end_offset;
3088
0
  uint32_t dword;
3089
3090
  /* Look for the first start word. Assume byte aligned. */
3091
0
  while (1) {
3092
0
          if (tvb_reported_length(tvb) < 4) {
3093
0
      return 0;
3094
0
    }
3095
0
    dword = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
3096
0
    if ((dword >> 8) == 1 || dword == 1) {
3097
0
      break;
3098
0
    } else if (dword != 0) {
3099
0
      return 0;
3100
0
    }
3101
0
    offset += 2;
3102
0
  }
3103
3104
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "H.265");
3105
0
        col_clear(pinfo->cinfo, COL_INFO);
3106
3107
0
  while (tvb_reported_length_remaining(tvb, offset)) {
3108
0
    dword = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
3109
0
    if ((dword >> 8) != 1) {
3110
      /* zero_byte */
3111
0
      offset++;
3112
0
    }
3113
    /* start_code_prefix_one_3bytes */
3114
0
    offset += 3;
3115
0
    int nal_length = tvb_reported_length_remaining(tvb, offset);
3116
    /* Search for \0\0\1 or \0\0\0\1 */
3117
0
    end_offset = tvb_find_uint16(tvb, offset, -1, 0);
3118
0
    while (end_offset != -1) {
3119
0
      if (tvb_find_uint16(tvb, end_offset + 1, 3, 1) != -1) {
3120
0
        nal_length = end_offset - offset;
3121
0
        break;
3122
0
      }
3123
0
      end_offset = tvb_find_uint16(tvb, end_offset + 1, -1, 0);
3124
0
    }
3125
3126
    /* If end_offset is -1, we got to the end; assume this is the
3127
     * end of the NAL. Handling NALs split across lower level
3128
     * packets requires something like epan/stream.h
3129
     */
3130
3131
0
    next_tvb = tvb_new_subset_length(tvb, offset, nal_length);
3132
3133
0
    dissect_h265(next_tvb, pinfo, tree, data);
3134
0
    offset += nal_length;
3135
0
  }
3136
0
  return tvb_reported_length(tvb);
3137
0
}
3138
3139
void
3140
proto_register_h265(void)
3141
14
{
3142
14
  module_t *h265_module;
3143
14
  expert_module_t* expert_h265;
3144
3145
  /* Setup list of header fields  See Section 1.6.1 for details*/
3146
14
  static hf_register_info hf[] = {
3147
14
    { &hf_h265_nal_f_bit,
3148
14
    { "F bit", "h265.f",
3149
14
    FT_BOOLEAN, 16, TFS(&h265_f_bit_vals), 0x8000,
3150
14
    NULL, HFILL }
3151
14
    },
3152
14
    { &hf_h265_type,
3153
14
    { "Type", "h265.nal_unit_type",
3154
14
    FT_UINT16, BASE_DEC, VALS(h265_type_values), 0x7E00,
3155
14
    NULL, HFILL }
3156
14
    },
3157
14
    { &hf_h265_nuh_layer_id,
3158
14
    { "LayerId", "h265.layer_id",
3159
14
    FT_UINT16, BASE_DEC, NULL, 0x01F8,
3160
14
    NULL, HFILL }
3161
14
    },
3162
14
    { &hf_h265_nuh_temporal_id_plus1,
3163
14
    { "TID", "h265.temporal_id",
3164
14
    FT_UINT16, BASE_DEC, NULL, 0x0007,
3165
14
    NULL, HFILL }
3166
14
    },
3167
14
    { &hf_h265_start_bit,
3168
14
    { "Start bit", "h265.start.bit",
3169
14
    FT_BOOLEAN, 8, TFS(&h265_start_bit_vals), 0x80,
3170
14
    NULL, HFILL }
3171
14
    },
3172
14
    { &hf_h265_end_bit,
3173
14
    { "End bit", "h265.end.bit",
3174
14
    FT_BOOLEAN, 8, TFS(&h265_end_bit_vals), 0x40,
3175
14
    NULL, HFILL }
3176
14
    },
3177
14
    { &hf_h265_nal_unit_type,
3178
14
    { "Nal_unit_type", "h265.nal_unit_type",
3179
14
    FT_UINT8, BASE_DEC, VALS(h265_type_values), 0x1f,
3180
14
    NULL, HFILL }
3181
14
    },
3182
14
    { &hf_h265_rbsp_stop_bit,
3183
14
    { "rbsp_stop_bit", "h265.rbsp_stop_bit",
3184
14
    FT_UINT8, BASE_DEC, NULL, 0x0,
3185
14
    NULL, HFILL }
3186
14
    },
3187
14
    { &hf_h265_rbsp_trailing_bits,
3188
14
    { "rbsp_trailing_bits", "h265.rbsp_trailing_bits",
3189
14
    FT_UINT8, BASE_DEC, NULL, 0x0,
3190
14
    NULL, HFILL }
3191
14
    },
3192
    /*VPS*/
3193
14
    { &hf_h265_vps_video_parameter_set_id,
3194
14
    { "vps_video_parameter_set_id", "h265.vps_video_parameter_set_id",
3195
14
    FT_UINT8, BASE_DEC, NULL, 0x0,
3196
14
    NULL, HFILL }
3197
14
    },
3198
14
    { &hf_h265_vps_base_layer_internal_flag,
3199
14
    { "vps_base_layer_internal_flag", "h265.vps_base_layer_internal_flag",
3200
14
    FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3201
14
    NULL, HFILL }
3202
14
    },
3203
14
    { &hf_h265_vps_base_layer_available_flag,
3204
14
    { "vps_base_layer_available_flag", "h265.vps_base_layer_available_flag",
3205
14
    FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3206
14
    NULL, HFILL }
3207
14
    },
3208
14
    { &hf_h265_vps_max_layers_minus1,
3209
14
    { "vps_max_layers_minus1", "h265.vps_max_layers_minus1",
3210
14
    FT_UINT8, BASE_DEC, NULL, 0x0,
3211
14
    NULL, HFILL }
3212
14
    },
3213
14
    { &hf_h265_vps_max_sub_layers_minus1,
3214
14
    { "vps_max_sub_layers_minus1", "h265.vps_max_sub_layers_minus1",
3215
14
    FT_UINT8, BASE_DEC, NULL, 0x0,
3216
14
    NULL, HFILL }
3217
14
    },
3218
14
    { &hf_h265_vps_temporal_id_nesting_flag,
3219
14
    { "vps_temporal_id_nesting_flag", "h265.vps_temporal_id_nesting_flag",
3220
14
    FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3221
14
    NULL, HFILL }
3222
14
    },
3223
14
    { &hf_h265_vps_reserved_0xffff_16bits,
3224
14
    { "vps_reserved_0xffff_16bits", "h265.vps_reserved_0xffff_16bits",
3225
14
    FT_UINT16, BASE_HEX, NULL, 0x0,
3226
14
    NULL, HFILL }
3227
14
    },
3228
    /* profile, level and tier*/
3229
14
    { &hf_h265_general_profile_space,
3230
14
    { "general_profile_space", "h265.general_profile_space",
3231
14
    FT_UINT8, BASE_DEC, NULL, 0xC0,
3232
14
    NULL, HFILL }
3233
14
    },
3234
14
    { &hf_h265_general_tier_flag,
3235
14
    { "general_tier_flag", "h265.general_tier_flag",
3236
14
    FT_BOOLEAN, 8, NULL, 0x20,
3237
14
    NULL, HFILL }
3238
14
    },
3239
14
    { &hf_h265_general_profile_idc,
3240
14
    { "general_profile_idc", "h265.general_profile_idc",
3241
14
    FT_UINT8, BASE_DEC, VALS(h265_profile_idc_values), 0x1F,
3242
14
    NULL, HFILL }
3243
14
    },
3244
14
    { &hf_h265_general_profile_compatibility_flags,
3245
14
    { "general_profile_compatibility_flags", "h265.general_profile_compatibility_flags",
3246
14
    FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFF,
3247
14
    NULL, HFILL }
3248
14
    },
3249
14
    { &hf_h265_general_progressive_source_flag,
3250
14
    { "general_progressive_source_flag", "h265.general_progressive_source_flag",
3251
14
    FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3252
14
    NULL, HFILL }
3253
14
    },
3254
14
    { &hf_h265_general_interlaced_source_flag,
3255
14
    { "general_interlaced_source_flag", "h265.general_interlaced_source_flag",
3256
14
    FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3257
14
    NULL, HFILL }
3258
14
    },
3259
14
    { &hf_h265_general_non_packed_constraint_flag,
3260
14
    { "general_non_packed_constraint_flag", "h265.general_non_packed_constraint_flag",
3261
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3262
14
    NULL, HFILL }
3263
14
    },
3264
14
    { &hf_h265_general_frame_only_constraint_flag,
3265
14
    { "general_frame_only_constraint_flag", "h265.general_frame_only_constraint_flag",
3266
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3267
14
      NULL, HFILL }
3268
14
    },
3269
14
    { &hf_h265_general_max_12bit_constraint_flag,
3270
14
    { "general_max_12bit_constraint_flag", "h265.general_max_12bit_constraint_flag",
3271
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3272
14
      NULL, HFILL }
3273
14
    },
3274
14
    { &hf_h265_general_max_10bit_constraint_flag,
3275
14
    { "general_max_10bit_constraint_flag", "h265.general_max_10bit_constraint_flag",
3276
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3277
14
      NULL, HFILL }
3278
14
    },
3279
14
    { &hf_h265_general_max_8bit_constraint_flag,
3280
14
    { "general_max_8bit_constraint_flag", "h265.general_max_8bit_constraint_flag",
3281
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3282
14
      NULL, HFILL }
3283
14
    },
3284
14
    { &hf_h265_general_max_422chroma_constraint_flag,
3285
14
    { "general_max_422chroma_constraint_flag", "h265.general_max_422chroma_constraint_flag",
3286
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3287
14
      NULL, HFILL }
3288
14
    },
3289
14
    { &hf_h265_general_max_420chroma_constraint_flag,
3290
14
    { "general_max_420chroma_constraint_flag", "h265.general_max_420chroma_constraint_flag",
3291
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3292
14
      NULL, HFILL }
3293
14
    },
3294
14
    { &hf_h265_general_max_monochrome_constraint_flag,
3295
14
    { "general_max_monochrome_constraint_flag", "h265.general_max_monochrome_constraint_flag",
3296
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3297
14
      NULL, HFILL }
3298
14
    },
3299
14
    { &hf_h265_general_intra_constraint_flag,
3300
14
    { "general_intra_constraint_flag", "h265.general_intra_constraint_flag",
3301
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3302
14
      NULL, HFILL }
3303
14
    },
3304
14
    { &hf_h265_general_one_picture_only_constraint_flag,
3305
14
    { "general_one_picture_only_constraint_flag", "h265.general_one_picture_only_constraint_flag",
3306
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3307
14
      NULL, HFILL }
3308
14
    },
3309
14
    { &hf_h265_general_lower_bit_rate_constraint_flag,
3310
14
    { "general_lower_bit_rate_constraint_flag", "h265.general_lower_bit_rate_constraint_flag",
3311
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3312
14
      NULL, HFILL }
3313
14
    },
3314
14
    { &hf_h265_general_max_14bit_constraint_flag,
3315
14
    { "general_max_14bit_constraint_flag", "h265.general_max_14bit_constraint_flag",
3316
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3317
14
      NULL, HFILL }
3318
14
    },
3319
14
    { &hf_h265_general_reserved_zero_33bits,
3320
14
    { "general_reserved_zero_33bits", "h265.general_reserved_zero_33bits",
3321
14
      FT_UINT40, BASE_DEC, NULL, 0x0,
3322
14
      NULL, HFILL }
3323
14
    },
3324
14
    { &hf_h265_general_reserved_zero_34bits,
3325
14
    { "general_reserved_zero_34bits", "h265.general_reserved_zero_34bits",
3326
14
      FT_UINT40, BASE_DEC, NULL, 0x0,
3327
14
      NULL, HFILL }
3328
14
    },
3329
14
    { &hf_h265_general_reserved_zero_7bits,
3330
14
    { "general_reserved_zero_7bits", "h265.general_reserved_zero_7bits",
3331
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3332
14
      NULL, HFILL }
3333
14
    },
3334
14
    { &hf_h265_general_reserved_zero_35bits,
3335
14
    { "general_reserved_zero_35bits", "h265.general_reserved_zero_35bits",
3336
14
      FT_UINT40, BASE_DEC, NULL, 0x0,
3337
14
      NULL, HFILL }
3338
14
    },
3339
14
    { &hf_h265_general_reserved_zero_43bits,
3340
14
    { "general_reserved_zero_43bits", "h265.general_reserved_zero_43bits",
3341
14
      FT_UINT48, BASE_DEC, NULL, 0x0,
3342
14
      NULL, HFILL }
3343
14
    },
3344
14
    { &hf_h265_general_inbld_flag,
3345
14
    { "general_inbld_flag", "h265.general_inbld_flag",
3346
14
      FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3347
14
      NULL, HFILL }
3348
14
    },
3349
14
    { &hf_h265_general_reserved_zero_bit,
3350
14
    { "general_reserved_zero_bit", "h265.general_reserved_zero_bit",
3351
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3352
14
      NULL, HFILL }
3353
14
    },
3354
14
    { &hf_h265_general_level_idc,
3355
14
    { "general_level_idc", "h265.general_level_idc",
3356
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3357
14
      NULL, HFILL }
3358
14
    },
3359
14
    { &hf_h265_sub_layer_profile_present_flag,
3360
14
    { "sub_layer_profile_present_flag", "h265.sub_layer_profile_present_flag",
3361
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3362
14
      NULL, HFILL }
3363
14
    },
3364
14
    { &hf_h265_sub_layer_level_present_flag,
3365
14
    { "sub_layer_level_present_flag", "h265.sub_layer_level_present_flag",
3366
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3367
14
      NULL, HFILL }
3368
14
    },
3369
14
    { &hf_h265_reserved_zero_2bits,
3370
14
    { "reserved_zero_2bits", "h265.reserved_zero_2bits",
3371
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3372
14
      NULL, HFILL }
3373
14
    },
3374
14
    { &hf_h265_sub_layer_profile_space,
3375
14
    { "sub_layer_profile_space", "h265.sub_layer_profile_space",
3376
14
      FT_UINT8, BASE_DEC, NULL, 0x03,
3377
14
      NULL, HFILL }
3378
14
    },
3379
14
    { &hf_h265_sub_layer_tier_flag,
3380
14
    { "sub_layer_tier_flag", "h265.sub_layer_tier_flag",
3381
14
      FT_UINT8, BASE_DEC, NULL, 0x04,
3382
14
      NULL, HFILL }
3383
14
    },
3384
14
    { &hf_h265_sub_layer_profile_idc,
3385
14
    { "sub_layer_profile_idc", "h265.sub_layer_profile_idc",
3386
14
      FT_UINT8, BASE_DEC, NULL, 0xF8,
3387
14
      NULL, HFILL }
3388
14
    },
3389
14
    { &hf_h265_sub_layer_profile_compatibility_flag,
3390
14
    { "sub_layer_profile_compatibility_flag", "h265.sub_layer_profile_compatibility_flag",
3391
14
      FT_UINT32, BASE_DEC, NULL, 0xFF,
3392
14
      NULL, HFILL }
3393
14
    },
3394
14
    { &hf_h265_sub_layer_progressive_source_flag,
3395
14
    { "sub_layer_progressive_source_flag", "h265.sub_layer_progressive_source_flag",
3396
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3397
14
      NULL, HFILL }
3398
14
    },
3399
3400
14
    { &hf_h265_sub_layer_interlaced_source_flag,
3401
14
    { "sub_layer_interlaced_source_flag", "h265.sub_layer_interlaced_source_flag",
3402
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3403
14
      NULL, HFILL }
3404
14
    },
3405
14
    { &hf_h265_sub_layer_non_packed_constraint_flag,
3406
14
    { "sub_layer_non_packed_constraint_flag", "h265.sub_layer_non_packed_constraint_flag",
3407
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3408
14
      NULL, HFILL }
3409
14
    },
3410
14
    { &hf_h265_sub_layer_frame_only_constraint_flag,
3411
14
    { "sub_layer_frame_only_constraint_flag", "h265.sub_layer_frame_only_constraint_flag",
3412
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3413
14
      NULL, HFILL }
3414
14
    },
3415
14
    { &hf_h265_sub_layer_max_12bit_constraint_flag,
3416
14
    { "sub_layer_max_12bit_constraint_flag", "h265.sub_layer_max_12bit_constraint_flag",
3417
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3418
14
      NULL, HFILL }
3419
14
    },
3420
14
    { &hf_h265_sub_layer_max_10bit_constraint_flag,
3421
14
    { "sub_layer_max_10bit_constraint_flag", "h265.sub_layer_max_10bit_constraint_flag",
3422
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3423
14
      NULL, HFILL }
3424
14
    },
3425
14
    { &hf_h265_sub_layer_max_8bit_constraint_flag,
3426
14
    { "sub_layer_max_8bit_constraint_flag", "h265.sub_layer_max_8bit_constraint_flag",
3427
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3428
14
      NULL, HFILL }
3429
14
    },
3430
14
    { &hf_h265_sub_layer_max_422chroma_constraint_flag,
3431
14
    { "sub_layer_max_422chroma_constraint_flag", "h265.sub_layer_max_422chroma_constraint_flag",
3432
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3433
14
      NULL, HFILL }
3434
14
    },
3435
14
    { &hf_h265_sub_layer_max_420chroma_constraint_flag,
3436
14
    { "sub_layer_max_420chroma_constraint_flag", "h265.sub_layer_max_420chroma_constraint_flag",
3437
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3438
14
      NULL, HFILL }
3439
14
    },
3440
14
    { &hf_h265_sub_layer_max_monochrome_constraint_flag,
3441
14
    { "sub_layer_max_monochrome_constraint_flag", "h265.sub_layer_max_monochrome_constraint_flag",
3442
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3443
14
      NULL, HFILL }
3444
14
    },
3445
14
    { &hf_h265_sub_layer_intra_constraint_flag,
3446
14
    { "sub_layer_intra_constraint_flag", "h265.sub_layer_intra_constraint_flag",
3447
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3448
14
      NULL, HFILL }
3449
14
    },
3450
14
    { &hf_h265_sub_layer_one_picture_only_constraint_flag,
3451
14
    { "sub_layer_one_picture_only_constraint_flag", "h265.sub_layer_one_picture_only_constraint_flag",
3452
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3453
14
      NULL, HFILL }
3454
14
    },
3455
14
    { &hf_h265_sub_layer_lower_bit_rate_constraint_flag,
3456
14
    { "sub_layer_lower_bit_rate_constraint_flag", "h265.sub_layer_lower_bit_rate_constraint_flag",
3457
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3458
14
      NULL, HFILL }
3459
14
    },
3460
14
    { &hf_h265_sub_layer_max_14bit_constraint_flag,
3461
14
    { "sub_layer_max_14bit_constraint_flag", "h265.sub_layer_max_14bit_constraint_flag",
3462
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3463
14
      NULL, HFILL }
3464
14
    },
3465
14
    { &hf_h265_sub_layer_reserved_zero_33bits,
3466
14
    { "sub_layer_reserved_zero_33bits", "h265.sub_layer_reserved_zero_33bits",
3467
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3468
14
      NULL, HFILL }
3469
14
    },
3470
14
    { &hf_h265_sub_layer_reserved_zero_34bits,
3471
14
    { "sub_layer_reserved_zero_34bits", "h265.sub_layer_reserved_zero_34bits",
3472
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3473
14
      NULL, HFILL }
3474
14
    },
3475
14
    { &hf_h265_sub_layer_reserved_zero_7bits,
3476
14
    { "sub_layer_reserved_zero_7bits", "h265.sub_layer_reserved_zero_7bits",
3477
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3478
14
      NULL, HFILL }
3479
14
    },
3480
14
    { &hf_h265_sub_layer_reserved_zero_35bits,
3481
14
    { "sub_layer_reserved_zero_35bits", "h265.sub_layer_reserved_zero_35bits",
3482
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3483
14
      NULL, HFILL }
3484
14
    },
3485
14
    { &hf_h265_sub_layer_reserved_zero_43bits,
3486
14
    { "sub_layer_reserved_zero_43bits", "h265.sub_layer_reserved_zero_43bits",
3487
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3488
14
      NULL, HFILL }
3489
14
    },
3490
14
    { &hf_h265_sub_layer_inbld_flag,
3491
14
    { "sub_layer_inbld_flag", "h265.sub_layer_inbld_flag",
3492
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3493
14
      NULL, HFILL }
3494
14
    },
3495
14
    { &hf_h265_sub_layer_reserved_zero_bit,
3496
14
    { "sub_layer_reserved_zero_bit", "h265.sub_layer_reserved_zero_bit",
3497
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3498
14
      NULL, HFILL }
3499
14
    },
3500
14
    { &hf_h265_sub_layer_level_idc,
3501
14
    { "sub_layer_level_idc", "h265.sub_layer_level_idc",
3502
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3503
14
      NULL, HFILL }
3504
14
    },
3505
14
    { &hf_h265_vps_sub_layer_ordering_info_present_flag,
3506
14
    { "vps_sub_layer_ordering_info_present_flag", "h265.vps_sub_layer_ordering_info_present_flag",
3507
14
      FT_UINT8, BASE_DEC, NULL, 0x01,
3508
14
      NULL, HFILL }
3509
14
    },
3510
14
    { &hf_h265_vps_max_dec_pic_buffering_minus1,
3511
14
    { "vps_max_dec_pic_buffering_minus1", "h265.vps_max_dec_pic_buffering_minus1",
3512
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3513
14
      NULL, HFILL }
3514
14
    },
3515
14
    { &hf_h265_vps_max_num_reorder_pics,
3516
14
    { "vps_max_num_reorder_pics", "h265.vps_max_num_reorder_pics",
3517
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3518
14
      NULL, HFILL }
3519
14
    },
3520
14
    { &hf_h265_vps_max_latency_increase_plus1,
3521
14
    { "vps_max_latency_increase_plus1", "h265.vps_max_latency_increase_plus1",
3522
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3523
14
      NULL, HFILL }
3524
14
    },
3525
14
    { &hf_h265_vps_max_layer_id,
3526
14
    { "vps_max_layer_id", "h265.vps_max_layer_id",
3527
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3528
14
      NULL, HFILL }
3529
14
    },
3530
14
    { &hf_h265_vps_num_layer_sets_minus1,
3531
14
    { "vps_num_layer_sets_minus1", "h265.vps_num_layer_sets_minus1",
3532
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3533
14
      NULL, HFILL }
3534
14
    },
3535
14
    { &hf_h265_layer_id_included_flag,
3536
14
    { "layer_id_included_flag", "h265.layer_id_included_flag",
3537
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3538
14
      NULL, HFILL }
3539
14
    },
3540
14
    { &hf_h265_vps_timing_info_present_flag,
3541
14
    { "vps_timing_info_present_flag", "h265.vps_timing_info_present_flag",
3542
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3543
14
      NULL, HFILL }
3544
14
    },
3545
14
    { &hf_h265_vps_num_units_in_tick,
3546
14
    { "vps_num_units_in_tick", "h265.vps_num_units_in_tick",
3547
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3548
14
      NULL, HFILL }
3549
14
    },
3550
14
    { &hf_h265_vps_time_scale,
3551
14
    { "vps_time_scale", "h265.vps_time_scale",
3552
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3553
14
      NULL, HFILL }
3554
14
    },
3555
14
    { &hf_h265_vps_poc_proportional_to_timing_flag,
3556
14
    { "vps_poc_proportional_to_timing_flag", "h265.vps_poc_proportional_to_timing_flag",
3557
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3558
14
      NULL, HFILL }
3559
14
    },
3560
14
    { &hf_h265_vps_num_ticks_poc_diff_one_minus1,
3561
14
    { "vps_num_ticks_poc_diff_one_minus1", "h265.vps_num_ticks_poc_diff_one_minus1",
3562
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3563
14
      NULL, HFILL }
3564
14
    },
3565
14
    { &hf_h265_vps_num_hrd_parameters,
3566
14
    { "vps_num_hrd_parameters", "h265.vps_num_hrd_parameters",
3567
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3568
14
      NULL, HFILL }
3569
14
    },
3570
14
    { &hf_h265_hrd_layer_set_idx,
3571
14
    { "hrd_layer_set_idx", "h265.hrd_layer_set_idx",
3572
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3573
14
      NULL, HFILL }
3574
14
    },
3575
14
    { &hf_h265_cprms_present_flag,
3576
14
    { "cprms_present_flag", "h265.cprms_present_flag",
3577
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3578
14
      NULL, HFILL }
3579
14
    },
3580
14
    { &hf_h265_vps_extension_flag,
3581
14
    { "vps_extension_flag", "h265.vps_extension_flag",
3582
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3583
14
      NULL, HFILL }
3584
14
    },
3585
14
    { &hf_h265_vps_extension_data_flag,
3586
14
    { "vps_extension_data_flag", "h265.vps_extension_data_flag",
3587
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3588
14
      NULL, HFILL }
3589
14
    },
3590
      /*hrd_parameters*/
3591
14
    { &hf_h265_nal_hrd_parameters_present_flag,
3592
14
    { "nal_hrd_parameters_present_flag", "h265.nal_hrd_parameters_present_flag",
3593
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3594
14
      NULL, HFILL }
3595
14
    },
3596
14
    { &hf_h265_vcl_hrd_parameters_present_flag,
3597
14
    { "vcl_hrd_parameters_present_flag", "h265.vcl_hrd_parameters_present_flag",
3598
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3599
14
      NULL, HFILL }
3600
14
    },
3601
14
    { &hf_h265_sub_pic_hrd_params_present_flag,
3602
14
    { "sub_pic_hrd_params_present_flag", "h265.sub_pic_hrd_params_present_flag",
3603
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3604
14
      NULL, HFILL }
3605
14
    },
3606
14
    { &hf_h265_tick_divisor_minus2,
3607
14
    { "tick_divisor_minus2", "h265.tick_divisor_minus2",
3608
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3609
14
      NULL, HFILL }
3610
14
    },
3611
14
    { &hf_h265_du_cpb_removal_delay_increment_length_minus1,
3612
14
    { "du_cpb_removal_delay_increment_length_minus1", "h265.du_cpb_removal_delay_increment_length_minus1",
3613
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3614
14
      NULL, HFILL }
3615
14
    },
3616
14
    { &hf_h265_sub_pic_cpb_params_in_pic_timing_sei_flag,
3617
14
    { "sub_pic_cpb_params_in_pic_timing_sei_flag", "h265.sub_pic_cpb_params_in_pic_timing_sei_flag",
3618
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3619
14
      NULL, HFILL }
3620
14
    },
3621
14
    { &hf_h265_dpb_output_delay_du_length_minus1,
3622
14
    { "dpb_output_delay_du_length_minus1", "h265.dpb_output_delay_du_length_minus1",
3623
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3624
14
      NULL, HFILL }
3625
14
    },
3626
14
    { &hf_h265_bit_rate_scale,
3627
14
    { "bit_rate_scale", "h265.bit_rate_scale",
3628
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3629
14
      NULL, HFILL }
3630
14
    },
3631
14
    { &hf_h265_cpb_size_scale,
3632
14
    { "cpb_size_scale", "h265.cpb_size_scale",
3633
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3634
14
      NULL, HFILL }
3635
14
    },
3636
14
    { &hf_h265_cpb_size_du_scale,
3637
14
    { "cpb_size_du_scale", "h265.cpb_size_du_scale",
3638
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3639
14
      NULL, HFILL }
3640
14
    },
3641
14
    { &hf_h265_initial_cpb_removal_delay_length_minus1,
3642
14
    { "initial_cpb_removal_delay_length_minus1", "h265.initial_cpb_removal_delay_length_minus1",
3643
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3644
14
      NULL, HFILL }
3645
14
    },
3646
14
    { &hf_h265_au_cpb_removal_delay_length_minus1,
3647
14
    { "au_cpb_removal_delay_length_minus1", "h265.au_cpb_removal_delay_length_minus1",
3648
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3649
14
      NULL, HFILL }
3650
14
    },
3651
14
    { &hf_h265_dpb_output_delay_length_minus1,
3652
14
    { "dpb_output_delay_length_minus1", "h265.dpb_output_delay_length_minus1",
3653
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3654
14
      NULL, HFILL }
3655
14
    },
3656
14
    { &hf_h265_fixed_pic_rate_general_flag,
3657
14
    { "fixed_pic_rate_general_flag", "h265.fixed_pic_rate_general_flag",
3658
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3659
14
      NULL, HFILL }
3660
14
    },
3661
14
    { &hf_h265_fixed_pic_rate_within_cvs_flag,
3662
14
    { "fixed_pic_rate_within_cvs_flag", "h265.fixed_pic_rate_within_cvs_flag",
3663
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3664
14
      NULL, HFILL }
3665
14
    },
3666
14
    { &hf_h265_elemental_duration_in_tc_minus1,
3667
14
    { "elemental_duration_in_tc_minus1", "h265.elemental_duration_in_tc_minus1",
3668
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3669
14
      NULL, HFILL }
3670
14
    },
3671
14
    { &hf_h265_low_delay_hrd_flag,
3672
14
    { "low_delay_hrd_flag", "h265.low_delay_hrd_flag",
3673
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3674
14
      NULL, HFILL }
3675
14
    },
3676
14
    { &hf_h265_cpb_cnt_minus1,
3677
14
    { "cpb_cnt_minus1", "h265.cpb_cnt_minus1",
3678
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3679
14
      NULL, HFILL }
3680
14
    },
3681
      /*sub_layer_hrd_parameters*/
3682
14
    { &hf_h265_bit_rate_value_minus1,
3683
14
    { "bit_rate_value_minus1", "h265.bit_rate_value_minus1",
3684
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3685
14
      NULL, HFILL }
3686
14
    },
3687
14
    { &hf_h265_cpb_size_value_minus1,
3688
14
    { "cpb_size_value_minus1", "h265.cpb_size_value_minus1",
3689
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3690
14
      NULL, HFILL }
3691
14
    },
3692
14
    { &hf_h265_cpb_size_du_value_minus1,
3693
14
    { "cpb_size_du_value_minus1", "h265.cpb_size_du_value_minus1",
3694
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3695
14
      NULL, HFILL }
3696
14
    },
3697
14
    { &hf_h265_bit_rate_du_value_minus1,
3698
14
    { "bit_rate_du_value_minus1", "h265.bit_rate_du_value_minus1",
3699
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3700
14
      NULL, HFILL }
3701
14
    },
3702
14
    { &hf_h265_cbr_flag,
3703
14
    { "cbr_flag", "h265.cbr_flag",
3704
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3705
14
      NULL, HFILL }
3706
14
    },
3707
      /*SPS*/
3708
14
    { &hf_h265_sps_video_parameter_set_id,
3709
14
    { "sps_video_parameter_set_id", "h265.sps_video_parameter_set_id",
3710
14
      FT_UINT8, BASE_DEC, NULL, 0xF0,
3711
14
      NULL, HFILL }
3712
14
    },
3713
14
    { &hf_h265_sps_max_sub_layers_minus1,
3714
14
    { "sps_max_sub_layers_minus1", "h265.sps_max_sub_layers_minus1",
3715
14
      FT_UINT8, BASE_DEC, NULL, 0x0E,
3716
14
      NULL, HFILL }
3717
14
    },
3718
14
    { &hf_h265_sps_temporal_id_nesting_flag,
3719
14
    { "sps_temporal_id_nesting_flag", "h265.sps_temporal_id_nesting_flag",
3720
14
      FT_UINT8, BASE_DEC, NULL, 0x01,
3721
14
      NULL, HFILL }
3722
14
    },
3723
14
    { &hf_h265_sps_seq_parameter_set_id,
3724
14
    { "sps_seq_parameter_set_id", "h265.sps_seq_parameter_set_id",
3725
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3726
14
      NULL, HFILL }
3727
14
    },
3728
14
    { &hf_h265_chroma_format_idc,
3729
14
    { "chroma_format_idc", "h265.chroma_format_idc",
3730
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3731
14
      NULL, HFILL }
3732
14
    },
3733
14
    { &hf_h265_separate_colour_plane_flag,
3734
14
    { "separate_colour_plane_flag", "h265.separate_colour_plane_flag",
3735
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3736
14
      NULL, HFILL }
3737
14
    },
3738
14
    { &hf_h265_pic_width_in_luma_samples,
3739
14
    { "pic_width_in_luma_samples", "h265.pic_width_in_luma_samples",
3740
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3741
14
      NULL, HFILL }
3742
14
    },
3743
14
    { &hf_h265_pic_height_in_luma_samples,
3744
14
    { "pic_height_in_luma_samples", "h265.pic_height_in_luma_samples",
3745
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3746
14
      NULL, HFILL }
3747
14
    },
3748
14
    { &hf_h265_conformance_window_flag,
3749
14
    { "conformance_window_flag", "h265.conformance_window_flag",
3750
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3751
14
      NULL, HFILL }
3752
14
    },
3753
14
    { &hf_h265_conf_win_left_offset,
3754
14
    { "conf_win_left_offset", "h265.conf_win_left_offset",
3755
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3756
14
      NULL, HFILL }
3757
14
    },
3758
14
    { &hf_h265_conf_win_right_offset,
3759
14
    { "conf_win_right_offset", "h265.conf_win_right_offset",
3760
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3761
14
      NULL, HFILL }
3762
14
    },
3763
14
    { &hf_h265_conf_win_top_offset,
3764
14
    { "conf_win_top_offset", "h265.conf_win_top_offset",
3765
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3766
14
      NULL, HFILL }
3767
14
    },
3768
14
    { &hf_h265_conf_win_bottom_offset,
3769
14
    { "conf_win_bottom_offset", "h265.conf_win_bottom_offset",
3770
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3771
14
      NULL, HFILL }
3772
14
    },
3773
14
    { &hf_h265_bit_depth_luma_minus8,
3774
14
    { "bit_depth_luma_minus8", "h265.bit_depth_luma_minus8",
3775
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3776
14
      NULL, HFILL }
3777
14
    },
3778
14
    { &hf_h265_bit_depth_chroma_minus8,
3779
14
    { "bit_depth_chroma_minus8", "h265.bit_depth_chroma_minus8",
3780
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3781
14
      NULL, HFILL }
3782
14
    },
3783
14
    { &hf_h265_log2_max_pic_order_cnt_lsb_minus4,
3784
14
    { "log2_max_pic_order_cnt_lsb_minus4", "h265.log2_max_pic_order_cnt_lsb_minus4",
3785
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3786
14
      NULL, HFILL }
3787
14
    },
3788
14
    { &hf_h265_sps_sub_layer_ordering_info_present_flag,
3789
14
    { "sps_sub_layer_ordering_info_present_flag", "h265.sps_sub_layer_ordering_info_present_flag",
3790
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3791
14
      NULL, HFILL }
3792
14
    },
3793
14
    { &hf_h265_sps_max_dec_pic_buffering_minus1,
3794
14
    { "sps_max_dec_pic_buffering_minus1", "h265.sps_max_dec_pic_buffering_minus1",
3795
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3796
14
      NULL, HFILL }
3797
14
    },
3798
14
    { &hf_h265_sps_max_num_reorder_pics,
3799
14
    { "sps_max_num_reorder_pics", "h265.sps_max_num_reorder_pics",
3800
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3801
14
      NULL, HFILL }
3802
14
    },
3803
14
    { &hf_h265_sps_max_latency_increase_plus1,
3804
14
    { "sps_max_latency_increase_plus1", "h265.sps_max_latency_increase_plus1",
3805
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3806
14
      NULL, HFILL }
3807
14
    },
3808
14
    { &hf_h265_log2_min_luma_coding_block_size_minus3,
3809
14
    { "log2_min_luma_coding_block_size_minus3", "h265.log2_min_luma_coding_block_size_minus3",
3810
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3811
14
      NULL, HFILL }
3812
14
    },
3813
14
    { &hf_h265_log2_diff_max_min_luma_coding_block_size,
3814
14
    { "log2_diff_max_min_luma_coding_block_size", "h265.log2_diff_max_min_luma_coding_block_size",
3815
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3816
14
      NULL, HFILL }
3817
14
    },
3818
14
    { &hf_h265_log2_min_luma_transform_block_size_minus2,
3819
14
    { "log2_min_luma_transform_block_size_minus2", "h265.log2_min_luma_transform_block_size_minus2",
3820
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3821
14
      NULL, HFILL }
3822
14
    },
3823
14
    { &hf_h265_log2_diff_max_min_luma_transform_block_size,
3824
14
    { "log2_diff_max_min_luma_transform_block_size", "h265.log2_diff_max_min_luma_transform_block_size",
3825
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3826
14
      NULL, HFILL }
3827
14
    },
3828
14
    { &hf_h265_max_transform_hierarchy_depth_inter,
3829
14
    { "max_transform_hierarchy_depth_inter", "h265.max_transform_hierarchy_depth_inter",
3830
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3831
14
      NULL, HFILL }
3832
14
    },
3833
14
    { &hf_h265_max_transform_hierarchy_depth_intra,
3834
14
    { "max_transform_hierarchy_depth_intra", "h265.max_transform_hierarchy_depth_intra",
3835
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3836
14
      NULL, HFILL }
3837
14
    },
3838
14
    { &hf_h265_scaling_list_enabled_flag,
3839
14
    { "scaling_list_enabled_flag", "h265.scaling_list_enabled_flag",
3840
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3841
14
      NULL, HFILL }
3842
14
    },
3843
14
    { &hf_h265_sps_scaling_list_data_present_flag,
3844
14
    { "sps_scaling_list_data_present_flag", "h265.sps_scaling_list_data_present_flag",
3845
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3846
14
      NULL, HFILL }
3847
14
    },
3848
14
    { &hf_h265_amp_enabled_flag,
3849
14
    { "amp_enabled_flag", "h265.amp_enabled_flag",
3850
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3851
14
      NULL, HFILL }
3852
14
    },
3853
14
    { &hf_h265_sample_adaptive_offset_enabled_flag,
3854
14
    { "sample_adaptive_offset_enabled_flag", "h265.sample_adaptive_offset_enabled_flag",
3855
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3856
14
      NULL, HFILL }
3857
14
    },
3858
14
    { &hf_h265_pcm_enabled_flag,
3859
14
    { "pcm_enabled_flag", "h265.pcm_enabled_flag",
3860
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3861
14
      NULL, HFILL }
3862
14
    },
3863
14
    { &hf_h265_pcm_sample_bit_depth_luma_minus1,
3864
14
    { "pcm_sample_bit_depth_luma_minus1", "h265.pcm_sample_bit_depth_luma_minus1",
3865
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3866
14
      NULL, HFILL }
3867
14
    },
3868
14
    { &hf_h265_pcm_sample_bit_depth_chroma_minus1,
3869
14
    { "pcm_sample_bit_depth_chroma_minus1", "h265.pcm_sample_bit_depth_chroma_minus1",
3870
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3871
14
      NULL, HFILL }
3872
14
    },
3873
14
    { &hf_h265_log2_min_pcm_luma_coding_block_size_minus3,
3874
14
    { "log2_min_pcm_luma_coding_block_size_minus3", "h265.log2_min_pcm_luma_coding_block_size_minus3",
3875
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3876
14
      NULL, HFILL }
3877
14
    },
3878
14
    { &hf_h265_log2_diff_max_min_pcm_luma_coding_block_size,
3879
14
    { "log2_diff_max_min_pcm_luma_coding_block_size", "h265.log2_diff_max_min_pcm_luma_coding_block_size",
3880
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3881
14
      NULL, HFILL }
3882
14
    },
3883
14
    { &hf_h265_pcm_loop_filter_disabled_flag,
3884
14
    { "pcm_loop_filter_disabled_flag", "h265.pcm_loop_filter_disabled_flag",
3885
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3886
14
      NULL, HFILL }
3887
14
    },
3888
14
    { &hf_h265_num_short_term_ref_pic_sets,
3889
14
    { "num_short_term_ref_pic_sets", "h265.num_short_term_ref_pic_sets",
3890
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3891
14
      NULL, HFILL }
3892
14
    },
3893
14
    { &hf_h265_long_term_ref_pics_present_flag,
3894
14
    { "long_term_ref_pics_present_flag", "h265.long_term_ref_pics_present_flag",
3895
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3896
14
      NULL, HFILL }
3897
14
    },
3898
14
    { &hf_h265_num_long_term_ref_pics_sps,
3899
14
    { "num_long_term_ref_pics_sps", "h265.num_long_term_ref_pics_sps",
3900
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3901
14
      NULL, HFILL }
3902
14
    },
3903
14
    { &hf_h265_lt_ref_pic_poc_lsb_sps,
3904
14
    { "lt_ref_pic_poc_lsb_sps", "h265.lt_ref_pic_poc_lsb_sps",
3905
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3906
14
      NULL, HFILL }
3907
14
    },
3908
14
    { &hf_h265_used_by_curr_pic_lt_sps_flag,
3909
14
    { "used_by_curr_pic_lt_sps_flag", "h265.used_by_curr_pic_lt_sps_flag",
3910
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3911
14
      NULL, HFILL }
3912
14
    },
3913
14
    { &hf_h265_sps_temporal_mvp_enabled_flag,
3914
14
    { "sps_temporal_mvp_enabled_flag", "h265.sps_temporal_mvp_enabled_flag",
3915
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3916
14
      NULL, HFILL }
3917
14
    },
3918
14
    { &hf_h265_strong_intra_smoothing_enabled_flag,
3919
14
    { "strong_intra_smoothing_enabled_flag", "h265.strong_intra_smoothing_enabled_flag",
3920
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3921
14
      NULL, HFILL }
3922
14
    },
3923
14
    { &hf_h265_vui_parameters_present_flag,
3924
14
    { "vui_parameters_present_flag", "h265.vui_parameters_present_flag",
3925
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3926
14
      NULL, HFILL }
3927
14
    },
3928
14
    { &hf_h265_sps_extension_present_flag,
3929
14
    { "sps_extension_present_flag", "h265.sps_extension_present_flag",
3930
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3931
14
      NULL, HFILL }
3932
14
    },
3933
14
    { &hf_h265_sps_range_extension_flag,
3934
14
    { "sps_range_extension_flag", "h265.sps_range_extension_flag",
3935
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3936
14
      NULL, HFILL }
3937
14
    },
3938
14
    { &hf_h265_sps_multilayer_extension_flag,
3939
14
    { "sps_multilayer_extension_flag", "h265.sps_multilayer_extension_flag",
3940
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3941
14
      NULL, HFILL }
3942
14
    },
3943
14
    { &hf_h265_sps_3d_extension_flag,
3944
14
    { "sps_3d_extension_flag", "h265.sps_3d_extension_flag",
3945
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3946
14
      NULL, HFILL }
3947
14
    },
3948
14
    { &hf_h265_sps_scc_extension_flag,
3949
14
    { "sps_scc_extension_flag", "h265.sps_scc_extension_flag",
3950
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3951
14
      NULL, HFILL }
3952
14
    },
3953
14
    { &hf_h265_sps_extension_4bits,
3954
14
    { "sps_extension_4bits", "h265.sps_extension_4bits",
3955
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3956
14
      NULL, HFILL }
3957
14
    },
3958
14
    { &hf_h265_sps_extension_data_flag,
3959
14
    { "sps_extension_data_flag", "h265.sps_extension_data_flag",
3960
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3961
14
      NULL, HFILL }
3962
14
    },
3963
      /* scaling_list_data */
3964
14
    { &hf_h265_scaling_list_pred_mode_flag,
3965
14
    { "scaling_list_pred_mode_flag", "h265.scaling_list_pred_mode_flag",
3966
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3967
14
      NULL, HFILL }
3968
14
    },
3969
14
    { &hf_h265_scaling_list_pred_matrix_id_delta,
3970
14
    { "scaling_list_pred_matrix_id_delta", "h265.scaling_list_pred_matrix_id_delta",
3971
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3972
14
      NULL, HFILL }
3973
14
    },
3974
14
    { &hf_h265_scaling_list_dc_coef_minus8,
3975
14
    { "scaling_list_dc_coef_minus8", "h265.scaling_list_dc_coef_minus8",
3976
14
      FT_INT32, BASE_DEC, NULL, 0x0,
3977
14
      NULL, HFILL }
3978
14
    },
3979
14
    { &hf_h265_scaling_list_delta_coef,
3980
14
    { "scaling_list_delta_coef", "h265.scaling_list_delta_coef",
3981
14
      FT_INT32, BASE_DEC, NULL, 0x0,
3982
14
      NULL, HFILL }
3983
14
    },
3984
      /*st_ref_pic_set*/
3985
14
    { &hf_h265_inter_ref_pic_set_prediction_flag,
3986
14
    { "inter_ref_pic_set_prediction_flag", "h265.inter_ref_pic_set_prediction_flag",
3987
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3988
14
      NULL, HFILL }
3989
14
    },
3990
14
    { &hf_h265_delta_idx_minus1,
3991
14
    { "delta_idx_minus1", "h265.delta_idx_minus1",
3992
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
3993
14
      NULL, HFILL }
3994
14
    },
3995
14
    { &hf_h265_delta_rps_sign,
3996
14
    { "delta_rps_sign", "h265.delta_rps_sign",
3997
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
3998
14
      NULL, HFILL }
3999
14
    },
4000
14
    { &hf_h265_abs_delta_rps_minus1,
4001
14
    { "abs_delta_rps_minus1", "h265.abs_delta_rps_minus1",
4002
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4003
14
      NULL, HFILL }
4004
14
    },
4005
14
    { &hf_h265_used_by_curr_pic_flag,
4006
14
    { "used_by_curr_pic_flag", "h265.used_by_curr_pic_flag",
4007
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4008
14
      NULL, HFILL }
4009
14
    },
4010
14
    { &hf_h265_use_delta_flag,
4011
14
    { "use_delta_flag", "h265.use_delta_flag",
4012
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4013
14
      NULL, HFILL }
4014
14
    },
4015
14
    { &hf_h265_num_negative_pics,
4016
14
    { "num_negative_pics", "h265.num_negative_pics",
4017
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4018
14
      NULL, HFILL }
4019
14
    },
4020
14
    { &hf_h265_num_positive_pics,
4021
14
    { "num_positive_pics", "h265.num_positive_pics",
4022
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4023
14
      NULL, HFILL }
4024
14
    },
4025
14
    { &hf_h265_delta_poc_s0_minus1,
4026
14
    { "delta_poc_s0_minus1", "h265.delta_poc_s0_minus1",
4027
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4028
14
      NULL, HFILL }
4029
14
    },
4030
14
    { &hf_h265_used_by_curr_pic_s0_flag,
4031
14
    { "used_by_curr_pic_s0_flag", "h265.used_by_curr_pic_s0_flag",
4032
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4033
14
      NULL, HFILL }
4034
14
    },
4035
14
    { &hf_h265_delta_poc_s1_minus1,
4036
14
    { "delta_poc_s1_minus1", "h265.delta_poc_s1_minus1",
4037
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4038
14
      NULL, HFILL }
4039
14
    },
4040
14
    { &hf_h265_used_by_curr_pic_s1_flag,
4041
14
    { "used_by_curr_pic_s1_flag", "h265.used_by_curr_pic_s1_flag",
4042
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4043
14
      NULL, HFILL }
4044
14
    },
4045
      /*vui*/
4046
14
    { &hf_h265_aspect_ratio_info_present_flag,
4047
14
    { "aspect_ratio_info_present_flag", "h265.aspect_ratio_info_present_flag",
4048
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4049
14
      NULL, HFILL }
4050
14
    },
4051
14
    { &hf_h265_aspect_ratio_idc,
4052
14
    { "aspect_ratio_idc", "h265.aspect_ratio_idc",
4053
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4054
14
      NULL, HFILL }
4055
14
    },
4056
14
    { &hf_h265_sar_width,
4057
14
    { "sar_width", "h265.sar_width",
4058
14
      FT_UINT16, BASE_DEC, NULL, 0x0,
4059
14
      NULL, HFILL }
4060
14
    },
4061
14
    { &hf_h265_sar_height,
4062
14
    { "sar_height", "h265.sar_height",
4063
14
      FT_UINT16, BASE_DEC, NULL, 0x0,
4064
14
      NULL, HFILL }
4065
14
    },
4066
14
    { &hf_h265_overscan_info_present_flag,
4067
14
    { "overscan_info_present_flag", "h265.overscan_info_present_flag",
4068
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4069
14
      NULL, HFILL }
4070
14
    },
4071
14
    { &hf_h265_overscan_appropriate_flag,
4072
14
    { "overscan_appropriate_flag", "h265.overscan_appropriate_flag",
4073
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4074
14
      NULL, HFILL }
4075
14
    },
4076
14
    { &hf_h265_video_signal_type_present_flag,
4077
14
    { "video_signal_type_present_flag", "h265.video_signal_type_present_flag",
4078
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4079
14
      NULL, HFILL }
4080
14
    },
4081
14
    { &hf_h265_video_format,
4082
14
    { "video_format", "h265.video_format",
4083
14
      FT_UINT8, BASE_DEC, VALS(h265_video_format_vals), 0x0,
4084
14
      NULL, HFILL }
4085
14
    },
4086
14
    { &hf_h265_video_full_range_flag,
4087
14
    { "video_full_range_flag", "h265.video_full_range_flag",
4088
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4089
14
      NULL, HFILL }
4090
14
    },
4091
14
    { &hf_h265_colour_description_present_flag,
4092
14
    { "colour_description_present_flag", "h265.colour_description_present_flag",
4093
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4094
14
      NULL, HFILL }
4095
14
    },
4096
14
    { &hf_h265_colour_primaries,
4097
14
    { "colour_primaries", "h265.colour_primaries",
4098
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4099
14
      NULL, HFILL }
4100
14
    },
4101
14
    { &hf_h265_transfer_characteristics,
4102
14
    { "transfer_characteristics", "h265.transfer_characteristics",
4103
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4104
14
      NULL, HFILL }
4105
14
    },
4106
14
    { &hf_h265_matrix_coeffs,
4107
14
    { "matrix_coefficients", "h265.matrix_coefficients",
4108
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4109
14
      NULL, HFILL }
4110
14
    },
4111
14
    { &hf_h265_chroma_loc_info_present_flag,
4112
14
    { "chroma_loc_info_present_flag", "h265.chroma_loc_info_present_flag",
4113
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4114
14
      NULL, HFILL }
4115
14
    },
4116
14
    { &hf_h265_chroma_sample_loc_type_top_field,
4117
14
    { "chroma_sample_loc_type_top_field", "h265.chroma_sample_loc_type_top_field",
4118
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4119
14
      NULL, HFILL }
4120
14
    },
4121
14
    { &hf_h265_chroma_sample_loc_type_bottom_field,
4122
14
    { "chroma_sample_loc_type_bottom_field", "h265.chroma_sample_loc_type_bottom_field",
4123
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4124
14
      NULL, HFILL }
4125
14
    },
4126
14
    { &hf_h265_neutral_chroma_indication_flag,
4127
14
    { "neutral_chroma_indication_flag", "h265.neutral_chroma_indication_flag",
4128
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4129
14
      NULL, HFILL }
4130
14
    }, { &hf_h265_field_seq_flag,
4131
14
    { "field_seq_flag", "h265.field_seq_flag",
4132
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4133
14
      NULL, HFILL }
4134
14
    }, { &hf_h265_frame_field_info_present_flag,
4135
14
    { "frame_field_info_present_flag", "h265.frame_field_info_present_flag",
4136
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4137
14
      NULL, HFILL }
4138
14
    }, { &hf_h265_default_display_window_flag,
4139
14
    { "default_display_window_flag", "h265.default_display_window_flag",
4140
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4141
14
      NULL, HFILL }
4142
14
    },
4143
14
    { &hf_h265_def_disp_win_left_offset,
4144
14
    { "def_disp_win_left_offset", "h265.def_disp_win_left_offset",
4145
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4146
14
      NULL, HFILL }
4147
14
    },
4148
14
    { &hf_h265_def_disp_win_right_offset,
4149
14
    { "def_disp_win_right_offset", "h265.def_disp_win_right_offset",
4150
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4151
14
      NULL, HFILL }
4152
14
    },
4153
14
    { &hf_h265_def_disp_win_top_offset,
4154
14
    { "def_disp_win_top_offset", "h265.def_disp_win_top_offset",
4155
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4156
14
      NULL, HFILL }
4157
14
    },
4158
14
    { &hf_h265_def_disp_win_bottom_offset,
4159
14
    { "def_disp_win_bottom_offset", "h265.def_disp_win_bottom_offset",
4160
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4161
14
      NULL, HFILL }
4162
14
    },
4163
14
    { &hf_h265_vui_timing_info_present_flag,
4164
14
    { "vui_timing_info_present_flag", "h265.vui_timing_info_present_flag",
4165
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4166
14
      NULL, HFILL }
4167
14
    },
4168
14
    { &hf_h265_vui_num_units_in_tick,
4169
14
    { "vui_num_units_in_tick", "h265.vui_num_units_in_tick",
4170
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4171
14
      NULL, HFILL }
4172
14
    },
4173
14
    { &hf_h265_vui_time_scale,
4174
14
    { "vui_time_scale", "h265.vui_time_scale",
4175
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4176
14
      NULL, HFILL }
4177
14
    },
4178
14
    { &hf_h265_vui_poc_proportional_to_timing_flag,
4179
14
    { "vui_poc_proportional_to_timing_flag", "h265.vui_poc_proportional_to_timing_flag",
4180
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4181
14
      NULL, HFILL }
4182
14
    },
4183
14
    { &hf_h265_vui_num_ticks_poc_diff_one_minus1,
4184
14
    { "vui_num_ticks_poc_diff_one_minus1", "h265.vui_num_ticks_poc_diff_one_minus1",
4185
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4186
14
      NULL, HFILL }
4187
14
    },
4188
14
    { &hf_h265_vui_hrd_parameters_present_flag,
4189
14
    { "vui_hrd_parameters_present_flag", "h265.vui_hrd_parameters_present_flag",
4190
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4191
14
      NULL, HFILL }
4192
14
    },
4193
14
    { &hf_h265_bitstream_restriction_flag,
4194
14
    { "bitstream_restriction_flag", "h265.bitstream_restriction_flag",
4195
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4196
14
      NULL, HFILL }
4197
14
    },
4198
14
    { &hf_h265_tiles_fixed_structure_flag,
4199
14
    { "tiles_fixed_structure_flag", "h265.tiles_fixed_structure_flag",
4200
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4201
14
      NULL, HFILL }
4202
14
    },
4203
14
    { &hf_h265_motion_vectors_over_pic_boundaries_flag,
4204
14
    { "motion_vectors_over_pic_boundaries_flag", "h265.motion_vectors_over_pic_boundaries_flag",
4205
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4206
14
      NULL, HFILL }
4207
14
    },
4208
14
    { &hf_h265_restricted_ref_pic_lists_flag,
4209
14
    { "restricted_ref_pic_lists_flag", "h265.restricted_ref_pic_lists_flag",
4210
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4211
14
      NULL, HFILL }
4212
14
    },
4213
14
    { &hf_h265_min_spatial_segmentation_idc,
4214
14
    { "min_spatial_segmentation_idc", "h265.min_spatial_segmentation_idc",
4215
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4216
14
      NULL, HFILL }
4217
14
    },
4218
14
    { &hf_h265_max_bytes_per_pic_denom,
4219
14
    { "max_bytes_per_pic_denom", "h265.max_bytes_per_pic_denom",
4220
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4221
14
      NULL, HFILL }
4222
14
    },
4223
14
    { &hf_h265_max_bits_per_min_cu_denom,
4224
14
    { "max_bits_per_mb_denom", "h265.max_bits_per_mb_denom",
4225
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4226
14
      NULL, HFILL }
4227
14
    },
4228
14
    { &hf_h265_log2_max_mv_length_horizontal,
4229
14
    { "max_mv_length_horizontal", "h265.max_mv_length_horizontal",
4230
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4231
14
      NULL, HFILL }
4232
14
    },
4233
14
    { &hf_h265_log2_max_mv_length_vertical,
4234
14
    { "log2_max_mv_length_vertical", "h265.log2_max_mv_length_vertical",
4235
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4236
14
      NULL, HFILL }
4237
14
    },
4238
      /* sps_range_extension */
4239
14
    { &hf_h265_transform_skip_rotation_enabled_flag,
4240
14
    { "transform_skip_rotation_enabled_flag", "h265.transform_skip_rotation_enabled_flag",
4241
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4242
14
      NULL, HFILL }
4243
14
    },
4244
14
    { &hf_h265_transform_skip_context_enabled_flag,
4245
14
    { "transform_skip_context_enabled_flag", "h265.transform_skip_context_enabled_flag",
4246
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4247
14
      NULL, HFILL }
4248
14
    },
4249
14
    { &hf_h265_implicit_rdpcm_enabled_flag,
4250
14
    { "implicit_rdpcm_enabled_flag", "h265.implicit_rdpcm_enabled_flag",
4251
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4252
14
      NULL, HFILL }
4253
14
    },
4254
14
    { &hf_h265_explicit_rdpcm_enabled_flag,
4255
14
    { "explicit_rdpcm_enabled_flag", "h265.explicit_rdpcm_enabled_flag",
4256
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4257
14
      NULL, HFILL }
4258
14
    },
4259
14
    { &hf_h265_extended_precision_processing_flag,
4260
14
    { "extended_precision_processing_flag", "h265.extended_precision_processing_flag",
4261
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4262
14
      NULL, HFILL }
4263
14
    },
4264
14
    { &hf_h265_intra_smoothing_disabled_flag,
4265
14
    { "intra_smoothing_disabled_flag", "h265.intra_smoothing_disabled_flag",
4266
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4267
14
      NULL, HFILL }
4268
14
    },
4269
14
    { &hf_h265_high_precision_offsets_enabled_flag,
4270
14
    { "high_precision_offsets_enabled_flag", "h265.high_precision_offsets_enabled_flag",
4271
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4272
14
      NULL, HFILL }
4273
14
    },
4274
14
    { &hf_h265_persistent_rice_adaptation_enabled_flag,
4275
14
    { "persistent_rice_adaptation_enabled_flag", "h265.persistent_rice_adaptation_enabled_flag",
4276
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4277
14
      NULL, HFILL }
4278
14
    },
4279
14
    { &hf_h265_cabac_bypass_alignment_enabled_flag,
4280
14
    { "cabac_bypass_alignment_enabled_flag", "h265.cabac_bypass_alignment_enabled_flag",
4281
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4282
14
      NULL, HFILL }
4283
14
    },
4284
      /* sps_scc_extension */
4285
14
    { &hf_h265_sps_curr_pic_ref_enabled_flag,
4286
14
    { "sps_curr_pic_ref_enabled_flag", "h265.sps_curr_pic_ref_enabled_flag",
4287
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4288
14
      NULL, HFILL }
4289
14
    },
4290
14
    { &hf_h265_palette_mode_enabled_flag,
4291
14
    { "palette_mode_enabled_flag", "h265.palette_mode_enabled_flag",
4292
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4293
14
      NULL, HFILL }
4294
14
    },
4295
14
    { &hf_h265_palette_max_size,
4296
14
    { "palette_max_size", "h265.palette_max_size",
4297
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4298
14
      NULL, HFILL }
4299
14
    },
4300
14
    { &hf_h265_delta_palette_max_predictor_size,
4301
14
    { "delta_palette_max_predictor_size", "h265.delta_palette_max_predictor_size",
4302
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4303
14
      NULL, HFILL }
4304
14
    },
4305
14
    { &hf_h265_sps_palette_predictor_initializers_present_flag,
4306
14
    { "sps_palette_predictor_initializers_present_flag", "h265.sps_palette_predictor_initializers_present_flag",
4307
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4308
14
      NULL, HFILL }
4309
14
    },
4310
14
    { &hf_h265_sps_num_palette_predictor_initializers_minus1,
4311
14
    { "sps_num_palette_predictor_initializers_minus1", "h265.sps_num_palette_predictor_initializers_minus1",
4312
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4313
14
      NULL, HFILL }
4314
14
    },
4315
14
    { &hf_h265_sps_palette_predictor_initializer,
4316
14
    { "sps_palette_predictor_initializer", "h265.sps_palette_predictor_initializer",
4317
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4318
14
      NULL, HFILL }
4319
14
    },
4320
14
    { &hf_h265_motion_vector_resolution_control_idc,
4321
14
    { "motion_vector_resolution_control_idc", "h265.motion_vector_resolution_control_idc",
4322
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4323
14
      NULL, HFILL }
4324
14
    },
4325
14
    { &hf_h265_intra_boundary_filtering_disabled_flag,
4326
14
    { "intra_boundary_filtering_disabled_flag", "h265.intra_boundary_filtering_disabled_flag",
4327
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4328
14
      NULL, HFILL }
4329
14
    },
4330
      /* PPS */
4331
14
    { &hf_h265_pps_pic_parameter_set_id,
4332
14
    { "pps_pic_parameter_set_id", "h265.pps_pic_parameter_set_id",
4333
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4334
14
      NULL, HFILL }
4335
14
    },
4336
14
    { &hf_h265_pps_seq_parameter_set_id,
4337
14
    { "pps_seq_parameter_set_id", "h265.pps_seq_parameter_set_id",
4338
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4339
14
      NULL, HFILL }
4340
14
    },
4341
14
    { &hf_h265_dependent_slice_segments_enabled_flag,
4342
14
    { "dependent_slice_segments_enabled_flag", "h265.dependent_slice_segments_enabled_flag",
4343
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4344
14
      NULL, HFILL }
4345
14
    },
4346
14
    { &hf_h265_output_flag_present_flag,
4347
14
    { "output_flag_present_flag", "h265.output_flag_present_flag",
4348
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4349
14
      NULL, HFILL }
4350
14
    },
4351
14
    { &hf_h265_num_extra_slice_header_bits,
4352
14
    { "num_extra_slice_header_bits", "h265.num_extra_slice_header_bits",
4353
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4354
14
      NULL, HFILL }
4355
14
    },
4356
14
    { &hf_h265_sign_data_hiding_enabled_flag,
4357
14
    { "sign_data_hiding_enabled_flag", "h265.sign_data_hiding_enabled_flag",
4358
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4359
14
      NULL, HFILL }
4360
14
    },
4361
14
    { &hf_h265_cabac_init_present_flag,
4362
14
    { "cabac_init_present_flag", "h265.cabac_init_present_flag",
4363
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4364
14
      NULL, HFILL }
4365
14
    },
4366
14
    { &hf_h265_num_ref_idx_l0_default_active_minus1,
4367
14
    { "num_ref_idx_l0_default_active_minus1", "h265.num_ref_idx_l0_default_active_minus1",
4368
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4369
14
      NULL, HFILL }
4370
14
    },
4371
14
    { &hf_h265_num_ref_idx_l1_default_active_minus1,
4372
14
    { "num_ref_idx_l1_default_active_minus1", "h265.num_ref_idx_l1_default_active_minus1",
4373
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4374
14
      NULL, HFILL }
4375
14
    },
4376
14
    { &hf_h265_init_qp_minus26,
4377
14
    { "init_qp_minus26", "h265.init_qp_minus26",
4378
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4379
14
      NULL, HFILL }
4380
14
    },
4381
14
    { &hf_h265_constrained_intra_pred_flag,
4382
14
    { "constrained_intra_pred_flag", "h265.constrained_intra_pred_flag",
4383
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4384
14
      NULL, HFILL }
4385
14
    },
4386
14
    { &hf_h265_transform_skip_enabled_flag,
4387
14
    { "transform_skip_enabled_flag", "h265.transform_skip_enabled_flag",
4388
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4389
14
      NULL, HFILL }
4390
14
    },
4391
14
    { &hf_h265_cu_qp_delta_enabled_flag,
4392
14
    { "cu_qp_delta_enabled_flag", "h265.cu_qp_delta_enabled_flag",
4393
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4394
14
      NULL, HFILL }
4395
14
    },
4396
14
    { &hf_h265_diff_cu_qp_delta_depth,
4397
14
    { "diff_cu_qp_delta_depth", "h265.diff_cu_qp_delta_depth",
4398
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4399
14
      NULL, HFILL }
4400
14
    },
4401
14
    { &hf_h265_pps_cb_qp_offset,
4402
14
    { "pps_cb_qp_offset", "h265.pps_cb_qp_offset",
4403
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4404
14
      NULL, HFILL }
4405
14
    },
4406
14
    { &hf_h265_pps_cr_qp_offset,
4407
14
    { "pps_cr_qp_offset", "h265.pps_cr_qp_offset",
4408
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4409
14
      NULL, HFILL }
4410
14
    },
4411
14
    { &hf_h265_pps_slice_chroma_qp_offsets_present_flag,
4412
14
    { "pps_slice_chroma_qp_offsets_present_flag", "h265.pps_slice_chroma_qp_offsets_present_flag",
4413
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4414
14
      NULL, HFILL }
4415
14
    },
4416
14
    { &hf_h265_weighted_pred_flag,
4417
14
    { "weighted_pred_flag", "h265.weighted_pred_flag",
4418
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4419
14
      NULL, HFILL }
4420
14
    },
4421
14
    { &hf_h265_weighted_bipred_flag,
4422
14
    { "weighted_bipred_flag", "h265.weighted_bipred_flag",
4423
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4424
14
      NULL, HFILL }
4425
14
    },
4426
14
    { &hf_h265_transquant_bypass_enabled_flag,
4427
14
    { "transquant_bypass_enabled_flag", "h265.transquant_bypass_enabled_flag",
4428
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4429
14
      NULL, HFILL }
4430
14
    },
4431
14
    { &hf_h265_tiles_enabled_flag,
4432
14
    { "tiles_enabled_flag", "h265.tiles_enabled_flag",
4433
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4434
14
      NULL, HFILL }
4435
14
    },
4436
14
    { &hf_h265_entropy_coding_sync_enabled_flag,
4437
14
    { "entropy_coding_sync_enabled_flag", "h265.entropy_coding_sync_enabled_flag",
4438
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4439
14
      NULL, HFILL }
4440
14
    },
4441
14
    { &hf_h265_num_tile_columns_minus1,
4442
14
    { "num_tile_columns_minus1", "h265.num_tile_columns_minus1",
4443
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4444
14
      NULL, HFILL }
4445
14
    },
4446
14
    { &hf_h265_num_tile_rows_minus1,
4447
14
    { "num_tile_rows_minus1", "h265.num_tile_rows_minus1",
4448
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4449
14
      NULL, HFILL }
4450
14
    },
4451
14
    { &hf_h265_uniform_spacing_flag,
4452
14
    { "uniform_spacing_flag", "h265.uniform_spacing_flag",
4453
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4454
14
      NULL, HFILL }
4455
14
    },
4456
14
    { &hf_h265_column_width_minus1,
4457
14
    { "column_width_minus1", "h265.column_width_minus1",
4458
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4459
14
      NULL, HFILL }
4460
14
    },
4461
14
    { &hf_h265_row_height_minus1,
4462
14
    { "row_height_minus1", "h265.row_height_minus1",
4463
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4464
14
      NULL, HFILL }
4465
14
    },
4466
14
    { &hf_h265_loop_filter_across_tiles_enabled_flag,
4467
14
    { "loop_filter_across_tiles_enabled_flag", "h265.loop_filter_across_tiles_enabled_flag",
4468
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4469
14
      NULL, HFILL }
4470
14
    },
4471
14
    { &hf_h265_pps_loop_filter_across_slices_enabled_flag,
4472
14
    { "pps_loop_filter_across_slices_enabled_flag", "h265.pps_loop_filter_across_slices_enabled_flag",
4473
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4474
14
      NULL, HFILL }
4475
14
    },
4476
14
    { &hf_h265_deblocking_filter_control_present_flag,
4477
14
    { "deblocking_filter_control_present_flag", "h265.deblocking_filter_control_present_flag",
4478
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4479
14
      NULL, HFILL }
4480
14
    },
4481
14
    { &hf_h265_deblocking_filter_override_enabled_flag,
4482
14
    { "deblocking_filter_override_enabled_flag", "h265.deblocking_filter_override_enabled_flag",
4483
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4484
14
      NULL, HFILL }
4485
14
    },
4486
14
    { &hf_h265_pps_deblocking_filter_disabled_flag,
4487
14
    { "pps_deblocking_filter_disabled_flag", "h265.pps_deblocking_filter_disabled_flag",
4488
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4489
14
      NULL, HFILL }
4490
14
    },
4491
14
    { &hf_h265_pps_beta_offset_div2,
4492
14
    { "pps_beta_offset_div2", "h265.pps_beta_offset_div2",
4493
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4494
14
      NULL, HFILL }
4495
14
    },
4496
14
    { &hf_h265_pps_tc_offset_div2,
4497
14
    { "pps_tc_offset_div2", "h265.pps_tc_offset_div2",
4498
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4499
14
      NULL, HFILL }
4500
14
    },
4501
14
    { &hf_h265_pps_scaling_list_data_present_flag,
4502
14
    { "pps_scaling_list_data_present_flag", "h265.pps_scaling_list_data_present_flag",
4503
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4504
14
      NULL, HFILL }
4505
14
    },
4506
14
    { &hf_h265_lists_modification_present_flag,
4507
14
    { "lists_modification_present_flag", "h265.lists_modification_present_flag",
4508
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4509
14
      NULL, HFILL }
4510
14
    },
4511
14
    { &hf_h265_log2_parallel_merge_level_minus2,
4512
14
    { "log2_parallel_merge_level_minus2", "h265.log2_parallel_merge_level_minus2",
4513
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4514
14
      NULL, HFILL }
4515
14
    },
4516
14
    { &hf_h265_slice_segment_header_extension_present_flag,
4517
14
    { "slice_segment_header_extension_present_flag", "h265.slice_segment_header_extension_present_flag",
4518
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4519
14
      NULL, HFILL }
4520
14
    },
4521
14
    { &hf_h265_pps_extension_present_flag,
4522
14
    { "pps_extension_present_flag", "h265.pps_extension_present_flag",
4523
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4524
14
      NULL, HFILL }
4525
14
    },
4526
14
    { &hf_h265_pps_range_extension_flag,
4527
14
    { "pps_range_extension_flag", "h265.pps_range_extension_flag",
4528
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4529
14
      NULL, HFILL }
4530
14
    },
4531
14
    { &hf_h265_pps_multilayer_extension_flag,
4532
14
    { "pps_multilayer_extension_flag", "h265.pps_multilayer_extension_flag",
4533
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4534
14
      NULL, HFILL }
4535
14
    },
4536
14
    { &hf_h265_pps_3d_extension_flag,
4537
14
    { "pps_3d_extension_flag", "h265.pps_3d_extension_flag",
4538
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4539
14
      NULL, HFILL }
4540
14
    },
4541
14
    { &hf_h265_pps_scc_extension_flag,
4542
14
    { "pps_scc_extension_flag", "h265.pps_scc_extension_flag",
4543
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4544
14
      NULL, HFILL }
4545
14
    },
4546
14
    { &hf_h265_pps_extension_4bits,
4547
14
    { "pps_extension_4bits", "h265.pps_extension_4bits",
4548
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4549
14
      NULL, HFILL }
4550
14
    },
4551
14
    { &hf_h265_pps_extension_data_flag,
4552
14
    { "pps_extension_data_flag", "h265.pps_extension_data_flag",
4553
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4554
14
      NULL, HFILL }
4555
14
    },
4556
4557
14
    { &hf_h265_log2_max_transform_skip_block_size_minus2,
4558
14
    { "log2_max_transform_skip_block_size_minus2", "h265.log2_max_transform_skip_block_size_minus2",
4559
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4560
14
      NULL, HFILL }
4561
14
    },
4562
14
    { &hf_h265_cross_component_prediction_enabled_flag,
4563
14
    { "cross_component_prediction_enabled_flag", "h265.cross_component_prediction_enabled_flag",
4564
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4565
14
      NULL, HFILL }
4566
14
    },
4567
14
    { &hf_h265_chroma_qp_offset_list_enabled_flag,
4568
14
    { "chroma_qp_offset_list_enabled_flag", "h265.chroma_qp_offset_list_enabled_flag",
4569
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4570
14
      NULL, HFILL }
4571
14
    },
4572
14
    { &hf_h265_diff_cu_chroma_qp_offset_depth,
4573
14
    { "diff_cu_chroma_qp_offset_depth", "h265.diff_cu_chroma_qp_offset_depth",
4574
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4575
14
      NULL, HFILL }
4576
14
    },
4577
14
    { &hf_h265_chroma_qp_offset_list_len_minus1,
4578
14
    { "chroma_qp_offset_list_len_minus1", "h265.chroma_qp_offset_list_len_minus1",
4579
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4580
14
      NULL, HFILL }
4581
14
    },
4582
14
    { &hf_h265_cb_qp_offset_list,
4583
14
    { "cb_qp_offset_list", "h265.cb_qp_offset_list",
4584
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4585
14
      NULL, HFILL }
4586
14
    },
4587
14
    { &hf_h265_cr_qp_offset_list,
4588
14
    { "cr_qp_offset_list", "h265.cr_qp_offset_list",
4589
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4590
14
      NULL, HFILL }
4591
14
    },
4592
14
    { &hf_h265_log2_sao_offset_scale_luma,
4593
14
    { "log2_sao_offset_scale_luma", "h265.log2_sao_offset_scale_luma",
4594
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4595
14
      NULL, HFILL }
4596
14
    },
4597
14
    { &hf_h265_log2_sao_offset_scale_chroma,
4598
14
    { "log2_sao_offset_scale_chroma", "h265.log2_sao_offset_scale_chroma",
4599
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4600
14
      NULL, HFILL }
4601
14
    },
4602
      /*pps_scc_extension*/
4603
14
    { &hf_h265_pps_curr_pic_ref_enabled_flag,
4604
14
    { "pps_curr_pic_ref_enabled_flag", "h265.pps_curr_pic_ref_enabled_flag",
4605
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4606
14
      NULL, HFILL }
4607
14
    }, { &hf_h265_residual_adaptive_colour_transform_enabled_flag,
4608
14
    { "residual_adaptive_colour_transform_enabled_flag", "h265.residual_adaptive_colour_transform_enabled_flag",
4609
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4610
14
      NULL, HFILL }
4611
14
    },
4612
14
    { &hf_h265_pps_slice_act_qp_offsets_present_flag,
4613
14
    { "pps_slice_act_qp_offsets_present_flag", "h265.pps_slice_act_qp_offsets_present_flag",
4614
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4615
14
      NULL, HFILL }
4616
14
    },
4617
14
    { &hf_h265_pps_act_y_qp_offset_plus5,
4618
14
    { "pps_act_y_qp_offset_plus5", "h265.pps_act_y_qp_offset_plus5",
4619
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4620
14
      NULL, HFILL }
4621
14
    },
4622
14
    { &hf_h265_pps_act_cb_qp_offset_plus5,
4623
14
    { "pps_act_cb_qp_offset_plus5", "h265.pps_act_cb_qp_offset_plus5",
4624
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4625
14
      NULL, HFILL }
4626
14
    },
4627
14
    { &hf_h265_pps_act_cr_qp_offset_plus3,
4628
14
    { "pps_act_cr_qp_offset_plus3", "h265.pps_act_cr_qp_offset_plus3",
4629
14
      FT_INT32, BASE_DEC, NULL, 0x0,
4630
14
      NULL, HFILL }
4631
14
    },
4632
14
    { &hf_h265_pps_palette_predictor_initializers_present_flag,
4633
14
    { "pps_palette_predictor_initializers_present_flag", "h265.pps_palette_predictor_initializers_present_flag",
4634
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4635
14
      NULL, HFILL }
4636
14
    },
4637
14
    { &hf_h265_pps_num_palette_predictor_initializers,
4638
14
    { "pps_num_palette_predictor_initializers", "h265.pps_num_palette_predictor_initializers",
4639
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4640
14
      NULL, HFILL }
4641
14
    },
4642
14
    { &hf_h265_monochrome_palette_flag,
4643
14
    { "monochrome_palette_flag", "h265.monochrome_palette_flag",
4644
14
      FT_UINT8, BASE_DEC, NULL, 0x0,
4645
14
      NULL, HFILL }
4646
14
    },
4647
14
    { &hf_h265_luma_bit_depth_entry_minus8,
4648
14
    { "luma_bit_depth_entry_minus8", "h265.luma_bit_depth_entry_minus8",
4649
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4650
14
      NULL, HFILL }
4651
14
    },
4652
14
    { &hf_h265_chroma_bit_depth_entry_minus8,
4653
14
    { "chroma_bit_depth_entry_minus8", "h265.chroma_bit_depth_entry_minus8",
4654
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4655
14
      NULL, HFILL }
4656
14
    },
4657
14
    { &hf_h265_pps_palette_predictor_initializer,
4658
14
    { "pps_palette_predictor_initializer", "h265.pps_palette_predictor_initializer",
4659
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4660
14
      NULL, HFILL }
4661
14
    },
4662
4663
      /*Slice*/
4664
14
    { &hf_h265_slice_pic_parameter_set_id,
4665
14
    { "slice_pic_parameter_set_id", "h265.slice_pic_parameter_set_id",
4666
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4667
14
      NULL, HFILL }
4668
14
    },
4669
14
    { &hf_h265_slice_segment_address,
4670
14
    { "slice_segment_address", "h265.slice_segment_address",
4671
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4672
14
      NULL, HFILL }
4673
14
    },
4674
14
    { &hf_h265_slice_type,
4675
14
    { "slice_type", "h265.slice_type",
4676
14
      FT_UINT32, BASE_DEC, VALS(h265_slice_type_vals), 0x0,
4677
14
      NULL, HFILL }
4678
14
    },
4679
      /* SEI */
4680
14
    { &hf_h265_payloadsize,
4681
14
    { "PayloadSize", "h265.payloadsize",
4682
14
      FT_UINT32, BASE_DEC, NULL, 0x0,
4683
14
      NULL, HFILL }
4684
14
    },
4685
14
    { &hf_h265_payloadtype,
4686
14
    { "payloadType", "h265.payloadtype",
4687
14
      FT_UINT32, BASE_DEC, VALS(h265_sei_payload_vals), 0x0,
4688
14
      NULL, HFILL }
4689
14
    },
4690
14
    { &hf_h265_pic_type,
4691
14
    { "pic_type", "h265.pic_type",
4692
14
      FT_UINT8, BASE_DEC, VALS(h265_pic_type_vals), 0x0,
4693
14
      "slice_type values that may be present in the coded picture", HFILL }
4694
14
    },
4695
      /* SDP parameters*/
4696
14
    { &hf_h265_sdp_parameter_sprop_vps,
4697
14
    { "sprop-vps", "h265.sdp.sprop_vps",
4698
14
      FT_BYTES, BASE_NONE, NULL, 0x0,
4699
14
      NULL, HFILL }
4700
14
    },
4701
14
    { &hf_h265_sdp_parameter_sprop_sps,
4702
14
    { "sprop-sps", "h265.sdp.sprop_sps",
4703
14
      FT_BYTES, BASE_NONE, NULL, 0x0,
4704
14
      NULL, HFILL }
4705
14
    },
4706
14
    { &hf_h265_sdp_parameter_sprop_pps,
4707
14
    { "sprop-pps", "h265.sdp.sprop_pps",
4708
14
      FT_BYTES, BASE_NONE, NULL, 0x0,
4709
14
      NULL, HFILL }
4710
14
    },
4711
4712
14
    };
4713
4714
  /* Setup protocol subtree array */
4715
14
  static int *ett[] = {
4716
14
    &ett_h265,
4717
14
    &ett_h265_profile,
4718
14
    &ett_h265_nal,
4719
14
    &ett_h265_fu,
4720
14
    &ett_h265_stream,
4721
14
    &ett_h265_sps_multilayer_extension,
4722
14
    &ett_h265_sps_3d_extension,
4723
14
    &ett_h265_pps_multilayer_extension,
4724
14
    &ett_h265_pps_3d_extension,
4725
14
    &ett_h265_access_unit_delimiter_rbsp,
4726
14
    &ett_h265_sei_rbsp,
4727
14
    &ett_h265_filler_data_rbsp,
4728
14
    &ett_h265_end_of_seq_rbsp,
4729
14
    &ett_h265_end_of_bitstream_rbsp,
4730
14
    &ett_h265_profile_tier_level,
4731
14
    &ett_h265_ref_pic_set,
4732
14
    &ett_h265_vui_parameters,
4733
14
    &ett_h265_hrd_parameters,
4734
14
    &ett_h265_sprop_parameters
4735
14
  };
4736
4737
14
  static ei_register_info ei[] = {
4738
14
    { &ei_h265_undecoded,{ "h265.undecoded", PI_UNDECODED, PI_WARN, "[Not decoded yet]", EXPFILL } },
4739
14
    { &ei_h265_oversized_exp_golomb_code, {"h265.oversized_exp_golomb_code", PI_MALFORMED, PI_ERROR, "Exponential Golomb encoded value greater than 32 bit integer, clamped", EXPFILL } },
4740
14
    { &ei_h265_value_to_large,{ "h265.value_to_large", PI_PROTOCOL, PI_ERROR, "[Value to large, protocol violation]", EXPFILL } },
4741
14
    { &ei_h265_format_specific_parameter,{ "h265.format_specific_parameter", PI_UNDECODED, PI_WARN, "[Unspecified media format specific parameter]", EXPFILL } },
4742
14
  };
4743
4744
  /* Register the protocol name and description */
4745
14
  proto_h265 = proto_register_protocol("H.265", "H.265", "h265");
4746
4747
  /* Required function calls to register the header fields and subtrees used */
4748
14
  proto_register_field_array(proto_h265, hf, array_length(hf));
4749
14
  proto_register_subtree_array(ett, array_length(ett));
4750
14
  expert_h265 = expert_register_protocol(proto_h265);
4751
14
  expert_register_field_array(expert_h265, ei, array_length(ei));
4752
  /* Register a configuration option for port */
4753
4754
4755
14
  h265_module = prefs_register_protocol(proto_h265, NULL);
4756
4757
14
  prefs_register_obsolete_preference(h265_module, "dynamic.payload.type");
4758
4759
14
  h265_handle = register_dissector("h265", dissect_h265, proto_h265);
4760
14
  register_dissector_with_description("h265_bytestream", "H.265 Annex B Byte stream format", dissect_h265_bytestream, proto_h265);
4761
14
}
4762
4763
/* Register the protocol with Wireshark */
4764
void
4765
proto_reg_handoff_h265(void)
4766
14
{
4767
14
        dissector_add_string("rtp_dyn_payload_type", "H265", h265_handle);
4768
14
  dissector_add_uint_range_with_preference("rtp.pt", "", h265_handle);
4769
14
}
4770
4771
/*
4772
* Editor modelines  -  https://www.wireshark.org/tools/modelines.html
4773
*
4774
* Local variables:
4775
* c-basic-offset: 4
4776
* tab-width: 8
4777
* indent-tabs-mode: nil
4778
* End:
4779
*
4780
* vi: set shiftwidth=4 tabstop=8 expandtab:
4781
* :indentSize=4:tabSize=8:noTabs=true:
4782
*/