Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 73 files). Show all
Unified · Split
| @@ -309,11 +309,11 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, · 308 unmodified lines | |||
| 309 | const int32_t kiThreadNum = pCtx->pSvcParam->iCountThreadsNum; | 309 | const int32_t kiThreadNum = pCtx->pSvcParam->iCountThreadsNum; |
| 310 | int32_t iThreadIdx = 0; | 310 | int32_t iThreadIdx = 0; |
| 311 | do { | 311 | do { |
| 312 | #ifdef WIN32 | 312 | #ifdef _WIN32 |
| 313 | WelsEventSignal (&pCtx->pSliceThreading->pUpdateMbListEvent[iThreadIdx]); | 313 | WelsEventSignal (&pCtx->pSliceThreading->pUpdateMbListEvent[iThreadIdx]); |
| 314 | #else | 314 | #else |
| 315 | WelsEventSignal (pCtx->pSliceThreading->pUpdateMbListEvent[iThreadIdx]); | 315 | WelsEventSignal (pCtx->pSliceThreading->pUpdateMbListEvent[iThreadIdx]); |
| 316 | #endif//WIN32 | 316 | #endif//_WIN32 |
| 317 | ++ iThreadIdx; | 317 | ++ iThreadIdx; |
| 318 | } while (iThreadIdx < kiThreadNum); | 318 | } while (iThreadIdx < kiThreadNum); |
| 319 | 319 | ||
| @@ -367,7 +367,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 47 unmodified lines | |||
| 367 | "pThreadHandles"); | 367 | "pThreadHandles"); |
| 368 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pThreadHandles), FreeMemorySvc (ppCtx)) | 368 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pThreadHandles), FreeMemorySvc (ppCtx)) |
| 369 | 369 | ||
| 370 | #ifdef WIN32 | 370 | #ifdef _WIN32 |
| 371 | pSmt->pSliceCodedEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pSliceCodedEvent"); | 371 | pSmt->pSliceCodedEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pSliceCodedEvent"); |
| 372 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceCodedEvent), FreeMemorySvc (ppCtx)) | 372 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceCodedEvent), FreeMemorySvc (ppCtx)) |
| 373 | pSmt->pReadySliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, | 373 | pSmt->pReadySliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, |
| @@ -375,7 +375,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 1 unmodified line | |||
| 375 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pReadySliceCodingEvent), FreeMemorySvc (ppCtx)) | 375 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pReadySliceCodingEvent), FreeMemorySvc (ppCtx)) |
| 376 | pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent"); | 376 | pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent"); |
| 377 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx)) | 377 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx)) |
| 378 | #endif//WIN32 | 378 | #endif//_WIN32 |
| 379 | 379 | ||
| 380 | #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) | 380 | #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) |
| 381 | #if defined(__GNUC__) | 381 | #if defined(__GNUC__) |
| @@ -383,18 +383,18 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 1 unmodified line | |||
| 383 | "pUpdateMbListThrdHandles"); | 383 | "pUpdateMbListThrdHandles"); |
| 384 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListThrdHandles), FreeMemorySvc (ppCtx)) | 384 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListThrdHandles), FreeMemorySvc (ppCtx)) |
| 385 | #endif//__GNUC__ | 385 | #endif//__GNUC__ |
| 386 | #ifdef WIN32 | 386 | #ifdef _WIN32 |
| 387 | pSmt->pUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent"); | 387 | pSmt->pUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent"); |
| 388 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx)) | 388 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx)) |
| 389 | pSmt->pFinUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinUpdateMbListEvent"); | 389 | pSmt->pFinUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinUpdateMbListEvent"); |
| 390 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinUpdateMbListEvent), FreeMemorySvc (ppCtx)) | 390 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinUpdateMbListEvent), FreeMemorySvc (ppCtx)) |
| 391 | #endif//WIN32 | 391 | #endif//_WIN32 |
| 392 | #endif//#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) | 392 | #endif//#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) |
| 393 | 393 | ||
| 394 | #ifdef WIN32 | 394 | #ifdef _WIN32 |
| 395 | pSmt->pExitEncodeEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pExitEncodeEvent"); | 395 | pSmt->pExitEncodeEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pExitEncodeEvent"); |
| 396 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pExitEncodeEvent), FreeMemorySvc (ppCtx)) | 396 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pExitEncodeEvent), FreeMemorySvc (ppCtx)) |
| 397 | #endif//WIN32 | 397 | #endif//_WIN32 |
| 398 | 398 | ||
| 399 | #if defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG) | 399 | #if defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG) |
| 400 | iIdx = 0; | 400 | iIdx = 0; |
| @@ -428,11 +428,11 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 27 unmodified lines | |||
| 428 | fclose (pSmt->pFSliceDiff); | 428 | fclose (pSmt->pFSliceDiff); |
| 429 | pSmt->pFSliceDiff = NULL; | 429 | pSmt->pFSliceDiff = NULL; |
| 430 | } | 430 | } |
| 431 | #ifdef WIN32 | 431 | #ifdef _WIN32 |
| 432 | pSmt->pFSliceDiff = fopen (".\\slice_time.txt", "wt+"); | 432 | pSmt->pFSliceDiff = fopen (".\\slice_time.txt", "wt+"); |
| 433 | #else | 433 | #else |
| 434 | pSmt->pFSliceDiff = fopen ("/tmp/slice_time.txt", "wt+"); | 434 | pSmt->pFSliceDiff = fopen ("/tmp/slice_time.txt", "wt+"); |
| 435 | #endif//WIN32 | 435 | #endif//_WIN32 |
| 436 | #endif//MT_DEBUG | 436 | #endif//MT_DEBUG |
| 437 | 437 | ||
| 438 | #if defined(ENABLE_TRACE_MT) | 438 | #if defined(ENABLE_TRACE_MT) |
| @@ -452,7 +452,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 13 unmodified lines | |||
| 452 | pSmt->pThreadHandles[iIdx] = 0; | 452 | pSmt->pThreadHandles[iIdx] = 0; |
| 453 | 453 | ||
| 454 | #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) | 454 | #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) |
| 455 | #ifdef WIN32 | 455 | #ifdef _WIN32 |
| 456 | WelsEventInit (&pSmt->pUpdateMbListEvent[iIdx]); | 456 | WelsEventInit (&pSmt->pUpdateMbListEvent[iIdx]); |
| 457 | WelsEventInit (&pSmt->pFinUpdateMbListEvent[iIdx]); | 457 | WelsEventInit (&pSmt->pFinUpdateMbListEvent[iIdx]); |
| 458 | #else | 458 | #else |
| @@ -468,10 +468,10 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 9 unmodified lines | |||
| 468 | #if defined(ENABLE_TRACE_MT) | 468 | #if defined(ENABLE_TRACE_MT) |
| 469 | WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno); | 469 | WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno); |
| 470 | #endif | 470 | #endif |
| 471 | #endif//WIN32 | 471 | #endif//_WIN32 |
| 472 | #endif//#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) | 472 | #endif//#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) |
| 473 | 473 | ||
| 474 | #ifdef WIN32 | 474 | #ifdef _WIN32 |
| 475 | WelsEventInit (&pSmt->pSliceCodedEvent[iIdx]); | 475 | WelsEventInit (&pSmt->pSliceCodedEvent[iIdx]); |
| 476 | WelsEventInit (&pSmt->pReadySliceCodingEvent[iIdx]); | 476 | WelsEventInit (&pSmt->pReadySliceCodingEvent[iIdx]); |
| 477 | WelsEventInit (&pSmt->pFinSliceCodingEvent[iIdx]); | 477 | WelsEventInit (&pSmt->pFinSliceCodingEvent[iIdx]); |
| @@ -490,7 +490,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 12 unmodified lines | |||
| 490 | WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pReadySliceCodingEvent%d = 0x%p named(%s) ret%d err%d\n", iIdx, | 490 | WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pReadySliceCodingEvent%d = 0x%p named(%s) ret%d err%d\n", iIdx, |
| 491 | (void*)pSmt->pReadySliceCodingEvent[iIdx]), (void*) (*ppCtx), err, errno); | 491 | (void*)pSmt->pReadySliceCodingEvent[iIdx]), (void*) (*ppCtx), err, errno); |
| 492 | #endif | 492 | #endif |
| 493 | #endif//WIN32 | 493 | #endif//_WIN32 |
| 494 | 494 | ||
| 495 | ++ iIdx; | 495 | ++ iIdx; |
| 496 | } | 496 | } |
| @@ -557,7 +557,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 60 unmodified lines | |||
| 557 | return; | 557 | return; |
| 558 | 558 | ||
| 559 | while (iIdx < iThreadNum) { | 559 | while (iIdx < iThreadNum) { |
| 560 | #ifdef WIN32 | 560 | #ifdef _WIN32 |
| 561 | if (pSmt->pThreadHandles != NULL && pSmt->pThreadHandles[iIdx] != NULL) | 561 | if (pSmt->pThreadHandles != NULL && pSmt->pThreadHandles[iIdx] != NULL) |
| 562 | WelsThreadDestroy (&pSmt->pThreadHandles[iIdx]); | 562 | WelsThreadDestroy (&pSmt->pThreadHandles[iIdx]); |
| 563 | 563 | ||
| @@ -592,12 +592,12 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 28 unmodified lines | |||
| 592 | ename[used_len] = '\0'; | 592 | ename[used_len] = '\0'; |
| 593 | WelsEventClose (pSmt->pFinUpdateMbListEvent[iIdx], ename); | 593 | WelsEventClose (pSmt->pFinUpdateMbListEvent[iIdx], ename); |
| 594 | #endif//DYNAMIC_SLICE_ASSIGN && TRY_SLICING_BALANCE | 594 | #endif//DYNAMIC_SLICE_ASSIGN && TRY_SLICING_BALANCE |
| 595 | #endif//WIN32 | 595 | #endif//_WIN32 |
| 596 | 596 | ||
| 597 | ++ iIdx; | 597 | ++ iIdx; |
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | #ifdef WIN32 | 600 | #ifdef _WIN32 |
| 601 | if (pSmt->pExitEncodeEvent != NULL) { | 601 | if (pSmt->pExitEncodeEvent != NULL) { |
| 602 | pMa->WelsFree (pSmt->pExitEncodeEvent, "pExitEncodeEvent"); | 602 | pMa->WelsFree (pSmt->pExitEncodeEvent, "pExitEncodeEvent"); |
| 603 | pSmt->pExitEncodeEvent = NULL; | 603 | pSmt->pExitEncodeEvent = NULL; |
| @@ -614,7 +614,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 10 unmodified lines | |||
| 614 | pMa->WelsFree (pSmt->pFinSliceCodingEvent, "pFinSliceCodingEvent"); | 614 | pMa->WelsFree (pSmt->pFinSliceCodingEvent, "pFinSliceCodingEvent"); |
| 615 | pSmt->pFinSliceCodingEvent = NULL; | 615 | pSmt->pFinSliceCodingEvent = NULL; |
| 616 | } | 616 | } |
| 617 | #endif//WIN32 | 617 | #endif//_WIN32 |
| 618 | 618 | ||
| 619 | #ifdef PACKING_ONE_SLICE_PER_LAYER | 619 | #ifdef PACKING_ONE_SLICE_PER_LAYER |
| 620 | if (NULL != pSmt->pCountBsSizeInPartition) { | 620 | if (NULL != pSmt->pCountBsSizeInPartition) { |
| @@ -669,7 +669,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 48 unmodified lines | |||
| 669 | 669 | ||
| 670 | #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) | 670 | #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) |
| 671 | 671 | ||
| 672 | #ifdef WIN32 | 672 | #ifdef _WIN32 |
| 673 | if (pSmt->pUpdateMbListEvent != NULL) { | 673 | if (pSmt->pUpdateMbListEvent != NULL) { |
| 674 | pMa->WelsFree (pSmt->pUpdateMbListEvent, "pUpdateMbListEvent"); | 674 | pMa->WelsFree (pSmt->pUpdateMbListEvent, "pUpdateMbListEvent"); |
| 675 | pSmt->pUpdateMbListEvent = NULL; | 675 | pSmt->pUpdateMbListEvent = NULL; |
| @@ -683,7 +683,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 7 unmodified lines | |||
| 683 | pMa->WelsFree (pSmt->pUpdateMbListThrdHandles, "pUpdateMbListThrdHandles"); | 683 | pMa->WelsFree (pSmt->pUpdateMbListThrdHandles, "pUpdateMbListThrdHandles"); |
| 684 | pSmt->pUpdateMbListThrdHandles = NULL; | 684 | pSmt->pUpdateMbListThrdHandles = NULL; |
| 685 | } | 685 | } |
| 686 | #endif//WIN32 | 686 | #endif//_WIN32 |
| 687 | 687 | ||
| 688 | #endif//#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) | 688 | #endif//#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) |
| 689 | 689 | ||
| @@ -901,7 +901,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 211 unmodified lines | |||
| 901 | SDqLayer* pCurDq = NULL; | 901 | SDqLayer* pCurDq = NULL; |
| 902 | SSlice* pSlice = NULL; | 902 | SSlice* pSlice = NULL; |
| 903 | SWelsSliceBs* pSliceBs = NULL; | 903 | SWelsSliceBs* pSliceBs = NULL; |
| 904 | #ifdef WIN32 | 904 | #ifdef _WIN32 |
| 905 | WELS_EVENT pEventsList[3]; | 905 | WELS_EVENT pEventsList[3]; |
| 906 | int32_t iEventCount = 0; | 906 | int32_t iEventCount = 0; |
| 907 | #endif | 907 | #endif |
| @@ -925,16 +925,16 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 17 unmodified lines | |||
| 925 | iThreadIdx = pPrivateData->iThreadIndex; | 925 | iThreadIdx = pPrivateData->iThreadIndex; |
| 926 | iEventIdx = iThreadIdx; | 926 | iEventIdx = iThreadIdx; |
| 927 | 927 | ||
| 928 | #ifdef WIN32 | 928 | #ifdef _WIN32 |
| 929 | pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pReadySliceCodingEvent[iEventIdx]; | 929 | pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pReadySliceCodingEvent[iEventIdx]; |
| 930 | pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pExitEncodeEvent[iEventIdx]; | 930 | pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pExitEncodeEvent[iEventIdx]; |
| 931 | #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) | 931 | #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) |
| 932 | pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pUpdateMbListEvent[iEventIdx]; | 932 | pEventsList[iEventCount++] = pEncPEncCtx->pSliceThreading->pUpdateMbListEvent[iEventIdx]; |
| 933 | #endif//#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) | 933 | #endif//#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) |
| 934 | #endif//WIN32 | 934 | #endif//_WIN32 |
| 935 | 935 | ||
| 936 | do { | 936 | do { |
| 937 | #ifdef WIN32 | 937 | #ifdef _WIN32 |
| 938 | iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount, | 938 | iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount, |
| 939 | &pEventsList[0], | 939 | &pEventsList[0], |
| 940 | (uint32_t) - 1); // blocking until at least one event is | 940 | (uint32_t) - 1); // blocking until at least one event is |
| @@ -1058,7 +1058,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 117 unmodified lines | |||
| 1058 | pSliceBs->bSliceCodedFlag = TRUE; | 1058 | pSliceBs->bSliceCodedFlag = TRUE; |
| 1059 | #endif//MT_DEBUG_BS_WR | 1059 | #endif//MT_DEBUG_BS_WR |
| 1060 | 1060 | ||
| 1061 | #ifdef WIN32 | 1061 | #ifdef _WIN32 |
| 1062 | WelsEventSignal ( | 1062 | WelsEventSignal ( |
| 1063 | &pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice | 1063 | &pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice |
| 1064 | #else | 1064 | #else |
| @@ -1174,14 +1174,14 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 109 unmodified lines | |||
| 1174 | if (uiThrdRet) // any exception?? | 1174 | if (uiThrdRet) // any exception?? |
| 1175 | break; | 1175 | break; |
| 1176 | 1176 | ||
| 1177 | #ifdef WIN32 | 1177 | #ifdef _WIN32 |
| 1178 | WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice | 1178 | WelsEventSignal (&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice |
| 1179 | #else | 1179 | #else |
| 1180 | WelsEventSignal (pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice | 1180 | WelsEventSignal (pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice |
| 1181 | #endif//WIN32 | 1181 | #endif//WIN32 |
| 1182 | } | 1182 | } |
| 1183 | } | 1183 | } |
| 1184 | #ifdef WIN32 | 1184 | #ifdef _WIN32 |
| 1185 | else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal | 1185 | else if (WELS_THREAD_ERROR_WAIT_OBJECT_0 + 1 == iWaitRet) { // exit thread signal |
| 1186 | uiThrdRet = 0; | 1186 | uiThrdRet = 0; |
| 1187 | break; | 1187 | break; |
| @@ -1206,7 +1206,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 18 unmodified lines | |||
| 1206 | } | 1206 | } |
| 1207 | } while (1); | 1207 | } while (1); |
| 1208 | 1208 | ||
| 1209 | #ifdef WIN32 | 1209 | #ifdef _WIN32 |
| 1210 | WelsEventSignal (&pEncPEncCtx->pSliceThreading->pFinSliceCodingEvent[iEventIdx]); // notify to mother encoding threading | 1210 | WelsEventSignal (&pEncPEncCtx->pSliceThreading->pFinSliceCodingEvent[iEventIdx]); // notify to mother encoding threading |
| 1211 | #endif//WIN32 | 1211 | #endif//WIN32 |
| 1212 | 1212 | ||
| @@ -1216,7 +1216,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 3 unmodified lines | |||
| 1216 | int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { | 1216 | int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { |
| 1217 | const int32_t kiThreadCount = pCtx->pSvcParam->iCountThreadsNum; | 1217 | const int32_t kiThreadCount = pCtx->pSvcParam->iCountThreadsNum; |
| 1218 | int32_t iIdx = 0; | 1218 | int32_t iIdx = 0; |
| 1219 | #if defined(WIN32) && defined(BIND_CPU_CORES_TO_THREADS) | 1219 | #if defined(_WIN32) && defined(BIND_CPU_CORES_TO_THREADS) |
| 1220 | DWORD dwProcessAffinity; | 1220 | DWORD dwProcessAffinity; |
| 1221 | DWORD dwSystemAffinity; | 1221 | DWORD dwSystemAffinity; |
| 1222 | GetProcessAffinityMask (GetCurrentProcess(), &dwProcessAffinity, &dwSystemAffinity); | 1222 | GetProcessAffinityMask (GetCurrentProcess(), &dwProcessAffinity, &dwSystemAffinity); |
| @@ -1225,7 +1225,7 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { · 2 unmodified lines | |||
| 1225 | while (iIdx < kiThreadCount) { | 1225 | while (iIdx < kiThreadCount) { |
| 1226 | WelsThreadCreate (&pCtx->pSliceThreading->pThreadHandles[iIdx], CodingSliceThreadProc, | 1226 | WelsThreadCreate (&pCtx->pSliceThreading->pThreadHandles[iIdx], CodingSliceThreadProc, |
| 1227 | &pCtx->pSliceThreading->pThreadPEncCtx[iIdx], 0); | 1227 | &pCtx->pSliceThreading->pThreadPEncCtx[iIdx], 0); |
| 1228 | #if defined(WIN32) && defined(BIND_CPU_CORES_TO_THREADS) | 1228 | #if defined(_WIN32) && defined(BIND_CPU_CORES_TO_THREADS) |
| 1229 | if (dwProcessAffinity > 1 | 1229 | if (dwProcessAffinity > 1 |
| 1230 | && pCtx->pSliceThreading->pThreadHandles[iIdx] != NULL) { // multiple cores and thread created successfully | 1230 | && pCtx->pSliceThreading->pThreadHandles[iIdx] != NULL) { // multiple cores and thread created successfully |
| 1231 | DWORD dw = 0; | 1231 | DWORD dw = 0; |
| @@ -1264,7 +1264,7 @@ void ResetCountBsSizeInPartitions (uint32_t* pCountBsSizeList, const int32_t iPa · 32 unmodified lines | |||
| 1264 | } | 1264 | } |
| 1265 | #endif//PACKING_ONE_SLICE_PER_LAYER | 1265 | #endif//PACKING_ONE_SLICE_PER_LAYER |
| 1266 | 1266 | ||
| 1267 | #ifdef WIN32 | 1267 | #ifdef _WIN32 |
| 1268 | int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList, SLayerBSInfo* pLbi, | 1268 | int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList, SLayerBSInfo* pLbi, |
| 1269 | const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const BOOL_T bIsDynamicSlicingMode) | 1269 | const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const BOOL_T bIsDynamicSlicingMode) |
| 1270 | #else | 1270 | #else |
| @@ -1299,7 +1299,7 @@ int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT** pEven · 28 unmodified lines | |||
| 1299 | while (iIdx < kiEventCnt) { | 1299 | while (iIdx < kiEventCnt) { |
| 1300 | pPriData[iIdx].pLayerBs = pLbi; | 1300 | pPriData[iIdx].pLayerBs = pLbi; |
| 1301 | pPriData[iIdx].iSliceIndex = iIdx; | 1301 | pPriData[iIdx].iSliceIndex = iIdx; |
| 1302 | #ifdef WIN32 | 1302 | #ifdef _WIN32 |
| 1303 | if (pEventsList[iIdx]) | 1303 | if (pEventsList[iIdx]) |
| 1304 | WelsEventSignal (&pEventsList[iIdx]); | 1304 | WelsEventSignal (&pEventsList[iIdx]); |
| 1305 | #else | 1305 | #else |
| @@ -1325,7 +1325,7 @@ int32_t FiredSliceThreads (SSliceThreadPrivateData* pPriData, WELS_EVENT** pEven · 19 unmodified lines | |||
| 1325 | while (iIdx < kiEventCnt) { | 1325 | while (iIdx < kiEventCnt) { |
| 1326 | pPriData[iIdx].pLayerBs = pLbi; | 1326 | pPriData[iIdx].pLayerBs = pLbi; |
| 1327 | pPriData[iIdx].iSliceIndex = iIdx; | 1327 | pPriData[iIdx].iSliceIndex = iIdx; |
| 1328 | #ifdef WIN32 | 1328 | #ifdef _WIN32 |
| 1329 | if (pEventsList[iIdx]) | 1329 | if (pEventsList[iIdx]) |
| 1330 | WelsEventSignal (&pEventsList[iIdx]); | 1330 | WelsEventSignal (&pEventsList[iIdx]); |
| 1331 | #else | 1331 | #else |
| @@ -1371,7 +1371,7 @@ int32_t AdjustBaseLayer (sWelsEncCtx* pCtx) { · 39 unmodified lines | |||
| 1371 | iT0 = WelsTime() - iT0; | 1371 | iT0 = WelsTime() - iT0; |
| 1372 | if (pCtx->pSliceThreading->pFSliceDiff) { | 1372 | if (pCtx->pSliceThreading->pFSliceDiff) { |
| 1373 | fprintf (pCtx->pSliceThreading->pFSliceDiff, | 1373 | fprintf (pCtx->pSliceThreading->pFSliceDiff, |
| 1374 | #ifdef WIN32 | 1374 | #ifdef _WIN32 |
| 1375 | "%6I64d us adjust time at base spatial layer, iNeedAdj %d, DynamicAdjustSlicing()\n", | 1375 | "%6I64d us adjust time at base spatial layer, iNeedAdj %d, DynamicAdjustSlicing()\n", |
| 1376 | #else | 1376 | #else |
| 1377 | "%6lld us adjust time at base spatial layer, iNeedAdj %d, DynamicAdjustSlicing()\n", | 1377 | "%6lld us adjust time at base spatial layer, iNeedAdj %d, DynamicAdjustSlicing()\n", |
| @@ -1429,7 +1429,7 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) { · 51 unmodified lines | |||
| 1429 | iT1 = WelsTime() - iT1; | 1429 | iT1 = WelsTime() - iT1; |
| 1430 | if (pCtx->pSliceThreading->pFSliceDiff) { | 1430 | if (pCtx->pSliceThreading->pFSliceDiff) { |
| 1431 | fprintf (pCtx->pSliceThreading->pFSliceDiff, | 1431 | fprintf (pCtx->pSliceThreading->pFSliceDiff, |
| 1432 | #ifdef WIN32 | 1432 | #ifdef _WIN32 |
| 1433 | "%6I64d us adjust time at spatial layer %d, iNeedAdj %d, DynamicAdjustSlicing()\n", | 1433 | "%6I64d us adjust time at spatial layer %d, iNeedAdj %d, DynamicAdjustSlicing()\n", |
| 1434 | #else | 1434 | #else |
| 1435 | "%6lld us adjust time at spatial layer %d, iNeedAdj %d, DynamicAdjustSlicing()\n", | 1435 | "%6lld us adjust time at spatial layer %d, iNeedAdj %d, DynamicAdjustSlicing()\n", |