ref: ae63f064a0b99faf8c396e068b88aa395d5178ff
parent: 71bc52d10365eca8a7ba1a930674e64c3e08e39c
author: Martin Storsjö <[email protected]>
date: Sun Mar 2 17:22:23 EST 2014
Share the declarations for WELS_EVENT arrays between win32 and unix codepaths
--- a/codec/encoder/core/inc/mt_defs.h
+++ b/codec/encoder/core/inc/mt_defs.h
@@ -92,20 +92,16 @@
typedef struct TagSliceThreading {
SSliceThreadPrivateData* pThreadPEncCtx;// thread context, [iThreadIdx]
WELS_THREAD_HANDLE* pThreadHandles;// thread handles, [iThreadIdx]
-#ifdef _WIN32
WELS_EVENT* pSliceCodedEvent;// events for slice coded state, [iThreadIdx]
WELS_EVENT* pReadySliceCodingEvent; // events for slice coding ready, [iThreadIdx]
-WELS_EVENT* pFinSliceCodingEvent; // notify slice coding thread is done
-WELS_EVENT* pExitEncodeEvent; // event for exit encoding event
WELS_EVENT* pUpdateMbListEvent; // signal to update mb list neighbor for various slices
WELS_EVENT* pFinUpdateMbListEvent; // signal to indicate finish updating mb list
+#ifdef _WIN32
+WELS_EVENT* pFinSliceCodingEvent; // notify slice coding thread is done
+WELS_EVENT* pExitEncodeEvent; // event for exit encoding event
#else
-WELS_EVENT pSliceCodedEvent[MAX_THREADS_NUM];// events for slice coded state, [iThreadIdx]
-WELS_EVENT pReadySliceCodingEvent[MAX_THREADS_NUM]; // events for slice coding ready, [iThreadIdx]
WELS_THREAD_HANDLE* pUpdateMbListThrdHandles; // thread handles for update mb list thread, [iThreadIdx]
-WELS_EVENT pUpdateMbListEvent[MAX_THREADS_NUM]; // signal to update mb list neighbor for various slices
-WELS_EVENT pFinUpdateMbListEvent[MAX_THREADS_NUM]; // signal to indicate finish updating mb list
#endif//_WIN32
WELS_MUTEX mutexSliceNumUpdate; // for dynamic slicing mode MT
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -320,14 +320,11 @@
"pThreadHandles");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pThreadHandles), FreeMemorySvc (ppCtx))
-#ifdef _WIN32
pSmt->pSliceCodedEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pSliceCodedEvent");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceCodedEvent), FreeMemorySvc (ppCtx))
pSmt->pReadySliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum,
"pReadySliceCodingEvent");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pReadySliceCodingEvent), FreeMemorySvc (ppCtx))
- pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent");
- WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx))
pSmt->pUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx))
@@ -334,6 +331,10 @@
pSmt->pFinUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinUpdateMbListEvent");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinUpdateMbListEvent), FreeMemorySvc (ppCtx))
+#ifdef _WIN32
+ pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent");
+ WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx))
+
pSmt->pExitEncodeEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pExitEncodeEvent");
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pExitEncodeEvent), FreeMemorySvc (ppCtx))
#else
@@ -514,11 +515,6 @@
++ iIdx;
}
-#ifdef _WIN32
- if (pSmt->pExitEncodeEvent != NULL) {
- pMa->WelsFree (pSmt->pExitEncodeEvent, "pExitEncodeEvent");
- pSmt->pExitEncodeEvent = NULL;
- }
if (pSmt->pSliceCodedEvent != NULL) {
pMa->WelsFree (pSmt->pSliceCodedEvent, "pSliceCodedEvent");
pSmt->pSliceCodedEvent = NULL;
@@ -527,6 +523,11 @@
pMa->WelsFree (pSmt->pReadySliceCodingEvent, "pReadySliceCodingEvent");
pSmt->pReadySliceCodingEvent = NULL;
}
+#ifdef _WIN32
+ if (pSmt->pExitEncodeEvent != NULL) {
+ pMa->WelsFree (pSmt->pExitEncodeEvent, "pExitEncodeEvent");
+ pSmt->pExitEncodeEvent = NULL;
+ }
if (pSmt->pFinSliceCodingEvent != NULL) {
pMa->WelsFree (pSmt->pFinSliceCodingEvent, "pFinSliceCodingEvent");
pSmt->pFinSliceCodingEvent = NULL;
@@ -573,7 +574,6 @@
++ iIdx;
}
-#ifdef _WIN32
if (pSmt->pUpdateMbListEvent != NULL) {
pMa->WelsFree (pSmt->pUpdateMbListEvent, "pUpdateMbListEvent");
pSmt->pUpdateMbListEvent = NULL;
@@ -582,12 +582,12 @@
pMa->WelsFree (pSmt->pFinUpdateMbListEvent, "pFinUpdateMbListEvent");
pSmt->pFinUpdateMbListEvent = NULL;
}
-#else
+#ifndef _WIN32
if (pSmt->pUpdateMbListThrdHandles) {
pMa->WelsFree (pSmt->pUpdateMbListThrdHandles, "pUpdateMbListThrdHandles");
pSmt->pUpdateMbListThrdHandles = NULL;
}
-#endif//_WIN32
+#endif//!_WIN32
#ifdef MT_DEBUG
// file handle for debug