[build] Fix building for other than x86 target

This commit is contained in:
Marko Viitanen 2022-04-29 14:26:00 +03:00
parent 3479218ca8
commit 7557067b41
4 changed files with 20 additions and 18 deletions

View file

@ -61,9 +61,6 @@ if(MSVC)
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32 -DWIN32 -DWIN64)
endif()
# ToDo: allow compiling on other than x86
add_definitions(-DCOMPILE_INTEL)
if(BUILD_SHARED_LIBS)
list( APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" "./" "../lib" )
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
@ -101,7 +98,10 @@ if(MSVC)
target_include_directories(uvg266 PUBLIC src/threadwrapper/include)
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
else()
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" )
list(APPEND ALLOW_AVX2 "x86_64" "AMD64")
if(${CMAKE_SYSTEM_PROCESSOR} IN_LIST ALLOW_AVX2)
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" )
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(uvg266 PUBLIC Threads::Threads)

View file

@ -419,10 +419,11 @@ Others might encounter the same problem and there is probably much to
improve in the build process. We want to make this as simple as
possible.
**CMakeLists.txt assumes that the x86 based CPUs are 64bit and support AVX2**
### CMake
Depending on the platform, some additional tools are required for compiling uvg266 with CMake.
For Ubuntu, the required packages are `automake autoconf build-essential`.
For Ubuntu, the required packages are `build-essential cmake`.
Run the following commands to compile and install uvg266.
@ -433,6 +434,7 @@ Run the following commands to compile and install uvg266.
Visual Studio natively supports opening the `CMakeLists.txt` of the CMake build package has been installed.
Otherwise CMake-CLI can be used to generate the Visual Studio project files.
**When building shared library with visual studio the tests will fail to link, the main binary will still work**
### Docker
This project includes a [Dockerfile](./Dockerfile), which enables building for Docker.
@ -442,6 +444,8 @@ For other examples, see [Dockerfile](./Dockerfile)
## Paper
**The paper is open access**
Please cite [this paper](https://ieeexplore.ieee.org/document/9690938) for uvg266:
```M. Viitanen, J. Sainio, A. Mercat, A. Lemmetti, and J. Vanne, “From HEVC to VVC: the First Development Steps of a Practical Intra Video Encoder,” Accepted to IEEE Transactions on Consumer Electronics```
@ -484,7 +488,7 @@ You can generate Doxygen documentation pages by running the command
- Main automatic way of testing is with Github Actions. Commits, branches
and pull requests are tested automatically.
- Uninitialized variables and such are checked with Valgrind.
- Bitstream validity is checked with HM.
- Bitstream validity is checked with VTM.
- Compilation is checked on GCC and Clang on Linux, and Clang on OSX.
- Windows msys2 and msvc builds are checked automatically on Appveyor.
- If your changes change the bitstream, decode with VTM to check that

View file

@ -36,10 +36,6 @@
#include "strategies/avx2/dct-avx2.h"
#if COMPILE_INTEL_AVX2
#include "uvg266.h"
#if UVG_BIT_DEPTH == 8
#include <immintrin.h>
#include "strategyselector.h"
#include "tables.h"
@ -56,7 +52,10 @@ extern const int16_t uvg_g_dct_8_t[8][8];
extern const int16_t uvg_g_dct_16_t[16][16];
extern const int16_t uvg_g_dct_32_t[32][32];
#if COMPILE_INTEL_AVX2
#include "uvg266.h"
#if UVG_BIT_DEPTH == 8
#include <immintrin.h>
/*
* \file
@ -940,10 +939,6 @@ static void matrix_i ## type ## _## n ## x ## n ## _avx2(int8_t bitdepth, const
TRANSFORM(dct, 32);
ITRANSFORM(dct, 32);
#endif // UVG_BIT_DEPTH == 8
#endif //COMPILE_INTEL_AVX2
/*****************************************************/
/********************** M T S ************************/
@ -1626,6 +1621,8 @@ static void mts_idct_avx2(
}
}
#endif // UVG_BIT_DEPTH == 8
#endif //COMPILE_INTEL_AVX2
int uvg_strategy_register_dct_avx2(void* opaque, uint8_t bitdepth)
{

View file

@ -24,7 +24,10 @@ if(MSVC)
set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32 -DWIN32 -DWIN64)
else()
set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" )
list(APPEND ALLOW_AVX2 "x86_64" "AMD64")
if(${CMAKE_SYSTEM_PROCESSOR} IN_LIST ALLOW_AVX2)
set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" )
endif()
find_package(Threads REQUIRED)
target_link_libraries(uvg266_tests PUBLIC Threads::Threads)
@ -39,7 +42,5 @@ else()
target_link_libraries(uvg266_tests PUBLIC ${EXTRA_LIBS})
endif()
add_definitions(-DCOMPILE_INTEL)
target_link_libraries(uvg266_tests PUBLIC uvg266)