📄 umc_h264_enc_cpb.h
字号:
// 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 return PicOrderCnt(index,force)*2+FrameNumWrap()*534+FrameNum()*878+PicNum(index,force)*14 +RefPicListResetCount(index,force);#else Ipp32s ret = static_cast <Ipp32s>((size_t)this); return ret+index;#endif } void setPicOrderCnt(Ipp32s PicOrderCnt, int index) {m_PicOrderCnt[index] = PicOrderCnt;}; bool isLongTermRef(Ipp8s WhichField) { if (m_PictureStructureForRef>=FRM_STRUCTURE) return m_isLongTermRef[0] && m_isLongTermRef[1]; else return m_isLongTermRef[WhichField]; }; Ipp8u isLongTermRef() { return m_isLongTermRef[0] + m_isLongTermRef[1]*2; }; void SetisLongTermRef(Ipp8s WhichField) { if (m_PictureStructureForRef>=FRM_STRUCTURE) m_isLongTermRef[0] = m_isLongTermRef[1] = true; else m_isLongTermRef[WhichField] = true; } void unSetisShortTermRef(Ipp8u WhichField) { if (m_PictureStructureForRef>=FRM_STRUCTURE) { m_isShortTermRef[0] = m_isShortTermRef[1] = false; } else m_isShortTermRef[WhichField] = false; } void unSetisLongTermRef(Ipp8u WhichField) { if (m_PictureStructureForRef>=FRM_STRUCTURE) { m_isLongTermRef[0] = m_isLongTermRef[1] = false; } else m_isLongTermRef[WhichField] = false; } Ipp32s LongTermPicNum(Ipp8u f,Ipp8u force=0) { if ((m_PictureStructureForRef>=FRM_STRUCTURE && force==0) || force==3) { return MIN(m_LongTermPicNum[0],m_LongTermPicNum[1]); } else if (force==2) { if (isLongTermRef(0) && isLongTermRef(1)) return MIN(m_LongTermPicNum[0],m_LongTermPicNum[1]); else if (isShortTermRef(0)) return m_LongTermPicNum[0]; else return m_LongTermPicNum[0]; } return m_LongTermPicNum[f]; } void setLongTermPicNum(Ipp32s LongTermPicNum,Ipp8u f) {m_LongTermPicNum[f] = LongTermPicNum;} void UpdateLongTermPicNum(Ipp8u CurrPicStruct); void IncreaseRefPicListResetCount(Ipp8u f) { /*if (m_PictureStructureForRef>=FRM_STRUCTURE) { m_RefPicListResetCount[0]++; m_RefPicListResetCount[1]++; } else*/ m_RefPicListResetCount[f]++; } void InitRefPicListResetCount(Ipp8u f) { if (m_PictureStructureForRef>=FRM_STRUCTURE) m_RefPicListResetCount[0]=m_RefPicListResetCount[1]=0; else m_RefPicListResetCount[f]=0; } Ipp32s RefPicListResetCount(Ipp8u f,Ipp8u force=0) { if ((m_PictureStructureForRef>=FRM_STRUCTURE && force==0)|| force==3) return MAX(m_RefPicListResetCount[0],m_RefPicListResetCount[1]); else return m_RefPicListResetCount[f]; } Ipp8s GetNumberByParity(Ipp8s parity) { if (parity==-1) return -1; if (m_bottom_field_flag[0]==parity) return 0; if (m_bottom_field_flag[1]==parity) return 1; VM_ASSERT(m_PictureStructureForRef>=FRM_STRUCTURE); return 0; } bool m_bIsIDRPic; // Read from slice NAL unit of current picture. True indicates the // picture contains only I or SI slice types. Ipp16u m_num_slice_start; //start slice index of 2nd field // Buffer (within m_pParsedFrameData) used to store information for // each MB in the bitstream. // Struct containing list 0 and list 1 reference picture lists for one slice. // Length is plus 1 to provide for null termination. struct EncoderRefPicListStruct { H264EncoderFrame *m_RefPicList[MAX_NUM_REF_FRAMES+1]; Ipp8s m_Prediction[MAX_NUM_REF_FRAMES+1]; }; struct EncoderRefPicList { EncoderRefPicListStruct m_RefPicListL0; EncoderRefPicListStruct m_RefPicListL1; }; // EncoderRefPicList EncoderRefPicList *m_pRefPicList; // Buffer (within m_pParsedFrameData) used to store reference // picture lists generated while decoding the frame. Contains // a pair of lists (list 0, list 1) for each slice. ////////////////////////////////////////////////////////////////////////////// // GetRefPicList // Returns pointer to start of specified ref pic list. ////////////////////////////////////////////////////////////////////////////// EncoderRefPicListStruct* GetRefPicList(Ipp32u SliceNum, Ipp32u List) { H264EncoderFrame::EncoderRefPicListStruct *pList; if (List == LIST_0) pList = &m_pRefPicList[SliceNum].m_RefPicListL0; else pList = &m_pRefPicList[SliceNum].m_RefPicListL1; return pList; } // RefPicList // Returns pointer to start of specified ref pic list. Ipp8u *m_pParsedFrameData; Ipp8u *m_pParsedFrameDataNew; // This points to a huge, monolithic buffer that contains data // derived from parsing the current frame. It contains motion // vectors, MB info, reference indices, and slice info for the // current frame, among other things. When B slices are used it // contains L0 and L1 motion vectors and reference indices. sDimensions m_paddedParsedFrameDataSize; // m_pParsedFrameData's allocated size is remembered so that a // re-allocation is done only if size requirements exceed the // existing allocation. // m_paddedParsedFrameDataSize contains the image dimensions, // rounded up to a multiple of 16, that were used. Status allocateParsedFrameData ( const sDimensions&,Ipp32s ); // Reallocate m_pParsedFrameData, if necessary, and initialize the // various pointers that point into it. void deallocateParsedFrameData(); void ColorCnvtFrame(const H264_Image&);};class H264EncoderFrameList{private: // m_pHead points to the first element in the list, and m_pTail // points to the last. m_pHead->previous() and m_pTail->future() // are both NULL. H264EncoderFrame *m_pHead; H264EncoderFrame *m_pTail; H264EncoderFrame *m_pCurrent;public: H264EncoderFrameList() { m_pHead = m_pTail = m_pCurrent = 0; } virtual ~H264EncoderFrameList(); H264EncoderFrame *head() { return m_pHead; } H264EncoderFrame *tail() { return m_pTail; } bool isEmpty() { return !m_pHead; } H264EncoderFrame *detachHead(); // Detach the first frame and return a pointer to it, void RemoveFrame(H264EncoderFrame*); // Removes selected frame from list // or return NULL if the list is empty. void append(H264EncoderFrame *pFrame); H264EncoderFrame* InsertFrame(const H264_Image& rFrame,EnumPicCodType ePictureType,Ipp32s num_slices); // Append the given frame to our tail void insertList(H264EncoderFrameList &src); // Move the given list to the beginning of our list. void destroy(){}; H264EncoderFrame *findNextDisposable(void); // Search through the list for the next disposable frame to decode into void insertAtCurrent(H264EncoderFrame *pFrame); // Inserts a frame immediately after the position pointed to by m_pCurrent void resetCurrent(void) { m_pCurrent = m_pTail; } // Resets the position of the current to the tail. This allows // us to start "before" the head when we wrap around. void setCurrent(H264EncoderFrame *pFrame) { m_pCurrent = pFrame; } // Set the position of the current to pFrame void removeAllRef(); // Mark all frames as not used as reference frames. void IncreaseRefPicListResetCount(H264EncoderFrame *ExcludeFrame); // Mark all frames as not used as reference frames. void freeOldestShortTermRef(); // Mark the oldest short-term reference frame as not used. void freeShortTermRef(Ipp32s PicNum); // Mark the short-term reference frame with specified PicNum // as not used void freeLongTermRef(Ipp32s LongTermPicNum); // Mark the long-term reference frame with specified LongTermPicNum // as not used void freeLongTermRefIdx(Ipp32s LongTermFrameIdx); // Mark the long-term reference frame with specified LongTermFrameIdx // as not used void freeOldLongTermRef(Ipp32s MaxLongTermFrameIdx); // Mark any long-term reference frame with LongTermFrameIdx greater // than MaxLongTermFrameIdx as not used. void changeSTtoLTRef(Ipp32s PicNum, Ipp32s LongTermFrameIdx); // Mark the short-term reference frame with // specified PicNum as long-term with specified long term idx. void countActiveRefs(Ipp32u &NumShortTerm, Ipp32u &NumLongTerm); void countL1Refs(Ipp32u &NumRefs, Ipp32s curPOC); // Return number of active short and long term reference frames. H264EncoderFrame *findOldestToEncode(H264EncoderFrameList* dpb,Ipp32u min_L1_refs); H264EncoderFrame *findNewestToEncode(H264EncoderFrameList* dpb); // Search through the list for the oldest displayable frame. Ipp32s countNumToEncode();};} //namespace UMC#endif // E3QUEUE_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -