Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 19 files). Show all
Unified · Split
| @@ -62,6 +62,7 @@ · 61 unmodified lines | |||
| 62 | #include "cpu.h" | 62 | #include "cpu.h" |
| 63 | 63 | ||
| 64 | #include "measure_time.h" | 64 | #include "measure_time.h" |
| 65 | #include "wels_task_management.h" | ||
| 65 | 66 | ||
| 66 | #if defined(ENABLE_TRACE_MT) | 67 | #if defined(ENABLE_TRACE_MT) |
| 67 | #define MT_TRACE_LOG(x, ...) WelsLog(x, __VA_ARGS__) | 68 | #define MT_TRACE_LOG(x, ...) WelsLog(x, __VA_ARGS__) |
| @@ -443,6 +444,10 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 375 unmodified lines | |||
| 443 | iReturn = WelsMutexInit (&pSmt->mutexSliceNumUpdate); | 444 | iReturn = WelsMutexInit (&pSmt->mutexSliceNumUpdate); |
| 444 | WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) | 445 | WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) |
| 445 | 446 | ||
| 447 | memset(&pSmt->bThreadBsBufferUsage, 0, MAX_THREADS_NUM * sizeof(bool)); | ||
| 448 | iReturn = WelsMutexInit (&pSmt->mutexThreadBsBufferUsage); | ||
| 449 | WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) | ||
| 450 | |||
| 446 | iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError); | 451 | iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError); |
| 447 | WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) | 452 | WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) |
| 448 | 453 | ||
| @@ -496,6 +501,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 47 unmodified lines | |||
| 496 | WelsEventClose (&pSmt->pSliceCodedMasterEvent, ename); | 501 | WelsEventClose (&pSmt->pSliceCodedMasterEvent, ename); |
| 497 | 502 | ||
| 498 | WelsMutexDestroy (&pSmt->mutexSliceNumUpdate); | 503 | WelsMutexDestroy (&pSmt->mutexSliceNumUpdate); |
| 504 | WelsMutexDestroy (&pSmt->mutexThreadBsBufferUsage); | ||
| 499 | WelsMutexDestroy (& ((*ppCtx)->mutexEncoderError)); | 505 | WelsMutexDestroy (& ((*ppCtx)->mutexEncoderError)); |
| 500 | 506 | ||
| 501 | if (pSmt->pThreadPEncCtx != NULL) { | 507 | if (pSmt->pThreadPEncCtx != NULL) { |
| @@ -509,6 +515,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 7 unmodified lines | |||
| 509 | pSmt->pThreadBsBuffer[i] = NULL; | 515 | pSmt->pThreadBsBuffer[i] = NULL; |
| 510 | } | 516 | } |
| 511 | } | 517 | } |
| 518 | memset(&pSmt->bThreadBsBufferUsage, 0, MAX_THREADS_NUM * sizeof(bool)); | ||
| 512 | 519 | ||
| 513 | pSliceB = (*ppCtx)->pSliceBs; | 520 | pSliceB = (*ppCtx)->pSliceBs; |
| 514 | iIdx = 0; | 521 | iIdx = 0; |