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