📄 tmdlmbs2_support.c
字号:
lineBufferSize = 2048; gMbsChipBugs [i] = MBS_V2_REVA_BUGS; break; case 1: // version used on PNX1500 lineBufferSize = 1024; gMbsChipBugs [i] = MBS_V2_REVB_BUGS; gMbsFeatures [i] |= tmdlMbsFeature1500EnhMsa3; break; default: status = TMDL_ERR_MBS_SWHW_COMPATIBILITY; gNumberOfUnits = 0; break; } break; // enhanced full-featured version - tapeout 2 case 2: gMbsCaps [i].maxNrOfClutEntries = 256; gMbsFeatures [i] = (tmdlMbsFeatureDeint | tmdlMbsFeatureEddi | tmdlMbsFeatureMeas | tmdlMbsFeatureEnhMsa3 | tmdlMbsFeatureDynMsa3 | tmdlMbsFeatureIFFcrop | tmdlMbsFeatureDFFcrop); gMbsTlCount [i] = tlMbs2Msa3EnhCount; gMbsCaps [i].deinterlacing = True; gMbsCaps [i].eddi = True; gMbsCaps [i].measurement = True; switch (blockId.bits.minorRevision) { case 0: // PNX8550 tapeout 2 lineBufferSize = 2048; gMbsChipBugs [i] = MBS_V2_REVB_BUGS; break; case 8: // PNX1500 1.1 lineBufferSize = 1024; gMbsChipBugs [i] = MBS_V2_REVB_BUGS; break; default: status = TMDL_ERR_MBS_SWHW_COMPATIBILITY; gNumberOfUnits = 0; break; } break; // MBS without De-interlacing, EDDI, or Measurement - tapeout 2 case 3: gMbsCaps [i].maxNrOfClutEntries = 256; gMbsFeatures [i] = (tmdlMbsFeatureIFFcrop | tmdlMbsFeatureDFFcrop); gMbsTlCount [i] = tlMbs2BaseCount; switch (blockId.bits.minorRevision) { case 0: lineBufferSize = 2048; gMbsChipBugs [i] = MBS_V2_REVB_BUGS; break; default: status = TMDL_ERR_MBS_SWHW_COMPATIBILITY; gNumberOfUnits = 0; break; } break; // MBS2 for pnx2015 - 32-bit addresses & feature reg case 4: gMbsFeatures [i] = (tmdlMbsFeatureIFFcrop | tmdlMbsFeatureDFFcrop); featureReg.u32 = pRegs->c.feature.u32; gMbsTlCount [i] = tlMbs2BaseCount; if (featureReg.bits.measurements) { gMbsCaps [i].measurement = True; gMbsFeatures [i] |= tmdlMbsFeatureMeas; gMbsTlCount [i] = tlMbs2MeasCount; } if (featureReg.bits.eddi) { gMbsCaps [i].eddi = True; gMbsFeatures [i] |= tmdlMbsFeatureEddi; gMbsTlCount [i] = tlMbs2EddiCount; } if (featureReg.bits.deinterlacing) { gMbsCaps [i].deinterlacing = True; gMbsFeatures [i] |= tmdlMbsFeatureDeint | tmdlMbsFeatureEnhMsa3; gMbsTlCount [i] = tlMbs2Msa3EnhCount; } switch (blockId.bits.minorRevision) { case 0: lineBufferSize = 2048; gMbsChipBugs [i] = MBS_V2_REVB_BUGS; break; default: status = TMDL_ERR_MBS_SWHW_COMPATIBILITY; gNumberOfUnits = 0; break; } break; default: status = TMDL_ERR_MBS_SWHW_COMPATIBILITY; gNumberOfUnits = 0; break; } } gMbsCaps [i].inputSize.x = lineSize; gMbsCaps [i].inputSize.y = lineCount; gMbsCaps [i].outputSize.x = lineSize; gMbsCaps [i].outputSize.y = lineCount; gMbsCaps [i].lineBufferSize = lineBufferSize; gMbsLineSize [i] = lineSize; gMbsLineCount [i] = lineCount;#if ( (TMFL_PNX_ID == 1500)|| (TMFL_PNX_ID == 1700)) gMbsLineBufferSize [i] = lineBufferSize;#endif if (gMbsChipBugs [i] & tmdlMbsBugsSmallLineDiff) { gMbsLineDifMax [i] = 3; } else { gMbsLineDifMax [i] = 7; } if (gMbsChipBugs [i] & tmdlMbsBugsSmallDtoOffset) { gMbsDtoOffsetMax [i] = 0x1FFF; gMbsDtoLineMask [i] = 0x1C00; } else { gMbsDtoOffsetMax [i] = 0x3FFF; gMbsDtoLineMask [i] = 0x3C00; } --i; } } // return number of units *pUnitCount = gNumberOfUnits; DBG_ASSERT2((status == TM_OK), ("MbsInit: Unsupported MBS HW revision")); return status;} // MbsInit#if (TMFL_OS_IS_CE && (TMFL_CPU == TMFL_CPU_R3940))#pragma optimize( "", off )#endif//-----------------------------------------------------------------------------// FUNCTION: MbsInitClock://// DESCRIPTION: Calls the Clock device library to initialize the MBS input // clock.//// RETURN: Resulting error condition//// NOTES: None//-----------------------------------------------------------------------------//tmErrorCode_tMbsInitClock ( ptmdlMbsInstance_t pMbsInst // I: ptr to MBS instance data ){ tmErrorCode_t status = TM_OK; tmInstance_t clockInst; tmdlClockSrcType_t clockSrc; tmdlClockFuncDescr_t clockDescriptor; tmdlClockInstanceSetup_t clockSetup; tmdlMbs2_clockFreq_t clockFreq;#if (TMFL_PNX_ID == 8550) tmUnitSelect_t clockUnit; tmUnitSelect_t mbsUnit; // the PNX8550 supports 3 units across 2 clock modules if (pMbsInst->unit == tmUnit2) { clockUnit = tmUnit1; mbsUnit = tmUnit0; } else { clockUnit = tmUnit0; mbsUnit = pMbsInst->unit; } if ((status = tmdlClockOpenM (&clockInst, clockUnit)) != TM_OK) { return status; } clockSetup.unitNumber = mbsUnit;#else if ((status = tmdlClockOpen (&clockInst)) != TM_OK) { return status; } clockSetup.unitNumber = pMbsInst->unit;#endif clockSetup.moduleId = MBS_119_MOD_ID; clockSetup.clockUnitId = TMDL_CLK_DEFAULT; if ((status = tmdlClockInstanceSetup (clockInst, &clockSetup)) == TM_OK) { clockSrc = tmdlClockTypeFunc; clockDescriptor.funcClockId = tmdlFuncDdsPll; clockDescriptor.funcDivider = 1; clockDescriptor.funcUseInvertedClock = False; if ((status = tmdlClockSetSrc (clockInst, clockSrc, &clockDescriptor)) == TM_OK) { status = tmdlClockEnable (clockInst, True); } } tmdlClockClose (clockInst); if (status == TM_OK) { clockFreq = tmdlMbs2_CfgGetClockFrequency (pMbsInst->unit); status = MbsSetClockFreq (pMbsInst, clockFreq); // eh04#468 gMbsInitialClockFreq [pMbsInst->unit] = clockFreq;// tmbslCorePrintf(1,0,"set inital clocl unit %d frq %d\n", pMbsInst->unit, clockFreq); // eh04#468 END } return status;} // MbsInitClock#if (TMFL_OS_IS_CE && (TMFL_CPU == TMFL_CPU_R3940))#pragma optimize( "", on )#endif//-----------------------------------------------------------------------------// FUNCTION: MbsInitHorzScaling://// DESCRIPTION: Initializes the register values relating to horizontal scaling.//// RETURN: Resulting error condition//// NOTES: None//-----------------------------------------------------------------------------//tmErrorCode_tMbsInitHorzScaling ( ptmdlMbsInstance_t pMbsInst, // I: pointer to instance data ptmdlMbsTaskInfo_t pTask // I: pointer to task information ){ tmErrorCode_t status = TM_OK; Int32 inputWidth; Int32 outputWidth; UInt32 coefOutputWidth; UInt32 multBase = 0x100; UInt32 multSign = 1; Int32 multShift = 1; Int32 startPhase; Bool scaling = True; // assume a scaling task Bool needDevLibCoeff; Bool panoramicMode; Int32 shift = 0; UInt32 horzScale = MBS_HSP_SCALE_UNITY; pUInt32 pLoadCmd, pLoadCoeff; union _mbsModeCtrl modeControl; union _mbsHorzInitialZoom horzInitialZoom; union _mbsHorzPhaseCtrl horzPhaseCtrl; ptmdlMbsTaskDescriptor_t pdlTaskDescr = &(pTask->dlTaskDescr); tmdlMbsCoeffDescr_t horzDefaultDescr = {tmdlMbsFilterBypass, tmdlMbsPhases64, 6, True }; ptmdlMbsCoeffDescr_t pHorzCoeffDescr = &horzDefaultDescr; Int32 leftBorder, rightBorder; Int32 modifiedLeftBorder, modifiedRightBorder, modifiedLeftBorderPhase; UInt32 bufferWidth; (void) pMbsInst; inputWidth = pdlTaskDescr->inputBuffer.rect.lr.x - pdlTaskDescr->inputBuffer.rect.ul.x; outputWidth = pdlTaskDescr->outputBuffer.rect.lr.x - pdlTaskDescr->outputBuffer.rect.ul.x; bufferWidth = pdlTaskDescr->inputBuffer.bufFormat.imageWidth; modifiedLeftBorder = leftBorder = pdlTaskDescr->inputBuffer.rect.ul.x; modifiedRightBorder = rightBorder = pdlTaskDescr->inputBuffer.rect.lr.x; pLoadCmd = pTask->pNextCmd; pLoadCoeff = pLoadCmd + 1; panoramicMode = pdlTaskDescr->horzSetup.panoramaEnable;// This is here to handle the case where initially it looks like we will be// downscaling in transposed mode, but we find that after rounding, etc. we // need to switch to normal polyphase mode. MbsInitHorzScaling_restart: // assume no panorama mode pTask->pCtrlRegs [tlHorzScaleZoomDelta] = 0; pTask->pCtrlRegs [tlHorzScaleZoomChange] = 0; if (pTask->srcFormatInfo.bits.rgb != pTask->dstFormatInfo.bits.rgb) { MBS2_ERR_CHECK( inputWidth == outputWidth, TMDL_ERR_MBS_NOT_SUPPORTED, "MbsInitHorzScaling: Color Space Conv & Horz Scaling not Supported"); // color space conversion status = MbsSetColorSpaceConv (pTask); scaling = False; } else { // horizontal scaling modeControl.u32 = pTask->pCtrlRegs [tlModeControl]; horzInitialZoom.u32 = pTask->pCtrlRegs [tlHorzScaleZoom]; horzPhaseCtrl.u32 = pTask->pCtrlRegs [tlHorzScaleControl]; if (pdlTaskDescr->horzSetup.userCoeffs) { // using user supplied coefficients if (pdlTaskDescr->horzSetup.coeffDescr.phaseMode == tmdlMbsPhasesInterpolate) { pTask->horzCoeffs = 0; } else { DBG_ASSERT(pdlTaskDescr->horzSetup.pCoeffs != Null); pTask->pHorzCoeff = pTask->pNextCmd; ++pTask->pHorzCoeff; pTask->horzCoeffs = gPhases [pdlTaskDescr->horzSetup.coeffDescr.phaseMode]; MbsLoadCoeff (&(pTask->pNextCmd), tmdlMbsHorCoeff, pdlTaskDescr->horzSetup.coeffDescr.phaseMode, pdlTaskDescr->horzSetup.pCoeffs); } } else { // using default DevLib coefficients needDevLibCoeff = True; // assume we need filters enabled if (inputWidth == outputWidth) { if ((pdlTaskDescr->horzSetup.filterUnity) || (panoramicMode)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -