Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 2 files). Show all
Unified · Split
| @@ -320,20 +320,21 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 319 unmodified lines | |||
| 320 | "pThreadHandles"); | 320 | "pThreadHandles"); |
| 321 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pThreadHandles), FreeMemorySvc (ppCtx)) | 321 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pThreadHandles), FreeMemorySvc (ppCtx)) |
| 322 | 322 | ||
| 323 | #ifdef _WIN32 | ||
| 324 | pSmt->pSliceCodedEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pSliceCodedEvent"); | 323 | pSmt->pSliceCodedEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pSliceCodedEvent"); |
| 325 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceCodedEvent), FreeMemorySvc (ppCtx)) | 324 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceCodedEvent), FreeMemorySvc (ppCtx)) |
| 326 | pSmt->pReadySliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, | 325 | pSmt->pReadySliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, |
| 327 | "pReadySliceCodingEvent"); | 326 | "pReadySliceCodingEvent"); |
| 328 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pReadySliceCodingEvent), FreeMemorySvc (ppCtx)) | 327 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pReadySliceCodingEvent), FreeMemorySvc (ppCtx)) |
| 329 | pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent"); | ||
| 330 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx)) | ||
| 331 | 328 | ||
| 332 | pSmt->pUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent"); | 329 | pSmt->pUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent"); |
| 333 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx)) | 330 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx)) |
| 334 | pSmt->pFinUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinUpdateMbListEvent"); | 331 | pSmt->pFinUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinUpdateMbListEvent"); |
| 335 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinUpdateMbListEvent), FreeMemorySvc (ppCtx)) | 332 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinUpdateMbListEvent), FreeMemorySvc (ppCtx)) |
| 336 | 333 | ||
| 334 | #ifdef _WIN32 | ||
| 335 | pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent"); | ||
| 336 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx)) | ||
| 337 | |||
| 337 | pSmt->pExitEncodeEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pExitEncodeEvent"); | 338 | pSmt->pExitEncodeEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pExitEncodeEvent"); |
| 338 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pExitEncodeEvent), FreeMemorySvc (ppCtx)) | 339 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pExitEncodeEvent), FreeMemorySvc (ppCtx)) |
| 339 | #else | 340 | #else |
| @@ -514,11 +515,6 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 174 unmodified lines | |||
| 514 | ++ iIdx; | 515 | ++ iIdx; |
| 515 | } | 516 | } |
| 516 | 517 | ||
| 517 | #ifdef _WIN32 | ||
| 518 | if (pSmt->pExitEncodeEvent != NULL) { | ||
| 519 | pMa->WelsFree (pSmt->pExitEncodeEvent, "pExitEncodeEvent"); | ||
| 520 | pSmt->pExitEncodeEvent = NULL; | ||
| 521 | } | ||
| 522 | if (pSmt->pSliceCodedEvent != NULL) { | 518 | if (pSmt->pSliceCodedEvent != NULL) { |
| 523 | pMa->WelsFree (pSmt->pSliceCodedEvent, "pSliceCodedEvent"); | 519 | pMa->WelsFree (pSmt->pSliceCodedEvent, "pSliceCodedEvent"); |
| 524 | pSmt->pSliceCodedEvent = NULL; | 520 | pSmt->pSliceCodedEvent = NULL; |
| @@ -527,6 +523,11 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 2 unmodified lines | |||
| 527 | pMa->WelsFree (pSmt->pReadySliceCodingEvent, "pReadySliceCodingEvent"); | 523 | pMa->WelsFree (pSmt->pReadySliceCodingEvent, "pReadySliceCodingEvent"); |
| 528 | pSmt->pReadySliceCodingEvent = NULL; | 524 | pSmt->pReadySliceCodingEvent = NULL; |
| 529 | } | 525 | } |
| 526 | #ifdef _WIN32 | ||
| 527 | if (pSmt->pExitEncodeEvent != NULL) { | ||
| 528 | pMa->WelsFree (pSmt->pExitEncodeEvent, "pExitEncodeEvent"); | ||
| 529 | pSmt->pExitEncodeEvent = NULL; | ||
| 530 | } | ||
| 530 | if (pSmt->pFinSliceCodingEvent != NULL) { | 531 | if (pSmt->pFinSliceCodingEvent != NULL) { |
| 531 | pMa->WelsFree (pSmt->pFinSliceCodingEvent, "pFinSliceCodingEvent"); | 532 | pMa->WelsFree (pSmt->pFinSliceCodingEvent, "pFinSliceCodingEvent"); |
| 532 | pSmt->pFinSliceCodingEvent = NULL; | 533 | pSmt->pFinSliceCodingEvent = NULL; |
| @@ -573,7 +574,6 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 40 unmodified lines | |||
| 573 | ++ iIdx; | 574 | ++ iIdx; |
| 574 | } | 575 | } |
| 575 | 576 | ||
| 576 | #ifdef _WIN32 | ||
| 577 | if (pSmt->pUpdateMbListEvent != NULL) { | 577 | if (pSmt->pUpdateMbListEvent != NULL) { |
| 578 | pMa->WelsFree (pSmt->pUpdateMbListEvent, "pUpdateMbListEvent"); | 578 | pMa->WelsFree (pSmt->pUpdateMbListEvent, "pUpdateMbListEvent"); |
| 579 | pSmt->pUpdateMbListEvent = NULL; | 579 | pSmt->pUpdateMbListEvent = NULL; |
| @@ -582,12 +582,12 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 2 unmodified lines | |||
| 582 | pMa->WelsFree (pSmt->pFinUpdateMbListEvent, "pFinUpdateMbListEvent"); | 582 | pMa->WelsFree (pSmt->pFinUpdateMbListEvent, "pFinUpdateMbListEvent"); |
| 583 | pSmt->pFinUpdateMbListEvent = NULL; | 583 | pSmt->pFinUpdateMbListEvent = NULL; |
| 584 | } | 584 | } |
| 585 | #else | 585 | #ifndef _WIN32 |
| 586 | if (pSmt->pUpdateMbListThrdHandles) { | 586 | if (pSmt->pUpdateMbListThrdHandles) { |
| 587 | pMa->WelsFree (pSmt->pUpdateMbListThrdHandles, "pUpdateMbListThrdHandles"); | 587 | pMa->WelsFree (pSmt->pUpdateMbListThrdHandles, "pUpdateMbListThrdHandles"); |
| 588 | pSmt->pUpdateMbListThrdHandles = NULL; | 588 | pSmt->pUpdateMbListThrdHandles = NULL; |
| 589 | } | 589 | } |
| 590 | #endif//_WIN32 | 590 | #endif//!_WIN32 |
| 591 | 591 | ||
| 592 | #ifdef MT_DEBUG | 592 | #ifdef MT_DEBUG |
| 593 | // file handle for debug | 593 | // file handle for debug |