📄 umc_h264_dec.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.////*/#ifndef __UMC_H264_DEC_H__#define __UMC_H264_DEC_H__#include <stdlib.h>#include "umc_video_decoder.h"#include "umc_h264_dec_defs_dec.h"#include "umc_h264_dec_defs_yuv.h"#include "umc_h264_dec_tables.h"#include "umc_h264_bitstream.h"#include "umc_base_color_space_converter.h"//#define VM_DEBUG 7//#define USE_DETAILED_TIMINGnamespace UMC{// forward declaration of internal typesclass H264ThreadedDeblockingTools;class H264VideoDecoder : public VideoDecoder{public:// The H264DecoderFrame class represents a YUV work space which was obtained// by decoding a bitstream picture. class H264DecoderFrame : public H264DecYUVWorkSpace { H264DecoderFrame *m_pPreviousFrame; H264DecoderFrame *m_pFutureFrame; // These point to the previous and future reference frames // used to decode this frame. // These are also used to maintain a doubly-linked list of // reference frames in the H264DecoderFrameList class. So, these // may be non-NULL even if the current frame is an I frame, // for example. m_pPreviousFrame will always be valid when // decoding a P or B frame, and m_pFutureFrame will always // be valid when decoding a B frame. Ipp64f m_cumulativeTR; // This is the TR of the picture, relative to the very first // frame decoded after a call to Start_Sequence. The Ipp64f type // is used to avoid wrap around problems. bool m_isDisplayable; // When true indicates this decoded frame contains a decoded // frame ready for output. The frame should not be overwritten // until wasOutputted is also true. bool m_wasOutputted; // m_wasOutputted indicates whether this decoded frame has // already been sent for output to the calling application. // The frame might not be immediately displayed depending // on whether the application buffers up decoded frames. bool m_wasDisplayed; // m_wasDisplayed indicates whether this decoded frame has // already been displayed. bool m_lockedForDisplay; // m_lockedForDisplay indicates whether this decoded frame // is locked by the application for display purposes. // If it is, the decoder should not overwrite it until // unlocked.public: double m_dFrameTime; Ipp8u m_PictureStructureForRef; Ipp8u m_PictureStructureForDec;#ifdef USE_SEI Ipp8u m_PictureStructureFromSEI; Ipp8s m_RepeatCount;#endif Ipp32s totalMBs; // For type 1 calculation of m_PicOrderCnt. m_FrameNum is needed to // be used as previous frame num. Ipp32s m_PicNum[2]; Ipp32s m_LongTermPicNum[2]; Ipp32s m_FrameNum; Ipp32s m_FrameNumWrap; Ipp32s m_LongTermFrameIdx; Ipp32s m_RefPicListResetCount[2]; Ipp32s m_PicOrderCnt[2]; // Display order picture count mod MAX_PIC_ORDER_CNT. Ipp32s m_SliceType[2]; // Display order picture count mod MAX_PIC_ORDER_CNT. Ipp32s m_crop_left; Ipp32s m_crop_right; Ipp32s m_crop_top; Ipp32s m_crop_bottom; Ipp8s m_crop_flag; bool m_isShortTermRef[2]; bool m_isLongTermRef[2]; H264DecoderGlobalMacroblocksDescriptor m_mbinfo; //Global MB Data //Ipp32u m_FrameNum; // Decode order frame label, from slice header Ipp8u m_PQUANT; // Picture QP (from first slice header) Ipp8u m_PQUANT_S; // Picture QS (from first slice header) sDimensions m_dimensions; Ipp8u m_bottom_field_flag[2]; // The above variables are used for management of reference frames // on reference picture lists maintained in m_RefPicList. They are // updated as reference picture management information is decoded // from the bitstream. The picture and frame number variables determine // reference picture ordering on the lists. H264DecoderFrame(); virtual ~H264DecoderFrame(); virtual Status allocate(const sDimensions &lumaSize); // This allocate method first clears our state, and then // calls H264DecYUVWorkSpace::allocate. // An existing buffer, if any, is not reallocated if it // is already large enough. // The following methods provide access to the H264Decoder's doubly // linked list of H264DecoderFrames. Note that m_pPreviousFrame can // be non-NULL even for an I frame. H264DecoderFrame *previous() { return m_pPreviousFrame; } H264DecoderFrame *future() { return m_pFutureFrame; } void setPrevious(H264DecoderFrame *pPrev) { m_pPreviousFrame = pPrev; } void setFuture(H264DecoderFrame *pFut) { m_pFutureFrame = pFut; } Ipp64f cumulativeTR() { return m_cumulativeTR; } void setCumulativeTR(Ipp64f tr) { m_cumulativeTR = tr; } bool wasDisplayed() { return m_wasDisplayed; } void setWasDisplayed() { m_wasDisplayed = true; } //EnumPicCodType m_PicCodType; //sDimensions m_dimensions; bool isDisplayable() { return m_isDisplayable; } void SetisDisplayable() { m_isDisplayable = true; } void unSetisDisplayable() { m_isDisplayable = false; } bool wasOutputted() { return m_wasOutputted; } void setWasOutputted() { m_wasOutputted = true; } void unsetWasOutputted() { m_wasOutputted = false; } void LockForDisplay() { m_lockedForDisplay = true; } void unLockForDisplay() { m_lockedForDisplay = false; } bool isDisposable() { return (!m_isShortTermRef[0] && !m_isShortTermRef[1] && !m_isLongTermRef[0] && !m_isLongTermRef[0] && !m_lockedForDisplay && (m_wasOutputted || !m_isDisplayable)); } // A decoded frame can be "disposed" if it is not an active reference // and it is not locked by the calling application and it has been // output for display. Ipp32s PicNum(Ipp8u f,Ipp8u force=0) { if ((m_PictureStructureForRef>=FRM_STRUCTURE && force==0) || force==3) { return MIN(m_PicNum[0],m_PicNum[1]); } else if (force==2) { if (isShortTermRef(0) && isShortTermRef(1)) return MIN(m_PicNum[0],m_PicNum[1]); else if (isShortTermRef(0)) return m_PicNum[0]; else return m_PicNum[0]; } return m_PicNum[f]; } void setPicNum(Ipp32s PicNum,Ipp8u f) { if (m_PictureStructureForRef>=FRM_STRUCTURE) { m_PicNum[0] = m_PicNum[1]=PicNum; } else m_PicNum[f] = PicNum; } // Updates m_LongTermPicNum for if long term reference, based upon // m_LongTermFrameIdx. Ipp32s FrameNum() { return m_FrameNum; } void setFrameNum(Ipp32s FrameNum) { m_FrameNum = FrameNum; } Ipp32s FrameNumWrap() { return m_FrameNumWrap; } void setFrameNumWrap(Ipp32s FrameNumWrap) { m_FrameNumWrap = FrameNumWrap; }; void UpdateFrameNumWrap(Ipp32s CurrFrameNum, Ipp32s MaxFrameNum,Ipp8u CurrPicStruct); // Updates m_FrameNumWrap and m_PicNum if the frame is a short-term // reference and a frame number wrap has occurred. Ipp32s LongTermFrameIdx() { return m_LongTermFrameIdx; } void setLongTermFrameIdx(Ipp32s LongTermFrameIdx) { m_LongTermFrameIdx = LongTermFrameIdx; }; bool isShortTermRef(Ipp8s WhichField) { if (m_PictureStructureForRef>=FRM_STRUCTURE ) return m_isShortTermRef[0] && m_isShortTermRef[1]; else return m_isShortTermRef[WhichField]; }; Ipp8u isShortTermRef() { return m_isShortTermRef[0] + m_isShortTermRef[1]*2; }; void SetisShortTermRef(Ipp8s WhichField) { if (m_PictureStructureForRef>=FRM_STRUCTURE) m_isShortTermRef[0] = m_isShortTermRef[1] = true; else m_isShortTermRef[WhichField] = true; } Ipp32s PicOrderCnt(int index,Ipp8u force=0) { if ((m_PictureStructureForRef>=FRM_STRUCTURE && force==0) || force==3) { return MIN(m_PicOrderCnt[0],m_PicOrderCnt[1]); } else if (force==2) { if (isShortTermRef(0) && isShortTermRef(1)) return MIN(m_PicOrderCnt[0],m_PicOrderCnt[1]); else if (isShortTermRef(0)) return m_PicOrderCnt[0]; else return m_PicOrderCnt[1]; } return m_PicOrderCnt[index]; } Ipp32s DeblockPicID(int index) {#if 0 //the constants are subject to change
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -