diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..1f1b4078 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,100 @@ +cmake_minimum_required(VERSION 3.12) + +project(uvg266 +LANGUAGES C CXX +HOMEPAGE_URL https://github.com/ultravideo/uvg266 +DESCRIPTION "An open-source VVC encoder licensed under 3-clause BSD" +VERSION 0.2.3) + +configure_file("${PROJECT_SOURCE_DIR}/src/kvazaar.pc.in" "${PROJECT_SOURCE_DIR}/src/kvazaar.pc" @ONLY) + +option(USE_SHARED_LIB "Build using shared uvg266 library" ON) + + +find_package(Git QUIET) +if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") +# Update submodules as needed + option(GIT_SUBMODULE "Check submodules during build" ON) + if(GIT_SUBMODULE) + message(STATUS "Submodule update") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(WARNING "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() + endif() +endif() + +if(NOT EXISTS "${PROJECT_SOURCE_DIR}/greatest/greatest.h") + message(WARNING "The submodule greatest was not loaded, some tests may fail") +endif() + +# Add all sources in src/ base +file(GLOB LIB_SOURCES "src/*.h" "src/*.c") + +# We don't want CLI main in the library +list(REMOVE_ITEM LIB_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/encmain.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/cli.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/yuv_io.c") + +# Add also all the strategies +file(GLOB_RECURSE LIB_SOURCES_STRATEGIES "src/strategies/*.c") + +# ToDo: do something with encode_coding_tree-avx2, currently not converted to VVC +list(REMOVE_ITEM LIB_SOURCES_STRATEGIES "${CMAKE_CURRENT_SOURCE_DIR}/src/strategies/avx2/encode_coding_tree-avx2.c") + +list(APPEND LIB_SOURCES ${LIB_SOURCES_STRATEGIES}) + +# We also need the libmd5 +list(APPEND LIB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/extras/libmd5.c) + +if(NOT USE_SHARED_LIB) + add_definitions(-DPIC -DKVZ_DLL_EXPORTS) +endif() + +# For visual studio / windows we also need our own pthread implementation and getopt +if(MSVC) + list(APPEND LIB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/extras/getopt.c ${CMAKE_CURRENT_SOURCE_DIR}/src/threadwrapper/src/pthread.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/threadwrapper/src/semaphore.cpp) + add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32 -DWIN32 -DWIN64) +endif() + +# ToDo: allow compiling on other than x86 +add_definitions(-DCOMPILE_INTEL) + +if(USE_SHARED_LIB) + add_library(libuvg266 SHARED ${LIB_SOURCES}) +else() + add_library(libuvg266 STATIC ${LIB_SOURCES}) +endif() + +target_compile_definitions(libuvg266 PUBLIC libuvg266) + +target_include_directories(libuvg266 PUBLIC src) +target_include_directories(libuvg266 PUBLIC src/extras) +target_include_directories(libuvg266 PUBLIC src/strategies) + +file(GLOB LIB_SOURCES_STRATEGIES_AVX2 "src/strategies/avx2/*.c") + +set(CLI_SOURCES "src/encmain.c" "src/cli.c" "src/yuv_io.c") + +if(MSVC) + target_include_directories(libuvg266 PUBLIC src/threadwrapper/include) + set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" ) + list(APPEND CLI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/extras/getopt.c ${CMAKE_CURRENT_SOURCE_DIR}/src/threadwrapper/src/pthread.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/threadwrapper/src/semaphore.cpp) +else() + set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "-mavx2" ) +endif() + +add_executable(uvg266 ${CLI_SOURCES}) +target_link_libraries(uvg266 PUBLIC libuvg266) + +#source_group( "Header Files" FILES ${INC_FILES} ) +#source_group( "Resource Files" FILES ${RESOURCE_FILE} ) + +# TESTS +if(EXISTS "${PROJECT_SOURCE_DIR}/greatest/greatest.h") + add_subdirectory( "tests/" ) + + #enable_testing() + + add_test( NAME Test_uvg266 COMMAND uvg266_tests ) +endif() diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 48963a44..00000000 --- a/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS = src tests - -dist_man1_MANS = doc/kvazaar.1 - -dist_doc_DATA = LICENSE LICENSE.EXT.greatest LICENSE.EXT.x264asm CREDITS README.md - -EXTRA_DIST = \ - build \ - doc \ - docs.doxy \ - greatest \ - tools - -# Run scripts to maintain autogenerated documentation -# in the version control. -docs: all ./tools/genmanpage.sh ./tools/update_readme.sh - ./tools/genmanpage.sh - ./tools/update_readme.sh diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 16133311..00000000 --- a/autogen.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -git submodule update --init --depth 1 -autoreconf -if diff --git a/build/kvazaar_VS2017.sln b/build/kvazaar_VS2017.sln deleted file mode 100644 index dda84746..00000000 --- a/build/kvazaar_VS2017.sln +++ /dev/null @@ -1,55 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kvazaar_lib", "kvazaar_lib\kvazaar_lib.vcxproj", "{EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{50AB7A17-4885-4D20-BF01-376DE4417FCD}" - ProjectSection(SolutionItems) = preProject - kvazaar_VS2010.vsd = kvazaar_VS2010.vsd - kvazaar_VS2010.vsmdi = kvazaar_VS2010.vsmdi - Local.testsettings = Local.testsettings - TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kvazaar_tests", "kvazaar_tests\kvazaar_tests.vcxproj", "{3CD1C68B-542C-46D8-9B8A-6C91C5A3F312}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kvazaar_cli", "kvazaar_cli\kvazaar_cli.vcxproj", "{C755308D-9B3E-4712-99AB-7F6F4E2DA567}" - ProjectSection(ProjectDependencies) = postProject - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF} = {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF}.Debug|Win32.ActiveCfg = Debug|Win32 - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF}.Debug|Win32.Build.0 = Debug|Win32 - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF}.Debug|x64.ActiveCfg = Debug|x64 - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF}.Debug|x64.Build.0 = Debug|x64 - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF}.Release|Win32.ActiveCfg = Release|Win32 - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF}.Release|Win32.Build.0 = Release|Win32 - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF}.Release|x64.ActiveCfg = Release|x64 - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF}.Release|x64.Build.0 = Release|x64 - {3CD1C68B-542C-46D8-9B8A-6C91C5A3F312}.Debug|Win32.ActiveCfg = Debug|Win32 - {3CD1C68B-542C-46D8-9B8A-6C91C5A3F312}.Debug|x64.ActiveCfg = Debug|x64 - {3CD1C68B-542C-46D8-9B8A-6C91C5A3F312}.Release|Win32.ActiveCfg = Release|Win32 - {3CD1C68B-542C-46D8-9B8A-6C91C5A3F312}.Release|x64.ActiveCfg = Release|x64 - {C755308D-9B3E-4712-99AB-7F6F4E2DA567}.Debug|Win32.ActiveCfg = Debug|Win32 - {C755308D-9B3E-4712-99AB-7F6F4E2DA567}.Debug|Win32.Build.0 = Debug|Win32 - {C755308D-9B3E-4712-99AB-7F6F4E2DA567}.Debug|x64.ActiveCfg = Debug|x64 - {C755308D-9B3E-4712-99AB-7F6F4E2DA567}.Debug|x64.Build.0 = Debug|x64 - {C755308D-9B3E-4712-99AB-7F6F4E2DA567}.Release|Win32.ActiveCfg = Release|Win32 - {C755308D-9B3E-4712-99AB-7F6F4E2DA567}.Release|Win32.Build.0 = Release|Win32 - {C755308D-9B3E-4712-99AB-7F6F4E2DA567}.Release|x64.ActiveCfg = Release|x64 - {C755308D-9B3E-4712-99AB-7F6F4E2DA567}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/build/kvazaar_cli/kvazaar_cli.vcxproj b/build/kvazaar_cli/kvazaar_cli.vcxproj deleted file mode 100644 index d845d7fa..00000000 --- a/build/kvazaar_cli/kvazaar_cli.vcxproj +++ /dev/null @@ -1,102 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {C755308D-9B3E-4712-99AB-7F6F4E2DA567} - Win32Proj - kvazaar_cli - 10.0.16299.0 - - - - true - v141 - - - true - v141 - - - false - v141 - - - false - v141 - - - - - - - - - - - - - - - - - - - - - kvazaar - - - kvazaar - - - kvazaar - - - kvazaar - - - - - - - - - - {eea3bdd1-8a08-41c1-ba57-e05d5c2cd8ff} - false - true - false - true - false - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/kvazaar_cli/kvazaar_cli.vcxproj.filters b/build/kvazaar_cli/kvazaar_cli.vcxproj.filters deleted file mode 100644 index 0f16c487..00000000 --- a/build/kvazaar_cli/kvazaar_cli.vcxproj.filters +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/build/kvazaar_lib/kvazaar_lib.vcxproj b/build/kvazaar_lib/kvazaar_lib.vcxproj deleted file mode 100644 index de6bd428..00000000 --- a/build/kvazaar_lib/kvazaar_lib.vcxproj +++ /dev/null @@ -1,356 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {EEA3BDD1-8A08-41C1-BA57-E05D5C2CD8FF} - Win32Proj - kvazaar_lib - 10.0.16299.0 - - - - StaticLibrary - true - v141 - - - StaticLibrary - true - v141 - - - StaticLibrary - false - v141 - - - StaticLibrary - false - v141 - - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)$(Platform)-$(Configuration)-libs\ - - - $(SolutionDir)$(Platform)-$(Configuration)-libs\ - - - $(SolutionDir)$(Platform)-$(Configuration)-libs\ - - - $(SolutionDir)$(Platform)-$(Configuration)-libs\ - - - - - - - - - - - ARCH_X86_64=1;%(Defines) - $(SolutionDir)..\src\extras;%(IncludePaths);$(SolutionDir)..\src\strategies\x86-asm; - - - - - ARCH_X86_64=0;PREFIX - $(SolutionDir)..\src\extras;%(IncludePaths);$(SolutionDir)..\src\strategies\x86-asm; - - - - - - - - - - - - - - - ARCH_X86_64=0;PREFIX - $(SolutionDir)..\src\extras;%(IncludePaths);$(SolutionDir)..\src\strategies\x86-asm; - - - - - - - - - - - - - - - ARCH_X86_64=1;%(Defines) - $(SolutionDir)..\src\extras;%(IncludePaths);$(SolutionDir)..\src\strategies\x86-asm; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - - - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - - - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - - - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - - - - - - - - - - - - - - - - - - - - - - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - - - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - - - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - AdvancedVectorExtensions2 - - - - - - - - - - - - - - - CompileAsCpp - CompileAsCpp - CompileAsCpp - CompileAsCpp - - - CompileAsCpp - CompileAsCpp - CompileAsCpp - CompileAsCpp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - true - true - - - - - - - - - - - - \ No newline at end of file diff --git a/build/kvazaar_lib/kvazaar_lib.vcxproj.filters b/build/kvazaar_lib/kvazaar_lib.vcxproj.filters deleted file mode 100644 index 45e196d1..00000000 --- a/build/kvazaar_lib/kvazaar_lib.vcxproj.filters +++ /dev/null @@ -1,520 +0,0 @@ - - - - - {c7f0ebb9-e5c1-479d-bb12-c2403f551ae0} - - - {2d160ce0-596b-4f8c-ae61-1ddd5ccbe1ea} - - - {871a51e7-0a11-4870-ad93-0809af9a2412} - - - {8a1eee84-49e9-4e2d-9681-a23a774cdb18} - - - {1dce39e5-50a3-4cd7-adfa-6d382446debd} - - - {aa218f1d-2e13-425d-80a7-3f4d74076c5c} - - - {e4e77a4f-e708-4b11-9ba7-9d2b746e3f5d} - - - {0c7b7451-4b19-443f-b51c-588e63bb4c93} - - - {2b47e32d-3fee-4a34-a4cb-8453b769b1b0} - - - {770e42cd-56bc-4377-af83-c14872722ed2} - - - {4ffb5d27-c5bb-44d5-a935-fa93066a259e} - - - {d0ce7d00-30c6-4e8a-b96e-51e13cb038ea} - - - {c696e039-5ba4-48ab-845d-cfe1a5713525} - - - {7b258ce6-90d8-4e47-ab43-babda9eefbd9} - - - {f4560af3-b3b4-47b4-b401-908f2d279847} - - - {63c21cb2-b379-4d38-bcb8-173786c2466d} - - - {f4abece9-e209-4817-a57e-c64ca7c5e05c} - - - {895fc8cc-6f08-49a7-b377-b5c38a44d1b1} - - - - - Optimization\strategies - - - Optimization\strategies - - - Optimization\strategies\generic - - - Optimization\strategies\generic - - - Optimization\strategies\altivec - - - Optimization\strategies\sse41 - - - Optimization\strategies\sse2 - - - Optimization\strategies\avx2 - - - Optimization\strategies\x86_asm - - - Optimization\strategies\avx2 - - - Optimization\strategies\generic - - - Optimization\strategies - - - Optimization\strategies - - - Optimization\strategies\avx2 - - - Optimization\strategies\generic - - - Optimization\strategies - - - Optimization\strategies\generic - - - Optimization\strategies\avx2 - - - Optimization\strategies - - - Optimization\strategies\generic - - - Optimization\strategies\avx2 - - - Compression - - - Compression - - - Compression - - - Control - - - Control - - - Control - - - Control - - - CABAC - - - CABAC - - - CABAC - - - Control - - - Reconstruction - - - Extras - - - Data structures - - - Data structures - - - Data structures - - - Data structures - - - Compression - - - Compression - - - Reconstruction - - - Reconstruction - - - Control - - - Control - - - Bitstream - - - Control - - - Reconstruction - - - Reconstruction - - - Optimization - - - Reconstruction - - - Reconstruction - - - Reconstruction - - - Threading - - - Bitstream - - - Bitstream - - - Optimization\strategies - - - Optimization\strategies\generic - - - Optimization\strategies\avx2 - - - - Optimization\strategies\generic - - - Threadwrapper - - - Threadwrapper - - - Constraint - - - Constraint - - - Reconstruction - - - Reconstruction - - - - Optimization\strategies\generic - - - Optimization\strategies - - - Optimization\strategies\sse41 - - - Optimization\strategies\avx2 - - - - - - CABAC - - - CABAC - - - CABAC - - - Control - - - Control - - - Control - - - Control - - - Control - - - Control - - - Control - - - Threading - - - Threading - - - Control - - - Control - - - Data structures - - - Data structures - - - Data structures - - - Data structures - - - Extras - - - Reconstruction - - - Reconstruction - - - Reconstruction - - - Reconstruction - - - Reconstruction - - - Reconstruction - - - Reconstruction - - - - - Optimization - - - Compression - - - Compression - - - Compression - - - Bitstream - - - Compression - - - Compression - - - Optimization\strategies - - - Optimization\strategies - - - Optimization\strategies - - - Optimization\strategies - - - Optimization\strategies - - - Optimization\strategies - - - Optimization\strategies - - - Optimization\strategies\x86_asm - - - Optimization\strategies\x86_asm - - - Optimization\strategies\x86_asm - - - Optimization\strategies\sse41 - - - Optimization\strategies\sse2 - - - Optimization\strategies\generic - - - Optimization\strategies\generic - - - Optimization\strategies\generic - - - Optimization\strategies\generic - - - Optimization\strategies\generic - - - Optimization\strategies\generic - - - Optimization\strategies\avx2 - - - Optimization\strategies\avx2 - - - Optimization\strategies\avx2 - - - Optimization\strategies\avx2 - - - Optimization\strategies\avx2 - - - Optimization\strategies\altivec - - - Bitstream - - - Bitstream - - - - Optimization\strategies - - - Optimization\strategies\generic - - - Optimization\strategies\avx2 - - - - Threadwrapper - - - Threadwrapper - - - Optimization\strategies\generic - - - Optimization\strategies - - - Constraint - - - Constraint - - - Control - - - Reconstruction - - - Reconstruction - - - Optimization\strategies\generic - - - Optimization\strategies - - - Optimization\strategies\sse41 - - - Optimization\strategies\avx2 - - - Reconstruction - - - - - - Extras - - - Optimization\strategies\x86_asm - - - Optimization\strategies\x86_asm - - - - - - \ No newline at end of file diff --git a/build/kvazaar_tests/kvazaar_tests.vcxproj b/build/kvazaar_tests/kvazaar_tests.vcxproj deleted file mode 100644 index 120eabd9..00000000 --- a/build/kvazaar_tests/kvazaar_tests.vcxproj +++ /dev/null @@ -1,120 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {3CD1C68B-542C-46D8-9B8A-6C91C5A3F312} - Win32Proj - kvazaar_tests - 10.0.16299.0 - - - - true - v141 - - - true - v141 - - - false - v141 - - - false - v141 - - - - - - - - - - - - - - - - - - - - - - - 4127;%(DisableSpecificWarnings) - - - - - $(TargetPath) - - - - - - - - - $(TargetPath) - - - - - $(TargetPath) - - - 4127;%(DisableSpecificWarnings) - - - - - {eea3bdd1-8a08-41c1-ba57-e05d5c2cd8ff} - false - true - false - true - false - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/kvazaar_tests/kvazaar_tests.vcxproj.filters b/build/kvazaar_tests/kvazaar_tests.vcxproj.filters deleted file mode 100644 index 13798e3e..00000000 --- a/build/kvazaar_tests/kvazaar_tests.vcxproj.filters +++ /dev/null @@ -1,60 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 3a0d1582..00000000 --- a/configure.ac +++ /dev/null @@ -1,176 +0,0 @@ - -AC_INIT([kvazaar], m4_esyscmd([printf $(awk '/#define KVZ_VERSION/ { print $3 }' src/global.h)])) -AC_CONFIG_SRCDIR([src/encmain.c]) - -# Library version number, modify: -# - When modifying kvazaar.h. -# - Modify either major or minor. -# - When making a new release. -# - If major or minor did not change since last release. -# - Check git history to see if someone forgot to increment major or minor. -# - Increment release. -# -# major: -# - Increment when ABI changes, meaning lib users need to be recompiled. -# - ABI changes when anything existing gets modified, including sizes of structs. -# minor: -# - Increment when only API changes in a backwards compatible way without breaking ABI. -# - We count adding parameters to bottom of kvz_config as ABI compatible, because user -# shouldn't copy that struct or care about it's size. -# - If not sure, increment major instead. -# release: -# - Increment when making new releases and major or minor was not changed since last release. -# -# Here is a somewhat sane guide to lib versioning: http://apr.apache.org/versioning.html -ver_major=6 -ver_minor=7 -ver_release=0 - -# Prevents configure from adding a lot of defines to the CFLAGS -AC_CONFIG_HEADERS([config.h]) - -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_AUX_DIR([build-aux]) - -AM_INIT_AUTOMAKE([-Wall dist-bzip2 dist-xz foreign subdir-objects]) -AM_SILENT_RULES([yes]) - -AC_PROG_CC -AC_PROG_CC_C99 -AM_PROG_AR -AC_PROG_CXX - -# Get fread that can read more than 2GB on 32 bit systems. -AC_SYS_LARGEFILE - -LT_INIT([win32-dll]) - -AC_CANONICAL_HOST - -flag_gcc_on_mingw="false" -case x"${host_os}" in - x"cygwin"*|x"mingw"*) - if test x"${CC}" = x"gcc" ; then - flag_gcc_on_mingw="true" - fi -esac - -AX_CHECK_COMPILE_FLAG([-maltivec],[flag_altivec="true"]) -AX_CHECK_COMPILE_FLAG([-mavx2], [flag_avx2="true"]) -AX_CHECK_COMPILE_FLAG([-msse4.1], [flag_sse4_1="true"]) -AX_CHECK_COMPILE_FLAG([-msse2], [flag_sse2="true"]) -AX_CHECK_COMPILE_FLAG([-mbmi], [flag_bmi="true"]) -AX_CHECK_COMPILE_FLAG([-mabm], [flag_abm="true"]) -AX_CHECK_COMPILE_FLAG([-mpopcnt], [flag_popcnt="true"]) -AX_CHECK_COMPILE_FLAG([-mlzcnt], [flag_lzcnt="true"]) -AX_CHECK_COMPILE_FLAG([-mbmi2], [flag_bmi2="true"]) - -# Do we need -mpopcnt and -mlzcnt, or -mabm to use POPCNT and LZCNT -# instructions? Ask GCC and Clang, and they have different answers. -AM_CONDITIONAL([HAVE_ALTIVEC], [test x"$flag_altivec" = x"true"]) -AM_CONDITIONAL([HAVE_AVX2_GCC], [test x"$flag_avx2" = x"true" -a x"$flag_bmi" = x"true" -a x"$flag_abm" = x"true" -a x"$flag_bmi2" = x"true" -a x"$flag_gcc_on_mingw" = x"false"]) -AM_CONDITIONAL([HAVE_AVX2_CLANG], [test x"$flag_avx2" = x"true" -a x"$flag_bmi" = x"true" -a x"$flag_popcnt" = x"true" -a x"$flag_lzcnt" = x"true" -a x"$flag_bmi2" = x"true" -a x"$flag_gcc_on_mingw" = x"false"]) -AM_CONDITIONAL([HAVE_SSE4_1], [test x"$flag_sse4_1" = x"true"]) -AM_CONDITIONAL([HAVE_SSE2], [test x"$flag_sse2" = x"true"]) - -KVZ_CFLAGS="-Wall -Wextra -Wvla -Wno-sign-compare -Wno-unused-parameter -I$srcdir/src -I$srcdir/src/extras -ftree-vectorize -fvisibility=hidden" -CFLAGS="$KVZ_CFLAGS $CFLAGS" - -AC_SEARCH_LIBS([log], [m c], [], [exit 1]) -AC_SEARCH_LIBS([pow], [m c], [], [exit 1]) -AC_SEARCH_LIBS([sqrt], [m c], [], [exit 1]) - -CPPFLAGS="-DKVZ_DLL_EXPORTS $CPPFLAGS" - - -# We need to force AX_PTHREAD to check -pthread -lpthread since otherwise -# it only outputs -pthread for GCC. Without -lpthread GCC does not link the -# shared library against the pthread library (even though it does link the -# executable). -PTHREAD_CFLAGS=-pthread -PTHREAD_LIBS=-lpthread - -# This does workarounds for pthreads on various compilers. -AX_PTHREAD([],[AC_MSG_ERROR([POSIX threads not found])]) - -CFLAGS="$PTHREAD_CFLAGS $CFLAGS" -LIBS="$PTHREAD_LIBS $LIBS" -CC="$PTHREAD_CC" - -# --enable-werror -AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror], [treat warnings as errors [no]])], - [CFLAGS="-Werror $CFLAGS"], [] -) - - -# host and cpu specific settings -AS_CASE([$host_cpu], - [i?86], [BITS="32" ASFLAGS="$ASFLAGS -DARCH_X86_64=0" X86="true"], - [x86_64], [BITS="64" ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -m amd64" X86="true"], - [powerpc*], [PPC="true"] -) - -AS_CASE([$host_os], - [darwin*], [ - ASFLAGS="$ASFLAGS -f macho$BITS -DPREFIX" - ], - [cygwin*|msys*|mingw*], [ - CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO=1" - AS_IF( - [test "x$BITS" = "x32"], [ - ASFLAGS="$ASFLAGS -fwin32 -DPREFIX -DHAVE_ALIGNED_STACK=0" - ], [ - ASFLAGS="$ASFLAGS -fwin64 -DHAVE_ALIGNED_STACK=1" - ] - ) - ], - [midipix*], [ - AS_IF( - [test "x$BITS" = "x32"], [ - ASFLAGS="$ASFLAGS -fwin32 -DPREFIX -DHAVE_ALIGNED_STACK=0" - ], [ - ASFLAGS="$ASFLAGS -fwin64 -DHAVE_ALIGNED_STACK=1" - ] - ) - ], - [linux*|*kfreebsd*], [ - ASFLAGS="$ASFLAGS -f elf$BITS" - LDFLAGS="$LDFLAGS -Wl,-z,noexecstack" - LIBS="$LIBS -lrt" - ], [ - ASFLAGS="$ASFLAGS -f elf$BITS" - LDFLAGS="$LDFLAGS -Wl,-z,noexecstack" - ] -) - - -# YASM checks -AS_IF([test "x$X86" = "xtrue"], [ - AC_CHECK_TOOL([YASM], [yasm], [no]) -]) -AS_IF([test "x$YASM" != "xno"], [have_yasm="yes"]) - -AC_ARG_ENABLE([asm], [AS_HELP_STRING([--disable-asm], [disable assembly [no]])], - [], [enable_asm="yes"] -) -AS_IF([test "x$enable_asm" != "xno" -a $have_yasm != "yes"], - [enable_asm="no"] -) - - -AM_CONDITIONAL([HAVE_X86], [test "x$X86" = "xtrue"]) -AM_CONDITIONAL([HAVE_PPC], [test "x$PPC" = "xtrue"]) -AM_CONDITIONAL([HAVE_ARM], [test "x$ARM" = "xtrue"]) -AM_CONDITIONAL([ENABLE_ASM], [test "x$enable_asm" = "xyes" -a "x$have_yasm" = "xyes" ]) - -AC_ARG_VAR([ASFLAGS], [ASFLAGS to use for assembler]) -AC_SUBST([ASFLAGS]) - -KVZ_API_VERSION="$ver_major:$ver_minor:$ver_release" -AC_SUBST([KVZ_API_VERSION]) - -AC_CONFIG_FILES([Makefile - src/Makefile - src/kvazaar.pc - tests/Makefile]) -AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 20db2fc0..00000000 --- a/src/Makefile.am +++ /dev/null @@ -1,264 +0,0 @@ -bin_PROGRAMS = kvazaar -lib_LTLIBRARIES = libkvazaar.la - - -EXTRA_DIST = \ - extras/getopt.c \ - extras/getopt.h - - -pkgconfigdir = $(libdir)/pkgconfig -nodist_pkgconfig_DATA = kvazaar.pc - - -include_HEADERS = \ - kvazaar.h - -noinst_HEADERS = \ - extras/x86inc.asm - -noinst_LTLIBRARIES = \ - libaltivec.la \ - libavx2.la \ - libsse2.la \ - libsse41.la - -kvazaar_SOURCES = \ - encmain.c \ - cli.h \ - cli.c \ - yuv_io.c \ - yuv_io.h - -kvazaar_LDADD = libkvazaar.la $(LIBS) - -kvazaar_CPPFLAGS = -DKVZ_VERSION="`$(srcdir)/../tools/version.sh`" - - -kvazaar_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ - - -libkvazaar_la_SOURCES = \ - alf.c \ - alf.h \ - bitstream.c \ - bitstream.h \ - cabac.c \ - cabac.h \ - checkpoint.c \ - checkpoint.h \ - cfg.c \ - cfg.h \ - constraint.c \ - constraint.h \ - context.c \ - context.h \ - cu.c \ - cu.h \ - debug.c \ - debug.h \ - encoder.c \ - encoder.h \ - encoderstate.c \ - encoderstate.h \ - encoder_state-bitstream.c \ - encoder_state-bitstream.h \ - encoder_state-ctors_dtors.c \ - encoder_state-ctors_dtors.h \ - encoder_state-geometry.c \ - encoder_state-geometry.h \ - encode_coding_tree.c \ - encode_coding_tree.h \ - fast_coeff_cost.c \ - fast_coeff_cost.h \ - filter.c \ - filter.h \ - global.h \ - gop.h \ - image.c \ - image.h \ - imagelist.c \ - imagelist.h \ - input_frame_buffer.c \ - input_frame_buffer.h \ - inter.c \ - inter.h \ - intra.c \ - intra.h \ - kvazaar.c \ - kvazaar_internal.h \ - kvz_math.h \ - mip_data.h \ - ml_intra_cu_depth_pred.c \ - ml_intra_cu_depth_pred.h \ - nal.c \ - nal.h \ - rate_control.c \ - rate_control.h \ - rdo.c \ - rdo.h \ - reshape.c \ - reshape.h \ - sao.c \ - sao.h \ - scalinglist.c \ - scalinglist.h \ - search.c \ - search.h \ - search_inter.c \ - search_inter.h \ - search_intra.c \ - search_intra.h \ - tables.c \ - tables.h \ - threadqueue.c \ - threadqueue.h \ - threads.h \ - transform.c \ - transform.h \ - videoframe.c \ - videoframe.h \ - strategies/generic/alf-generic.c \ - strategies/generic/alf-generic.h \ - strategies/generic/dct-generic.c \ - strategies/generic/dct-generic.h \ - strategies/generic/intra-generic.c \ - strategies/generic/intra-generic.h \ - strategies/generic/ipol-generic.c \ - strategies/generic/ipol-generic.h \ - strategies/generic/nal-generic.c \ - strategies/generic/nal-generic.h \ - strategies/generic/picture-generic.c \ - strategies/generic/picture-generic.h \ - strategies/generic/quant-generic.c \ - strategies/generic/quant-generic.h \ - strategies/generic/sao-generic.c \ - strategies/generic/sao-generic.h \ - strategies/generic/encode_coding_tree-generic.c \ - strategies/generic/encode_coding_tree-generic.h \ - strategies/missing-intel-intrinsics.h \ - strategies/optimized_sad_func_ptr_t.h \ - strategies/generic/sao_shared_generics.h \ - strategies/strategies-common.h \ - strategies/strategies-alf.c \ - strategies/strategies-alf.h \ - strategies/strategies-dct.c \ - strategies/strategies-dct.h \ - strategies/strategies-intra.c \ - strategies/strategies-intra.h \ - strategies/strategies-ipol.c \ - strategies/strategies-ipol.h \ - strategies/strategies-nal.c \ - strategies/strategies-nal.h \ - strategies/strategies-picture.c \ - strategies/strategies-picture.h \ - strategies/strategies-quant.c \ - strategies/strategies-quant.h \ - strategies/strategies-sao.c \ - strategies/strategies-sao.h \ - strategies/strategies-encode.c \ - strategies/strategies-encode.h \ - strategies/x86_asm/picture-x86-asm.c \ - strategies/x86_asm/picture-x86-asm.h \ - strategyselector.c \ - strategyselector.h \ - extras/libmd5.c \ - extras/libmd5.h - -libkvazaar_la_CFLAGS = - -libkvazaar_la_LIBADD = \ - libaltivec.la \ - libavx2.la \ - libsse2.la \ - libsse41.la - -libkvazaar_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-number $(KVZ_API_VERSION) - -libkvazaar_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libkvazaar_la_LDFLAGS) $(LDFLAGS) -o $@ - -libaltivec_la_SOURCES = \ - strategies/altivec/picture-altivec.c \ - strategies/altivec/picture-altivec.h - -libavx2_la_SOURCES = \ - strategies/avx2/avx2_common_functions.h \ - strategies/avx2/dct-avx2.c \ - strategies/avx2/dct-avx2.h \ - strategies/avx2/intra-avx2.c \ - strategies/avx2/intra-avx2.h \ - strategies/avx2/ipol-avx2.c \ - strategies/avx2/ipol-avx2.h \ - strategies/avx2/picture-avx2.c \ - strategies/avx2/picture-avx2.h \ - strategies/avx2/quant-avx2.c \ - strategies/avx2/quant-avx2.h \ - strategies/avx2/reg_sad_pow2_widths-avx2.h \ - strategies/avx2/sao-avx2.c \ - strategies/avx2/sao-avx2.h \ - strategies/avx2/alf-avx2.c \ - strategies/avx2/alf-avx2.h -# strategies/avx2/encode_coding_tree-avx2.c \ -# strategies/avx2/encode_coding_tree-avx2.h - -libsse2_la_SOURCES = \ - strategies/sse2/picture-sse2.c \ - strategies/sse2/picture-sse2.h - -libsse41_la_SOURCES = \ - strategies/sse41/picture-sse41.c \ - strategies/sse41/picture-sse41.h \ - strategies/sse41/reg_sad_pow2_widths-sse41.h \ - strategies/sse41/alf-sse41.c \ - strategies/sse41/alf-sse41.h - -if HAVE_PPC - -if HAVE_ALTIVEC -libaltivec_la_CFLAGS = -maltivec -endif - -endif #HAVE_PPC - -if HAVE_X86 - -if HAVE_AVX2_GCC -libavx2_la_CFLAGS = -mavx2 -mbmi -mabm -mbmi2 -endif -if HAVE_AVX2_CLANG -libavx2_la_CFLAGS = -mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2 -endif -if HAVE_SSE4_1 -libsse41_la_CFLAGS = -msse4.1 -endif -if HAVE_SSE2 -libsse2_la_CFLAGS = -msse2 -endif - -if ENABLE_ASM -noinst_LTLIBRARIES += libasm.la -libkvazaar_la_LIBADD += libasm.la -libasm_la_SOURCES = \ - strategies/x86_asm/picture-x86-asm-sad.asm \ - strategies/x86_asm/picture-x86-asm-sad.h \ - strategies/x86_asm/picture-x86-asm-satd.asm \ - strategies/x86_asm/picture-x86-asm-satd.h -libkvazaar_la_CFLAGS += -DKVZ_COMPILE_ASM - -strategies/x86_asm/picture-x86-asm-sad.lo: strategies/x86_asm/picture-x86-asm-sad.asm -strategies/x86_asm/picture-x86-asm-satd.lo: strategies/x86_asm/picture-x86-asm-satd.asm -endif #ENABLE_ASM -endif #HAVE_X86 - - -yasm_verbose = $(yasm_verbose_@AM_V@) -yasm_verbose_ = $(yasm_verbose_@AM_DEFAULT_V@) -yasm_verbose_0 = @echo " YASM " $@; - -.asm.lo: - $(yasm_verbose)$(LIBTOOL) --mode=compile --tag=CC $(YASM) -I$(srcdir)/extras $(ASFLAGS) $< -o $@ -prefer-non-pic 1>/dev/null - diff --git a/src/kvazaar.pc.in b/src/kvazaar.pc.in index a5ad89d3..753da68c 100644 --- a/src/kvazaar.pc.in +++ b/src/kvazaar.pc.in @@ -1,11 +1,12 @@ -prefix=@prefix@ +prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=@libdir@ +libdir=${prefix}/lib incdir=${prefix}/include -Name: libkvazaar -Description: Open-source HEVC encoder -Version: @VERSION@ -Libs: -L${libdir} -lkvazaar +Name: libuvg266 +Description: @CMAKE_PROJECT_DESCRIPTION@ +URL: @CMAKE_PROJECT_HOMEPAGE_URL@ +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -luvg266 Libs.private: @LIBS@ Cflags: -I${incdir} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..eb428c75 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,29 @@ +file( GLOB TEST_SOURCES "*.c" ) + +# ToDo: fix the tests +list(REMOVE_ITEM TEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/inter_recon_bipred_tests.c") + +add_executable(uvg266_tests ${TEST_SOURCES} ) + +target_include_directories(uvg266_tests PUBLIC ${PROJECT_SOURCE_DIR}) +target_include_directories(uvg266_tests PUBLIC ${PROJECT_SOURCE_DIR}/src) +target_include_directories(uvg266_tests PUBLIC ${PROJECT_SOURCE_DIR}/src/extras) + +if(USE_SHARED_LIB) + message(INFO " tests do not work with shared lib at the moment") + add_definitions(-DPIC -DKVZ_DLL_EXPORTS) +endif() + +if(MSVC) + target_include_directories(uvg266_tests PUBLIC ../src/threadwrapper/include) + + 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" ) +endif() + +add_definitions(-DCOMPILE_INTEL) + +target_link_libraries(uvg266_tests PUBLIC libuvg266) + diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index c6b8af22..00000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ - -TESTS = $(check_PROGRAMS) \ - test_external_symbols.sh \ - test_intra.sh \ - test_invalid_input.sh \ - test_monochrome.sh \ - test_lmcs.sh \ - test_tools.sh \ - test_slices.sh - #test_weird_shapes.sh - -EXTRA_DIST = \ - test_external_symbols.sh \ - test_intra.sh \ - test_invalid_input.sh \ - test_monochrome.sh \ - test_lmcs.sh \ - test_tools.sh \ - test_slices.sh \ - #test_weird_shapes.sh \ - util.sh - -check_PROGRAMS = kvazaar_tests - -kvazaar_tests_SOURCES = \ - coeff_sum_tests.c \ - dct_tests.c \ - mts_tests.c \ - intra_sad_tests.c \ - mv_cand_tests.c \ - sad_tests.c \ - sad_tests.h \ - satd_tests.c \ - satd_tests.h \ - speed_tests.c \ - tests_main.c \ - test_strategies.c \ - test_strategies.h -kvazaar_tests_CFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/src -kvazaar_tests_LDFLAGS = -static $(top_builddir)/src/libkvazaar.la $(LIBS) - -# This makes sure that CXXLD gets defined. -nodist_EXTRA_kvazaar_tests_SOURCES = cpp.cpp - -kvazaar_tests_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(kvazaar_tests_CFLAGS) $(CFLAGS) \ - $(kvazaar_tests_LDFLAGS) $(LDFLAGS) -o $@ -