📄 umc_mpeg4_pure_detect.h
字号:
/*////////////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright(c) 2003-2005 Intel Corporation. All Rights Reserved.//*/#include "ippdefs.h"#include "string.h"#include "ippvc.h"#include "vm_debug.h"#include "umc_structures.h"#ifndef __MPEG4_PURE_DETECT_H__#define __MPEG4_PURE_DETECT_H__using namespace UMC;class ParseHeader{public: virtual ~ParseHeader(){}; virtual Status Init (Ipp8u *pParam, int buflen) = 0; virtual void GetdecInfo (int& width, int& height);protected: Ipp32u NextBits (int n); void FlushBits (int n); Ipp32u GetBits (int n); struct { int picture_width; int picture_height; // bit stream Ipp8u* buffer; size_t buflen; Ipp8u* bufptr; int bitoff; } decInfo;};class ParseMP4Header : public ParseHeader{public: Status Init (Ipp8u *pParam, int buflen);protected: int GetMarkerBit (); Status Parse_VideoObjectLayer(); Ipp8u* FindStartCode (); Ipp8u* SeekStartCode ();};class ParseH261Header : public ParseHeader{public: Status Init (Ipp8u *pParam, int buflen);};class ParseH263Header : public ParseHeader{public: Status Init (Ipp8u *pParam, int buflen);};struct H264SPS{ Ipp8u profile_idc; // baseline, main, etc. Ipp8u level_idc; Ipp8u log2_max_frame_num; // Number of bits to hold the frame_num Ipp8u frame_mbs_only_flag; // Nonzero indicates all pictures in sequence Ipp8u gaps_in_frame_num_value_allowed_flag; Ipp8u seq_parameter_set_id; // id of this sequence parameter set Ipp8u pic_order_cnt_type; // Picture order counting method Ipp8u delta_pic_order_always_zero_flag; // If zero, delta_pic_order_cnt fields are // present in slice header. // are coded as frames (not fields). // at macroblock level Ipp32u log2_max_pic_order_cnt_lsb; // Value of MaxPicOrderCntLsb. Ipp32s offset_for_non_ref_pic; Ipp32s offset_for_top_to_bottom_field; // Expected pic order count difference from // top field to bottom field. Ipp32u num_ref_frames_in_pic_order_cnt_cycle; Ipp32s *poffset_for_ref_frame; // pointer to array of stored frame offsets, // length num_stored_frames_in_pic_order_cnt_cycle, // for pic order cnt type 1 Ipp32u num_ref_frames; // total number of pics in decoded pic buffer Ipp32u frame_width_in_mbs; Ipp32u frame_height_in_mbs; Ipp32u frame_cropping_rect_left_offset; Ipp32u frame_cropping_rect_right_offset; Ipp32u frame_cropping_rect_top_offset; Ipp32u frame_cropping_rect_bottom_offset;};struct H264PPS{ Ipp8u pic_parameter_set_id; Ipp8u seq_parameter_set_id; Ipp8u pic_order_present_flag; Ipp8u entropy_coding_mode;};struct H264SH{ Ipp8u pic_parameter_set_id; Ipp8u field_pic_flag; Ipp8u bottom_field_flag; Ipp32u first_mb_in_slice; Ipp32u frame_num; int slice_type; Ipp32u pic_order_cnt_lsb; Ipp32s delta_pic_order_cnt_bottom; Ipp32s delta_pic_order_cnt[2]; // picture order count differences double m_dTimeStamp; Ipp8u nal_ref_idc; Ipp8u idr_flag; Ipp32u idr_pic_id; // ID of an IDR picture};#define _h264splGetBits(current_data, offset, nbits, data) \{ \ Ipp32u x; \ \ VM_ASSERT((nbits) > 0 && (nbits) <= 32); \ VM_ASSERT(offset >= 0 && offset <= 31); \ \/* removeSCEBP(current_data, offset);*/ \ \ offset -= (nbits); \ \ if(offset >= 0) \ { \ x = current_data[0] >> (offset + 1); \ } \ else \ { \ offset += 32; \ \ x = current_data[1] >> (offset); \ x >>= 1; \ x += current_data[0] << (31 - offset); \ current_data++; \ } \ \ VM_ASSERT(offset >= 0 && offset <= 31); \ \ (data) = x & (((Ipp32u)0x01 << (nbits)) - 1); \}#define ippiGetBits1( current_data, offset, data) \ _h264splGetBits(current_data, offset, 1, data);\#define ippiGetNBits( current_data, offset, nbits, data) \ _h264splGetBits(current_data, offset, nbits, data);\__inlineIpp32s GetVLCElement(Ipp32u** m_pbs, Ipp32s* m_bitOffset, bool bIsSigned){ Ipp16s sval = 0; ippiDecodeExpGolombOne_H264_1u16s(m_pbs, m_bitOffset, &sval, bIsSigned); return sval;}__inlineIpp32u GetBits(Ipp32u** m_pbs, Ipp32s* m_bitOffset, const Ipp32u nbits){ Ipp32u w,n = nbits; ippiGetNBits((*m_pbs), (*m_bitOffset), n, w); return(w);}__inlineIpp32u Get1Bit(Ipp32u** m_pbs, Ipp32s* m_bitOffset){ Ipp32u w; ippiGetBits1((*m_pbs), (*m_bitOffset), w); return(w);}class H264Headers{#define MAX_NUM_PARSETS 32 public: H264Headers() { memset(m_SPS, 0, MAX_NUM_PARSETS*sizeof(H264SPS)); memset(m_PPS, 0, MAX_NUM_PARSETS*sizeof(H264PPS)); memset(m_SH , 0, MAX_NUM_PARSETS*sizeof(H264SH)); m_uiSPSCount = 0; m_uiPPSCount = 0; m_uiSHCount = 0; m_nPicComplete = 0; m_iLastFrameNum= -1; m_uiFieldIndex = 0; m_uiValidSPSIndex=0; m_bBrokenHeader = false; m_puiBrokenHeaderSize = 0; }; virtual ~H264Headers(){};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -