本文整理汇总了C++中CGolombBuffer::UExpGolombRead方法的典型用法代码示例。如果您正苦于以下问题:C++ CGolombBuffer::UExpGolombRead方法的具体用法?C++ CGolombBuffer::UExpGolombRead怎么用?C++ CGolombBuffer::UExpGolombRead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGolombBuffer
的用法示例。
在下文中一共展示了CGolombBuffer::UExpGolombRead方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HrdParameters
int HrdParameters(CGolombBuffer& gb)
{
UINT64 cnt = gb.UExpGolombRead(); // cpb_cnt_minus1
if (cnt > 32U) {
return -1;
}
gb.BitRead(4); // bit_rate_scale
gb.BitRead(4); // cpb_size_scale
for (unsigned int i = 0; i <= cnt; i++ ) {
gb.UExpGolombRead(); // bit_rate_value_minus1
gb.UExpGolombRead(); // cpb_size_value_minus1
gb.BitRead(1); // cbr_flag
}
gb.BitRead(5); // initial_cpb_removal_delay_length_minus1
gb.BitRead(5); // cpb_removal_delay_length_minus1
gb.BitRead(5); // dpb_output_delay_length_minus1
gb.BitRead(5); // time_offset_length
return 0;
}
示例2: ParseAVCHeader
bool ParseAVCHeader(CGolombBuffer gb, avc_hdr& h, bool fullscan)
{
static BYTE profiles[] = {44, 66, 77, 88, 100, 110, 118, 122, 128, 144, 244};
static BYTE levels[] = {10, 11, 12, 13, 20, 21, 22, 30, 31, 32, 40, 41, 42, 50, 51, 52};
memset((void*)&h, 0, sizeof(h));
h.profile = (BYTE)gb.BitRead(8);
if (!MatchValue(profiles, _countof(profiles), h.profile)) {
return false;
}
gb.BitRead(8);
h.level = (BYTE)gb.BitRead(8);
if (!MatchValue(levels, _countof(levels), h.level)) {
return false;
}
UINT64 sps_id = gb.UExpGolombRead(); // seq_parameter_set_id
if (sps_id >= 32) {
return false;
}
UINT64 chroma_format_idc = 0;
if (h.profile >= 100) { // high profile
chroma_format_idc = gb.UExpGolombRead();
if (chroma_format_idc == 3) { // chroma_format_idc
gb.BitRead(1); // residue_transform_flag
}
gb.UExpGolombRead(); // bit_depth_luma_minus8
gb.UExpGolombRead(); // bit_depth_chroma_minus8
gb.BitRead(1); // qpprime_y_zero_transform_bypass_flag
if (gb.BitRead(1)) { // seq_scaling_matrix_present_flag
for (int i = 0; i < 8; i++) {
if (gb.BitRead(1)) { // seq_scaling_list_present_flag
for (int j = 0, size = i < 6 ? 16 : 64, next = 8; j < size && next != 0; ++j) {
next = (next + gb.SExpGolombRead() + 256) & 255;
}
}
}
}
}
gb.UExpGolombRead(); // log2_max_frame_num_minus4
UINT64 pic_order_cnt_type = gb.UExpGolombRead();
if (pic_order_cnt_type == 0) {
gb.UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
} else if (pic_order_cnt_type == 1) {
gb.BitRead(1); // delta_pic_order_always_zero_flag
gb.SExpGolombRead(); // offset_for_non_ref_pic
gb.SExpGolombRead(); // offset_for_top_to_bottom_field
UINT64 num_ref_frames_in_pic_order_cnt_cycle = gb.UExpGolombRead();
if (num_ref_frames_in_pic_order_cnt_cycle >= 256) {
return false;
}
for (int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
gb.SExpGolombRead(); // offset_for_ref_frame[i]
}
} else if (pic_order_cnt_type != 2) {
return false;
}
UINT64 ref_frame_count = gb.UExpGolombRead(); // num_ref_frames
if (ref_frame_count > 30) {
return false;
}
gb.BitRead(1); // gaps_in_frame_num_value_allowed_flag
UINT64 pic_width_in_mbs_minus1 = gb.UExpGolombRead();
UINT64 pic_height_in_map_units_minus1 = gb.UExpGolombRead();
h.interlaced = !(BYTE)gb.BitRead(1);
if (h.interlaced) {
gb.BitRead(1); // mb_adaptive_frame_field_flag
}
BYTE direct_8x8_inference_flag = (BYTE)gb.BitRead(1); // direct_8x8_inference_flag
if (h.interlaced && !direct_8x8_inference_flag) {
return false;
}
if (gb.BitRead(1)) { // frame_cropping_flag
h.crop_left = (unsigned int)gb.UExpGolombRead(); // frame_cropping_rect_left_offset
h.crop_right = (unsigned int)gb.UExpGolombRead(); // frame_cropping_rect_right_offset
h.crop_top = (unsigned int)gb.UExpGolombRead(); // frame_cropping_rect_top_offset
h.crop_bottom = (unsigned int)gb.UExpGolombRead(); // frame_cropping_rect_bottom_offset
}
if (gb.BitRead(1)) { // vui_parameters_present_flag
if (gb.BitRead(1)) { // aspect_ratio_info_present_flag
BYTE aspect_ratio_idc = (BYTE)gb.BitRead(8); // aspect_ratio_idc
if (255 == aspect_ratio_idc) {
h.sar.num = (WORD)gb.BitRead(16); // sar_width
h.sar.den = (WORD)gb.BitRead(16); // sar_height
} else if (aspect_ratio_idc < 17) {
//.........这里部分代码省略.........