⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mbdec.c

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 C
字号:
/*************************************************************************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	Simon Winder (swinder@microsoft.com), Microsoft Corporation	(date: March, 1996)and edited by        Wei Wu (weiwu@stallion.risc.rockwell.com) Rockwell Science Centerand also edited by    Fujitsu Laboratories Ltd. (contact: Eishi Morimatsu)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:	mbdec.cAbstract:	MacroBlock level decoderRevision History:        May. 9   1998:  add boundary by Hyundai Electronics                                   Cheol-Soo Park (cspark@super5.hyundai.co.kr) 	Sep.06	1999 : RRV added by Eishi Morimatsu (Fujitsu Laboratories Ltd.) *************************************************************************/#include "typeapi.h"#include "codehead.h"#include "mode.h"#include "global.h"#include "entropy/bitstrm.h"#include "entropy/huffman.h"#include "vopses.h"#include "vopsedec.h"#include "mae_pass_thru.h"#include "mae_fe_mcomp.h"Void decodeTextureIntraMB (CMBMode* pmbmd, CoordI iMBX, CoordI iMBY){// HV - Perf Changes	assert (pmbmd != NULL);	if (pmbmd -> m_rgTranspStatus [0] == ALL) 		return;	assert (pmbmd->m_dctMd == INTRA || pmbmd->m_dctMd == INTRAQ);	Int iQP = pmbmd->m_stepSize, iDcScalerY, iDcScalerC;    //for intra pred    MacroBlockMemory* pmbmLeft = NULL;    MacroBlockMemory* pmbmTop = NULL;    MacroBlockMemory* pmbmLeftTop = NULL;    CMBMode* pmbmdLeft = NULL;    CMBMode* pmbmdTop = NULL;    CMBMode* pmbmdLeftTop = NULL;    Int iMBTop	= iMBY - 1, iWidthDst, iDcScaler, *rgiCoefQ, iBlk, iQpPred;    PixelC* rgchBlkDst = NULL;    BlockMemory blkmPred;	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;	}    // co-oridinates of the current MB    g_pHeader3->xpos = iMBX * 2;    g_pHeader3->ypos = iMBY * 2;    g_pHeader2->mbmode = MBMODE_INTRA_ALL;	assert (iQP > 0);	if (iMBTop >= 0)	    {		if (pmbmd->m_iVideoPacketNumber == (pmbmd - g_pDecoder->m_iNumMBX)->m_iVideoPacketNumber)	        {			pmbmTop  = g_pDecoder->m_rgpmbmAbove [iMBX];			pmbmdTop = pmbmd - g_pDecoder->m_iNumMBX; 		}	}	if (iMBX > 0)	    {		if (pmbmd->m_iVideoPacketNumber == (pmbmd - 1)->m_iVideoPacketNumber)	        {			pmbmLeft  = g_pDecoder->m_rgpmbmCurr [iMBX - 1];			pmbmdLeft = pmbmd -  1; 		}	}	if (iMBTop >= 0 && iMBX > 0)	    {		if (pmbmd->m_iVideoPacketNumber == (pmbmd - g_pDecoder->m_iNumMBX - 1)->m_iVideoPacketNumber)	        {			pmbmLeftTop  = g_pDecoder->m_rgpmbmAbove [iMBX - 1];			pmbmdLeftTop = pmbmd - g_pDecoder->m_iNumMBX - 1;		}	}	for (iBlk = Y_BLOCK1; iBlk <= V_BLOCK; iBlk++)    {        (iBlk < (UInt) U_BLOCK) ? (iDcScaler = iDcScalerY) : (iDcScaler = iDcScalerC);		rgiCoefQ = g_pDecoder->m_rgpiCoefQ [iBlk - 1];		blkmPred = NULL;		iQpPred = iQP; //default to current if no pred		blkmPred = decideIntraPred (pmbmd, &iQpPred, iBlk, pmbmLeft, pmbmTop, pmbmLeftTop, g_pDecoder->m_rgpmbmCurr [iMBX], pmbmdLeft,                                    pmbmdTop, pmbmdLeftTop);		decodeTextureIntraBlock (iQP, iDcScaler, iBlk, g_pDecoder->m_rgpmbmCurr [iMBX], pmbmd, blkmPred, iQpPred);	}    // *********************************************************************    // Finish filling in MB related parameters, then call CModel    // *********************************************************************    // Rounding control & CBP    g_pHeader3->rnd = g_pVOP->iRoundingControl;    g_pHeader1->cbp = CBP_FOR_420;    // Field DCT    if (pmbmd->m_bFieldDCT)        g_pHeader3->dctt = 1;#ifdef ENABLE_INTERLACING    // No interlacing on Intra block    if (pmbmd->m_bFieldMV)    {        g_pHeader3->fp = MAE_FIELD_PREDICTION;        if (!pmbmd->m_bForwardTop)            g_pHeader3->ft = 1;        if (!pmbmd->m_bForwardBottom)            g_pHeader3->fb = 1;        if (!pmbmd->m_bBackwardTop)            g_pHeader3->bt = 1;        if (!pmbmd->m_bBackwardBottom)            g_pHeader3->bb = 1;    }#endif    // Just set the number of coded blocks to 6 since all Intra blocks are coded    nCodedBlocks = BLOCKS_FOR_420_FORMAT;    MP4V_nBytesUsed = QueueMB (0);// ~HV - Perf Changes}Void decodeTextureInterMB (CMBMode* pmbmd){	assert (pmbmd != NULL);	if (pmbmd->m_rgTranspStatus [0] == ALL || pmbmd->m_bSkip) 		return;	assert (pmbmd->m_dctMd == INTER || pmbmd->m_dctMd == INTERQ);	Int iQP = pmbmd->m_stepSize, iBlk;	for (iBlk = Y_BLOCK1; iBlk <= V_BLOCK; iBlk++)    {		if (GETCODEDBLOCKPATTERN (pmbmd, iBlk))        {			decodeTextureInterBlock (iQP);            // Increment the number of coded blocks            nCodedBlocks++;            // Update the CBP accordingly            g_pHeader1->cbp |= BITS_FOR_CBP[iBlk-1];         }	}}#ifdef DUAL_MODEVoid CVideoObjectDecoder::copyFromPredForYAndRefForCToCurrQ (CoordI x, CoordI y, PixelC* ppxlcCurrQMBY, PixelC* ppxlcCurrQMBU,                                                              PixelC* ppxlcCurrQMBV,CRct *prctMVLimit){	Int iUnit = sizeof(PixelC); // NBIT: for memcpy	// needs limiting to reference area bounding box// RRV modification	limitMVRangeToExtendedBBFullPel(x,y,prctMVLimit, (MB_SIZE *m_iRRVScale));// ~RRV	Int iOffsetUV = (y / 2 + EXPANDUV_REF_FRAME) * m_iFrameWidthUV + x / 2 + EXPANDUV_REF_FRAME;	const PixelC* ppxlcPredMBY = m_ppxlcPredMBY;	const PixelC* ppxlcRefMBU = m_pvopcRefQ0->pixelsU () + iOffsetUV;	const PixelC* ppxlcRefMBV = m_pvopcRefQ0->pixelsV () + iOffsetUV;	CoordI iY;// RRV modification	for (iY = 0; iY < (BLOCK_SIZE *m_iRRVScale); iY++) {		memcpy (ppxlcCurrQMBY, ppxlcPredMBY, (MB_SIZE *m_iRRVScale)*iUnit);		memcpy (ppxlcCurrQMBU, ppxlcRefMBU, (BLOCK_SIZE *m_iRRVScale)*iUnit);		memcpy (ppxlcCurrQMBV, ppxlcRefMBV, (BLOCK_SIZE *m_iRRVScale)*iUnit);		ppxlcCurrQMBY += m_iFrameWidthY; 		ppxlcPredMBY += (MB_SIZE *m_iRRVScale);// ~RRV		ppxlcCurrQMBU += m_iFrameWidthUV; ppxlcRefMBU += m_iFrameWidthUV;		ppxlcCurrQMBV += m_iFrameWidthUV; ppxlcRefMBV += m_iFrameWidthUV;// RRV modification		memcpy (ppxlcCurrQMBY, ppxlcPredMBY, (MB_SIZE *m_iRRVScale)*iUnit);		ppxlcCurrQMBY += m_iFrameWidthY;		ppxlcPredMBY += (MB_SIZE *m_iRRVScale);// ~RRV	}}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -