#if HAVE_ARMV6
#include "arm/bitstream.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
#include "aarch64/bitstream.h"
#endif
if( cpu&X264_CPU_NEON )
pf->nal_escape = x264_nal_escape_neon;
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
if( cpu&X264_CPU_NEON )
pf->nal_escape = x264_nal_escape_neon;
#endif
#define x264_cabac_encode_decision x264_cabac_encode_decision_asm
#define x264_cabac_encode_bypass x264_cabac_encode_bypass_asm
#define x264_cabac_encode_terminal x264_cabac_encode_terminal_asm
-#elif defined(ARCH_AARCH64)
+#elif HAVE_AARCH64
#define x264_cabac_encode_decision x264_cabac_encode_decision_asm
#define x264_cabac_encode_bypass x264_cabac_encode_bypass_asm
#define x264_cabac_encode_terminal x264_cabac_encode_terminal_asm
const x264_cpu_name_t x264_cpu_names[] =
{
-#if HAVE_MMX
+#if ARCH_X86 || ARCH_X86_64
// {"MMX", X264_CPU_MMX}, // we don't support asm on mmx1 cpus anymore
#define MMX2 X264_CPU_MMX|X264_CPU_MMX2
{"MMX2", MMX2},
{"", 0},
};
-#if (ARCH_PPC && SYS_LINUX) || (ARCH_ARM && !HAVE_NEON)
+#if (HAVE_ALTIVEC && SYS_LINUX) || (HAVE_ARMV6 && !HAVE_NEON)
#include <signal.h>
#include <setjmp.h>
static sigjmp_buf jmpbuf;
return cpu;
}
-#elif ARCH_PPC && HAVE_ALTIVEC
+#elif HAVE_ALTIVEC
#if SYS_MACOSX || SYS_OPENBSD || SYS_FREEBSD
#include <sys/sysctl.h>
}
#endif
-#elif ARCH_ARM
+#elif HAVE_ARMV6
void x264_cpu_neon_test( void );
int x264_cpu_fast_neon_mrc_test( void );
uint32_t x264_cpu_detect( void )
{
int flags = 0;
-#if HAVE_ARMV6
flags |= X264_CPU_ARMV6;
// don't do this hack if compiled with -mfpu=neon
flags |= x264_cpu_fast_neon_mrc_test() ? X264_CPU_FAST_NEON_MRC : 0;
#endif
// TODO: write dual issue test? currently it's A8 (dual issue) vs. A9 (fast mrc)
-#endif
return flags;
}
-#elif ARCH_AARCH64
+#elif HAVE_AARCH64
uint32_t x264_cpu_detect( void )
{
return X264_CPU_ARMV8 | X264_CPU_NEON;
}
-#elif ARCH_MIPS
+#elif HAVE_MSA
uint32_t x264_cpu_detect( void )
{
- uint32_t flags = 0;
-#if HAVE_MSA
- flags |= X264_CPU_MSA;
-#endif
- return flags;
+ return X264_CPU_MSA;
}
#else
#if HAVE_MMX
# include "x86/dct.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
# include "ppc/dct.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
# include "arm/dct.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
# include "aarch64/dct.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
# include "mips/dct.h"
#endif
}
#endif
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
dctf->sub4x4_dct = x264_sub4x4_dct_neon;
pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_altivec;
}
#endif
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_neon;
-#if ARCH_AARCH64
+#if HAVE_AARCH64
pf_interlaced->scan_4x4 = x264_zigzag_scan_4x4_field_neon;
pf_interlaced->scan_8x8 = x264_zigzag_scan_8x8_field_neon;
pf_interlaced->sub_4x4 = x264_zigzag_sub_4x4_field_neon;
pf_progressive->sub_4x4 = x264_zigzag_sub_4x4_frame_neon;
pf_progressive->sub_4x4ac = x264_zigzag_sub_4x4ac_frame_neon;
pf_progressive->sub_8x8 = x264_zigzag_sub_8x8_frame_neon;
-#endif // ARCH_AARCH64
+#endif // HAVE_AARCH64
}
-#endif // HAVE_ARMV6 || ARCH_AARCH64
+#endif // HAVE_ARMV6 || HAVE_AARCH64
#endif // HIGH_BIT_DEPTH
pf_interlaced->interleave_8x8_cavlc =
#endif // HIGH_BIT_DEPTH
#endif
#if !HIGH_BIT_DEPTH
-#if ARCH_AARCH64
+#if HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
pf_interlaced->interleave_8x8_cavlc =
pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_neon;
}
-#endif // ARCH_AARCH64
+#endif // HAVE_AARCH64
#if HAVE_ALTIVEC
if( cpu&X264_CPU_ALTIVEC )
#if HAVE_MMX
#include "x86/deblock.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
#include "ppc/deblock.h"
#endif
#if HAVE_ARMV6
#include "arm/deblock.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
#include "aarch64/deblock.h"
#endif
#if HAVE_MSA
}
#endif // HAVE_ALTIVEC
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
pf->deblock_luma[1] = x264_deblock_v_luma_neon;
#if HAVE_MMX
#include "x86/mc.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
#include "ppc/mc.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
#include "arm/mc.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
#include "aarch64/mc.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
#include "mips/mc.h"
#endif
#if HAVE_ARMV6
x264_mc_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_mc_init_aarch64( cpu, pf );
#endif
#if HAVE_MSA
# include "x86/pixel.h"
# include "x86/predict.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
# include "ppc/pixel.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
# include "arm/pixel.h"
# include "arm/predict.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
# include "aarch64/pixel.h"
# include "aarch64/predict.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
# include "mips/pixel.h"
#endif
#endif
#if !HIGH_BIT_DEPTH
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
SATD_X_DECL7( _neon )
#endif
#endif // !HIGH_BIT_DEPTH
INTRA_MBCMP_8x8( sad, _mmx2, _c )
INTRA_MBCMP_8x8(sa8d, _sse2, _sse2 )
#endif
-#if !HIGH_BIT_DEPTH && (HAVE_ARMV6 || ARCH_AARCH64)
+#if !HIGH_BIT_DEPTH && (HAVE_ARMV6 || HAVE_AARCH64)
INTRA_MBCMP_8x8( sad, _neon, _neon )
INTRA_MBCMP_8x8(sa8d, _neon, _neon )
#endif
INTRA_MBCMP( sad, 16x16, v, h, dc, , _neon, _neon )
INTRA_MBCMP(satd, 16x16, v, h, dc, , _neon, _neon )
#endif
-#if !HIGH_BIT_DEPTH && ARCH_AARCH64
+#if !HIGH_BIT_DEPTH && HAVE_AARCH64
INTRA_MBCMP( sad, 4x4, v, h, dc, , _neon, _neon )
INTRA_MBCMP(satd, 4x4, v, h, dc, , _neon, _neon )
INTRA_MBCMP( sad, 8x8, dc, h, v, c, _neon, _neon )
}
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
INIT8( sad, _neon );
pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_neon;
pixf->ssim_end4 = x264_pixel_ssim_end4_neon;
}
-#endif // ARCH_AARCH64
+#endif // HAVE_AARCH64
#if HAVE_MSA
if( cpu&X264_CPU_MSA )
#if HAVE_MMX
# include "x86/predict.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
# include "ppc/predict.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
# include "arm/predict.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
# include "aarch64/predict.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
# include "mips/predict.h"
#endif
x264_predict_16x16_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_16x16_init_aarch64( cpu, pf );
#endif
x264_predict_8x8c_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_8x8c_init_aarch64( cpu, pf );
#endif
x264_predict_8x16c_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_8x16c_init_aarch64( cpu, pf );
#endif
}
x264_predict_8x8_init_arm( cpu, pf, predict_filter );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_8x8_init_aarch64( cpu, pf, predict_filter );
#endif
x264_predict_4x4_init_arm( cpu, pf );
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
x264_predict_4x4_init_aarch64( cpu, pf );
#endif
}
#if HAVE_MMX
#include "x86/quant.h"
#endif
-#if ARCH_PPC
+#if HAVE_ALTIVEC
# include "ppc/quant.h"
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
# include "arm/quant.h"
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
# include "aarch64/quant.h"
#endif
-#if ARCH_MIPS
+#if HAVE_MSA
# include "mips/quant.h"
#endif
pf->coeff_last8 = x264_coeff_last8_arm;
}
#endif
-#if HAVE_ARMV6 || ARCH_AARCH64
+#if HAVE_ARMV6 || HAVE_AARCH64
if( cpu&X264_CPU_NEON )
{
pf->quant_2x2_dc = x264_quant_2x2_dc_neon;
pf->decimate_score64 = x264_decimate_score64_neon;
}
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
if( cpu&X264_CPU_ARMV8 )
{
pf->coeff_last4 = x264_coeff_last4_aarch64;
"
# list of all preprocessor HAVE values we can define
-CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
+CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON AARCH64 BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER \
MSA MMAP WINRT VSX ARM_INLINE_ASM STRTOK_R CLOCK_GETTIME BITDEPTH8 BITDEPTH10"
if [ $asm = auto -a $ARCH = AARCH64 ] ; then
if [ $compiler = CL ] && cpp_check '' '' 'defined(_M_ARM64)' ; then
+ define HAVE_AARCH64
define HAVE_NEON
elif cc_check '' '' '__asm__("cmeq v0.8h, v0.8h, #0");' ; then
+ define HAVE_AARCH64
define HAVE_NEON
ASFLAGS="$ASFLAGS -c"
else
if( k < j )
continue;
printf( "%s_%s%s: %"PRId64"\n", benchs[i].name,
-#if HAVE_MMX
+#if ARCH_X86 || ARCH_X86_64
b->cpu&X264_CPU_AVX512 ? "avx512" :
b->cpu&X264_CPU_AVX2 ? "avx2" :
b->cpu&X264_CPU_BMI2 ? "bmi2" :
b->cpu&X264_CPU_MSA ? "msa" :
#endif
"c",
-#if HAVE_MMX
+#if ARCH_X86 || ARCH_X86_64
b->cpu&X264_CPU_CACHELINE_32 ? "_c32" :
b->cpu&X264_CPU_SLOW_ATOM && b->cpu&X264_CPU_CACHELINE_64 ? "_c64_atom" :
b->cpu&X264_CPU_CACHELINE_64 ? "_c64" :
static void (*simd_warmup_func)( void ) = NULL;
#define simd_warmup() do { if( simd_warmup_func ) simd_warmup_func(); } while( 0 )
-#if ARCH_X86 || ARCH_X86_64
+#if HAVE_MMX
int x264_stack_pagealign( int (*func)(), int align );
void x264_checkasm_warmup_avx( void );
void x264_checkasm_warmup_avx512( void );
#define x264_stack_pagealign( func, align ) func()
#endif
-#if ARCH_AARCH64
+#if HAVE_AARCH64
intptr_t x264_checkasm_call( intptr_t (*func)(), int *ok, ... );
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
intptr_t x264_checkasm_call_neon( intptr_t (*func)(), int *ok, ... );
intptr_t x264_checkasm_call_noneon( intptr_t (*func)(), int *ok, ... );
intptr_t (*x264_checkasm_call)( intptr_t (*func)(), int *ok, ... ) = x264_checkasm_call_noneon;
#define call_c1(func,...) func(__VA_ARGS__)
-#if ARCH_X86_64
+#if HAVE_MMX && ARCH_X86_64
/* Evil hack: detect incorrect assumptions that 32-bit ints are zero-extended to 64-bit.
* This is done by clobbering the stack with junk around the stack pointer and calling the
* assembly function through x264_checkasm_call with added dummy arguments which forces all
x264_checkasm_stack_clobber( r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r ); /* max_args+6 */ \
simd_warmup(); \
x264_checkasm_call(( intptr_t(*)())func, &ok, 0, 0, 0, 0, __VA_ARGS__ ); })
-#elif ARCH_AARCH64 && !defined(__APPLE__)
+#elif HAVE_AARCH64 && !defined(__APPLE__)
void x264_checkasm_stack_clobber( uint64_t clobber, ... );
#define call_a1(func,...) ({ \
uint64_t r = (rand() & 0xffff) * 0x0001000100010001ULL; \
x264_checkasm_stack_clobber( r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r ); /* max_args+8 */ \
x264_checkasm_call(( intptr_t(*)())func, &ok, 0, 0, 0, 0, 0, 0, __VA_ARGS__ ); })
-#elif ARCH_X86 || ARCH_ARM
+#elif HAVE_MMX || HAVE_ARMV6
#define call_a1(func,...) x264_checkasm_call( (intptr_t(*)())func, &ok, __VA_ARGS__ )
#else
#define call_a1 call_c1
#endif
-#if ARCH_ARM
+#if HAVE_ARMV6
#define call_a1_64(func,...) ((uint64_t (*)(intptr_t(*)(), int*, ...))x264_checkasm_call)( (intptr_t(*)())func, &ok, __VA_ARGS__ )
#else
#define call_a1_64 call_a1
DECL_CABAC(c)
#if HAVE_MMX
DECL_CABAC(asm)
-#elif defined(ARCH_AARCH64)
+#elif HAVE_AARCH64
DECL_CABAC(asm)
#else
#define run_cabac_decision_asm run_cabac_decision_c
int ret = 0;
int cpu0 = 0, cpu1 = 0;
uint32_t cpu_detect = x264_cpu_detect();
-#if ARCH_X86 || ARCH_X86_64
+#if HAVE_MMX
if( cpu_detect & X264_CPU_AVX512 )
simd_warmup_func = x264_checkasm_warmup_avx512;
else if( cpu_detect & X264_CPU_AVX )
#endif
simd_warmup();
-#if HAVE_MMX
+#if ARCH_X86 || ARCH_X86_64
if( cpu_detect & X264_CPU_MMX2 )
{
ret |= add_flags( &cpu0, &cpu1, X264_CPU_MMX | X264_CPU_MMX2, "MMX" );