From 61642deb821e75f055d7e05a440d032ed0de165b Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Thu, 28 Apr 2022 22:01:02 +0300 Subject: [PATCH] [cleanup] Change the interface function names and some other kvazaar mentions to uvg266 --- .github/workflows/kvazaar.yml | 2 +- .github/workflows/pull_request.yml | 2 +- .gitignore | 4 +- CMakeLists.txt | 12 ++--- appveyor.yml | 83 ------------------------------ src/strategyselector.c | 4 +- src/uvg266.c | 50 +++++++++--------- src/uvg266.h | 6 +-- src/uvg266_internal.h | 6 +-- tests/test_external_symbols.sh | 2 +- 10 files changed, 43 insertions(+), 128 deletions(-) delete mode 100644 appveyor.yml diff --git a/.github/workflows/kvazaar.yml b/.github/workflows/kvazaar.yml index 323abb21..46ec7281 100644 --- a/.github/workflows/kvazaar.yml +++ b/.github/workflows/kvazaar.yml @@ -71,7 +71,7 @@ jobs: runs-on: self-hosted env: - KVAZAAR_OVERRIDE_angular_pred: generic + UVG266_OVERRIDE_angular_pred: generic steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 981df6bf..5428d54c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -87,7 +87,7 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'safe to test') env: - KVAZAAR_OVERRIDE_angular_pred: generic + UVG266_OVERRIDE_angular_pred: generic steps: - uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore index f0c18376..98db22e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ # Build files /bin /build/* -!/build/kvazaar_lib -/build/kvazaar_lib/* +!/build/uvg266_lib +/build/uvg266_lib/* !/build/uvg266_lib/uvg266_lib.vcxproj !/build/uvg266_lib/uvg266_lib.vcxproj.filters /scons_build_* diff --git a/CMakeLists.txt b/CMakeLists.txt index 44990e88..969b6289 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,7 +89,7 @@ set_target_properties(uvg266-bin PROPERTIES RUNTIME_OUTPUT_NAME uvg266) target_link_libraries(uvg266-bin PUBLIC uvg266) if(MSVC) - target_include_directories(uvg266-bin PUBLIC src/threadwrapper/include) + 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" ) @@ -133,16 +133,14 @@ add_custom_target(dist ) # TESTS + +enable_testing() + if(EXISTS "${PROJECT_SOURCE_DIR}/greatest/greatest.h") add_subdirectory( "tests/" ) add_test( NAME Test_uvg266 COMMAND uvg266_tests ) endif() if(NOT DEFINED MSVC) -add_custom_target( - check - COMMAND ${PROJECT_SOURCE_DIR}/tests/test_external_symbols.sh - COMMENT "Building and running test..." - VERBATIM - ) + add_test( NAME external_symbols COMMAND ${PROJECT_SOURCE_DIR}/tests/test_external_symbols.sh) endif() \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 1bb6a3ce..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,83 +0,0 @@ -# Email the author if their commit either failed to build or fixed a failed build -# good -> bad, bad -> bad, bad -> good but not good -> good -notifications: - - provider: Email - to: - - '{{commitAuthorEmail}}' - on_build_success: false - on_build_failure: true - on_build_status_changed: true - -# Skip commits that don't affect the code / compiling the code -skip_commits: - files: - - .gitignore - - .gitlab-ci.yml - - .travis-install.bash - - .travis.yml - - LICENSE - - CREDITS - - README.md - - docs.doxy - -# Download only a zip file of the latest commit -# Downloading the whole history of the repository would be unnecessary -shallow_clone: true - -# Only try building the app, don't run any tests -test: off - -# Don't bother with debug builds -configuration: - - Release - -# Build with multiple compilers / build suites -environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - platform: Win32 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - platform: x64 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - MSYSTEM: MINGW32 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - MSYSTEM: MINGW64 - -for: -- - # MinGW builds need all kinds of build scripts - matrix: - only: - - MSYSTEM: MINGW32 - - MSYSTEM: MINGW64 - - install: - # Update core packages - - C:\msys64\usr\bin\pacman -Syyuu --noconfirm --noprogressbar - # Update non-core packages - - C:\msys64\usr\bin\pacman -Suu --noconfirm --noprogressbar - # Install required MSYS2 packages - - C:\msys64\usr\bin\pacman -S --noconfirm --noprogressbar --needed automake-wrapper make - # Now MSYS2 is up to date, do the rest of the install from a bash script - - C:\msys64\usr\bin\bash -lc "cd \"$APPVEYOR_BUILD_FOLDER\" && exec ./tools/appveyor-install.sh" - - build_script: - - C:\msys64\usr\bin\bash -lc "cd \"$APPVEYOR_BUILD_FOLDER\" && exec ./tools/appveyor-build.sh" - - cache: - - C:\msys64\var\cache\pacman\pkg -- - # MSVC builds only need vsyasm and the solution file - matrix: - except: - - MSYSTEM: MINGW32 - - MSYSTEM: MINGW64 - - install: - - ps: $url = "http://ultravideo.cs.tut.fi/vsyasm.exe" - - ps: $output = "C:\Tools\vsyasm.exe" - - ps: "(New-Object System.Net.WebClient).DownloadFile($url, $output)" - - ps: '$env:Path += ";$output\.."' - - build: - project: .\build\kvazaar_VS2015.sln diff --git a/src/strategyselector.c b/src/strategyselector.c index fed238a7..4d31cd8d 100644 --- a/src/strategyselector.c +++ b/src/strategyselector.c @@ -286,8 +286,8 @@ static void* strategyselector_choose_for(const strategy_list_t * const strategie // Because VS doesn't support snprintf, let's assert that there is // enough room in the buffer. Max length for strategy type is // buffersize (256) - prefix including terminating zero. - assert(strlen(strategy_type) < 256 - sizeof("KVAZAAR_OVERRIDE_") ); - sprintf(buffer, "KVAZAAR_OVERRIDE_%s", strategy_type); + assert(strlen(strategy_type) < 256 - sizeof("UVG266_OVERRIDE_") ); + sprintf(buffer, "UVG266_OVERRIDE_%s", strategy_type); override = getenv(buffer); diff --git a/src/uvg266.c b/src/uvg266.c index ed0dfb42..07c96a94 100644 --- a/src/uvg266.c +++ b/src/uvg266.c @@ -53,7 +53,7 @@ #include "rate_control.h" -static void kvazaar_close(uvg_encoder *encoder) +static void uvg266_close(uvg_encoder *encoder) { if (encoder) { // The threadqueue must be stopped before freeing states. @@ -87,7 +87,7 @@ static void kvazaar_close(uvg_encoder *encoder) } -static uvg_encoder * kvazaar_open(const uvg_config *cfg) +static uvg_encoder * uvg266_open(const uvg_config *cfg) { uvg_encoder *encoder = NULL; @@ -95,17 +95,17 @@ static uvg_encoder * kvazaar_open(const uvg_config *cfg) // TODO: Make strategies non-global if (!uvg_strategyselector_init(cfg->cpuid, UVG_BIT_DEPTH)) { fprintf(stderr, "Failed to initialize strategies.\n"); - goto kvazaar_open_failure; + goto uvg266_open_failure; } encoder = calloc(1, sizeof(uvg_encoder)); if (!encoder) { - goto kvazaar_open_failure; + goto uvg266_open_failure; } encoder->control = uvg_encoder_control_init(cfg); if (!encoder->control) { - goto kvazaar_open_failure; + goto uvg266_open_failure; } encoder->num_encoder_states = encoder->control->cfg.owf + 1; @@ -116,20 +116,20 @@ static uvg_encoder * kvazaar_open(const uvg_config *cfg) // Assure that the rc data allocation was successful if(!uvg_get_rc_data(encoder->control)) { - goto kvazaar_open_failure; + goto uvg266_open_failure; } uvg_init_input_frame_buffer(&encoder->input_buffer); encoder->states = calloc(encoder->num_encoder_states, sizeof(encoder_state_t)); if (!encoder->states) { - goto kvazaar_open_failure; + goto uvg266_open_failure; } for (unsigned i = 0; i < encoder->num_encoder_states; ++i) { encoder->states[i].encoder_control = encoder->control; if (!uvg_encoder_state_init(&encoder->states[i], NULL)) { - goto kvazaar_open_failure; + goto uvg266_open_failure; } encoder->states[i].frame->QP = (int8_t)cfg->qp; @@ -148,8 +148,8 @@ static uvg_encoder * kvazaar_open(const uvg_config *cfg) return encoder; -kvazaar_open_failure: - kvazaar_close(encoder); +uvg266_open_failure: + uvg266_close(encoder); return NULL; } @@ -177,7 +177,7 @@ static void set_frame_info(uvg_frame_info *const info, const encoder_state_t *co } -static int kvazaar_headers(uvg_encoder *enc, +static int uvg266_headers(uvg_encoder *enc, uvg_data_chunk **data_out, uint32_t *len_out) { @@ -241,7 +241,7 @@ static int yuv_io_extract_field(const uvg_picture *frame_in, unsigned source_sca } -static int kvazaar_encode(uvg_encoder *enc, +static int uvg266_encode(uvg_encoder *enc, uvg_picture *pic_in, uvg_data_chunk **data_out, uint32_t *len_out, @@ -314,7 +314,7 @@ static int kvazaar_encode(uvg_encoder *enc, } -static int kvazaar_field_encoding_adapter(uvg_encoder *enc, +static int uvg266_field_encoding_adapter(uvg_encoder *enc, uvg_picture *pic_in, uvg_data_chunk **data_out, uint32_t *len_out, @@ -324,7 +324,7 @@ static int kvazaar_field_encoding_adapter(uvg_encoder *enc, { if (enc->control->cfg.source_scan_type == UVG_INTERLACING_NONE) { // For progressive, simply call the normal encoding function. - return kvazaar_encode(enc, pic_in, data_out, len_out, pic_out, src_out, info_out); + return uvg266_encode(enc, pic_in, data_out, len_out, pic_out, src_out, info_out); } // For interlaced, make two fields out of the input frame and call encode on them separately. @@ -338,11 +338,11 @@ static int kvazaar_field_encoding_adapter(uvg_encoder *enc, if (pic_in != NULL) { first_field = uvg_image_alloc(state->encoder_control->chroma_format, state->encoder_control->in.width, state->encoder_control->in.height); if (first_field == NULL) { - goto kvazaar_field_encoding_adapter_failure; + goto uvg266_field_encoding_adapter_failure; } second_field = uvg_image_alloc(state->encoder_control->chroma_format, state->encoder_control->in.width, state->encoder_control->in.height); if (second_field == NULL) { - goto kvazaar_field_encoding_adapter_failure; + goto uvg266_field_encoding_adapter_failure; } yuv_io_extract_field(pic_in, pic_in->interlacing, 0, first_field); @@ -358,11 +358,11 @@ static int kvazaar_field_encoding_adapter(uvg_encoder *enc, second_field->interlacing = pic_in->interlacing; } - if (!kvazaar_encode(enc, first_field, &first.data_out, &first.len_out, pic_out, NULL, info_out)) { - goto kvazaar_field_encoding_adapter_failure; + if (!uvg266_encode(enc, first_field, &first.data_out, &first.len_out, pic_out, NULL, info_out)) { + goto uvg266_field_encoding_adapter_failure; } - if (!kvazaar_encode(enc, second_field, &second.data_out, &second.len_out, NULL, NULL, NULL)) { - goto kvazaar_field_encoding_adapter_failure; + if (!uvg266_encode(enc, second_field, &second.data_out, &second.len_out, NULL, NULL, NULL)) { + goto uvg266_field_encoding_adapter_failure; } uvg_image_free(first_field); @@ -389,7 +389,7 @@ static int kvazaar_field_encoding_adapter(uvg_encoder *enc, return 1; -kvazaar_field_encoding_adapter_failure: +uvg266_field_encoding_adapter_failure: uvg_image_free(first_field); uvg_image_free(second_field); uvg_bitstream_free_chunks(first.data_out); @@ -409,10 +409,10 @@ static const uvg_api uvg_8bit_api = { .chunk_free = uvg_bitstream_free_chunks, - .encoder_open = kvazaar_open, - .encoder_close = kvazaar_close, - .encoder_headers = kvazaar_headers, - .encoder_encode = kvazaar_field_encoding_adapter, + .encoder_open = uvg266_open, + .encoder_close = uvg266_close, + .encoder_headers = uvg266_headers, + .encoder_encode = uvg266_field_encoding_adapter, .picture_alloc_csp = uvg_image_alloc, }; diff --git a/src/uvg266.h b/src/uvg266.h index c8b8b41d..1545c9b8 100644 --- a/src/uvg266.h +++ b/src/uvg266.h @@ -1,5 +1,5 @@ -#ifndef KVAZAAR_H_ -#define KVAZAAR_H_ +#ifndef UVG266_H_ +#define UVG266_H_ /***************************************************************************** * This file is part of uvg266 VVC encoder. * @@ -834,4 +834,4 @@ UVG_PUBLIC const uvg_api * uvg_api_get(int bit_depth); } #endif -#endif // KVAZAAR_H_ +#endif // UVG266_H_ diff --git a/src/uvg266_internal.h b/src/uvg266_internal.h index 096693b6..b74a8c52 100644 --- a/src/uvg266_internal.h +++ b/src/uvg266_internal.h @@ -1,5 +1,5 @@ -#ifndef KVAZAAR_INTERNAL_H_ -#define KVAZAAR_INTERNAL_H_ +#ifndef UVG266_INTERNAL_H_ +#define UVG266_INTERNAL_H_ /***************************************************************************** * This file is part of uvg266 VVC encoder. * @@ -75,4 +75,4 @@ struct uvg_encoder { unsigned frames_done; }; -#endif // KVAZAAR_INTERNAL_H_ +#endif // UVG266_INTERNAL_H_ diff --git a/tests/test_external_symbols.sh b/tests/test_external_symbols.sh index 96d4c6ca..b9b1837f 100755 --- a/tests/test_external_symbols.sh +++ b/tests/test_external_symbols.sh @@ -4,7 +4,7 @@ set -eu${BASH+o pipefail} -if nm -go --defined-only ../src/.libs/libuvg266.a | grep -v ' uvg_'; then +if nm -go --defined-only ../lib/libuvg266.a | grep -v ' uvg_'; then printf '%s\n' 'Only symbols prefixed with "uvg_" should be exported from libuvg266.' false fi