shithub: openh264

Download patch

ref: e9c340367418435d31e31e2d51b6186b7bfa8e37
parent: 73cc5862bad6518709f9a74f194d008fd2150734
author: Martin Storsjö <[email protected]>
date: Sun Mar 2 11:41:15 EST 2014

Merge some WIN32 ifdefs that were directly next to each other

--- a/codec/encoder/core/inc/mt_defs.h
+++ b/codec/encoder/core/inc/mt_defs.h
@@ -97,18 +97,13 @@
 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
 #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]
-#endif//_WIN32
 
-#if !defined(_WIN32)
 WELS_THREAD_HANDLE*			pUpdateMbListThrdHandles;	// thread handles for update mb list thread, [iThreadIdx]
-#endif//!_WIN32
-#ifdef _WIN32
-WELS_EVENT*					pUpdateMbListEvent;		// signal to update mb list neighbor for various slices
-WELS_EVENT*					pFinUpdateMbListEvent;	// signal to indicate finish updating mb list
-#else
 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
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -332,22 +332,19 @@
   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))
-#else
-  pSmt->pUpdateMbListThrdHandles	= (WELS_THREAD_HANDLE*)pMa->WelsMalloc (sizeof (WELS_THREAD_HANDLE) * iThreadNum,
-                                    "pUpdateMbListThrdHandles");
-  WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListThrdHandles), FreeMemorySvc (ppCtx))
-#endif//!_WIN32
-#ifdef _WIN32
+
   pSmt->pUpdateMbListEvent	= (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent");
   WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx))
   pSmt->pFinUpdateMbListEvent	= (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinUpdateMbListEvent");
   WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinUpdateMbListEvent), FreeMemorySvc (ppCtx))
-#endif//_WIN32
 
-#ifdef _WIN32
   pSmt->pExitEncodeEvent	= (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pExitEncodeEvent");
   WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pExitEncodeEvent), FreeMemorySvc (ppCtx))
-#endif//_WIN32
+#else
+  pSmt->pUpdateMbListThrdHandles	= (WELS_THREAD_HANDLE*)pMa->WelsMalloc (sizeof (WELS_THREAD_HANDLE) * iThreadNum,
+                                    "pUpdateMbListThrdHandles");
+  WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListThrdHandles), FreeMemorySvc (ppCtx))
+#endif//!_WIN32
 
   iIdx = 0;
   while (iIdx < iNumSpatialLayers) {
@@ -396,6 +393,10 @@
 #ifdef _WIN32
     WelsEventInit (&pSmt->pUpdateMbListEvent[iIdx]);
     WelsEventInit (&pSmt->pFinUpdateMbListEvent[iIdx]);
+    WelsEventInit (&pSmt->pSliceCodedEvent[iIdx]);
+    WelsEventInit (&pSmt->pReadySliceCodingEvent[iIdx]);
+    WelsEventInit (&pSmt->pFinSliceCodingEvent[iIdx]);
+    WelsEventInit (&pSmt->pExitEncodeEvent[iIdx]);
 #else
     // length of semaphore name should be system constrained at least on mac 10.7
     WelsSnprintf (name, SEM_NAME_MAX, "ud%d%p", iIdx, (void*) (*ppCtx));
@@ -408,14 +409,6 @@
 #if defined(ENABLE_TRACE_MT)
     WelsLog ((*ppCtx), WELS_LOG_INFO, "[MT] Open pFinUpdateMbListEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno);
 #endif
-#endif//_WIN32
-
-#ifdef _WIN32
-    WelsEventInit (&pSmt->pSliceCodedEvent[iIdx]);
-    WelsEventInit (&pSmt->pReadySliceCodingEvent[iIdx]);
-    WelsEventInit (&pSmt->pFinSliceCodingEvent[iIdx]);
-    WelsEventInit (&pSmt->pExitEncodeEvent[iIdx]);
-#else
     WelsSnprintf (name, SEM_NAME_MAX, "sc%d%p", iIdx, (void*) (*ppCtx));
     err = WelsEventOpen (&pSmt->pSliceCodedEvent[iIdx], name);
 #if defined(ENABLE_TRACE_MT)