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); }
static Void VcapVencVdecVdis_ipcBitsSendFullBitBufs(OSA_QueHndl *fullQue) { VCODEC_BITSBUF_LIST_S fullBufList; VCODEC_BITSBUF_S *pBuf; Int status; fullBufList.numBufs = 0; while((status = OSA_queGet(fullQue,(Int32 *)(&pBuf),OSA_TIMEOUT_NONE)) == 0) { OSA_assert(fullBufList.numBufs < VCODEC_BITSBUF_MAX); fullBufList.bitsBuf[fullBufList.numBufs] = *pBuf; fullBufList.numBufs++; VcapVencVdecVdis_FreeBitBufFree(pBuf); if (fullBufList.numBufs == VCODEC_BITSBUF_MAX) { break; } } if (fullBufList.numBufs) { Vdec_putBitstreamBuffer(&fullBufList); } }
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); }