Fix x265 on non-x86 architectures. Patches are from maya@netbsd.org. Thanks!

This commit is contained in:
jklos 2018-12-11 17:55:56 +00:00
parent a8a7984c4d
commit cac2e1309d
4 changed files with 68 additions and 1 deletions

View file

@ -1,8 +1,11 @@
$NetBSD: distinfo,v 1.26 2018/10/06 12:12:48 adam Exp $
$NetBSD: distinfo,v 1.27 2018/12/11 17:55:56 jklos Exp $
SHA1 (x265_2.9.tar.gz) = 3c005b4ab409c6f996b36ad88d780ff85fbc9abf
RMD160 (x265_2.9.tar.gz) = ea6772ec426c141eb1756cdf6bb2def3d6319f47
SHA512 (x265_2.9.tar.gz) = 270818c7fd84947fde371e32bef225c1880cfb0bcd95378d95b51f50577a134d7cd585fcdfa43b103a24d76c5ad826b09509a07eb9e208e8f2b56f2f77365cf3
Size (x265_2.9.tar.gz) = 1385848 bytes
SHA1 (patch-CMakeLists.txt) = fbf4d08133a48b342a060f1b45bab0253455a1b1
SHA1 (patch-common_cpu.cpp) = 78ca000d57dba65bd0bf6d6c4d3bd878ae3387e7
SHA1 (patch-common_cpu.h) = 33e3bb9bc9cb60735aa09efa185c474ebd3e6af5
SHA1 (patch-common_quant.cpp) = 8cbaf6f00c1799ffaa503ffa372f05b76e97ae3b
SHA1 (patch-encoder_encoder.cpp) = 907db18c8e9afd51684ed886da70c23ac3d3652a

View file

@ -0,0 +1,26 @@
$NetBSD: patch-common_cpu.cpp,v 1.1 2018/12/11 17:55:56 jklos Exp $
Retire detect512, make enable512 a global.
--- common/cpu.cpp.orig 2018-10-05 12:14:40.000000000 +0000
+++ common/cpu.cpp
@@ -58,7 +58,7 @@ static void sigill_handler(int sig)
#endif // if X265_ARCH_ARM
namespace X265_NS {
-static bool enable512 = false;
+bool enable512 = false;
const cpu_name_t cpu_names[] =
{
#if X265_ARCH_X86
@@ -123,10 +123,6 @@ uint64_t PFX(cpu_xgetbv)(int xcr);
#pragma warning(disable: 4309) // truncation of constant value
#endif
-bool detect512()
-{
- return(enable512);
-}
uint32_t cpu_detect(bool benableavx512 )
{

View file

@ -0,0 +1,15 @@
$NetBSD: patch-common_cpu.h,v 1.1 2018/12/11 17:55:56 jklos Exp $
Retire detect512, use enable512 as a global
--- common/cpu.h.orig 2018-10-05 12:14:40.000000000 +0000
+++ common/cpu.h
@@ -50,7 +50,7 @@ extern "C" void PFX(safe_intel_cpu_indic
namespace X265_NS {
uint32_t cpu_detect(bool);
-bool detect512();
+extern bool enable512;
struct cpu_name_t
{

View file

@ -0,0 +1,23 @@
$NetBSD: patch-common_quant.cpp,v 1.1 2018/12/11 17:55:56 jklos Exp $
Use enable512 as a global, not through detect512
--- common/quant.cpp.orig 2018-10-05 12:14:40.000000000 +0000
+++ common/quant.cpp
@@ -723,7 +723,6 @@ uint32_t Quant::rdoQuant(const CUData& c
X265_CHECK(coeffNum[cgScanPos] == 0, "count of coeff failure\n");
uint32_t scanPosBase = (cgScanPos << MLS_CG_SIZE);
uint32_t blkPos = codeParams.scan[scanPosBase];
- bool enable512 = detect512();
if (enable512)
primitives.cu[log2TrSize - 2].psyRdoQuant(m_resiDctCoeff, m_fencDctCoeff, costUncoded, &totalUncodedCost, &totalRdCost, &psyScale, blkPos);
else
@@ -805,8 +804,6 @@ uint32_t Quant::rdoQuant(const CUData& c
uint32_t blkPos = codeParams.scan[scanPosBase];
if (usePsyMask)
{
- bool enable512 = detect512();
-
if (enable512)
primitives.cu[log2TrSize - 2].psyRdoQuant(m_resiDctCoeff, m_fencDctCoeff, costUncoded, &totalUncodedCost, &totalRdCost, &psyScale, blkPos);
else