changeset 240:e9cffb400da1

Merged multicoreware/xhevc into default
author Deepthi Devaki Akkoorath <deepthidevaki@multicorewareinc.com>
date Wed, 03 Apr 2013 18:29:27 +0530
parents b553eaec9dd7 (current diff) 3b9f17747601 (diff)
children ba8f928d91d6
files
diffstat 3 files changed, 28 insertions(+-), 30 deletions(-) [+]
line wrap: on
line diff
--- a/source/encoder/primitives.cpp	Wed Apr 03 14:34:39 2013 +0530
+++ b/source/encoder/primitives.cpp	Wed Apr 03 18:29:27 2013 +0530
@@ -22,13 +22,12 @@
  *****************************************************************************/
 
 #include "primitives.h"
+#include "instrset.h"
 #include <assert.h>
 #include <stdint.h>
 #include <string.h>
 #include <stdio.h>
 
-int instrset_detect(void); // from instrset_detect.cpp
-
 namespace x265 {
 // x265 private namespace
 
@@ -56,27 +55,6 @@ int PartitionFromSizes(int Width, int He
     return (int) psize[(Width>>2)-1][(Height>>2)-1];
 }
 
-
-void Setup_C_Primitives(EncoderPrimitives &p);
-
-/* These functions are defined by C++ files in encoder/vec. Depending on your
- * compiler, some of them may be undefined.  The #if logic here must match the
- * file lists in vec/CMakeLists.txt */
-
-#if defined (__GNUC__) || defined(_MSC_VER)
-extern void Setup_Vec_Primitives_sse42(EncoderPrimitives&);
-extern void Setup_Vec_Primitives_sse41(EncoderPrimitives&);
-extern void Setup_Vec_Primitives_ssse3(EncoderPrimitives&);
-extern void Setup_Vec_Primitives_sse3(EncoderPrimitives&);
-extern void Setup_Vec_Primitives_sse2(EncoderPrimitives&);
-#endif
-#if defined(_MSC_VER) && _MSC_VER >= 1600
-extern void Setup_Vec_Primitives_avx(EncoderPrimitives&);
-#endif
-#if defined(_MSC_VER) && _MSC_VER >= 1700
-extern void Setup_Vec_Primitives_avx2(EncoderPrimitives&);
-#endif
-
 /* the "authoritative" set of encoder primitives */
 #if ENABLE_PRIMITIVES
 EncoderPrimitives primitives;
@@ -88,7 +66,7 @@ void SetupPrimitives(int cpuid)
 {
     if (cpuid == 0)
     {
-        cpuid = cpuIDDetect();
+        cpuid = CpuIDDetect();
     }
 
 #if ENABLE_PRIMITIVES
@@ -102,7 +80,7 @@ void SetupPrimitives(int cpuid)
     if (cpuid > 4) Setup_Vec_Primitives_sse41(primitives);
     if (cpuid > 5) Setup_Vec_Primitives_sse42(primitives);
 #endif
-#if defined(_MSC_VER) && _MSC_VER >= 1600
+#if (defined(_MSC_VER) && _MSC_VER >= 1600) || defined(__GNUC__)
     if (cpuid > 6) Setup_Vec_Primitives_avx(primitives);
 #endif
 #if defined(_MSC_VER) && _MSC_VER >= 1700
@@ -113,7 +91,7 @@ void SetupPrimitives(int cpuid)
 #endif
 }
 
-int cpuIDDetect(void)
+int CpuIDDetect(void)
 {
     int cpuid = 0;
     int iset = instrset_detect(); // Detect supported instruction set
--- a/source/encoder/primitives.h	Wed Apr 03 14:34:39 2013 +0530
+++ b/source/encoder/primitives.h	Wed Apr 03 18:29:27 2013 +0530
@@ -95,9 +95,27 @@ struct EncoderPrimitives
 /* This copy of the table is what gets used by all by the encoder.
  * It must be initialized before the encoder begins. */
 extern EncoderPrimitives primitives;
+void SetupPrimitives(int cpuid = 0);
+int CpuIDDetect(void);
 
-void SetupPrimitives(int cpuid = 0);
-int cpuIDDetect(void);
+void Setup_C_Primitives(EncoderPrimitives &p);
+
+/* These functions are defined by C++ files in encoder/vec. Depending on your
+ * compiler, some of them may be undefined.  The #if logic here must match the
+ * file lists in vec/CMakeLists.txt */
+#if defined (__GNUC__) || defined(_MSC_VER)
+extern void Setup_Vec_Primitives_sse42(EncoderPrimitives&);
+extern void Setup_Vec_Primitives_sse41(EncoderPrimitives&);
+extern void Setup_Vec_Primitives_ssse3(EncoderPrimitives&);
+extern void Setup_Vec_Primitives_sse3(EncoderPrimitives&);
+extern void Setup_Vec_Primitives_sse2(EncoderPrimitives&);
+#endif
+#if (defined(_MSC_VER) && _MSC_VER >= 1600) || defined(__GNUC__)
+extern void Setup_Vec_Primitives_avx(EncoderPrimitives&);
+#endif
+#if defined(_MSC_VER) && _MSC_VER >= 1700
+extern void Setup_Vec_Primitives_avx2(EncoderPrimitives&);
+#endif
 
 }
 
--- a/source/encoder/vec/CMakeLists.txt	Wed Apr 03 14:34:39 2013 +0530
+++ b/source/encoder/vec/CMakeLists.txt	Wed Apr 03 18:29:27 2013 +0530
@@ -11,8 +11,10 @@ if (MSVC_VERSION EQUAL 1700) # VC11
     set_source_files_properties(avx.cpp avx2.cpp PROPERTIES COMPILE_FLAGS /arch:AVX)
 endif()
 if(GCC)
-    set(PRIMITIVES sse2.cpp sse3.cpp ssse3.cpp sse41.cpp sse42.cpp)
-    add_definitions(-msse4)
+    set(PRIMITIVES sse2.cpp sse3.cpp ssse3.cpp sse41.cpp sse42.cpp avx.cpp)
+    set_source_files_properties(sse2.cpp sse3.cpp ssse3.cpp sse41.cpp sse42.cpp
+                                PROPERTIES COMPILE_FLAGS -msse4)
+    set_source_files_properties(avx.cpp PROPERTIES COMPILE_FLAGS -mavx)
 endif(GCC)
 
 file(GLOB VECTORCLASS ../../VectorClass/*.h ../../VectorClass/special/*.h)