Coverage Report

Created: 2026-01-02 06:13

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