📄 vopses.hpp
字号:
/*************************************************************************This software module was originally developed by Ming-Chieh Lee (mingcl@microsoft.com), Microsoft Corporation Wei-ge Chen (wchen@microsoft.com), Microsoft Corporation Bruce Lin (blin@microsoft.com), Microsoft Corporation Chuang Gu (chuanggu@microsoft.com), Microsoft Corporation (date: March, 1996)and edited by Wei Wu (weiwu@stallion.risc.rockwell.com) Rockwell Science Centerand also edited by Yoshihiro Kikuchi (TOSHIBA CORPORATION) Takeshi Nagai (TOSHIBA CORPORATION) Toshiaki Watanabe (TOSHIBA CORPORATION) Noboru Yamaguchi (TOSHIBA CORPORATION)and edited by Xuemin Chen (General Instrument Corp.)in the course of development of the MPEG-4 Video (ISO/IEC 14496-2). This software module is an implementation of a part of one or more MPEG-4 Video tools as specified by the MPEG-4 Video. ISO/IEC gives users of the MPEG-4 Video free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-4 Video. Those intending to use this software module in hardware or software products are advised that its use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-4 Video conforming products. Microsoft retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third parties from using the code for non <MPEG standard> conforming products. This copyright notice must be included in all copies or derivative works. Copyright (c) 1996, 1997.Module Name: vopSes.hppAbstract: Base class for the encoder for one Video Object.Revision History: December 20, 1997 Interlaced tools added by General Instrument Corp.(GI) X. Chen (xchen@gi.com), B. Eifrig (beifrig@gi.com) May. 9 1998: add boundary by Hyundai Electronics Cheol-Soo Park (cspark@super5.hyundai.co.kr) May. 9 1998: add field based MC padding by Hyundai Electronics Cheol-Soo Park (cspark@super5.hyundai.co.kr) *************************************************************************/#ifndef __VOPSES_HPP_ #define __VOPSES_HPP_typedef enum {NOT_DONE, PIECE_DONE, UPDATE_DONE} SptMBstatus;#define BlockMemory Int*typedef struct MacroBlockMemory { BlockMemory* rgblkm;} MacroBlockMemory;Class ArCodec;Class CInvBlockDCT;Class CVideoObject{public: // Constructors virtual ~CVideoObject (); CVideoObject (); // Attributes const CVOPU8YUVBA* pvopcQuantCurr () const {return m_pvopcCurrQ;} const CVOPU8YUVBA* pvopcRefQPrev () const {return m_pvopcRefQ0;} const CVOPU8YUVBA* pvopcRefQLater () const {return m_pvopcRefQ1;} //This modification is for reconstructed BVOP image in SS coding should be used as refrence layer const CVOPU8YUVBA* pvopcReconCurr () const; // {return ((m_vopmd.vopPredType == BVOP && m_volmd.volType == BASE_LAYER) // ||(m_vopmd.vopPredType == BVOP && m_vopmd.iRefSelectCode != 0) // ||(m_vopmd.vopPredType == SPRITE && m_volmd.fAUsage != RECTANGLE)) // ? m_pvopcCurrQ : m_pvopcRefQ1;} //reconstructed current frame const VOLMode& volmd () const {return m_volmd;} const VOPMode& vopmd () const {return m_vopmd;} UInt fSptUsage () const {return m_uiSprite;} // Operations //virtual Void encode () {} Void swapRefQ1toSpt (); Void changeSizeofCurrQ (CRct rctOrg); Void setRctDisp (CRct rctDisp) {m_rctSptDisp = rctDisp;} Int iNumOfPnts () const {return m_iNumOfPnts;} const CVOPU8YUVBA* pvopcSptQ () const {return m_pvopcSptQ;} //low latency sprite stuff Void Overlay (CU8Image& uci1, CU8Image& uci2, float fscale); //1 on 2 Void VOPOverlay (CVOPU8YUVBA& pvopc1, CVOPU8YUVBA& pvopc2, Int iscale = 0); //1 on 2// dshu: begin of modification Void U8iGet (CU8Image& uci1, CU8Image& uci2, CRct rctPieceY); Void PieceGet (CVOPU8YUVBA& pvopc1, CVOPU8YUVBA& pvopc2, CRct rctPieceY); Void U8iPut (CU8Image& uci1, CU8Image& uci2, CRct rctPieceY); Void PiecePut (CVOPU8YUVBA& pvopc1, CVOPU8YUVBA& pvopc2, CRct rctPieceY); // dshu: end of modification// dshu: [v071] Begin of modification Void padSprite(); Void copySptQShapeYToMb (PixelC* ppxlcDstMB, const PixelC* ppxlcSrc) ;// dshu: [v071] end of modification Bool SptPieceMB_NOT_HOLE(Int iMBXoffset, Int iMBYoffset, CMBMode* pmbmd); Bool SptUpdateMB_NOT_HOLE(Int iMBXoffset, Int iMBYoffset, CMBMode* pmbmd); Void SaveMBmCurrRow (Int iMBYoffset, MacroBlockMemory** rgpmbmCurr); Void RestoreMBmCurrRow (Int iMBYoffset, MacroBlockMemory** rgpmbmCurr); Void CopyCurrQToPred (PixelC* ppxlcQMBY, PixelC* ppxlcQMBU, PixelC* ppxlcQMBV);///// 97/12/22 start Void copyVOPU8YUVBA (CVOPU8YUVBA*& pvopc0, CVOPU8YUVBA*& pvopc1); Void copyVOPU8YUVBA (CVOPU8YUVBA*& pvopc0, CVOPU8YUVBA*& pvopc1, CVOPU8YUVBA*& pvopc2); Void compute_bfShapeMembers ();///// 97/12/22 end///////////////// implementation ///////////////// Int getWidth(void) { return m_ivolWidth;}; Int getHeight(void) { return m_ivolHeight;}; double getFrameTime(void) { return (m_t / (double)m_volmd.iClockRate); }; Int getClockRate(void) { return m_volmd.iClockRate; };protected: // general routines Void swapVOPU8Pointers (CVOPU8YUVBA*& pvopc0, CVOPU8YUVBA*& pvopc1); Void swapVOPIntPointers (CVOPIntYUVBA*& pvopi0, CVOPIntYUVBA*& pvopi1); // VOL routines Void allocateVOLMembers (Int iSessionWidth, Int iSessionHeight); Void computeVOLConstMembers (); // VOP routines Void computeVOPMembers (); Void setRefStartingPointers (); Void updateAllRefVOPs (); Void updateAllRefVOPs (const CVOPU8YUVBA *pvopcRefBaselayer); // for spatial scalability Void repeatPadYOrA (PixelC* ppxlcOldLeft, CVOPU8YUVBA* pvopcRef); Void repeatPadUV (CVOPU8YUVBA* pvopcRef); Void resetBYPlane (); // MB routines Void decideTransparencyStatus (CMBMode* pmbmd, const PixelC* ppxlcMBBY); Void decideMBTransparencyStatus (CMBMode* pmbmd); Void downSampleBY (const PixelC* ppxlcMBBY, PixelC* ppxlcMBBUV); // downsample original BY now for LPE padding (using original shape) // Added for field based MC padding by Hyundai(1998-5-9) Void decideFieldTransparencyStatus ( CMBMode* pmbmd, const PixelC* ppxlcMBBY, const PixelC* ppxlcMBBUV ); Void fieldBasedDownSampleBY ( const PixelC* ppxlcMBBY, PixelC* ppxlcMBBUV ); // End of Hyundai(1998-5-9) // error signal processing Void addErrorAndPredToCurrQ (PixelC* ppxlcRefMBY, PixelC* ppxlcRefMBU, PixelC* ppxlcRefMBV); Void addAlphaErrorAndPredToCurrQ (PixelC* ppxlcRefMBA); // shape coding functions Void saveShapeMode(); own Int* computeShapeSubBlkIndex (Int iSubBlkSize, Int iSrcSize); Int getContextUS (PixelC a, PixelC b, PixelC c, PixelC d, PixelC e, PixelC f, PixelC g, PixelC h); PixelC getRefValue (const PixelC* ppxlcRow, Int x_adr, Int y_adr, Int h_size, Int v_size); Void adaptiveUpSampleShape (const PixelC* rgpxlcSrc, PixelC* rgpxlcDst, Int h_size, Int v_size); Void downSampleShapeMCPred(const PixelC* ppxlcSrc,PixelC* ppxlcDst,Int iRate); Void upSampleShape (PixelC* ppxlcBYFrm,const PixelC* rgpxlcSrc, PixelC* rgpxlcDst); Void copyLeftTopBorderFromVOP (PixelC* ppxlcSrc, PixelC* ppxlcDst); Void subsampleLeftTopBorderFromVOP (PixelC* ppxlcSrc, PixelC* ppxlcDst); Void makeRightBottomBorder (PixelC* ppxlcSrc, Int iWidth); Int contextIntra (const PixelC* ppxlcSrc); Int contextIntraTranspose (const PixelC* ppxlcSrc); Int contextInter (const PixelC* ppxlcSrc, const PixelC* ppxlcPred); Int contextInterTranspose (const PixelC* ppxlcSrc, const PixelC* ppxlcPred); Void copyReconShapeToMbAndRef (PixelC* ppxlcDstMB, PixelC* ppxlcRefFrm, PixelC pxlcSrc); Void copyReconShapeToMbAndRef (PixelC* ppxlcDstMB, PixelC* ppxlcRefFrm, const PixelC* ppxlcSrc, Int iSrcWidth, Int iBorder); Void copyRefShapeToMb (PixelC* ppxlcDstMB, const PixelC* ppxlcSrc); // Added for data partitioning mode By Toshiba(1998-1-16:DP+RVLC) Void copyReconShapeUVToRef (PixelC* ppxlcRefFrm, const PixelC* ppxlcSrc); CMotionVector findShapeMVP (const CMotionVector* pmv, const CMotionVector* pmvBY, const CMBMode* pmbmd, Int iMBX, Int iMBY) const; Int m_iInverseCR; // B-VOP stuff Void findColocatedMB (Int iMBX, Int iMBY, const CMBMode*& pmbmdRef, const CMotionVector*& pmvRef); // motion compensation Void limitMVRangeToExtendedBBHalfPel (CoordI &x,CoordI &y,CRct *prct,Int iBlkSize); Void limitMVRangeToExtendedBBFullPel (CoordI &x,CoordI &y,CRct *prct,Int iBlkSize); Void motionCompMB ( PixelC* ppxlcPredMB, const PixelC* ppxlcRefLeftTop, const CMotionVector* pmv, const CMBMode* pmbmd, Int imbX, Int imbY, CoordI x, CoordI y, Bool bSkipNonOBMC, Bool bAlphaMB, CRct *prctMVLimit ); Void motionComp ( PixelC* ppxlcPred, // can be either Y or A const PixelC* ppxlcRefLeftTop, Int iSize, // either MB or BLOCK size CoordI xRef, CoordI yRef, // x + mvX, in half pel unit Int iRoundingControl, CRct *prctMVLimit ); Void motionCompUV ( PixelC* ppxlcPredMBU, PixelC* ppxlcPredMBV, const CVOPU8YUVBA* pvopcRef, CoordI x, CoordI y, CoordI xRefUV, CoordI yRefUV, Int iRoundingControl, CRct *prctMVLimit );// INTERLACE Void motionCompFieldUV (PixelC* ppxlcPredMBU, PixelC* ppxlcPredMBV, const CVOPU8YUVBA* pvopcRef,CoordI x, CoordI y, CoordI xRefUV, CoordI yRefUV, Int iRefFieldSelect); Void motionCompYField ( PixelC* ppxlcPred, const PixelC* ppxlcRefLeftTop, CoordI xRef, CoordI yRef); // new change 02-19-99 Void motionCompDirectMode(CoordI x, CoordI y, CMBMode *pmbmd, const CMotionVector *pmvRef, CRct *prctMVLimitFwd, CRct *prctMVLimitBak, Int plane); Void motionCompOneBVOPReference(CVOPU8YUVBA *pvopcPred, MBType type, CoordI x, CoordI y, const CMBMode *pmbmd, const CMotionVector *pmv, CRct *prctMVLimit);// ~INTERLACE Void motionCompOverLap ( PixelC* ppxlcPredMB, const PixelC* ppxlcRefLeftTop, const CMotionVector* pmv, // motion vector const CMBMode* pmbmd, // macroblk mode Int imbx, // current macroblk index Int imby, // current macroblk index CoordI x, // current coordinate system CoordI y, // current coordinate system CRct *prctMVLimit ); Void motionCompBY ( PixelC* ppxlcPred, const PixelC* ppxlcRefLeftTop, CoordI iXRef, CoordI iYRef ); // B-VOP stuff Void motionCompInterp ( const CMotionVector* pmvForward, const CMotionVector* pmvBackward, CoordI x, CoordI y ); Void bilnrMCVH (UInt* PredY, const PixelC* ppxliPrevYC, UInt* pMWght, UInt xlow, UInt xhigh, UInt ylow, UInt yhigh, Bool bAdd); Void bilnrMCV (UInt* PredY, const PixelC* ppxliPrevYC, UInt* pMWght, UInt xlow, UInt xhigh, UInt ylow, UInt yhigh, Bool bAdd); Void bilnrMCH (UInt* PredY, const PixelC* ppxliPrevYC, UInt* pMWght, UInt xlow, UInt xhigh, UInt ylow, UInt yhigh, Bool bAdd); Void bilnrMC (UInt* PredY, const PixelC* ppxliPrevYC, UInt* pMWght, UInt xlow, UInt xhigh, UInt ylow, UInt yhigh, Bool bAdd); Void assignPredToCurrQ (PixelC* ppxlcRefMBY, PixelC* ppxlcRefMBU, PixelC* ppxlcRefMBV); Void assignAlphaPredToCurrQ (PixelC* ppxlcRefMBA); Void copyFromRefToCurrQ ( // zero motion case const CVOPU8YUVBA* pvopcRef, // reference VOP CoordI x, CoordI y, PixelC* ppxlcCurrQMBY, PixelC* ppxlcCurrQMBU, PixelC* ppxlcCurrQMBV, CRct *prctMVLimit ); // for non-obmc mode Void copyFromRefToCurrQ_WithShape ( // zero motion case const CVOPU8YUVBA* pvopcRef, // reference VOP CoordI x, CoordI y, PixelC* ppxlcCurrQMBY, PixelC* ppxlcCurrQMBU, PixelC* ppxlcCurrQMBV, PixelC* ppxlcCurrQMBBY ); // for non-obmc mode Void copyAlphaFromRefToCurrQ ( const CVOPU8YUVBA* pvopcRef, CoordI x, CoordI y, PixelC* ppxlcCurrQMBA, CRct *prctMVLimit ); // MC padding Void mcPadCurrMB ( PixelC* ppxlcRefMBY, PixelC* ppxlcRefMBU, PixelC* ppxlcRefMBV, PixelC* ppxlcRefMBA ); Void mcPadCurr ( PixelC *ppxlcTextureBase, // (uiStride X ???) const PixelC *ppxlcAlphaBase, // uiBlkSize X uiBlkSize UInt uiBlkSize, UInt uiStride ); Void padNeighborTranspMBs ( CoordI xb, CoordI yb, CMBMode* pmbmd, PixelC* ppxlcRefMBY, PixelC* ppxlcRefMBU, PixelC* ppxlcRefMBV, PixelC* ppxlcRefMBA ); Void padCurrAndTopTranspMBFromNeighbor ( CoordI xb, CoordI yb, CMBMode* pmbmd, PixelC* ppxlcRefMBY, PixelC* ppxlcRefMBU, PixelC* ppxlcRefMBV, PixelC* ppxlcRefMBA ); Void mcPadLeftMB (PixelC* ppxlcMBY, PixelC* ppxlcMBU, PixelC* ppxlcMBV, PixelC* ppxlcRefMBA); Void mcPadTopMB (PixelC* ppxlcMBY, PixelC* ppxlcMBU, PixelC* ppxlcMBV, PixelC* ppxlcRefMBA); Void mcPadCurrMBFromLeft (PixelC* ppxlcMBY, PixelC* ppxlcMBU, PixelC* ppxlcMBV, PixelC* ppxlcRefMBA); Void mcPadCurrMBFromTop (PixelC* ppxlcMBY, PixelC* ppxlcMBU, PixelC* ppxlcMBV, PixelC* ppxlcRefMBA); Void mcSetTopMBGray (PixelC* ppxlcMBY, PixelC* ppxlcMBU, PixelC* ppxlcMBV, PixelC* ppxlcRefMBA); Void mcSetCurrMBGray (PixelC* ppxlcMBY, PixelC* ppxlcMBU, PixelC* ppxlcMBV, PixelC* ppxlcRefMBA); Void mcSetLeftMBGray (PixelC* ppxlcMBY, PixelC* ppxlcMBU, PixelC* ppxlcMBV, PixelC* ppxlcRefMBA); // Added for field based MC padding by Hyundai(1998-5-9) Void fieldBasedMCPadding ( CMBMode* pmbmd, CVOPU8YUVBA* pvopcCurrQ ); Void mcPadCurrAndNeighborsMBFields ( Int iMBX, Int iMBY, CMBMode *pmbmd, PixelC* ppxlcRefMBY, PixelC* ppxlcRefMBU, PixelC* ppxlcRefMBV, PixelC* ppxlcRefMBBY, PixelC* ppxlcRefMBBUV, PixelC* ppxlcRefMBA ); Void mcPadFieldsCurr ( Int iMBX, Int iMBY, CMBMode *pmbmd, Int mode, PixelC *ppxlcCurrMB1, PixelC *ppxlcCurrMB2,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -