diff --git a/CMakeLists.txt b/CMakeLists.txt index 603574c32e8a7117e7a9d5c89e4ce6ce482f0406..7c12b6bca07ca966706f2107a30cf687173147b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -403,12 +403,12 @@ set(AOM_DSP_INTRIN_SSSE3 set(AOM_DSP_ASM_SSSE3 "${AOM_ROOT}/aom_dsp/x86/aom_subpixel_8t_ssse3.asm" "${AOM_ROOT}/aom_dsp/x86/aom_subpixel_bilinear_ssse3.asm" - "${AOM_ROOT}/aom_dsp/x86/fwd_txfm_ssse3_x86_64.asm" "${AOM_ROOT}/aom_dsp/x86/intrapred_ssse3.asm" "${AOM_ROOT}/aom_dsp/x86/sad_ssse3.asm") set(AOM_DSP_ASM_SSSE3_X86_64 "${AOM_ROOT}/aom_dsp/x86/avg_ssse3_x86_64.asm" + "${AOM_ROOT}/aom_dsp/x86/fwd_txfm_ssse3_x86_64.asm" "${AOM_ROOT}/aom_dsp/x86/inv_txfm_ssse3_x86_64.asm" "${AOM_ROOT}/aom_dsp/x86/quantize_ssse3_x86_64.asm" "${AOM_ROOT}/aom_dsp/x86/ssim_opt_x86_64.asm") @@ -420,7 +420,7 @@ set(AOM_DSP_INTRIN_SSE4_1 "${AOM_ROOT}/aom_dsp/x86/blend_a64_hmask_sse4.c" "${AOM_ROOT}/aom_dsp/x86/blend_a64_mask_sse4.c" "${AOM_ROOT}/aom_dsp/x86/blend_a64_vmask_sse4.c") -set(AOM_DSP_AVX_ASM "${AOM_ROOT}/aom_dsp/x86/quantize_avx_x86_64.asm") +set(AOM_DSP_AVX_ASM_X86_64 "${AOM_ROOT}/aom_dsp/x86/quantize_avx_x86_64.asm") set(AOM_DSP_AVX2_INTRIN "${AOM_ROOT}/aom_dsp/x86/aom_subpixel_8t_intrin_avx2.c" "${AOM_ROOT}/aom_dsp/x86/fwd_txfm_avx2.c" @@ -460,7 +460,7 @@ set(AOM_AV1_ENCODER_SSE2_INTRIN "${AOM_ROOT}/av1/encoder/x86/highbd_block_error_intrin_sse2.c" "${AOM_ROOT}/av1/encoder/x86/av1_quantize_sse2.c") -set(AOM_AV1_ENCODER_SSSE3_ASM +set(AOM_AV1_ENCODER_SSSE3_ASM_X86_64 "${AOM_ROOT}/av1/encoder/x86/av1_quantize_ssse3_x86_64.asm") set(AOM_AV1_ENCODER_SSSE3_INTRIN @@ -817,9 +817,10 @@ endif () if (HAVE_SSSE3) if ("${AOM_TARGET_CPU}" STREQUAL "x86_64") list(APPEND AOM_DSP_ASM_SSSE3 ${AOM_DSP_ASM_SSSE3_X86_64}) + add_asm_library("aom_av1_encoder_ssse3" + "AOM_AV1_ENCODER_SSSE3_ASM_X86_64" "aom") endif () add_asm_library("aom_dsp_ssse3" "AOM_DSP_ASM_SSSE3" "aom") - add_asm_library("aom_av1_encoder_ssse3" "AOM_AV1_ENCODER_SSSE3_ASM" "aom") require_flag_nomsvc("-mssse3" NO) add_intrinsics_object_library("-mssse3" "ssse3" "aom_dsp" "AOM_DSP_INTRIN_SSSE3") @@ -842,8 +843,8 @@ if (HAVE_SSE4_1) endif () endif () -if (HAVE_AVX) - add_asm_library("aom_dsp_avx" "AOM_DSP_AVX_ASM" "aom") +if (HAVE_AVX AND "${AOM_TARGET_CPU}" STREQUAL "x86_64") + add_asm_library("aom_dsp_avx" "AOM_DSP_AVX_ASM_X86_64" "aom") endif () if (HAVE_AVX2) require_flag_nomsvc("-mavx2" NO) diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake index 915e6b830da1b6ab5fc23709372ff8684babf189..fbadc10c2d348bc7b11df0f212185ac60dc86445 100644 --- a/build/cmake/aom_configure.cmake +++ b/build/cmake/aom_configure.cmake @@ -16,11 +16,19 @@ include("${AOM_ROOT}/build/cmake/compiler_tests.cmake") # Detect target CPU. if (NOT AOM_TARGET_CPU) - # TODO(tomfinegan): This will not work for a cross compile. Target CPU and - # system will have to come from a toolchain file or the cmake command line. - set(AOM_TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR}) - if (AOM_TARGET_CPU STREQUAL "AMD64") - set(AOM_TARGET_CPU "x86_64") + if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR + "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") + if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(AOM_TARGET_CPU "x86") + elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8) + set(AOM_TARGET_CPU "x86_64") + else () + message(FATAL_ERROR + "--- Unexpected pointer size (${CMAKE_SIZEOF_VOID_P}) for\n" + " CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}\n" + " CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}\n" + " CMAKE_GENERATOR=${CMAKE_GENERATOR}\n") + endif () endif () set(AOM_TARGET_SYSTEM ${CMAKE_SYSTEM_NAME}) if (NOT EXISTS "${AOM_ROOT}/build/cmake/targets/${AOM_TARGET_CPU}.cmake") diff --git a/build/cmake/aom_optimization.cmake b/build/cmake/aom_optimization.cmake index b71217d3c765b110cd744532f8d80a1882d04046..76e7c4221a2b569740d71afb151b199bddb993b7 100644 --- a/build/cmake/aom_optimization.cmake +++ b/build/cmake/aom_optimization.cmake @@ -78,6 +78,12 @@ function (get_asm_obj_format out_format) else () message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}") endif () + elseif ("${AOM_TARGET_CPU}" STREQUAL "x86") + if ("${AOM_TARGET_SYSTEM}" STREQUAL "Windows") + set(objformat "win32") + else () + message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_SYSTEM}") + endif () else () message(FATAL_ERROR "Unknown obj format: ${AOM_TARGET_CPU}-${AOM_TARGET_SYSTEM}") @@ -132,4 +138,8 @@ function (add_asm_library lib_name asm_sources dependent_target) target_sources(${lib_name} PUBLIC ${dummy_c_file}) target_link_libraries(${dependent_target} PRIVATE ${lib_name}) + + # Add the new lib target to the global list of aom library targets. + list(APPEND AOM_LIB_TARGETS ${lib_name}) + set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE) endfunction () diff --git a/build/cmake/targets/rtcd_templates/x86.rtcd.cmake b/build/cmake/targets/rtcd_templates/x86.rtcd.cmake new file mode 100644 index 0000000000000000000000000000000000000000..17541d68f95b03891d511a36860a57e67d2e48ad --- /dev/null +++ b/build/cmake/targets/rtcd_templates/x86.rtcd.cmake @@ -0,0 +1,42 @@ +## +## Copyright (c) 2017, Alliance for Open Media. All rights reserved +## +## This source code is subject to the terms of the BSD 2 Clause License and +## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License +## was not distributed with this source code in the LICENSE file, you can +## obtain it at www.aomedia.org/license/software. If the Alliance for Open +## Media Patent License 1.0 was not distributed with this source code in the +## PATENTS file, you can obtain it at www.aomedia.org/license/patent. +## +ARCH_X86=${RTCD_ARCH_X86} +HAVE_MMX=${RTCD_HAVE_MMX} +HAVE_SSE=${RTCD_HAVE_SSE} +HAVE_SSE2=${RTCD_HAVE_SSE2} +HAVE_SSE3=${RTCD_HAVE_SSE3} +HAVE_SSSE3=${RTCD_HAVE_SSSE3} +HAVE_SSE4_1=${RTCD_HAVE_SSE4_1} +HAVE_AVX=${RTCD_HAVE_AVX} +HAVE_AVX2=${RTCD_HAVE_AVX2} + +CONFIG_AV1=${RTCD_CONFIG_AV1} +CONFIG_AV1_DECODER=${RTCD_CONFIG_AV1_DECODER} +CONFIG_AV1_ENCODER=${RTCD_CONFIG_AV1_ENCODER} +CONFIG_INSTALL_BINS=${RTCD_CONFIG_INSTALL_BINS} +CONFIG_INSTALL_LIBS=${RTCD_CONFIG_INSTALL_LIBS} +CONFIG_GCC=${RTCD_CONFIG_GCC} +CONFIG_MULTITHREAD=${RTCD_CONFIG_MULTITHREAD} +CONFIG_AV1_ENCODER=${RTCD_CONFIG_AV1_ENCODER} +CONFIG_AV1_DECODER=${RTCD_CONFIG_AV1_DECODER} +CONFIG_AV1=${RTCD_CONFIG_AV1} +CONFIG_ENCODERS=${RTCD_CONFIG_ENCODERS} +CONFIG_DECODERS=${RTCD_CONFIG_DECODERS} +CONFIG_SPATIAL_RESAMPLING=${RTCD_CONFIG_SPATIAL_RESAMPLING} +CONFIG_STATIC=${RTCD_CONFIG_STATIC} +CONFIG_OS_SUPPORT=${RTCD_CONFIG_OS_SUPPORT} +CONFIG_TEMPORAL_DENOISING=${RTCD_CONFIG_TEMPORAL_DENOISING} +CONFIG_RUNTIME_CPU_DETECT=${RTCD_CONFIG_RUNTIME_CPU_DETECT} +CONFIG_AOM_HIGHBITDEPTH=${RTCD_CONFIG_AOM_HIGHBITDEPTH} +CONFIG_CLPF=${RTCD_CONFIG_CLPF} +CONFIG_EXT_INTER=${RTCD_CONFIG_EXT_INTER} +CONFIG_INTERNAL_STATS=${RTCD_CONFIG_INTERNAL_STATS} +CONFIG_MOTION_VAR=${RTCD_CONFIG_MOTION_VAR} diff --git a/build/cmake/targets/x86.cmake b/build/cmake/targets/x86.cmake new file mode 100644 index 0000000000000000000000000000000000000000..ef82b9ec30837f200e92704db9e6d1965f4feb5f --- /dev/null +++ b/build/cmake/targets/x86.cmake @@ -0,0 +1,69 @@ +## +## Copyright (c) 2017, Alliance for Open Media. All rights reserved +## +## This source code is subject to the terms of the BSD 2 Clause License and +## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License +## was not distributed with this source code in the LICENSE file, you can +## obtain it at www.aomedia.org/license/software. If the Alliance for Open +## Media Patent License 1.0 was not distributed with this source code in the +## PATENTS file, you can obtain it at www.aomedia.org/license/patent. +## +set(AOM_ARCH "x86") +set(ARCH_X86 1) + +# Assembly flavors available for the target. +set(HAVE_MMX 1) +set(HAVE_SSE 1) +set(HAVE_SSE2 1) +set(HAVE_SSE3 1) +set(HAVE_SSSE3 1) +set(HAVE_SSE4_1 1) +set(HAVE_AVX 1) +set(HAVE_AVX2 1) + +# RTCD versions of assembly flavor flags ("yes" means on in rtcd.pl, not 1). +set(RTCD_ARCH_X86 "yes") +set(RTCD_HAVE_MMX "yes") +set(RTCD_HAVE_SSE "yes") +set(RTCD_HAVE_SSE2 "yes") +set(RTCD_HAVE_SSE3 "yes") +set(RTCD_HAVE_SSSE3 "yes") +set(RTCD_HAVE_SSE4_1 "yes") +set(RTCD_HAVE_AVX "yes") +set(RTCD_HAVE_AVX2 "yes") + +# TODO(tomfinegan): These must not be hard coded. They must be set based on +# the values of the externally configurable vars that omit the RTCD_ prefix. +set(RTCD_CONFIG_AV1 "yes") +set(RTCD_CONFIG_AV1_DECODER "yes") +set(RTCD_CONFIG_AV1_ENCODER "yes") +set(RTCD_CONFIG_INSTALL_BINS "yes") +set(RTCD_CONFIG_INSTALL_LIBS "yes") +set(RTCD_CONFIG_GCC "yes") +set(RTCD_CONFIG_MULTITHREAD "yes") +set(RTCD_CONFIG_AV1_ENCODER "yes") +set(RTCD_CONFIG_AV1_DECODER "yes") +set(RTCD_CONFIG_AV1 "yes") +set(RTCD_CONFIG_ENCODERS "yes") +set(RTCD_CONFIG_DECODERS "yes") +set(RTCD_CONFIG_SPATIAL_RESAMPLING "yes") +set(RTCD_CONFIG_STATIC "yes") +set(RTCD_CONFIG_OS_SUPPORT "yes") +set(RTCD_CONFIG_TEMPORAL_DENOISING "yes") +set(RTCD_CONFIG_RUNTIME_CPU_DETECT "yes") + +if (CONFIG_AOM_HIGHBITDEPTH) + set(RTCD_CONFIG_AOM_HIGHBITDEPTH "yes") +endif () +if (CONFIG_CLPF) + set(RTCD_CONFIG_CLPF "yes") +endif () +if (CONFIG_EXT_INTER) + set(RTCD_CONFIG_EXT_INTER "yes") +endif () +if (CONFIG_INTERNAL_STATS) + set(RTCD_CONFIG_INTERNAL_STATS "yes") +endif () +if (CONFIG_MOTION_VAR AND HAVE_SSE4_1) + set(RTCD_CONFIG_MOTION_VAR "yes") +endif ()