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

📄 mae_pass_thru.c

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 C
📖 第 1 页 / 共 2 页
字号:
// ***************************************************************************#ifdef UNDER_CEvoid QueueMB ()#else //!UNDER_CEINLINE void QueueMB ()#endif //UNDER_CE{  int nNumBytes;#ifndef INLINE_MV_CLIPPING	int index, nNumYMVs, nNumUVMVPairs = 1; #ifdef ENABLE_INTERLACING  int xDivisor, yDivisor;#endif  int	MVX, MVY, shift = 0;  int nLinesize	= iPicWidth;  int nHeight		= iPicHeight;	// Adjust the xpos & ypos as per the old code (needed for MV clipping)	// Since we did a pos*2 (instead of pos*16 which the old code did), 	// lets just do an additional pos*8 to make the clipping logic fall in place	int xpos		= g_pHeader3->xpos * 8;	int ypos		= g_pHeader3->ypos * 8;    int xloc, yloc;#endif#ifdef ENABLE_PRINTS    static nSizeSoFar = 0;    if (pMAEContext->tnum == 10000)    {        printf("\nBD[0]=0x%x BD[1]=0x%x",pMAEContext->pDataBlock[0], pMAEContext->pDataBlock[1]);    }#endif#ifdef ENABLE_INTERLACING    if (g_pHeader2->mbmode == MBMODE_BID_ALL_420)    {        nNumUVMVPairs = 2;        printf("\nQueueMB : Set nNumUVMVs here (mae_pass_thru.c)!!");        exit(0);    }#endif#ifndef INLINE_MV_CLIPPING	if (g_pHeader2->mbmode)	{#ifdef ENABLE_INTERLACING		shift = 0;		if (g_pHeader3->mbtype == MBT_16x8)			shift = 1;		// NOTE:  There are still cases in the reference source code where		// the Y shift right by 1 is used before calling this function - 		// this is done mainly so that an accurate assessment of whether 		// we need to flip from MAE to the reference implementation for 		// motion vector processing can be done.        // Clip luma motion vectors		if (g_pHeader3->fp == MAE_FIELD_PREDICTION)			yDivisor = 2;#endif        // Get the number of Y Motion Vectors        nNumYMVs = (g_NumMVs == TOTAL_8x8_BID_MVS) ? 8 : 4;        // Clip Y Motion Vectors		for (index = 0; index < nNumYMVs; index++)		{			MVX = (int)((int16)((g_pMV[index] >> 16) & 0x0000FFFF));			MVY = (int)((int16)(g_pMV[index] & 0x0000FFFF));			// Only lumas can have either QUARTER_PEL or HALF_PEL_BILINEAR 			// MVs. We need to do the clipping accordingly.			// ************************************************************			if(g_pHeader3->mcprecy == MAE_QUARTER_PEL)            {#ifdef ENABLE_INTERLACING				MP4V_LimitToQPel (xpos, ypos/yDivisor, &MVX, &MVY, nLinesize, nHeight/yDivisor, index);#else                MP4V_LimitToQPel (xpos, ypos, &MVX, &MVY, nLinesize, nHeight, index);#endif            }			else            {                xloc = xpos+MVX;                yloc = ypos+MVY;#ifdef ENABLE_INTERLACING				MP4V_LIMITTOHPEL_Y (xpos, ypos/yDivisor, &MVX, &MVY, nLinesize, nHeight/yDivisor, index);#else                if((xloc<=-16) || (xloc>=nLinesize) || (yloc<=-16) || (yloc >= nHeight))                    MP4V_LIMITTOHPEL_Y (xpos, ypos, &MVX, &MVY, nLinesize, nHeight, index);#endif            }			g_pMV[index] = (MVX << 16) | ((MVY >> shift) & 0x0000FFFF);		}	#ifdef ENABLE_INTERLACING        // Clip chroma motion vectors		if (g_pHeader3->fp == MAE_FIELD_PREDICTION)			yDivisor = 4;        // Adjust the pos/width/height for the UV case.        xpos = xpos/xDivisor; // ERROR HERE - xDivisor is not set.        ypos =  ypos/yDivisor; // ERROR HERE - yDivisor MIGHT not be set.        nLinesize = nLinesize/xDivisor;        nHeight = nHeight/yDivisor;#else        // Adjust the pos/width/height for the UV case.        xpos >>= 1;        ypos >>= 1;        nLinesize>>=1;        nHeight >>=1;#endif        // Clip U & V Motion Vectors		for (index = 0; index < nNumUVMVPairs; index++)		{            MVX = (int)((int16)((g_pMV[g_UVMVId2] >> 16) & 0x0000FFFF));            MVY = (int)((int16)(g_pMV[g_UVMVId2] & 0x0000FFFF));            xloc = xpos+MVX;            yloc = ypos+MVY;            if((xloc <=-16) || (yloc<=-16) || (xloc>= nLinesize) || (yloc >= nHeight))                MP4V_LimitToHPel_UV (xpos, ypos, &MVX, &MVY, nLinesize, nHeight, index);			g_pMV[g_UVMVId2] = (MVX << 16) | ((MVY >> shift) & 0x0000FFFF);            if (g_pHeader2->mbmode == MBMODE_BID_ALL_420)            {    			MVX = (int)((int16)((g_pMV[g_UVMVId2 + 1] >> 16) & 0x0000FFFF));    			MVY = (int)((int16)(g_pMV[g_UVMVId2 + 1] & 0x0000FFFF));                    xloc = xpos+MVX;                yloc = ypos+MVY;                if((xloc <=-16) || (yloc<=-16) || (xloc>= nLinesize) || (yloc >= nHeight))                    MP4V_LimitToHPel_UV (xpos, ypos, &MVX, &MVY, nLinesize, nHeight, index);    			g_pMV[g_UVMVId2 + 1] = (MVX << 16) | ((MVY >> shift) & 0x0000FFFF);            }            g_UVMVId2++;		}	}#endif    nNumBytes =	(MAE_HEADERS_SIZE + (g_NumMVs * 4) + (nCodedBlocks * BLOCK_DATA_SIZE_16));    if (g_NumWMs)        nNumBytes += (g_NumWMs * WM_DATA_SIZE);    // Update the Byte Count in the descriptor    pMAEContext->desc_size += nNumBytes;    MP4V_nBytesUsed = nNumBytes;#ifdef ENABLE_PRINTS    if (pMAEContext->tnum == 10000)    {        int i;        printf("\nMB# %d, Size = %d Blocks = %d WMs = %d MVs = %d CBP = 0x%x SizeSoFar = %d\n",g_nMB, nNumBytes, nCodedBlocks, g_NumWMs, g_NumMVs, g_pHeader1->cbp, nSizeSoFar);        for (i=0; i<g_NumMVs; i++)            printf("MV[%d]=0x%x ",i, g_pMV[i]);        printf("\nMBMode=0x%x MBType=%d DCLuma=%d DCChroma=%d IQMUL2=%d",g_pHeader2->mbmode, g_pHeader3->mbtype, g_pHeader0->dcluma, g_pHeader0->dcchroma, g_pHeader0->iqmul2);        printf("\nBD[0]=0x%x BD[1]=0x%x",pMAEContext->pDataBlock[0], pMAEContext->pDataBlock[1]);        g_nMB++;        nSizeSoFar += nNumBytes;    }#endif}INLINE void UpdateDisplaySizes (int *iMPEG4Width, int *iMPEG4Height){#if defined(MP4_STANDALONE) || defined(UNDER_CE)    int disp_width, disp_height;        // Get the display size    get_display_size(&disp_width, &disp_height);        // If we exceed the supported sizes, truncate them back    if (*iMPEG4Width > disp_width)        *iMPEG4Width = disp_width;        if (*iMPEG4Height > disp_height)        *iMPEG4Height = disp_height;#ifdef NEW_MAE_DRIVER    // Limit the video size to 640x480 since that is the     // maximum size of our RGB buffers (in the driver)    if (*iMPEG4Width > 640)        *iMPEG4Width = 640;    if (*iMPEG4Height > 480)        *iMPEG4Height = 480;#endif    // Set the display size (its the same as decode size as of now)    set_display_size(*iMPEG4Width, *iMPEG4Height);#endif}#ifdef ENABLE_INTERLACINGvoid FillMAERegisters (int nFrameType, int bInterlaceMode) {	pMAERegs->regmask = 0;	// Frame sizes	pMAERegs->regmask |= PICTURE_SIZE_MASK;	// Current Y, U & V pointer masks	pMAERegs->regmask |= CUR_Y_MASK;	pMAERegs->regmask |= CUR_CB_MASK;	pMAERegs->regmask |= CUR_CR_MASK;	if (nFrameType == PFRAME || nFrameType == BFRAME)	{		pMAERegs->regmask |= FWD_Y_TOP_MASK;		pMAERegs->regmask |= FWD_CB_TOP_MASK;		pMAERegs->regmask |= FWD_CR_TOP_MASK;        if (bInterlaceMode)        {    		pMAERegs->regmask |= FWD_Y_BOT_MASK;    		pMAERegs->regmask |= FWD_CB_BOT_MASK;    		pMAERegs->regmask |= FWD_CR_BOT_MASK;        }	}	if (nFrameType == BFRAME)	{		pMAERegs->regmask |= BWD_Y_TOP_MASK;		pMAERegs->regmask |= BWD_CB_TOP_MASK;		pMAERegs->regmask |= BWD_CR_TOP_MASK;        if (bInterlaceMode)        {    		pMAERegs->regmask |= BWD_Y_BOT_MASK;    		pMAERegs->regmask |= BWD_CB_BOT_MASK;    		pMAERegs->regmask |= BWD_CR_BOT_MASK;        }	}	// Config0 reg	pMAERegs->regmask |= CONFIG0_MASK;	// Let us dump all this into pMAEConfig 	WrapSetRegisters (pMAERegs, 0); // Progressive only as of now!!}// ***************************************************************************////  Function:       CheckForFlip//////  Parameters:     CachedFILE pFile(File handle) & falg to write to file or not////  Return Value:   VOID////  Notes:          This checks to see if we flipped processing from MAE to //					REF mode (when Interlacing is ON due to the OOF bytes issue //					with MAE for bottom-fields at the top of the frame & //					top-fields at the bottom of the frame). If so, we need to //					add the string FLIP_TO_REF for this MB.//// ***************************************************************************unsigned char CheckForFlip(CachedFILE pFile, unsigned char bWriteToFile){  unsigned char bRet = 0;  // In MAE-Interlaced mode, did we flip this MB to the reference mode?  // Note that the file name will already have a .MAE extension (gFileExt)  // since we start off in the USE_MAE mode initially   if (nFlipToRef == FLIP_TO_REF)	bRet = 1;  if (bWriteToFile)	fprintf(pFile, "$FLIP_TO_REF ");  return bRet;}#endif

⌨️ 快捷键说明

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