📄 umc_mpeg4_pure_detect.h
字号:
H264SPS m_SPS[MAX_NUM_PARSETS]; unsigned int m_uiSPSCount; H264PPS m_PPS[MAX_NUM_PARSETS]; unsigned int m_uiPPSCount; H264SH m_SH[MAX_NUM_PARSETS]; unsigned int m_uiSHCount; int m_nPicComplete; int m_iLastFrameNum; int m_uiFieldIndex; int m_uiValidSPSIndex; bool m_bBrokenHeader; int m_puiBrokenHeaderSize; #define MINIMUM_H_SIZE 8 unsigned char m_pubBrokenHeader[MINIMUM_H_SIZE]; unsigned int m_uiSavedIndex; unsigned int m_uiStartCodeOff; unsigned int m_uiStartCodePos; unsigned int uiStartCodeMax; int IsCompletePicture() { return m_nPicComplete; }};__inlineint GetSequenceParamSet(Ipp32u** m_pbs, Ipp32s* m_bitOffset, H264Headers *head){ Ipp8u profile_idc; Ipp8u level_idc; Ipp8u seq_parameter_set_id; //memset(sps, 0, sizeof (H264SPS)); profile_idc = (Ipp8u)GetBits(m_pbs, m_bitOffset, 8); GetBits(m_pbs, m_bitOffset, 8); level_idc = (Ipp8u)GetBits(m_pbs, m_bitOffset, 8); seq_parameter_set_id = (Ipp8u)GetVLCElement(m_pbs, m_bitOffset, false); VM_ASSERT(seq_parameter_set_id < MAX_NUM_PARSETS); H264SPS *sps = &head->m_SPS[seq_parameter_set_id]; sps->profile_idc = profile_idc; sps->level_idc = level_idc; sps->seq_parameter_set_id = seq_parameter_set_id; if((sps->profile_idc==100) || (sps->profile_idc==110) || (sps->profile_idc==122) || (sps->profile_idc==144)) { if (GetVLCElement(m_pbs, m_bitOffset,false)==3)//chroma_format_idc Get1Bit(m_pbs, m_bitOffset);//residue_transform_flag GetVLCElement(m_pbs, m_bitOffset,false);//bit_depth_luma GetVLCElement(m_pbs, m_bitOffset,false);//bit_depth_chroma Get1Bit(m_pbs, m_bitOffset);//qpprime_y_zero_transform_bypass_flag if(Get1Bit(m_pbs, m_bitOffset))//seq_scaling_matrix_present_flag { int i; for (i=0;i<8;i++) { if (Get1Bit(m_pbs, m_bitOffset))//presented_flag[i] { // pass scaling_lists Ipp32u lastScale = 8; Ipp32u nextScale = 8; int maxnum = i<6?16:64; for( int j = 0; j < maxnum; j++ ) { if( nextScale != 0 ) { Ipp32s delta_scale = GetVLCElement(m_pbs, m_bitOffset,true); nextScale = ( lastScale + delta_scale + 256 ) & 0xff; } lastScale = ( nextScale == 0 ) ? lastScale : nextScale;; } } } } } // log2 max frame num (bitstream contains value - 4) sps->log2_max_frame_num = (Ipp8u)(GetVLCElement(m_pbs, m_bitOffset, false) + 4); // pic order cnt type (0..2) sps->pic_order_cnt_type = (Ipp8u)GetVLCElement(m_pbs, m_bitOffset, false); if (sps->pic_order_cnt_type == 0) { sps->log2_max_pic_order_cnt_lsb = (Ipp8u)GetVLCElement(m_pbs, m_bitOffset, false) + 4; } else if (sps->pic_order_cnt_type == 1) { sps->delta_pic_order_always_zero_flag = (Ipp8u)Get1Bit(m_pbs, m_bitOffset); sps->offset_for_non_ref_pic = GetVLCElement(m_pbs, m_bitOffset, true); sps->offset_for_top_to_bottom_field = GetVLCElement(m_pbs, m_bitOffset, true); sps->num_ref_frames_in_pic_order_cnt_cycle = GetVLCElement(m_pbs, m_bitOffset, false); // get offsets for (Ipp32u i=0; i<sps->num_ref_frames_in_pic_order_cnt_cycle; i++) { GetVLCElement(m_pbs, m_bitOffset, true); } } // pic order count type 1 // num ref frames sps->num_ref_frames = GetVLCElement(m_pbs, m_bitOffset, false); sps->gaps_in_frame_num_value_allowed_flag = (Ipp8u)Get1Bit(m_pbs, m_bitOffset); // picture width in MBs (bitstream contains value - 1) sps->frame_width_in_mbs = GetVLCElement(m_pbs, m_bitOffset, false) + 1; // picture height in MBs (bitstream contains value - 1) sps->frame_height_in_mbs = GetVLCElement(m_pbs, m_bitOffset, false) + 1; sps->frame_mbs_only_flag = (Ipp8u)Get1Bit(m_pbs, m_bitOffset); if (sps->frame_mbs_only_flag == 0) { Get1Bit(m_pbs, m_bitOffset);//mb_adaptive_frame_field_flag } Get1Bit(m_pbs, m_bitOffset);//direct_8x8_inference_flag if (Get1Bit(m_pbs, m_bitOffset))//frame_cropping_flag { sps->frame_cropping_rect_left_offset = GetVLCElement(m_pbs, m_bitOffset,false); sps->frame_cropping_rect_right_offset = GetVLCElement(m_pbs, m_bitOffset,false); sps->frame_cropping_rect_top_offset = GetVLCElement(m_pbs, m_bitOffset,false); sps->frame_cropping_rect_bottom_offset = GetVLCElement(m_pbs, m_bitOffset,false); } return seq_parameter_set_id;}__inlinevoid GetPictureParamSet(Ipp32u** m_pbs, Ipp32s* m_bitOffset,H264Headers *head){ Ipp8u pic_parameter_set_id; //memset(pps, 0, sizeof (H264PPS)); pic_parameter_set_id = (Ipp8u)GetVLCElement(m_pbs, m_bitOffset, false); VM_ASSERT(pic_parameter_set_id < MAX_NUM_PARSETS); H264PPS *pps = &head->m_PPS[pic_parameter_set_id]; pps->pic_parameter_set_id = pic_parameter_set_id; pps->seq_parameter_set_id = (Ipp8u)GetVLCElement(m_pbs, m_bitOffset, false); pps->entropy_coding_mode = (Ipp8u)Get1Bit(m_pbs, m_bitOffset); pps->pic_order_present_flag = (Ipp8u)Get1Bit(m_pbs, m_bitOffset);}__inlinevoid GetSliceHeader(Ipp32u** m_pbs, Ipp32s* m_bitOffset, H264Headers *head,Ipp8u idr_flag,Ipp8u nal_ref_idc){ int byte_count = (int)(*m_pbs); Ipp32u val; H264SH *hdr = &head->m_SH[head->m_uiSHCount]; VM_ASSERT(head->m_uiSHCount <= MAX_NUM_PARSETS); hdr->first_mb_in_slice = GetVLCElement(m_pbs, m_bitOffset, false); // slice type val = GetVLCElement(m_pbs, m_bitOffset, false); hdr->slice_type = val; hdr->pic_parameter_set_id = (Ipp8u)GetVLCElement(m_pbs, m_bitOffset, false); VM_ASSERT(hdr->pic_parameter_set_id < MAX_NUM_PARSETS); H264PPS *pps = &head->m_PPS[hdr->pic_parameter_set_id]; H264SPS *sps = &head->m_SPS[pps->seq_parameter_set_id]; hdr->frame_num = GetBits(m_pbs, m_bitOffset, sps->log2_max_frame_num); if (sps->frame_mbs_only_flag == 0) { hdr->field_pic_flag = (Ipp8u)Get1Bit(m_pbs, m_bitOffset); if (hdr->field_pic_flag != 0) { hdr->bottom_field_flag = (Ipp8u)Get1Bit(m_pbs, m_bitOffset); } } hdr->nal_ref_idc = nal_ref_idc; hdr->idr_flag = idr_flag; if (idr_flag) hdr->idr_pic_id = GetVLCElement(m_pbs, m_bitOffset, false); if (sps->pic_order_cnt_type == 0) { hdr->pic_order_cnt_lsb = GetBits(m_pbs, m_bitOffset,sps->log2_max_pic_order_cnt_lsb); if (pps->pic_order_present_flag && (!hdr->field_pic_flag)) hdr->delta_pic_order_cnt_bottom = GetVLCElement(m_pbs, m_bitOffset, true); } if ((sps->pic_order_cnt_type == 1) && (sps->delta_pic_order_always_zero_flag == 0)) { hdr->delta_pic_order_cnt[0] = GetVLCElement(m_pbs, m_bitOffset, true); if (pps->pic_order_present_flag && (!hdr->field_pic_flag)) hdr->delta_pic_order_cnt[1] = GetVLCElement(m_pbs, m_bitOffset, true); } byte_count = (int)(*m_pbs) - byte_count; byte_count += (4 - ((*m_bitOffset)+1)/8); head->m_uiSHCount++;}#endif // __MPEG4_PURE_DETECT_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -