diff --git a/.gitignore b/.gitignore index 5e00aa4a..f0c18376 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ /build/* !/build/kvazaar_lib /build/kvazaar_lib/* -!/build/kvazaar_lib/kvazaar_lib.vcxproj -!/build/kvazaar_lib/kvazaar_lib.vcxproj.filters +!/build/uvg266_lib/uvg266_lib.vcxproj +!/build/uvg266_lib/uvg266_lib.vcxproj.filters /scons_build_* # Generated documentation @@ -15,6 +15,7 @@ .deps .dirstamp .libs +.vs Makefile Makefile.in /aclocal.m4 @@ -50,8 +51,9 @@ Makefile.in *.log .kdev4 configure.scan -src/kvazaar -src/libkvazaar.so.* -src/kvazaar.pc -tests/kvazaar_tests -tests/kvazaar_tests.trs +src/uvg266 +src/libuvg266.so.* +src/uvg266.pc +src/version.h +tests/uvg266_tests +tests/uvg266_tests.trs diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b8001bb..fc359f45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,11 @@ 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) +VERSION 0.2.3 ) -configure_file("${PROJECT_SOURCE_DIR}/src/uvg266.pc.in" "${PROJECT_SOURCE_DIR}/src/uvg266.pc" @ONLY) +# Apply dynamic info to the config files +configure_file("${PROJECT_SOURCE_DIR}/src/uvg266.pc.in" "${PROJECT_SOURCE_DIR}/src/uvg266.pc" @ONLY) +configure_file("${PROJECT_SOURCE_DIR}/src/version.h.in" "${PROJECT_SOURCE_DIR}/src/version.h" @ONLY) option(USE_SHARED_LIB "Build using shared uvg266 library" ON) @@ -47,27 +49,25 @@ 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) +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) + 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) +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) @@ -76,16 +76,30 @@ file(GLOB LIB_SOURCES_STRATEGIES_AVX2 "src/strategies/avx2/*.c") set(CLI_SOURCES "src/encmain.c" "src/cli.c" "src/yuv_io.c") +add_executable(uvg266 ${CLI_SOURCES}) +target_link_libraries(uvg266 PUBLIC libuvg266) + 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" ) + set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" ) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(uvg266 PUBLIC Threads::Threads) + + include(CheckLibraryExists) + + CHECK_LIBRARY_EXISTS(m sin "" HAVE_LIB_M) + + if (HAVE_LIB_M) + set(EXTRA_LIBS ${EXTRA_LIBS} m) + endif (HAVE_LIB_M) + + target_link_libraries(uvg266 PUBLIC ${EXTRA_LIBS}) 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} ) diff --git a/doc/kvazaar.1 b/doc/uvg266.1 similarity index 99% rename from doc/kvazaar.1 rename to doc/uvg266.1 index f6f7821a..0198a247 100644 --- a/doc/kvazaar.1 +++ b/doc/uvg266.1 @@ -1,4 +1,4 @@ -.TH KVAZAAR "1" "March 2022" "uvg266 v2.1.0" "User Commands" +.TH UVG266 "1" "April 2022" "uvg266 v0.2.3" "User Commands" .SH NAME uvg266 \- open source VVC encoder .SH SYNOPSIS diff --git a/src/global.h b/src/global.h index f90691e3..444cdfac 100644 --- a/src/global.h +++ b/src/global.h @@ -47,6 +47,8 @@ #include "config.h" // IWYU pragma: export #endif +#include "version.h" + // Include some basics in all files, like assert, primitives and NULL. // If you add anything to this list with export pragma, think long and // and hard if it's actually a good idea to incude it for every c-file. @@ -274,13 +276,6 @@ typedef int16_t mv_t; #define QUOTE(x) #x #define QUOTE_EXPAND(x) QUOTE(x) -// NOTE: When making a release, check to see if incrementing libversion in -// configure.ac is necessary. -#ifndef UVG_VERSION -#define UVG_VERSION 2.1.0 -#endif -#define VERSION_STRING QUOTE_EXPAND(UVG_VERSION) - //#define VERBOSE 1 #define SAO_ABS_OFFSET_MAX ((1 << (MIN(UVG_BIT_DEPTH, 10) - 5)) - 1) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index eb428c75..fc523cdb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,7 +20,19 @@ 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" ) + set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" ) + find_package(Threads REQUIRED) + target_link_libraries(uvg266_tests PUBLIC Threads::Threads) + + include(CheckLibraryExists) + + CHECK_LIBRARY_EXISTS(m sin "" HAVE_LIB_M) + + if (HAVE_LIB_M) + set(EXTRA_LIBS ${EXTRA_LIBS} m) + endif (HAVE_LIB_M) + + target_link_libraries(uvg266_tests PUBLIC ${EXTRA_LIBS}) endif() add_definitions(-DCOMPILE_INTEL) diff --git a/tools/genmanpage.sh b/tools/genmanpage.sh index 5a9e7559..3bfd2352 100755 --- a/tools/genmanpage.sh +++ b/tools/genmanpage.sh @@ -6,11 +6,11 @@ set -e cd "$(dirname "$0")" date="$(date +"%B %Y")" -version="$(awk '/#define KVZ_VERSION/ { print $3 }' ../src/global.h)" -manpage_file=../doc/kvazaar.1 +version="$(awk '/VERSION/ {print $2}' ../CMakeLists.txt)" +manpage_file=../doc/uvg266.1 cat < $manpage_file -.TH KVAZAAR "1" "$date" "uvg266 v$version" "User Commands" +.TH UVG266 "1" "$date" "uvg266 v$version" "User Commands" .SH NAME uvg266 \- open source VVC encoder .SH SYNOPSIS @@ -18,7 +18,7 @@ uvg266 \- open source VVC encoder .SH DESCRIPTION EOF -../src/kvazaar --help 2>&1 | tail -n+5 | head -n-4 | \ +../bin/uvg266 --help 2>&1 | tail -n+5 | head -n-4 | \ sed 's| : |\n|g; s| :$||g; s|^ --|.TP\n\\fB--|g; diff --git a/tools/update_readme.sh b/tools/update_readme.sh index ae3dca4b..519c5b78 100755 --- a/tools/update_readme.sh +++ b/tools/update_readme.sh @@ -42,7 +42,7 @@ readme_file="../README.md" { sed '/BEGIN UVG266 HELP MESSAGE/q' -- "$readme_file"; printf '```\n'; - ../src/kvazaar --help; + ../bin/uvg266 --help; printf '```\n'; sed -n '/END UVG266 HELP MESSAGE/{:a;p;n;ba}' -- "$readme_file"; } >> "$tmpfile"