shithub: openh264

Download patch

ref: fba745f04e224b8133aa483237f05243ab5e7318
parent: 5fdd01ec0c67cd0f02496a8b4f4b2c5b3ff39efb
parent: e4a278620bf4c80cdb8e1cef53e14b139363911a
author: sijchen <sijchen@cisco.com>
date: Tue Feb 3 10:06:44 EST 2015

Merge pull request #1788 from mstorsjo/share-wels-const

Share parts of wels_const.h

--- a/Makefile
+++ b/Makefile
@@ -125,7 +125,7 @@
 ENCODER_UNITTEST_INCLUDES += $(CODEC_UNITTEST_INCLUDES) $(ENCODER_INCLUDES)
 PROCESSING_UNITTEST_INCLUDES += $(CODEC_UNITTEST_INCLUDES) $(PROCESSING_INCLUDES)
 API_TEST_INCLUDES += $(CODEC_UNITTEST_INCLUDES)
-COMMON_UNITTEST_INCLUDES += $(CODEC_UNITTEST_INCLUDES) $(DECODER_INCLUDES)
+COMMON_UNITTEST_INCLUDES += $(CODEC_UNITTEST_INCLUDES)
 MODULE_INCLUDES += -I$(SRC_PATH)gmp-api
 
 DECODER_UNITTEST_CFLAGS += $(CODEC_UNITTEST_CFLAGS)
--- a/codec/build/iOS/common/common.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/common/common.xcodeproj/project.pbxproj
@@ -69,6 +69,7 @@
 		4CE443E918B722CD0017DF25 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
 		53C1C9BA193F0F9E00404D8F /* expand_pic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = expand_pic.h; sourceTree = "<group>"; };
 		53C1C9BB193F0FB000404D8F /* expand_pic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = expand_pic.cpp; sourceTree = "<group>"; };
+		5B9196F91A7F8BA40075D641 /* wels_const_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_const_common.h; sourceTree = "<group>"; };
 		5BA8F2BE19603F3500011CE4 /* wels_common_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_common_defs.h; sourceTree = "<group>"; };
 		5BA8F2BF19603F5F00011CE4 /* common_tables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = common_tables.cpp; sourceTree = "<group>"; };
 		5BD896B81A7B837700D32B7D /* memory_align.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory_align.h; sourceTree = "<group>"; };
@@ -133,6 +134,7 @@
 				5BD896B81A7B837700D32B7D /* memory_align.h */,
 				4C3406C118D96EA600DFA14A /* typedefs.h */,
 				5BA8F2BE19603F3500011CE4 /* wels_common_defs.h */,
+				5B9196F91A7F8BA40075D641 /* wels_const_common.h */,
 				4C3406C218D96EA600DFA14A /* WelsThreadLib.h */,
 			);
 			path = inc;
--- a/codec/build/win32/dec/WelsDecCore.vcproj
+++ b/codec/build/win32/dec/WelsDecCore.vcproj
@@ -823,6 +823,10 @@
 					RelativePath="..\..\..\decoder\core\inc\wels_const.h"
 					>
 				</File>
+				<File
+					RelativePath="..\..\..\common\inc\wels_const_common.h"
+					>
+				</File>
 			</Filter>
 			<Filter
 				Name="Source Files"
--- a/codec/build/win32/enc/WelsEncCore.vcproj
+++ b/codec/build/win32/enc/WelsEncCore.vcproj
@@ -723,6 +723,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\common\inc\wels_const_common.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\encoder\core\inc\wels_func_ptr_def.h"
 				>
 			</File>
--- /dev/null
+++ b/codec/common/inc/wels_const_common.h
@@ -1,0 +1,56 @@
+/*!
+ * \copy
+ *     Copyright (c)  2013, Cisco Systems
+ *     All rights reserved.
+ *
+ *     Redistribution and use in source and binary forms, with or without
+ *     modification, are permitted provided that the following conditions
+ *     are met:
+ *
+ *        * Redistributions of source code must retain the above copyright
+ *          notice, this list of conditions and the following disclaimer.
+ *
+ *        * Redistributions in binary form must reproduce the above copyright
+ *          notice, this list of conditions and the following disclaimer in
+ *          the documentation and/or other materials provided with the
+ *          distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *     POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef WELS_CONST_COMMON_H__
+#define WELS_CONST_COMMON_H__
+
+// Miscellaneous sizing infos
+#ifndef MAX_FNAME_LEN
+#define MAX_FNAME_LEN		256	// maximal length of file name in char size
+#endif//MAX_FNAME_LEN
+
+#ifndef WELS_LOG_BUF_SIZE
+#define WELS_LOG_BUF_SIZE	4096
+#endif//WELS_LOG_BUF_SIZE
+
+#ifndef MAX_TRACE_LOG_SIZE
+#define MAX_TRACE_LOG_SIZE	(50 * (1<<20))	// max trace log size: 50 MB, overwrite occur if log file size exceeds this size
+#endif//MAX_TRACE_LOG_SIZE
+
+/* MB width in pixels for specified colorspace I420 usually used in codec */
+#define MB_WIDTH_LUMA		16
+#define MB_WIDTH_CHROMA		(MB_WIDTH_LUMA>>1)
+/* MB height in pixels for specified colorspace I420 usually used in codec */
+#define MB_HEIGHT_LUMA		16
+#define MB_HEIGHT_CHROMA	(MB_HEIGHT_LUMA>>1)
+
+#endif//WELS_CONST_COMMON_H__
--- a/codec/decoder/core/inc/wels_const.h
+++ b/codec/decoder/core/inc/wels_const.h
@@ -31,29 +31,11 @@
  */
 
 //wels_const.h
-#ifndef WELS_CONSTANCE_H__
-#define WELS_CONSTANCE_H__
+#ifndef WELS_CONST_H__
+#define WELS_CONST_H__
 
-// Miscellaneous sizing infos
-#ifndef MAX_FNAME_LEN
-#define MAX_FNAME_LEN		256	// maximal length of file name in char size
-#endif//MAX_FNAME_LEN
+#include "wels_const_common.h"
 
-#ifndef WELS_LOG_BUF_SIZE
-#define WELS_LOG_BUF_SIZE	4096
-#endif//WELS_LOG_BUF_SIZE
-
-#ifndef MAX_TRACE_LOG_SIZE
-#define MAX_TRACE_LOG_SIZE	(50 * (1<<20))	// max trace log size: 50 MB, overwrite occur if log file size exceeds this size
-#endif//MAX_TRACE_LOG_SIZE
-
-/* MB width in pixels for specified colorspace I420 usually used in codec */
-#define MB_WIDTH_LUMA		16
-#define MB_WIDTH_CHROMA		(MB_WIDTH_LUMA>>1)
-/* MB height in pixels for specified colorspace I420 usually used in codec */
-#define MB_HEIGHT_LUMA		16
-#define MB_HEIGHT_CHROMA	(MB_HEIGHT_LUMA>>1)
-
 /* Some list size */
 #define MB_COEFF_LIST_SIZE	(256+((MB_WIDTH_CHROMA*MB_HEIGHT_CHROMA)<<1))
 
@@ -102,4 +84,4 @@
     AVC_REWRITE_ENHANCE_MB = 2
 };
 
-#endif//WELS_CONSTANCE_H__
+#endif//WELS_CONST_H__
--- a/codec/encoder/core/inc/wels_const.h
+++ b/codec/encoder/core/inc/wels_const.h
@@ -31,11 +31,12 @@
  */
 
 //wels_const.h
-#ifndef WELS_CONSTANCE_H__
-#define WELS_CONSTANCE_H__
+#ifndef WELS_CONST_H__
+#define WELS_CONST_H__
 
 #include "as264_common.h"	//  to communicate with specific macros there, 3/18/2010
 #include "codec_app_def.h"
+#include "wels_const_common.h"
 
 /* To control number of spatial, quality and temporal layers constraint by application layer? */
 #define NUM_SPATIAL_LAYERS_CONSTRAINT
@@ -42,28 +43,8 @@
 #define NUM_QUALITY_LAYERS_CONSTRAINT
 
 
-// Miscellaneous sizing infos
-#ifndef MAX_FNAME_LEN
-#define MAX_FNAME_LEN		256	// maximal length of file name in char size
-#endif//MAX_FNAME_LEN
-
-#ifndef WELS_LOG_BUF_SIZE
-#define WELS_LOG_BUF_SIZE	4096
-#endif//WELS_LOG_BUF_SIZE
-
-#ifndef MAX_TRACE_LOG_SIZE
-#define MAX_TRACE_LOG_SIZE	(50 * (1<<20))	// max trace log size: 50 MB, overwrite occur if log file size exceeds this size
-#endif//MAX_TRACE_LOG_SIZE
-
 #define STATISTICS_LOG_INTERVAL_MS (5000) // output statistics log every 5s
 
-/* MB width in pixels for specified colorspace I420 usually used in codec */
-#define MB_WIDTH_LUMA		16
-#define MB_WIDTH_CHROMA		(MB_WIDTH_LUMA>>1)
-/* MB height in pixels for specified colorspace I420 usually used in codec */
-#define MB_HEIGHT_LUMA		16
-#define MB_HEIGHT_CHROMA	(MB_HEIGHT_LUMA>>1)
-
 /* Some list size */
 #define MB_COEFF_LIST_SIZE	(256+((MB_WIDTH_CHROMA*MB_HEIGHT_CHROMA)<<1))
 #define MB_REQ_LUMA_CACHE_SIZE	40	// 8x5 Size of MB cache only luma component required to store
@@ -215,4 +196,4 @@
 };
 //TODO: need to complete the return checking in encoder and fill in more types if needed
 
-#endif//WELS_CONSTANCE_H__
+#endif//WELS_CONST_H__
--- a/test/common/ExpandPicture.cpp
+++ b/test/common/ExpandPicture.cpp
@@ -2,14 +2,16 @@
 #include "codec_def.h"
 #include "expand_pic.h"
 #include "memory_align.h"
-#include "decoder_context.h"
 #include "cpu.h"
 #include "cpu_core.h"
+#include "macros.h"
+#include "wels_const_common.h"
+
 #define EXPAND_PIC_TEST_NUM 10
 #define H264_PADDING_LENGTH_LUMA (PADDING_LENGTH)
 #define H264_PADDING_LENGTH_CHROMA (PADDING_LENGTH>>1)
 
-using namespace WelsDec;
+using namespace WelsCommon;
 
 void H264ExpandPictureLumaAnchor_c (uint8_t* pDst, int32_t iStride, int32_t iPicWidth, int32_t iPicHeight) {
   uint8_t* pTmp = pDst;