diff --git a/source/common/cpu.cpp b/source/common/cpu.cpp index 800f51f9f..3eae5944c 100644 --- a/source/common/cpu.cpp +++ b/source/common/cpu.cpp @@ -471,14 +471,16 @@ uint32_t cpu_detect( bool benableavx512 ) } #elif X265_ARCH_POWER8 +#include "ppc/cpu.h" uint32_t cpu_detect(bool benableavx512) { -#if HAVE_ALTIVEC - return X265_CPU_ALTIVEC; -#else - return 0; -#endif + (void)benableavx512; + uint32_t flags = 0; + + flags = ppc_cpu_detect(); + + return flags; } #else // if X265_ARCH_POWER8 diff --git a/source/common/ppc/cpu.h b/source/common/ppc/cpu.h new file mode 100644 index 000000000..32ca11e2f --- /dev/null +++ b/source/common/ppc/cpu.h @@ -0,0 +1,39 @@ +/***************************************************************************** + * Copyright (C) 2026 MulticoreWare, Inc + * + * Authors: Brad Smith + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#ifndef X265_COMMON_PPC_CPU_H +#define X265_COMMON_PPC_CPU_H + +#include "x265.h" + +static inline uint32_t ppc_cpu_detect() +{ + uint32_t flags = 0; + +#if HAVE_ALTIVEC + flags |= X265_CPU_ALTIVEC; +#endif + return flags; +} + +#endif // ifndef X265_COMMON_PPC_CPU_H