History

fix build issue when some macro turn on

Karina committed 10 years ago

Commit 67f4dcf1 parent 7bfb96b1 file · +24 −24Browse files

Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 1 file). Show all

Unified · Split

codec/encoder/core/src/slice_multi_threading.cpp+24−24
@@ -207,7 +207,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 206 unmodified lines
207207
208208 WelsEmms();
209209
210− MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG, "[MT] DynamicAdjustSlicing(), iDid= %d, iCountNumMb= %d", iCurDid, kiCountNumMb);
210+ MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_DEBUG, "[MT] DynamicAdjustSlicing(), iDid= %d, iCountNumMb= %d", iCurDid, kiCountNumMb);
211211
212212 iSliceIdx = 0;
213213 while (iSliceIdx + 1 < kiCountSliceNum) {
@@ -232,7 +232,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 18 unmodified lines
232232 return;
233233 }
234234 iRunLen[iSliceIdx] = iNumMbAssigning;
235− MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG,
235+ MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_DEBUG,
236236 "[MT] DynamicAdjustSlicing(), uiSliceIdx= %d, iSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d",
237237 iSliceIdx, pSliceInLayer[iSliceIdx].iSliceComplexRatio * 1.0f / INT_MULTIPLY,
238238 pSliceInLayer[iSliceIdx].iCountMbNumInSlice,
@@ -241,9 +241,9 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 2 unmodified lines
241241 iMaximalMbNum = iMbNumLeft - (kiCountSliceNum - iSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts
242242 }
243243 iRunLen[iSliceIdx] = iMbNumLeft;
244− MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG,
244+ MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_DEBUG,
245245 "[MT] DynamicAdjustSlicing(), iSliceIdx= %d, pSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d",
246− iSliceIdx, pSliceComplexRatio[iSliceIdx] * 1.0f / INT_MULTIPLY, pSliceCtx->pCountMbNumInSlice[iSliceIdx], iMbNumLeft);
246+ iSliceIdx, pSliceInLayer[iSliceIdx].iSliceComplexRatio * 1.0f / INT_MULTIPLY, pSliceInLayer[iSliceIdx].iCountMbNumInSlice, iMbNumLeft);
247247
248248 pCurDqLayer->bNeedAdjustingSlicing = !DynamicAdjustSlicePEncCtxAll (pCurDqLayer, iRunLen);
249249 }
@@ -257,10 +257,11 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 7 unmodified lines
257257 int32_t iThreadNum = 0;
258258 int32_t iIdx = 0;
259259 int32_t iReturn = ENC_RETURN_SUCCESS;
260−
261260 if (NULL == ppCtx || NULL == pCodingParam || NULL == *ppCtx || iCountBsLen <= 0)
262261 return 1;
263−
262+#if defined(ENABLE_TRACE_MT)
263+ SLogContext* pLogCtx = & ((*ppCtx)->sLogCtx);
264+#endif
264265 pMa = (*ppCtx)->pMemAlign;
265266 pPara = pCodingParam;
266267 iNumSpatialLayers = pPara->iSpatialLayerNum;
@@ -291,7 +292,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 24 unmodified lines
291292 pSmt->pFSliceDiff = fopen ("slice_time.txt", "wt+");
292293 #endif//MT_DEBUG
293294
294− MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "encpEncCtx= 0x%p", (void*) *ppCtx);
295+ MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "encpEncCtx= 0x%p", (void*) *ppCtx);
295296
296297 char name[SEM_NAME_MAX] = {0};
297298 WELS_GCC_UNUSED WELS_THREAD_ERROR_CODE err = 0;
@@ -305,24 +306,24 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 7 unmodified lines
305306
306307 WelsSnprintf (name, SEM_NAME_MAX, "ee%d%s", iIdx, pSmt->eventNamespace);
307308 err = WelsEventOpen (&pSmt->pExitEncodeEvent[iIdx], name);
308− MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pExitEncodeEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
309+ MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pExitEncodeEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
309310 WelsSnprintf (name, SEM_NAME_MAX, "tm%d%s", iIdx, pSmt->eventNamespace);
310311 err = WelsEventOpen (&pSmt->pThreadMasterEvent[iIdx], name);
311− MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pThreadMasterEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
312+ MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pThreadMasterEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
312313 // length of semaphore name should be system constrained at least on mac 10.7
313314 WelsSnprintf (name, SEM_NAME_MAX, "ud%d%s", iIdx, pSmt->eventNamespace);
314315 err = WelsEventOpen (&pSmt->pUpdateMbListEvent[iIdx], name);
315− MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pUpdateMbListEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
316+ MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pUpdateMbListEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
316317 WelsSnprintf (name, SEM_NAME_MAX, "fu%d%s", iIdx, pSmt->eventNamespace);
317318 err = WelsEventOpen (&pSmt->pFinUpdateMbListEvent[iIdx], name);
318− MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d", iIdx, name, err,
319+ MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d", iIdx, name, err,
319320 errno);
320321 WelsSnprintf (name, SEM_NAME_MAX, "sc%d%s", iIdx, pSmt->eventNamespace);
321322 err = WelsEventOpen (&pSmt->pSliceCodedEvent[iIdx], name);
322− MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
323+ MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedEvent%d named(%s) ret%d err%d", iIdx, name, err, errno);
323324 WelsSnprintf (name, SEM_NAME_MAX, "rc%d%s", iIdx, pSmt->eventNamespace);
324325 err = WelsEventOpen (&pSmt->pReadySliceCodingEvent[iIdx], name);
325− MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pReadySliceCodingEvent%d = 0x%p named(%s) ret%d err%d", iIdx,
326+ MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pReadySliceCodingEvent%d = 0x%p named(%s) ret%d err%d", iIdx,
326327 (void*)pSmt->pReadySliceCodingEvent[iIdx], name, err, errno);
327328
328329 pSmt->pThreadBsBuffer[iIdx] = (uint8_t*)pMa->WelsMalloc (iCountBsLen, "pSmt->pThreadBsBuffer");
@@ -336,7 +337,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 7 unmodified lines
336337
337338 WelsSnprintf (name, SEM_NAME_MAX, "scm%s", pSmt->eventNamespace);
338339 err = WelsEventOpen (&pSmt->pSliceCodedMasterEvent, name);
339− MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedMasterEvent named(%s) ret%d err%d", name, err, errno);
340+ MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedMasterEvent named(%s) ret%d err%d", name, err, errno);
340341
341342 iReturn = WelsMutexInit (&pSmt->mutexSliceNumUpdate);
342343 WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))
@@ -351,7 +352,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 8 unmodified lines
351352 iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError);
352353 WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))
353354
354− MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iMultipleThreadIdc= %d",
355+ MT_TRACE_LOG (pLogCtx, WELS_LOG_INFO, "RequestMtResource(), iThreadNum=%d, iMultipleThreadIdc= %d",
355356 pPara->iMultipleThreadIdc,
356357 (*ppCtx)->iMaxSliceCount);
357358 return 0;
@@ -567,7 +568,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 209 unmodified lines
567568 WelsThreadSetName ("OpenH264Enc_CodingSliceThreadProc");
568569
569570 do {
570− MT_TRACE_LOG (pEncPEncCtx, WELS_LOG_INFO,
571+ MT_TRACE_LOG (&(pEncPEncCtx->sLogCtx), WELS_LOG_INFO,
571572 "[MT] CodingSliceThreadProc(), try to call WelsMultipleEventsWaitSingleBlocking(pEventsList= %p %p %p), pEncPEncCtx= %p!",
572573 pEventsList[0], pEventsList[1], pEventsList[1], (void*)pEncPEncCtx);
573574 iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount,
@@ -760,7 +761,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 186 unmodified lines
760761 );
761762 #endif//SLICE_INFO_OUTPUT
762763
763− MT_TRACE_LOG (pEncPEncCtx, WELS_LOG_INFO,
764+ MT_TRACE_LOG (&(pEncPEncCtx->sLogCtx), WELS_LOG_INFO,
764765 "[MT] CodingSliceThreadProc(), coding_idx %d, iPartitionId %d, uiSliceIdx %d, iSliceSize %d, count_mb_slice %d, iEndMbInPartition %d, pCurDq->pLastCodedMbIdxOfPartition[%d] %d\n",
765766 pEncPEncCtx->iCodingIndex, kiPartitionId, iSliceIdx, iSliceSize,
766767 pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx].iCountMbNumInSlice,
@@ -819,7 +820,7 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { · 52 unmodified lines
819820
820821 ++ iIdx;
821822 }
822− MT_TRACE_LOG (pCtx, WELS_LOG_INFO, "CreateSliceThreads() exit..");
823+ MT_TRACE_LOG (&(pCtx->sLogCtx), WELS_LOG_INFO, "CreateSliceThreads() exit..");
823824 return 0;
824825 }
825826
@@ -899,7 +900,7 @@ int32_t AdjustBaseLayer (sWelsEncCtx* pCtx) { · 73 unmodified lines
899900 iT0 = WelsTime() - iT0;
900901 if (pCtx->pSliceThreading->pFSliceDiff) {
901902 fprintf (pCtx->pSliceThreading->pFSliceDiff,
902− "%6"PRId64" us adjust time at base spatial layer, iNeedAdj %d, DynamicAdjustSlicing()\n",
903+ "%6" PRId64" us adjust time at base spatial layer, iNeedAdj %d, DynamicAdjustSlicing()\n",
903904 iT0, iNeedAdj);
904905 }
905906 #endif//MT_DEBUG
@@ -944,7 +945,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 38 unmodified lines
944945 iT1 = WelsTime() - iT1;
945946 if (pCtx->pSliceThreading->pFSliceDiff) {
946947 fprintf (pCtx->pSliceThreading->pFSliceDiff,
947− "%6"PRId64" us adjust time at spatial layer %d, iNeedAdj %d, DynamicAdjustSlicing()\n",
948+ "%6" PRId64" us adjust time at spatial layer %d, iNeedAdj %d, DynamicAdjustSlicing()\n",
948949 iT1, iCurDid, iNeedAdj);
949950 }
950951 #endif//MT_DEBUG
@@ -980,22 +981,21 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t · 29 unmodified lines
980981 pPara = pCtx->pSvcParam;
981982 while (iSpatialIdx < iSpatialNum) {
982983 const int32_t kiDid = pDidList[iSpatialIdx];
983− SSliceConfig* pSliceArgument = &pPara->sDependencyLayers[kiDid].sSliceArgument;
984+ SSliceArgument* pSliceArgument = &pPara->sSpatialLayers[kiDid].sSliceArgument;
984985 SDqLayer* pCurDq = pCtx->ppDqLayerList[kiDid];
985986 SSlice* pSliceInLayer = pCurDq->sLayerInfo.pSliceInLayer;
986987 SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx;
987988 const uint32_t kuiCountSliceNum = pSliceCtx->iSliceNumInFrame;
988989 if (pCtx->pSliceThreading) {
989990 if (pCtx->pSliceThreading->pFSliceDiff
990− && ((pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pSliceArgument->uiSliceMode == SM_AUTO_SLICE))
991+ && ((pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pSliceArgument->uiSliceMode == SM_SIZELIMITED_SLICE))
991992 && pPara->iMultipleThreadIdc > 1
992993 && pPara->iMultipleThreadIdc >= kuiCountSliceNum) {
993994 uint32_t i = 0;
994995 uint32_t uiMaxT = 0;
995996 int32_t iMaxI = 0;
996997 while (i < kuiCountSliceNum) {
997− if (pSliceInLayer[i] != NULL)
998− fprintf (pCtx->pSliceThreading->pFSliceDiff, "%6d us consume_time coding_idx %d iDid %d pSlice %d\n",
998+ fprintf (pCtx->pSliceThreading->pFSliceDiff, "%6d us consume_time coding_idx %d iDid %d pSlice %d\n",
999999 pSliceInLayer[i].uiSliceConsumeTime, pCtx->iCodingIndex, kiDid, i /*/ 1000*/);
10001000 if (pSliceInLayer[i].uiSliceConsumeTime > uiMaxT) {
10011001 uiMaxT = pSliceInLayer[i].uiSliceConsumeTime;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t