📄 vopsedec.h
字号:
/*************************************************************************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 Yoshihiro Kikuchi (TOSHIBA CORPORATION) Takeshi Nagai (TOSHIBA CORPORATION) Toshiaki Watanabe (TOSHIBA CORPORATION) Noboru Yamaguchi (TOSHIBA CORPORATION)and also edited by Dick van Smirren (D.vanSmirren@research.kpn.com), KPN Research Cor Quist (C.P.Quist@research.kpn.com), KPN Research (date: July, 1998)and also edited by Fujitsu Laboratories Ltd. (contact: Eishi Morimatsu)and also edited by Takefumi Nagumo (nagumo@av.crl.sony.co.jp), Sony Corporation Sehoon Son (shson@unitel.co.kr) Samsung AITin 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: vopsedec.hAbstract: Decoder for one Video Object.Revision History: 09-30-97: merge error resilient changes from Toshiba by wchen@microsoft.com 11-30-97: added Spatial tools by Takefumi Nagumo(nagumo@av.crl.sony.co.jp) SONY corporation 12-20-97: Interlaced tools added by NextLevel Systems X. Chen (xchen@nlvl.com), B. Eifrig (beifrig@nlvl.com) Sep.06 1999 : RRV added by Eishi Morimatsu (Fujitsu Laboratories Ltd.) Feb.01 2000 : Bug fixed OBSS by Takefumi Nagumo (Sony) May.25 2000 : MB stuffing decoding on the last MB by Hideaki Kimata (NTT)*************************************************************************/#ifndef __VOPSEDEC_HPP_ #define __VOPSEDEC_HPP_#define MP4V_UNSUPPORTED_CODING_TYPE 0x80000000// decoder.c relatedextern Bool main_short_video_header;// bitstrm.c related#ifdef MP4_STANDALONE#define MAX_BUFFER_SIZE (128*1024)#else#define MAX_BUFFER_SIZE (128*1024)#endifextern Int m_lCounter;extern int nBytesAvailable;extern unsigned int g_bEOFReached;extern UInt m_uNumOfBitsInBuffer;extern int m_chDecBuffer;extern int nTotalBytes;extern unsigned char MyBuffer[MAX_BUFFER_SIZE];extern int g_nMP4VPTS;extern int nFrames, g_iTNum;extern INLINE Void ReadFileMP4();extern INLINE UInt getBits (UInt numBits);//return bits from the streamextern INLINE Int peekBits (UInt numBits); //peek bits from the streamextern INLINE Int peekBitsTillByteAlign (Int *nBitsToPeek) ; //peek 1-8 bits until the next byte alignmentextern INLINE Int peekBitsFromByteAlign (Int numBits) ; //peek from the stream at byte boundary#ifdef ENABLE_INTERLACINGextern INLINE UInt getSingleBit ();//return 1 bit from the stream#endif#define MP4V_EOF() ((nBytesAvailable <= 0) ? (g_bEOFReached) : (0))#ifdef FAST_LUT_DECODE// fetches 32 bits from buffer when empty#define MP4V_RETSINGLEBIT(nBitRet)\{\ if (m_uNumOfBitsInBuffer == 0)\ {\ if(nBytesAvailable < 4)\ ReadFileMP4();\ {\ unsigned char *pBuf = (unsigned char *)&(MyBuffer[nTotalBytes-nBytesAvailable]);\ m_chDecBuffer = pBuf[0] << 24;\ m_chDecBuffer |= pBuf[1] << 16;\ m_chDecBuffer |= pBuf[2] << 8;\ m_chDecBuffer |= pBuf[3];\ nBytesAvailable-=4;\ }\ m_uNumOfBitsInBuffer = 32;\ }\ *nBitRet = (m_chDecBuffer < 0);\ m_chDecBuffer <<= 1;\ m_uNumOfBitsInBuffer--;\}#define MP4V_FLUSH(nExtraBits)\{\ int nBits;\\ if(m_uNumOfBitsInBuffer%8 == 0)\ getBits (nExtraBits);\\ else\ {\ nBits = m_uNumOfBitsInBuffer;\ m_uNumOfBitsInBuffer = ((m_uNumOfBitsInBuffer / 8) * 8);\ /*m_uNumOfBitsInBuffer = ((m_uNumOfBitsInBuffer >> 3) << 3);*/\\ nBits = nBits - m_uNumOfBitsInBuffer;\ m_chDecBuffer <<= nBits;\ }\}#else // !FAST_LUT_DECODE#define MP4V_RETSINGLEBIT(nBitRet) \{\if (m_uNumOfBitsInBuffer) \{ \ *nBitRet =(m_chDecBuffer < 0);\ m_chDecBuffer = m_chDecBuffer << 1;\ m_uNumOfBitsInBuffer --;\}\else\{\ if(!nBytesAvailable)\ ReadFileMP4();\\ m_chDecBuffer = MyBuffer[nTotalBytes-nBytesAvailable] << 24;\ if (nBytesAvailable) nBytesAvailable--;\\ *nBitRet = (m_chDecBuffer < 0);\ m_chDecBuffer = m_chDecBuffer << 1;\ m_uNumOfBitsInBuffer = 7;\}\}#define MP4V_FLUSH(nExtraBits)\{\ if(m_uNumOfBitsInBuffer==0)\ getBits (nExtraBits);\\ assert (m_uNumOfBitsInBuffer != 8);\ m_uNumOfBitsInBuffer = 0;\}#endif// huffman.c relatedextern PPHUFFMAN_DEC_STRUCT m_pentrdecDCT;extern PPHUFFMAN_DEC_STRUCT m_pentrdecDCTIntra;extern PPHUFFMAN_DEC_STRUCT m_pentrdecMV;extern PPHUFFMAN_DEC_STRUCT m_pentrdecMCBPCintra;extern PPHUFFMAN_DEC_STRUCT m_pentrdecMCBPCinter;extern PPHUFFMAN_DEC_STRUCT m_pentrdecCBPY;extern PPHUFFMAN_DEC_STRUCT m_pentrdecIntraDCy;extern PPHUFFMAN_DEC_STRUCT m_pentrdecIntraDCc;extern PPHUFFMAN_DEC_STRUCT m_pentrdecMbTypeBVOP;// gmc_motion.c relatedextern Void globalmv(Int *, Int *, Int *, Int *, CoordI, CoordI, Int, Bool);// blkdec.c related#define GETCODEDBLOCKPATTERN2(pMBMode, blkn) (pMBMode->m_rgbCodedBlockPattern[(UInt) blkn])#define GETCODEDBLOCKPATTERN(pMBMode, blkn) (pMBMode->m_rgbCodedBlockPattern[(UInt) blkn-1])#define SETCODEDBLOCKPATTERN(pMBMode, blkn, bisCoded) (GETCODEDBLOCKPATTERN(pMBMode, blkn) = bisCoded)extern CVideoObject *g_pVO;extern CVideoObjectDecoder *g_pDecoder;extern VOLMode *g_pVOL; // vol modeextern VOPMode *g_pVOP; // vop mode// Block decoding functionsextern INLINE Void decideIntraPred (CMBMode*, Int *, Int, MacroBlockMemory* , MacroBlockMemory*, MacroBlockMemory*, MacroBlockMemory*, CMBMode*, CMBMode*, CMBMode*, BlockMemory*);extern INLINE Void decodeTextureIntraBlock (Int, Int, Int, MacroBlockMemory*, CMBMode*, BlockMemory, Int);extern INLINE Void decodeTextureInterBlock ();// mbdec.c related#define SETCBPYANDC(pmbmd, iCBPC, iCBPY)\{\ Int iBitPos = 3;\\ SETCODEDBLOCKPATTERN (pmbmd, U_BLOCK, (iCBPC >> 1) & 1);\ SETCODEDBLOCKPATTERN (pmbmd, V_BLOCK, iCBPC & 1);\\ for (iBlk = Y_BLOCK1; iBlk <= Y_BLOCK4; iBlk++)\ {\ SETCODEDBLOCKPATTERN (pmbmd, iBlk, (iCBPY >> iBitPos) & 1);\ iBitPos--;\ }\}#define DECODETEXTUREINTRAMB(pmbmd, iMBX, iMBY)\{\ iMBTop = iMBY - 1;\ pmbmLeft = pmbmTop = pmbmLeftTop = NULL;\ pmbmdLeft = pmbmdTop = pmbmdLeftTop = NULL;\ iQP = pmbmd->m_stepSize;\\ assert (pmbmd != NULL);\ assert (pmbmd->m_dctMd == INTRA || pmbmd->m_dctMd == INTRAQ);\\ if (iQP <= 4)\ {\ iDcScalerY = 8;\ iDcScalerC = 8;\ }\\ else if (iQP >= 5 && iQP <= 8)\ {\ iDcScalerY = 2 * iQP;\ iDcScalerC = (iQP + 13) / 2;\ }\\ else if (iQP >= 9 && iQP <= 24)\ {\ iDcScalerY = iQP + 8;\ iDcScalerC = (iQP + 13) / 2;\ }\\ else\ {\ iDcScalerY = 2 * iQP - 16;\ iDcScalerC = iQP - 6;\ }\\ g_pHeader3->xpos = iMBX * 2;\ g_pHeader3->ypos = iMBY * 2;\\ assert (iQP > 0);\\ if (iMBTop >= 0)\ {\ if (pmbmd->m_iVideoPacketNumber == (pmbmd - g_pVO->m_iNumMBX)->m_iVideoPacketNumber)\ {\ pmbmTop = g_pVO->m_rgpmbmAbove [iMBX];\ pmbmdTop = pmbmd - g_pVO->m_iNumMBX;\ }\ }\\ if (iMBX > 0)\ {\ if (pmbmd->m_iVideoPacketNumber == (pmbmd - 1)->m_iVideoPacketNumber)\ {\ pmbmLeft = g_pVO->m_rgpmbmCurr [iMBX - 1];\ pmbmdLeft = pmbmd - 1;\ }\ }\\ if (iMBTop >= 0 && iMBX > 0)\ {\ if (pmbmd->m_iVideoPacketNumber == (pmbmd - g_pVO->m_iNumMBX - 1)->m_iVideoPacketNumber)\ {\ pmbmLeftTop = g_pVO->m_rgpmbmAbove [iMBX - 1];\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -