本文整理汇总了C++中BitArray::ReadExpGolomb方法的典型用法代码示例。如果您正苦于以下问题:C++ BitArray::ReadExpGolomb方法的具体用法?C++ BitArray::ReadExpGolomb怎么用?C++ BitArray::ReadExpGolomb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitArray
的用法示例。
在下文中一共展示了BitArray::ReadExpGolomb方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadSPSVUIHRD
bool ReadSPSVUIHRD(BitArray &ba, Variant &v) {
//E.1.2 HRD parameters syntax
//14496-10.pdf 268/280
READ_EG("cpb_cnt_minus1", uint64_t);
READ_INT("bit_rate_scale", uint8_t, 4);
READ_INT("cpb_size_scale", uint8_t, 4);
for (uint64_t i = 0; i <= (uint64_t) v["cpb_cnt_minus1"]; i++) {
uint64_t val = 0;
if (!ba.ReadExpGolomb(val)) {
FATAL("Unable to read bit_rate_value_minus1 value");
return false;
}
v["bit_rate_value_minus1"].PushToArray(val);
if (!ba.ReadExpGolomb(val)) {
FATAL("Unable to read cpb_size_value_minus1 value");
return false;
}
v["cpb_size_value_minus1"].PushToArray(val);
CHECK_BA_LIMITS("cbr_flag", 1);
v["cbr_flag"].PushToArray((bool)ba.ReadBits<bool>(1));
}
READ_INT("initial_cpb_removal_delay_length_minus1", uint8_t, 5);
READ_INT("cpb_removal_delay_length_minus1", uint8_t, 5);
READ_INT("dpb_output_delay_length_minus1", uint8_t, 5);
READ_INT("time_offset_length", uint8_t, 5);
return true;
}
示例2: scaling_list
bool scaling_list(BitArray &ba, uint8_t sizeOfScalingList) {
uint32_t nextScale = 8;
uint32_t lastScale = 8;
uint64_t delta_scale = 0;
for (uint8_t j = 0; j < sizeOfScalingList; j++) {
if (nextScale != 0) {
if (!ba.ReadExpGolomb(delta_scale))
return false;
nextScale = (lastScale + delta_scale + 256) % 256;
}
lastScale = (nextScale == 0) ? lastScale : nextScale;
}
return true;
}
示例3: ReadPPS
bool ReadPPS(BitArray &ba, Variant &v) {
//7.3.2.2 Picture parameter set RBSP syntax
//14496-10.pdf 44/280
READ_EG("pic_parameter_set_id", uint64_t);
READ_EG("seq_parameter_set_id", uint64_t);
READ_BOOL("entropy_coding_mode_flag");
READ_BOOL("pic_order_present_flag");
READ_EG("num_slice_groups_minus1", int64_t);
if ((int64_t) v["num_slice_groups_minus1"] > 0) {
READ_EG("slice_group_map_type", uint64_t);
if ((int64_t) v["slice_group_map_type"] == 0) {
for (int64_t i = 0; i < (int64_t) v["num_slice_groups_minus1"]; i++) {
uint64_t val = 0;
if (!ba.ReadExpGolomb(val)) {
FATAL("Unable to read run_length_minus1 value");
return false;
}
v["run_length_minus1"].PushToArray(val);
}
} else if ((int64_t) v["slice_group_map_type"] == 2) {
for (int64_t i = 0; i < (int64_t) v["num_slice_groups_minus1"]; i++) {
uint64_t val = 0;
if (!ba.ReadExpGolomb(val)) {
FATAL("Unable to read top_left value");
return false;
}
v["top_left"].PushToArray(val);
if (!ba.ReadExpGolomb(val)) {
FATAL("Unable to read bottom_right value");
return false;
}
v["bottom_right"].PushToArray(val);
}
} else if (((int64_t) v["slice_group_map_type"] == 3)
|| ((int64_t) v["slice_group_map_type"] == 4)
|| ((int64_t) v["slice_group_map_type"] == 5)) {
READ_BOOL("slice_group_change_direction_flag");
READ_EG("slice_group_change_rate_minus1", uint64_t);
} else if ((int64_t) v["slice_group_map_type"] == 6) {
READ_EG("pic_size_in_map_units_minus1", uint64_t);
for (uint64_t i = 0; i <= (uint64_t) v["pic_size_in_map_units_minus1"]; i++) {
uint64_t val = 0;
if (!ba.ReadExpGolomb(val)) {
FATAL("Unable to read slice_group_id value");
return false;
}
v["slice_group_id"].PushToArray((int64_t) val);
}
}
}
READ_EG("num_ref_idx_l0_active_minus1", uint64_t);
READ_EG("num_ref_idx_l1_active_minus1", uint64_t);
READ_BOOL("weighted_pred_flag");
READ_INT("weighted_bipred_idc", uint8_t, 2);
READ_EG("pic_init_qp_minus26", int64_t);
READ_EG("pic_init_qs_minus26", int64_t);
READ_EG("chroma_qp_index_offset", int64_t);
READ_BOOL("deblocking_filter_control_present_flag");
READ_BOOL("constrained_intra_pred_flag");
READ_BOOL("redundant_pic_cnt_present_flag");
return true;
}
示例4: ReadSPS
bool ReadSPS(BitArray &ba, Variant &v) {
//7.3.2.1 Sequence parameter set RBSP syntax
//14496-10.pdf 43/280
READ_INT("profile_idc", uint8_t, 8);
READ_BOOL("constraint_set0_flag");
READ_BOOL("constraint_set1_flag");
READ_BOOL("constraint_set2_flag");
READ_INT("reserved_zero_5bits", uint8_t, 5);
READ_INT("level_idc", uint8_t, 8);
READ_EG("seq_parameter_set_id", uint64_t);
if ((uint64_t) v["profile_idc"] >= 100) {
READ_EG("chroma_format_idc", uint64_t);
if ((uint64_t) v["chroma_format_idc"] == 3)
READ_BOOL("residual_colour_transform_flag");
READ_EG("bit_depth_luma_minus8", uint64_t);
READ_EG("bit_depth_chroma_minus8", uint64_t);
READ_BOOL("qpprime_y_zero_transform_bypass_flag");
READ_BOOL("seq_scaling_matrix_present_flag");
if ((bool)v["seq_scaling_matrix_present_flag"]) {
for (uint8_t i = 0; i < 8; i++) {
uint8_t flag = 0;
CHECK_BA_LIMITS("seq_scaling_list_present_flag", 1);
flag = ba.ReadBits<uint8_t > (1);
if (flag) {
if (i < 6) {
if (!scaling_list(ba, 16)) {
FATAL("scaling_list failed");
return false;
}
} else {
if (!scaling_list(ba, 64)) {
FATAL("scaling_list failed");
return false;
}
}
}
}
}
}
READ_EG("log2_max_frame_num_minus4", uint64_t);
READ_EG("pic_order_cnt_type", uint64_t);
if ((uint64_t) v["pic_order_cnt_type"] == 0) {
READ_EG("log2_max_pic_order_cnt_lsb_minus4", uint64_t);
} else if ((uint64_t) v["pic_order_cnt_type"] == 1) {
READ_BOOL("delta_pic_order_always_zero_flag");
READ_EG("offset_for_non_ref_pic", int64_t);
READ_EG("offset_for_top_to_bottom_field", int64_t);
READ_EG("num_ref_frames_in_pic_order_cnt_cycle", uint64_t);
for (uint64_t i = 0; i < (uint64_t) v["num_ref_frames_in_pic_order_cnt_cycle"]; i++) {
uint64_t val = 0;
if (!ba.ReadExpGolomb(val)) {
FATAL("Unable to read offset_for_ref_frame value");
return false;
}
v["offset_for_ref_frame"].PushToArray((int64_t) val);
}
}
READ_EG("num_ref_frames", uint64_t);
READ_BOOL("gaps_in_frame_num_value_allowed_flag");
READ_EG("pic_width_in_mbs_minus1", uint64_t);
READ_EG("pic_height_in_map_units_minus1", uint64_t);
READ_BOOL("frame_mbs_only_flag");
if (!((bool)v["frame_mbs_only_flag"]))
READ_BOOL("mb_adaptive_frame_field_flag");
READ_BOOL("direct_8x8_inference_flag");
READ_BOOL("frame_cropping_flag");
if ((bool)v["frame_cropping_flag"]) {
READ_EG("frame_crop_left_offset", uint64_t);
READ_EG("frame_crop_right_offset", uint64_t);
READ_EG("frame_crop_top_offset", uint64_t);
READ_EG("frame_crop_bottom_offset", uint64_t);
}
READ_BOOL("vui_parameters_present_flag");
if ((bool)v["vui_parameters_present_flag"]) {
if (!ReadSPSVUI(ba, v["vui_parameters"])) {
FATAL("Unable to read VUI");
return false;
}
}
return true;
}