[x265] [PATCH] asm: prevent assembly use in 32bit HBD builds

Steve Borho steve at borho.org
Fri Mar 6 03:39:31 CET 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1425609548 21600
#      Thu Mar 05 20:39:08 2015 -0600
# Node ID 45deb0125890ab0211d0e256c74d91ede78d12d3
# Parent  f27f2c0b2d8c665fcd11db529936b8b7e41df355
asm: prevent assembly use in 32bit HBD builds

We have prevented HIGH_BIT_DEPTH builds for 32bit target platforms for a very
long time. In the interest of keeping the code clean, we'll programically
prevent assembly use in the event this unsupported build combination is used.

diff -r f27f2c0b2d8c -r 45deb0125890 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Mar 05 19:50:40 2015 -0600
+++ b/source/CMakeLists.txt	Thu Mar 05 20:39:08 2015 -0600
@@ -213,6 +213,7 @@
     # can disable this if(X64) check if you desparately need a 32bit
     # build with 10bit/12bit support, but this violates the "shrink wrap
     # license" so to speak.  If it breaks you get to keep both halves.
+    # You will likely need to compile without assembly
     option(HIGH_BIT_DEPTH "Store pixels as 16bit values" OFF)
 endif(X64)
 if(HIGH_BIT_DEPTH)
diff -r f27f2c0b2d8c -r 45deb0125890 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Mar 05 19:50:40 2015 -0600
+++ b/source/common/x86/asm-primitives.cpp	Thu Mar 05 20:39:08 2015 -0600
@@ -796,6 +796,11 @@
 
 void setupAssemblyPrimitives(EncoderPrimitives &p, int cpuMask) // 16bpp
 {
+#if !defined(X86_64)
+    x265_log(NULL, X265_LOG_WARNING, "Assembly not allowed in 32bit high bit-depth builds\n");
+    return;
+#endif
+
     if (cpuMask & X265_CPU_SSE2)
     {
         /* We do not differentiate CPUs which support MMX and not SSE2. We only check
@@ -888,9 +893,8 @@
         p.cu[BLOCK_4x4].dct = x265_dct4_sse2;
         p.cu[BLOCK_8x8].dct = x265_dct8_sse2;
         p.cu[BLOCK_4x4].idct = x265_idct4_sse2;
-#if X86_64
         p.cu[BLOCK_8x8].idct = x265_idct8_sse2;
-#endif
+
         p.idst4x4 = x265_idst4_sse2;
 
         LUMA_VSS_FILTERS(sse2);
@@ -951,11 +955,8 @@
 
         // TODO: check POPCNT flag!
         ALL_LUMA_TU_S(copy_cnt, copy_cnt_, sse4);
-
-#if X86_64
         ALL_LUMA_CU(psy_cost_pp, psyCost_pp, sse4);
         ALL_LUMA_CU(psy_cost_ss, psyCost_ss, sse4);
-#endif
     }
     if (cpuMask & X265_CPU_AVX)
     {
@@ -1076,7 +1077,6 @@
         LUMA_VAR(xop);
         p.frameInitLowres = x265_frame_init_lowres_core_xop;
     }
-#if X86_64
     if (cpuMask & X265_CPU_AVX2)
     {
         p.cu[BLOCK_32x32].ssd_s = x265_pixel_ssd_s_32_avx2;
@@ -1120,7 +1120,6 @@
         ALL_LUMA_PU(luma_vsp, interp_8tap_vert_sp, avx2);
         ALL_LUMA_PU(luma_vss, interp_8tap_vert_ss, avx2);
     }
-#endif
 }
 #else // if HIGH_BIT_DEPTH
 


More information about the x265-devel mailing list