コード例 #1
0
static Void VcapVencVdecVdis_ipcBitsQueEmptyBitBufs(VcapVencVdecVdis_res resolution, OSA_QueHndl       *emptyQue)
{
    VCODEC_BITSBUF_LIST_S emptyBufList;
    VCODEC_BITSBUF_S *pBuf;
    VDEC_BUF_REQUEST_S reqInfo;
    Int i;
    Int status;
    UInt32 bitBufSize;

    bitBufSize = MCFW_IPCBITS_GET_BITBUF_SIZE(resolution.width,
                                                resolution.height);
    if (bitBufSize <=0 )
        return;

    emptyBufList.numBufs = 0;
    reqInfo.numBufs = VCODEC_BITSBUF_MAX;
    reqInfo.reqType = VDEC_BUFREQTYPE_BUFSIZE;
    for (i = 0; i < VCODEC_BITSBUF_MAX; i++)
    {
        reqInfo.u[i].minBufSize = bitBufSize;
    }
    Vdec_requestBitstreamBuffer(&reqInfo, &emptyBufList, 0);
    for (i = 0; i < emptyBufList.numBufs; i++)
    {
        pBuf = VcapVencVdecVdis_FreeBitBufAlloc();
        OSA_assert(pBuf != NULL);
        *pBuf = emptyBufList.bitsBuf[i];
        OSA_assert(pBuf->bufSize >= bitBufSize );

        status = OSA_quePut(emptyQue,(Int32)pBuf,OSA_TIMEOUT_NONE);
        OSA_assert(status == 0);
    }
}
コード例 #2
0
static Void VcapVencVdecVdis_ipcBitsProcessFullBufs(VcapVencVdecVdis_IpcBitsCtrlThrObj *thrObj,
        VcapVencVdecVdis_IpcBitsCtrlFileObj *fObj)
{
    VCODEC_BITSBUF_LIST_S fullBufList;
    VCODEC_BITSBUF_S *pFullBuf;
    VCODEC_BITSBUF_S *pEmptyBuf;
    Int i,status;
    static Int printStatsInterval = 0;

#ifdef IPC_BITS_DEBUG
    if ((printStatsInterval % MCFW_IPCBITS_INFO_PRINT_INTERVAL) == 0)
    {
        OSA_printf("MCFW_IPCBITS:%s:INFO: periodic print..",__func__);
    }
#endif
    printStatsInterval++;

    Venc_getBitstreamBuffer(&fullBufList, 0);

    for (i = 0; i < fullBufList.numBufs; i++)
    {
        VcapVencVdecVdis_updateStatistics(&fullBufList.bitsBuf[i]);

        if (fullBufList.bitsBuf[i].chnId < Venc_getPrimaryChannels())
        {
            status = OSA_queGet(&thrObj->bufQFreeBufs,(Int32 *)(&pEmptyBuf),
                                OSA_TIMEOUT_FOREVER);
            OSA_assert(status == 0);
            pFullBuf = &fullBufList.bitsBuf[i];
            VcapVencVdecVdis_ipcBitsCopyBitBufInfo(pEmptyBuf,pFullBuf);
            VcapVencVdecVdis_ipcBitsCopyBitBufDataMem2Mem(pEmptyBuf,pFullBuf);
            status = OSA_quePut(&thrObj->bufQFullBufs,
                                (Int32)pEmptyBuf,OSA_TIMEOUT_NONE);
            OSA_assert(status == 0);
        }
    }
    if (fObj->enableFWrite)
    {
        VcapVencVdecVdis_ipcBitsWriteBitsToFile(fObj->fpWrHdr,
                                                fObj->fpWrData,
                                                fObj->fpWrMvData,
                                                &fullBufList,
                                                fObj->maxFileSize,
                                                fObj->fwriteEnableBitMask,
                                                fObj->wrapOccuredHdr,
                                                fObj->wrapOccuredBuf);

    }
    Venc_releaseBitstreamBuffer(&fullBufList);
}
コード例 #3
0
static Void VcapVencVdecVdis_ipcBitsProcessFullBufs(VcapVencVdecVdis_IpcBitsCtrlThrObj *thrObj,
                                       VcapVencVdecVdis_IpcBitsCtrlFileObj *fObj,
                                       VcapVencVdecVdis_ChInfo decChInfo[])
{
    VCODEC_BITSBUF_LIST_S fullBufList;
    VCODEC_BITSBUF_S *pFullBuf;
    VCODEC_BITSBUF_S *pEmptyBuf;
    Int i,status;
    static Int printStatsInterval = 0;

    #ifdef IPC_BITS_DEBUG
    if ((printStatsInterval % MCFW_IPCBITS_INFO_PRINT_INTERVAL) == 0)
    {
        OSA_printf("MCFW_IPCBITS:%s:INFO: periodic print..",__func__);
    }
    #endif
    printStatsInterval++;

    Venc_getBitstreamBuffer(&fullBufList, 0);

    for (i = 0; i < fullBufList.numBufs; i++)
    {
        VcapVencVdecVdis_updateStatistics(&fullBufList.bitsBuf[i]);

        if (fullBufList.bitsBuf[i].chnId < Venc_getPrimaryChannels())
        {
            pFullBuf = &fullBufList.bitsBuf[i];
GET_BUF:
            status = OSA_queGet(&thrObj->bufQFreeBufs,(Int32 *)(&pEmptyBuf),
                                OSA_TIMEOUT_FOREVER);
            OSA_assert(status == 0);

            /* If empty buf size not enough to hold rcvd buf <e.g, in multiple resolution scenarios>,
                        * put back the buffer into freeBufs Q
                        */
            if (pFullBuf->filledBufSize > pEmptyBuf->bufSize)
            {
                status = OSA_quePut(&thrObj->bufQFreeBufs,(Int32)pEmptyBuf,
                                    OSA_TIMEOUT_FOREVER);
                OSA_assert(status == 0);
                goto GET_BUF;
            }
            VcapVencVdecVdis_ipcBitsCopyBitBufInfo(pEmptyBuf,pFullBuf);
            VcapVencVdecVdis_ipcBitsCopyBitBufDataMem2Mem(pEmptyBuf,pFullBuf);
            VcapVencVdecVdis_setFrameTimeStamp(&(decChInfo[pEmptyBuf->chnId]),pEmptyBuf);
            status = OSA_quePut(&thrObj->bufQFullBufs,
                                (Int32)pEmptyBuf,OSA_TIMEOUT_NONE);
            OSA_assert(status == 0);
        }
    }
    if (fObj->enableFWrite)
    {
        VcapVencVdecVdis_ipcBitsWriteBitsToFile(fObj->fpWrHdr,
                                      fObj->fpWrData,
                                      fObj->fpWrMvData,
                                      &fullBufList,
                                      fObj->maxFileSize,
                                      fObj->fwriteEnableBitMask,
                                      fObj->enableLayerWrite,
                                      fObj->wrapOccuredHdr,
                                      fObj->wrapOccuredBuf);

    }
    Venc_releaseBitstreamBuffer(&fullBufList);
}