Merge pull request #2330 from ruil2/mt_build_1
fix build issue when some macro turn on
This commit is contained in:
commit
d11f12db54
@ -207,7 +207,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx,
|
||||
|
||||
WelsEmms();
|
||||
|
||||
MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG, "[MT] DynamicAdjustSlicing(), iDid= %d, iCountNumMb= %d", iCurDid, kiCountNumMb);
|
||||
MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_DEBUG, "[MT] DynamicAdjustSlicing(), iDid= %d, iCountNumMb= %d", iCurDid, kiCountNumMb);
|
||||
|
||||
iSliceIdx = 0;
|
||||
while (iSliceIdx + 1 < kiCountSliceNum) {
|
||||
@ -232,7 +232,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx,
|
||||
return;
|
||||
}
|
||||
iRunLen[iSliceIdx] = iNumMbAssigning;
|
||||
MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG,
|
||||
MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_DEBUG,
|
||||
"[MT] DynamicAdjustSlicing(), uiSliceIdx= %d, iSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d",
|
||||
iSliceIdx, pSliceInLayer[iSliceIdx].iSliceComplexRatio * 1.0f / INT_MULTIPLY,
|
||||
pSliceInLayer[iSliceIdx].iCountMbNumInSlice,
|
||||
@ -241,9 +241,9 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx,
|
||||
iMaximalMbNum = iMbNumLeft - (kiCountSliceNum - iSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts
|
||||
}
|
||||
iRunLen[iSliceIdx] = iMbNumLeft;
|
||||
MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG,
|
||||
MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_DEBUG,
|
||||
"[MT] DynamicAdjustSlicing(), iSliceIdx= %d, pSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d",
|
||||
iSliceIdx, pSliceComplexRatio[iSliceIdx] * 1.0f / INT_MULTIPLY, pSliceCtx->pCountMbNumInSlice[iSliceIdx], iMbNumLeft);
|
||||
iSliceIdx, pSliceInLayer[iSliceIdx].iSliceComplexRatio * 1.0f / INT_MULTIPLY, pSliceInLayer[iSliceIdx].iCountMbNumInSlice, iMbNumLeft);
|
||||
|
||||
pCurDqLayer->bNeedAdjustingSlicing = !DynamicAdjustSlicePEncCtxAll (pCurDqLayer, iRunLen);
|
||||
}
|
||||
@ -257,10 +257,11 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
|
||||
int32_t iThreadNum = 0;
|
||||
int32_t iIdx = 0;
|
||||
int32_t iReturn = ENC_RETURN_SUCCESS;
|
||||
|
||||
if (NULL == ppCtx || NULL == pCodingParam || NULL == *ppCtx || iCountBsLen <= 0)
|
||||
return 1;
|
||||
|
||||
#if defined(ENABLE_TRACE_MT)
|
||||
SLogContext* pLogCtx = & ((*ppCtx)->sLogCtx);
|
||||
#endif
|
||||
pMa = (*ppCtx)->pMemAlign;
|
||||
pPara = pCodingParam;
|
||||
iNumSpatialLayers = pPara->iSpatialLayerNum;
|
||||
@ -291,7 +292,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
|
||||
pSmt->pFSliceDiff = fopen ("slice_time.txt", "wt+");
|
||||
#endif//MT_DEBUG
|
||||
|
||||
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "encpEncCtx= 0x%p", (void*) *ppCtx);
|
||||
MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "encpEncCtx= 0x%p", (void*) *ppCtx);
|
||||
|
||||
char name[SEM_NAME_MAX] = {0};
|
||||
WELS_GCC_UNUSED WELS_THREAD_ERROR_CODE err = 0;
|
||||
@ -305,24 +306,24 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
|
||||
|
||||
WelsSnprintf (name, SEM_NAME_MAX, "ee%d%s", iIdx, pSmt->eventNamespace);
|
||||
err = WelsEventOpen (&pSmt->pExitEncodeEvent[iIdx], name);
|
||||
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pExitEncodeEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
|
||||
MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pExitEncodeEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
|
||||
WelsSnprintf (name, SEM_NAME_MAX, "tm%d%s", iIdx, pSmt->eventNamespace);
|
||||
err = WelsEventOpen (&pSmt->pThreadMasterEvent[iIdx], name);
|
||||
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pThreadMasterEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
|
||||
MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pThreadMasterEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
|
||||
// length of semaphore name should be system constrained at least on mac 10.7
|
||||
WelsSnprintf (name, SEM_NAME_MAX, "ud%d%s", iIdx, pSmt->eventNamespace);
|
||||
err = WelsEventOpen (&pSmt->pUpdateMbListEvent[iIdx], name);
|
||||
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pUpdateMbListEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
|
||||
MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pUpdateMbListEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
|
||||
WelsSnprintf (name, SEM_NAME_MAX, "fu%d%s", iIdx, pSmt->eventNamespace);
|
||||
err = WelsEventOpen (&pSmt->pFinUpdateMbListEvent[iIdx], name);
|
||||
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d", iIdx, name, err,
|
||||
MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d", iIdx, name, err,
|
||||
errno);
|
||||
WelsSnprintf (name, SEM_NAME_MAX, "sc%d%s", iIdx, pSmt->eventNamespace);
|
||||
err = WelsEventOpen (&pSmt->pSliceCodedEvent[iIdx], name);
|
||||
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
|
||||
MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
|
||||
WelsSnprintf (name, SEM_NAME_MAX, "rc%d%s", iIdx, pSmt->eventNamespace);
|
||||
err = WelsEventOpen (&pSmt->pReadySliceCodingEvent[iIdx], name);
|
||||
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pReadySliceCodingEvent%d = 0x%p named(%s) ret%d err%d", iIdx,
|
||||
MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pReadySliceCodingEvent%d = 0x%p named(%s) ret%d err%d", iIdx,
|
||||
(void*)pSmt->pReadySliceCodingEvent[iIdx], name, err, errno);
|
||||
|
||||
pSmt->pThreadBsBuffer[iIdx] = (uint8_t*)pMa->WelsMalloc (iCountBsLen, "pSmt->pThreadBsBuffer");
|
||||
@ -336,7 +337,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
|
||||
|
||||
WelsSnprintf (name, SEM_NAME_MAX, "scm%s", pSmt->eventNamespace);
|
||||
err = WelsEventOpen (&pSmt->pSliceCodedMasterEvent, name);
|
||||
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedMasterEvent named(%s) ret%d err%d", name, err, errno);
|
||||
MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedMasterEvent named(%s) ret%d err%d", name, err, errno);
|
||||
|
||||
iReturn = WelsMutexInit (&pSmt->mutexSliceNumUpdate);
|
||||
WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))
|
||||
@ -351,7 +352,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
|
||||
iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError);
|
||||
WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))
|
||||
|
||||
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iMultipleThreadIdc= %d",
|
||||
MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iMultipleThreadIdc= %d",
|
||||
pPara->iMultipleThreadIdc,
|
||||
(*ppCtx)->iMaxSliceCount);
|
||||
return 0;
|
||||
@ -567,7 +568,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
|
||||
WelsThreadSetName ("OpenH264Enc_CodingSliceThreadProc");
|
||||
|
||||
do {
|
||||
MT_TRACE_LOG (pEncPEncCtx, WELS_LOG_INFO,
|
||||
MT_TRACE_LOG (&(pEncPEncCtx->sLogCtx), WELS_LOG_INFO,
|
||||
"[MT] CodingSliceThreadProc(), try to call WelsMultipleEventsWaitSingleBlocking(pEventsList= %p %p %p), pEncPEncCtx= %p!",
|
||||
pEventsList[0], pEventsList[1], pEventsList[1], (void*)pEncPEncCtx);
|
||||
iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount,
|
||||
@ -760,7 +761,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
|
||||
);
|
||||
#endif//SLICE_INFO_OUTPUT
|
||||
|
||||
MT_TRACE_LOG (pEncPEncCtx, WELS_LOG_INFO,
|
||||
MT_TRACE_LOG (&(pEncPEncCtx->sLogCtx), WELS_LOG_INFO,
|
||||
"[MT] CodingSliceThreadProc(), coding_idx %d, iPartitionId %d, uiSliceIdx %d, iSliceSize %d, count_mb_slice %d, iEndMbInPartition %d, pCurDq->pLastCodedMbIdxOfPartition[%d] %d\n",
|
||||
pEncPEncCtx->iCodingIndex, kiPartitionId, iSliceIdx, iSliceSize,
|
||||
pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx].iCountMbNumInSlice,
|
||||
@ -819,7 +820,7 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) {
|
||||
|
||||
++ iIdx;
|
||||
}
|
||||
MT_TRACE_LOG (pCtx, WELS_LOG_INFO, "CreateSliceThreads() exit..");
|
||||
MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_INFO, "CreateSliceThreads() exit..");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -899,7 +900,7 @@ int32_t AdjustBaseLayer (sWelsEncCtx* pCtx) {
|
||||
iT0 = WelsTime() - iT0;
|
||||
if (pCtx->pSliceThreading->pFSliceDiff) {
|
||||
fprintf (pCtx->pSliceThreading->pFSliceDiff,
|
||||
"%6"PRId64" us adjust time at base spatial layer, iNeedAdj %d, DynamicAdjustSlicing()\n",
|
||||
"%6" PRId64" us adjust time at base spatial layer, iNeedAdj %d, DynamicAdjustSlicing()\n",
|
||||
iT0, iNeedAdj);
|
||||
}
|
||||
#endif//MT_DEBUG
|
||||
@ -944,7 +945,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) {
|
||||
iT1 = WelsTime() - iT1;
|
||||
if (pCtx->pSliceThreading->pFSliceDiff) {
|
||||
fprintf (pCtx->pSliceThreading->pFSliceDiff,
|
||||
"%6"PRId64" us adjust time at spatial layer %d, iNeedAdj %d, DynamicAdjustSlicing()\n",
|
||||
"%6" PRId64" us adjust time at spatial layer %d, iNeedAdj %d, DynamicAdjustSlicing()\n",
|
||||
iT1, iCurDid, iNeedAdj);
|
||||
}
|
||||
#endif//MT_DEBUG
|
||||
@ -980,22 +981,21 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t
|
||||
pPara = pCtx->pSvcParam;
|
||||
while (iSpatialIdx < iSpatialNum) {
|
||||
const int32_t kiDid = pDidList[iSpatialIdx];
|
||||
SSliceConfig* pSliceArgument = &pPara->sDependencyLayers[kiDid].sSliceArgument;
|
||||
SSliceArgument* pSliceArgument = &pPara->sSpatialLayers[kiDid].sSliceArgument;
|
||||
SDqLayer* pCurDq = pCtx->ppDqLayerList[kiDid];
|
||||
SSlice* pSliceInLayer = pCurDq->sLayerInfo.pSliceInLayer;
|
||||
SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx;
|
||||
const uint32_t kuiCountSliceNum = pSliceCtx->iSliceNumInFrame;
|
||||
if (pCtx->pSliceThreading) {
|
||||
if (pCtx->pSliceThreading->pFSliceDiff
|
||||
&& ((pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pSliceArgument->uiSliceMode == SM_AUTO_SLICE))
|
||||
&& ((pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pSliceArgument->uiSliceMode == SM_SIZELIMITED_SLICE))
|
||||
&& pPara->iMultipleThreadIdc > 1
|
||||
&& pPara->iMultipleThreadIdc >= kuiCountSliceNum) {
|
||||
uint32_t i = 0;
|
||||
uint32_t uiMaxT = 0;
|
||||
int32_t iMaxI = 0;
|
||||
while (i < kuiCountSliceNum) {
|
||||
if (pSliceInLayer[i] != NULL)
|
||||
fprintf (pCtx->pSliceThreading->pFSliceDiff, "%6d us consume_time coding_idx %d iDid %d pSlice %d\n",
|
||||
fprintf (pCtx->pSliceThreading->pFSliceDiff, "%6d us consume_time coding_idx %d iDid %d pSlice %d\n",
|
||||
pSliceInLayer[i].uiSliceConsumeTime, pCtx->iCodingIndex, kiDid, i /*/ 1000*/);
|
||||
if (pSliceInLayer[i].uiSliceConsumeTime > uiMaxT) {
|
||||
uiMaxT = pSliceInLayer[i].uiSliceConsumeTime;
|
||||
|
Loading…
x
Reference in New Issue
Block a user