Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 2 files). Show all
Unified · Split
| @@ -332,22 +332,19 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 331 unmodified lines | |||
| 332 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pReadySliceCodingEvent), FreeMemorySvc (ppCtx)) | 332 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pReadySliceCodingEvent), FreeMemorySvc (ppCtx)) |
| 333 | pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent"); | 333 | pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent"); |
| 334 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx)) | 334 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx)) |
| 335 | #else | 335 | |
| 336 | pSmt->pUpdateMbListThrdHandles = (WELS_THREAD_HANDLE*)pMa->WelsMalloc (sizeof (WELS_THREAD_HANDLE) * iThreadNum, | ||
| 337 | "pUpdateMbListThrdHandles"); | ||
| 338 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListThrdHandles), FreeMemorySvc (ppCtx)) | ||
| 339 | #endif//!_WIN32 | ||
| 340 | #ifdef _WIN32 | ||
| 341 | pSmt->pUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent"); | 336 | pSmt->pUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent"); |
| 342 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx)) | 337 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx)) |
| 343 | pSmt->pFinUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinUpdateMbListEvent"); | 338 | pSmt->pFinUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinUpdateMbListEvent"); |
| 344 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinUpdateMbListEvent), FreeMemorySvc (ppCtx)) | 339 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinUpdateMbListEvent), FreeMemorySvc (ppCtx)) |
| 345 | #endif//_WIN32 | ||
| 346 | 340 | ||
| 347 | #ifdef _WIN32 | ||
| 348 | pSmt->pExitEncodeEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pExitEncodeEvent"); | 341 | pSmt->pExitEncodeEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pExitEncodeEvent"); |
| 349 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pExitEncodeEvent), FreeMemorySvc (ppCtx)) | 342 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pExitEncodeEvent), FreeMemorySvc (ppCtx)) |
| 350 | #endif//_WIN32 | 343 | #else |
| 344 | pSmt->pUpdateMbListThrdHandles = (WELS_THREAD_HANDLE*)pMa->WelsMalloc (sizeof (WELS_THREAD_HANDLE) * iThreadNum, | ||
| 345 | "pUpdateMbListThrdHandles"); | ||
| 346 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListThrdHandles), FreeMemorySvc (ppCtx)) | ||
| 347 | #endif//!_WIN32 | ||
| 351 | 348 | ||
| 352 | iIdx = 0; | 349 | iIdx = 0; |
| 353 | while (iIdx < iNumSpatialLayers) { | 350 | while (iIdx < iNumSpatialLayers) { |
| @@ -396,6 +393,10 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 42 unmodified lines | |||
| 396 | #ifdef _WIN32 | 393 | #ifdef _WIN32 |
| 397 | WelsEventInit (&pSmt->pUpdateMbListEvent[iIdx]); | 394 | WelsEventInit (&pSmt->pUpdateMbListEvent[iIdx]); |
| 398 | WelsEventInit (&pSmt->pFinUpdateMbListEvent[iIdx]); | 395 | WelsEventInit (&pSmt->pFinUpdateMbListEvent[iIdx]); |
| 396 | WelsEventInit (&pSmt->pSliceCodedEvent[iIdx]); | ||
| 397 | WelsEventInit (&pSmt->pReadySliceCodingEvent[iIdx]); | ||
| 398 | WelsEventInit (&pSmt->pFinSliceCodingEvent[iIdx]); | ||
| 399 | WelsEventInit (&pSmt->pExitEncodeEvent[iIdx]); | ||
| 399 | #else | 400 | #else |
| 400 | // length of semaphore name should be system constrained at least on mac 10.7 | 401 | // length of semaphore name should be system constrained at least on mac 10.7 |
| 401 | WelsSnprintf (name, SEM_NAME_MAX, "ud%d%p", iIdx, (void*) (*ppCtx)); | 402 | WelsSnprintf (name, SEM_NAME_MAX, "ud%d%p", iIdx, (void*) (*ppCtx)); |
| @@ -408,14 +409,6 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 6 unmodified lines | |||
| 408 | #if defined(ENABLE_TRACE_MT) | 409 | #if defined(ENABLE_TRACE_MT) |
| 409 | WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno); | 410 | WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno); |
| 410 | #endif | 411 | #endif |
| 411 | #endif//_WIN32 | ||
| 412 | |||
| 413 | #ifdef _WIN32 | ||
| 414 | WelsEventInit (&pSmt->pSliceCodedEvent[iIdx]); | ||
| 415 | WelsEventInit (&pSmt->pReadySliceCodingEvent[iIdx]); | ||
| 416 | WelsEventInit (&pSmt->pFinSliceCodingEvent[iIdx]); | ||
| 417 | WelsEventInit (&pSmt->pExitEncodeEvent[iIdx]); | ||
| 418 | #else | ||
| 419 | WelsSnprintf (name, SEM_NAME_MAX, "sc%d%p", iIdx, (void*) (*ppCtx)); | 412 | WelsSnprintf (name, SEM_NAME_MAX, "sc%d%p", iIdx, (void*) (*ppCtx)); |
| 420 | err = WelsEventOpen (&pSmt->pSliceCodedEvent[iIdx], name); | 413 | err = WelsEventOpen (&pSmt->pSliceCodedEvent[iIdx], name); |
| 421 | #if defined(ENABLE_TRACE_MT) | 414 | #if defined(ENABLE_TRACE_MT) |