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

📄 tmdlmbs2_support.c

📁 PNX1500上做视频缩放MBS的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
//              value.//// RETURN:      programmed chroma dto offset value//// NOTES:       chromaOffset[13:10] = VSP_OFFSET_C[13:10]//                           [9:0]  = (VSP_OFFSET_C[9:8] + VSP_OFFSET_0[9:0]) //                                    & 0x3FF////              if 420 format use VSP_OFFSET_0[9:0] >> 1//-----------------------------------------------------------------------------//UInt32MbsChromaOffset2ProgVal (    tmUnitSelect_t  unit,    UInt32          dtoOffsetC,     //  chroma dto Offset    UInt32          dtoOffsetL,     //  luma dto Offset    Bool            bYUV420Format   //  TRUE - 420 format, False - 422 format    ){    UInt32  mask = gMbsDtoLineMask [unit] >> 8;    dtoOffsetC = dtoOffsetC >> 8;    dtoOffsetL = (dtoOffsetL >> 8) & 3;    if (bYUV420Format)    {        dtoOffsetL = dtoOffsetL >> 1;    }    return ((dtoOffsetC & mask) + (((dtoOffsetC & 3) - dtoOffsetL) & 3));}   //  MbsChromaOffset2ProgVal//-----------------------------------------------------------------------------// FUNCTION:    MbsChromaProgVal2Offset://// DESCRIPTION: Converts the chroma programmed dto Offset value to the actual//              dto offset value.//// RETURN:      chroma dto offset value//// NOTES:       chromaOffset[13:10] = VSP_OFFSET_C[13:10]//                           [9:0]  = (VSP_OFFSET_C[9:8] + VSP_OFFSET_0[9:0]) //                                    & 0x3FF////              if 420 format use VSP_OFFSET_0[9:0] >> 1//-----------------------------------------------------------------------------//UInt32MbsChromaProgVal2Offset (    tmUnitSelect_t  unit,    UInt32          progVal,        //  prgrammed chroma dto Offset    UInt32          dtoOffsetL,     //  luma dto Offset    Bool            bYUV420Format   //  TRUE - 420 format, False - 422 format    ){    progVal = progVal << 8;    dtoOffsetL = dtoOffsetL & 0x3FF;    if (bYUV420Format)    {        dtoOffsetL = dtoOffsetL >> 1;    }    return ((progVal & gMbsDtoLineMask [unit]) +             (((progVal & 0x300) + dtoOffsetL) & 0x3FF));}   //  MbsChromaProgVal2Offset//-----------------------------------------------------------------------------// FUNCTION:    MbsClipMeasRect://// DESCRIPTION: Clips the measurement rectangle to the src slice rectangle.//// RETURN:      True  clipped completely//// NOTES:       //-----------------------------------------------------------------------------//BoolMbsClipMeasRect (    ptmRect_t   pMeasRect,          // IO: ptr to rectangle to clip    ptmRect_t   pSliceRect          //  I: ptr to clip rectangle    )    {    Bool        clipped = True;         //  assume window is clipped    if (pMeasRect->ul.x < pSliceRect->ul.x)    {        //  measurement window starts left of measured slice, so set to 0        pMeasRect->ul.x = pSliceRect->ul.x;    }    if (pMeasRect->ul.y < pSliceRect->ul.y)    {        //  measurement window starts above measured slice, so set to 0        pMeasRect->ul.y = pSliceRect->ul.y;    }    if (pMeasRect->lr.x > pSliceRect->lr.x)    {        //  measurement window ends beyond measured slice, set to slice width        pMeasRect->lr.x = pSliceRect->lr.x;    }    if (pMeasRect->lr.y > pSliceRect->lr.y)    {        //  measurement window ends below measured slice, set to slice height        pMeasRect->lr.y = pSliceRect->lr.y;    }    if ((pMeasRect->ul.x < pMeasRect->lr.x)        &&        (pMeasRect->ul.y < pMeasRect->lr.y))    {        //  part of the measurement window still falls within the slice        clipped = False;    }    return clipped;}   //  MbsClipMeasRect//-----------------------------------------------------------------------------// FUNCTION:    MbsDisableTaskDispatching//// DESCRIPTION: Disables interrupts and destroys the OS interrupt.//// RETURN:      None//// NOTES:       Assumes only called when closing the last instance for the unit.//-----------------------------------------------------------------------------//voidMbsDisableTaskDispatching (    ptmdlMbsInstance_t       pMbsInst       //  I: ptr to MBS instance data    ){    //  destroy the interrupt for this unit    if (mbsInterruptInitialized [pMbsInst->unit])    {        gpRegs [pMbsInst->unit]->event.intEnable.u32 = MBS_INT_DISABLE;        tmosalIntDestroy (mbsIntHandle [pMbsInst->unit]);        mbsInterruptInitialized [pMbsInst->unit] = False;    }    mbsTaskDispInitialized [pMbsInst->unit] = False;}   //  MbsDisableTaskDispatching//-----------------------------------------------------------------------------// FUNCTION:    MbsDQTasks://// DESCRIPTION: Checks for Queued tasks and places them in the HW FIFO if room.//// RETURN:      none//// NOTES:       None      //-----------------------------------------------------------------------------//voidMbsDQTasks (    tmUnitSelect_t  mbsUnit    ){    UInt32              queuePriority;        ptmdlMbsTaskInfo_t  pTask;    union _mbsTaskFifo  taskFifoReg;    queuePriority = tmdlMbsTaskPriority_Count - 1;    do    {        //  check for room in the HW FIFO        if (MBS_Q_IS_FULL(fifoQ [mbsUnit]))        {            return;        }        else    //  room in HW FIFO        {            //  check for any Queue'd tasks            if (!MBS_Q_IS_EMPTY(taskQ [queuePriority] [mbsUnit]))            {                //  get task in Queue                MBS_Q_READ(taskQ [queuePriority] [mbsUnit], pTask);                if (pTask->abortTask)                {                    //  signal we have aborted the task, if abort flag is set                    pTask->taskStatus = tmdlMbsTaskAborted;                    pTask->abortTask = False;                }                else                {                    //  place in HW FIFO                    fifoQ [mbsUnit].elems [fifoQ [mbsUnit].writePtr] = pTask;                    fifoQ [mbsUnit].writePtr =                         (fifoQ [mbsUnit].writePtr + 1) & fifoQ [mbsUnit].mask;                    pTask->taskStatus = tmdlMbsTaskInFifo;				// eh04#468                    if (True == pTask->clockFreqUpdate)                    {                        // Set clock to new frequency.                        MbsUnitSetClockFreq(mbsUnit, pTask->clockFreq);                    }                    else                    {                        // Set clock back to original value.                        MbsUnitSetClockFreq(mbsUnit, gMbsInitialClockFreq[mbsUnit]);                    }									// eh04#468 END                    taskFifoReg.bits.taskCmd = MBS_TC_GET_DESCRIPTOR;                    taskFifoReg.bits.taskBaseAddr = pTask->taskBase >> 3;                    gpRegs [mbsUnit]->c.taskFifo.u32  = taskFifoReg.u32;                }            }        }    } while (queuePriority-- > 0);}   //  MbsDQTasks//-----------------------------------------------------------------------------// FUNCTION:    MbsFlushCoeffLoad://// DESCRIPTION: Flushes the coefficient portion of the task list back to memory.//// RETURN:      none//// NOTES:       None//-----------------------------------------------------------------------------//voidMbsFlushCoeffLoad (    pUInt32             pLoadCmd,       //  I: pointer to place command    tmdlMbsPhaseMode_t  phaseMode       //  I: phase mode (number of phases)    ){    UInt32  numPhases;    numPhases = gPhases [phaseMode];    if (numPhases != 0)    {        tmmlCacheFlush (pLoadCmd, (2 * numPhases + 2) * sizeof(UInt32));    }}   //  MbsFlushCoeffLoad//-----------------------------------------------------------------------------// FUNCTION:    MbsInit://// DESCRIPTION: Determines the number of units in the system and stores the //              address of the MMIO registers.//// RETURN:      error if unsupported harware version//// NOTES:       None//-----------------------------------------------------------------------------//tmErrorCode_tMbsInit (    pInt32  pUnitCount          //  O: receives number of units    )    {    Int32                   i;    Int32                   lineSize = 2047;        // register limit    Int32                   lineCount = 2047;       // register limit    Int32                   lineBufferSize = 2048;    tmbslCoreModuleInfo_t   moduleInfo;    ptmdlMbsRegs_t          pRegs;    tmBlockId_t             blockId;    union _mbsFeature       featureReg;    union _mbsPowerdown     powerdownReg;    tmErrorCode_t           status = TM_OK;    if (gNumberOfUnits == 0)    {        MbsInitRegDefaults ();        // count number of MBS units        while ((gNumberOfUnits < MBS_MAX_UNITCOUNT)               &&               (tmbslCoreGetModuleInfo (MBS_119_MOD_ID,                                        (tmUnitSelect_t) gNumberOfUnits,                                        &moduleInfo) == TM_OK))        {            gpRegs[gNumberOfUnits] = moduleInfo.pMmioVirtAddr;            powerdownReg.u32 = gpRegs [gNumberOfUnits]->powerdown.u32;            powerdownReg.bits.power_down = MBS_POWER_UP;            gpRegs [gNumberOfUnits]->powerdown.u32 = powerdownReg.u32;            mbsIntParam [gNumberOfUnits] = gNumberOfUnits;            gNumberOfUnits++;        }        gSupportedInputFormats.dataClass   = gClassList;        gSupportedInputFormats.dataType    = gTypeList;        gSupportedInputFormats.dataSubtype = gInputSubTypeList;        gSupportedOutputFormats.dataClass   = gClassList;        gSupportedOutputFormats.dataType    = gTypeList;        gSupportedOutputFormats.dataSubtype = gOutputSubTypeList;        i = gNumberOfUnits - 1;        while ((i >= 0) && (status == TM_OK))        {            // eh04#468            gMbsUnitClock [i] = Null;            // eh04#468 END			            mbsInstanceCount [i] = 0;            mbsInStreamMode [i] = False;            gMbsCaps [i].size = sizeof(tmdlMbsCapabilities_t);            gMbsCaps [i].version.compatibilityNr = MBS_DL_COMP_NUM;            gMbsCaps [i].version.majorVersionNr  = MBS_DL_MAJOR_VER;            gMbsCaps [i].version.minorVersionNr  = MBS_DL_MINOR_VER;            gMbsCaps [i].numOfInstances = 65535;            gMbsCaps [i].colorSpaceConv = True;            gMbsCaps [i].deinterlacing = False;            gMbsCaps [i].eddi = False;            gMbsCaps [i].measurement = False;            gMbsCaps [i].slicing = True;            gMbsCaps [i].pInputTypes  = &gSupportedInputFormats;            gMbsCaps [i].pOutputTypes = &gSupportedOutputFormats;            gMbsCaps [i].bufferByteAlign = 8;            gMbsCaps [i].bufferStrideMult = 8;            lineSize  = 2047;   //  register size limitation            lineCount = 2047;   //  currently all versions support 2047 lines            gMbsChipBugs [i] = tmdlMbsBugsNone;            gMbsFeatures [i] = tmdlMbsFeatureNone;            pRegs = gpRegs [i];            blockId.u32 = pRegs->blockId.u32;            if (blockId.u32 == 0xdeadabba)            {                //  this is for quickturn testing                --gNumberOfUnits;            }            else            {                switch (blockId.bits.majorRevision)                {                    //  full featured MBS - tapeout 1                case 1:                    gMbsCaps [i].maxNrOfClutEntries = 256;                    gMbsFeatures [i] = (tmdlMbsFeatureDeint |                                         tmdlMbsFeatureEddi  |                                        tmdlMbsFeatureMeas);                    gMbsTlCount [i] = tlMbs2EddiCount;                    gMbsCaps [i].deinterlacing = True;                    gMbsCaps [i].eddi = True;                    gMbsCaps [i].measurement = True;                    switch (blockId.bits.minorRevision)                    {                    case 0:

⌨️ 快捷键说明

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