static void hevc_parse_hrd_parameters(GF_BitStream *bs, Bool commonInfPresentFlag, int maxNumSubLayersMinus1)
{
	int i;
	Bool nal_hrd_parameters_present_flag = GF_FALSE;
	Bool vcl_hrd_parameters_present_flag = GF_FALSE;
	Bool sub_pic_hrd_params_present_flag = GF_FALSE;
	if (commonInfPresentFlag) {
		nal_hrd_parameters_present_flag = gf_bs_read_int(bs, 1);
		vcl_hrd_parameters_present_flag = gf_bs_read_int(bs, 1);
		if (nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag) {
			sub_pic_hrd_params_present_flag = gf_bs_read_int(bs, 1);
			if (sub_pic_hrd_params_present_flag) {
				/*tick_divisor_minus2 = */gf_bs_read_int(bs, 8);
				/*du_cpb_removal_delay_increment_length_minus1 = */gf_bs_read_int(bs, 5);
				/*sub_pic_cpb_params_in_pic_timing_sei_flag = */gf_bs_read_int(bs, 1);
				/*dpb_output_delay_du_length_minus1 = */gf_bs_read_int(bs, 5);
			}
			/*bit_rate_scale = */gf_bs_read_int(bs, 4);
			/*cpb_size_scale = */gf_bs_read_int(bs, 4);
			if (sub_pic_hrd_params_present_flag) {
				/*cpb_size_du_scale = */gf_bs_read_int(bs, 4);
			}
			/*initial_cpb_removal_delay_length_minus1 = */gf_bs_read_int(bs, 5);
			/*au_cpb_removal_delay_length_minus1 = */gf_bs_read_int(bs, 5);
			/*dpb_output_delay_length_minus1 = */gf_bs_read_int(bs, 5);
		}
	}
	for (i = 0; i <= maxNumSubLayersMinus1; i++) {
		Bool fixed_pic_rate_general_flag_i = gf_bs_read_int(bs, 1);
		Bool fixed_pic_rate_within_cvs_flag_i = GF_TRUE;
		Bool low_delay_hrd_flag_i = GF_FALSE;
		u32 cpb_cnt_minus1_i = 0;
		if (!fixed_pic_rate_general_flag_i) {
			fixed_pic_rate_within_cvs_flag_i = gf_bs_read_int(bs, 1);
		}
		if (fixed_pic_rate_within_cvs_flag_i)
			/*elemental_duration_in_tc_minus1[i] = */bs_get_ue(bs);
		else
			low_delay_hrd_flag_i = gf_bs_read_int(bs, 1);
		if (!low_delay_hrd_flag_i) {
			cpb_cnt_minus1_i = bs_get_ue(bs);
		}
		if (nal_hrd_parameters_present_flag) {
			sub_layer_hrd_parameters(bs, i, cpb_cnt_minus1_i, sub_pic_hrd_params_present_flag);
		}
		if (vcl_hrd_parameters_present_flag) {
			sub_layer_hrd_parameters(bs, i, cpb_cnt_minus1_i, sub_pic_hrd_params_present_flag);
		}
	}
}
static void hevc_parse_hrd_parameters(GF_BitStream *bs, Bool commonInfPresentFlag, int maxNumSubLayersMinus1)
{
	int i;
	Bool nal_hrd_parameters_present_flag = GF_FALSE;
	Bool vcl_hrd_parameters_present_flag = GF_FALSE;
	Bool sub_pic_hrd_params_present_flag = GF_FALSE;
	if (commonInfPresentFlag) {
		nal_hrd_parameters_present_flag = gf_bs_read_int(bs, 1);
		vcl_hrd_parameters_present_flag = gf_bs_read_int(bs, 1);
		if (nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag) {
			sub_pic_hrd_params_present_flag = gf_bs_read_int(bs, 1);
			if (sub_pic_hrd_params_present_flag) {
				 gf_bs_read_int(bs, 8);
				 gf_bs_read_int(bs, 5);
				 gf_bs_read_int(bs, 1);
				 gf_bs_read_int(bs, 5);
			}
			 gf_bs_read_int(bs, 4);
			 gf_bs_read_int(bs, 4);
			if (sub_pic_hrd_params_present_flag) {
				 gf_bs_read_int(bs, 4);
			}
			 gf_bs_read_int(bs, 5);
			 gf_bs_read_int(bs, 5);
			 gf_bs_read_int(bs, 5);
		}
	}
	for (i = 0; i <= maxNumSubLayersMinus1; i++) {
		Bool fixed_pic_rate_general_flag_i = gf_bs_read_int(bs, 1);
		Bool fixed_pic_rate_within_cvs_flag_i = GF_TRUE;
		Bool low_delay_hrd_flag_i = GF_FALSE;
		u32 cpb_cnt_minus1_i = 0;
		if (!fixed_pic_rate_general_flag_i) {
			fixed_pic_rate_within_cvs_flag_i = gf_bs_read_int(bs, 1);
		}
		if (fixed_pic_rate_within_cvs_flag_i)
			 bs_get_ue(bs);
		else
			low_delay_hrd_flag_i = gf_bs_read_int(bs, 1);
		if (!low_delay_hrd_flag_i) {
			cpb_cnt_minus1_i = bs_get_ue(bs);
		}
		if (nal_hrd_parameters_present_flag) {
			sub_layer_hrd_parameters(bs, i, cpb_cnt_minus1_i, sub_pic_hrd_params_present_flag);
		}
		if (vcl_hrd_parameters_present_flag) {
			sub_layer_hrd_parameters(bs, i, cpb_cnt_minus1_i, sub_pic_hrd_params_present_flag);
		}
	}
}