author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
8,490
21.05.2021 10:41:42
-7,200
928c534976562bfe1b0386afbae8fde5da82373c
Fix MKL usage.
[ { "change_type": "MODIFY", "old_path": "cmake/Modules/FindMKL.cmake", "new_path": "cmake/Modules/FindMKL.cmake", "diff": "include(FindPackageHandleStandardArgs)\n+if(DEFINED ENV{INTELROOT})\n+ set(INTEL_ROOT $ENV{INTELROOT} CACHE PATH \"Folder contains intel libs\")\n+else()\nset(INTEL_ROOT \"/opt/intel\" CACHE PATH \"Folder contains intel libs\")\n+endif()\n+\nset(MKL_ROOT $ENV{MKLROOT} CACHE PATH \"Folder contains MKL\")\n# Find include dir\n@@ -119,7 +124,8 @@ else()\nPATHS ${INTEL_LIBRARIES_PATH})\nset(MKL_LIBRARY ${MKL_INTERFACE_LIBRARY} ${MKL_THREADING_LIBRARY} ${MKL_CORE_LIBRARY} ${MKL_FFT_LIBRARY} ${MKL_SCALAPACK_LIBRARY} ${MKL_RTL_LIBRARY})\n- set(MKL_MINIMAL_LIBRARY ${MKL_INTERFACE_LIBRARY} ${MKL_THREADING_LIBRARY} ${MKL_CORE_LIBRARY} ${MKL_RTL_LIBRARY})\n+ # set(MKL_MINIMAL_LIBRARY ${MKL_INTERFACE_LIBRARY} ${MKL_THREADING_LIBRARY} ${MKL_CORE_LIBRARY} ${MKL_RTL_LIBRARY})\n+ set(MKL_MINIMAL_LIBRARY ${MKL_INTERFACE_LIBRARY} ${MKL_THREADING_LIBRARY} ${MKL_CORE_LIBRARY})\nendif()\nset(CMAKE_FIND_LIBRARY_SUFFIXES ${_MKL_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Draw_generator/Event_generator/MKL/Event_generator_MKL.cpp", "new_path": "src/Tools/Algo/Draw_generator/Event_generator/MKL/Event_generator_MKL.cpp", "diff": "@@ -32,8 +32,8 @@ Event_generator_MKL<R,E>* Event_generator_MKL<R,E>\n::clone() const\n{\nEvent_generator_MKL<R,E>* eg = new Event_generator_MKL(*this);\n- VSLStreamStatePtr new_ptr;\n- vslCopyStream(&new_ptr, (VSLStreamStatePtr*)this->stream_state);\n+ VSLStreamStatePtr* new_ptr = new VSLStreamStatePtr;\n+ vslCopyStream(new_ptr, *(VSLStreamStatePtr*)this->stream_state);\neg->stream_state = (void*)new_ptr;\nreturn eg;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Draw_generator/Gaussian_noise_generator/MKL/Gaussian_noise_generator_MKL.cpp", "new_path": "src/Tools/Algo/Draw_generator/Gaussian_noise_generator/MKL/Gaussian_noise_generator_MKL.cpp", "diff": "@@ -29,8 +29,8 @@ Gaussian_noise_generator_MKL<R>* Gaussian_noise_generator_MKL<R>\n::clone() const\n{\nGaussian_noise_generator_MKL<R>* eg = new Gaussian_noise_generator_MKL(*this);\n- VSLStreamStatePtr new_ptr;\n- vslCopyStream(&new_ptr, (VSLStreamStatePtr*)this->stream_state);\n+ VSLStreamStatePtr* new_ptr = new VSLStreamStatePtr;\n+ vslCopyStream(new_ptr, *(VSLStreamStatePtr*)this->stream_state);\neg->stream_state = (void*)new_ptr;\nreturn eg;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Draw_generator/User_pdf_noise_generator/MKL/User_pdf_noise_generator_MKL.cpp", "new_path": "src/Tools/Algo/Draw_generator/User_pdf_noise_generator/MKL/User_pdf_noise_generator_MKL.cpp", "diff": "@@ -44,8 +44,8 @@ User_pdf_noise_generator_MKL<R>* User_pdf_noise_generator_MKL<R>\n::clone() const\n{\nUser_pdf_noise_generator_MKL<R>* eg = new User_pdf_noise_generator_MKL(*this);\n- VSLStreamStatePtr new_ptr;\n- vslCopyStream(&new_ptr, (VSLStreamStatePtr*)this->stream_state);\n+ VSLStreamStatePtr* new_ptr = new VSLStreamStatePtr;\n+ vslCopyStream(new_ptr, *(VSLStreamStatePtr*)this->stream_state);\neg->stream_state = (void*)new_ptr;\nreturn eg;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix MKL usage.
8,490
21.05.2021 11:33:27
-7,200
900383617f703d1d07d9a6285e8e351da60cf6fe
CI: enable Intel compiler build.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -313,37 +313,39 @@ build-linux-gcc-4.8:\n- source ./ci/tools/threads.sh\n- ./ci/build-linux-macos.sh\n-# build-linux-icpc:\n-# stage: build\n-# variables:\n-# GIT_SUBMODULE_STRATEGY: recursive\n-# except:\n-# - schedules\n-# needs:\n-# - job: analysis-cppcheck\n-# artifacts: false\n-# - job: analysis-headers\n-# artifacts: false\n-# tags:\n+build-linux-icpc:\n+ image: intel/oneapi-hpckit\n+ stage: build\n+ variables:\n+ GIT_SUBMODULE_STRATEGY: recursive\n+ except:\n+ - schedules\n+ needs:\n+ - job: analysis-cppcheck\n+ artifacts: false\n+ - job: analysis-headers\n+ artifacts: false\n+ tags:\n# - linux\n# - icpc\n# - cmake\n# - mkl\n# - gsl\n-# - x86\n-# artifacts:\n-# name: build-linux-icpc\n-# paths:\n-# - build_linux_icpc\n-# script:\n+ - x86\n+ - docker\n+ artifacts:\n+ name: build-linux-icpc\n+ paths:\n+ - build_linux_icpc\n+ script:\n# - source /opt/intel/vars-intel.sh\n-# - export CC=\"icc\"\n-# - export CXX=\"icpc\"\n-# - export CFLAGS=\"-Wall -funroll-loops -march=native -std=c++11\"\n-# - export CMAKE_OPT=\"-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF -DAFF3CT_LINK_GSL=ON -DAFF3CT_LINK_MKL=ON\"\n-# - export NAME=\"build_linux_icpc\"\n-# - source ./ci/tools/threads.sh\n-# - ./ci/build-linux-macos.sh\n+ - export CC=\"icc\"\n+ - export CXX=\"icpc\"\n+ - export CFLAGS=\"-Wall -funroll-loops -march=native -std=c++11\"\n+ - export CMAKE_OPT=\"-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF -DAFF3CT_LINK_GSL=OFF -DAFF3CT_LINK_MKL=ON\"\n+ - export NAME=\"build_linux_icpc\"\n+ - source ./ci/tools/threads.sh\n+ - ./ci/build-linux-macos.sh\nbuild-windows-gcc-x86-sse4.2:\nstage: build\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: enable Intel compiler build.
8,490
21.05.2021 16:04:10
-7,200
68f6e1a535a4fda52c66daa55779ffc446fa607a
CI: dockerize cppcheck.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -15,6 +15,7 @@ before_script:\n# - pwd\nanalysis-cppcheck:\n+ image: registry.gitlab.com/aff3ct/aff3ct/ubuntu_cppcheck:latest\nstage: analysis\nallow_failure: false\nartifacts:\n@@ -23,7 +24,8 @@ analysis-cppcheck:\npaths:\n- cppcheck/\ntags:\n- - cppcheck\n+ - docker\n+ - linux\nscript:\n- ./ci/analysis-cppcheck.sh\n@@ -326,19 +328,14 @@ build-linux-icpc:\n- job: analysis-headers\nartifacts: false\ntags:\n-# - linux\n-# - icpc\n-# - cmake\n-# - mkl\n-# - gsl\n- x86\n+ - linux\n- docker\nartifacts:\nname: build-linux-icpc\npaths:\n- build_linux_icpc\nscript:\n-# - source /opt/intel/vars-intel.sh\n- export CC=\"icc\"\n- export CXX=\"icpc\"\n- export CFLAGS=\"-Wall -funroll-loops -march=native -std=c++11\"\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: dockerize cppcheck.
8,490
21.05.2021 16:22:13
-7,200
bc0911534d22d80069de4cd703b11cc151adc44d
CI: fix cppcheck script for version 1.9.
[ { "change_type": "MODIFY", "old_path": "ci/analysis-cppcheck.sh", "new_path": "ci/analysis-cppcheck.sh", "diff": "@@ -10,28 +10,23 @@ find .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp\n# cppcheck for sonarqube\ncppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt --xml --xml-version=2 2> cppcheck/cppcheck.xml\ncppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt 2> cppcheck/cppcheck_all.log\n-cat cppcheck/cppcheck_all.log | grep \"(error)\" > cppcheck/cppcheck_error.log\n-cat cppcheck/cppcheck_all.log | grep \"(warning)\" > cppcheck/cppcheck_warning.log\n-cat cppcheck/cppcheck_all.log | grep \"(performance)\" > cppcheck/cppcheck_performance.log\n-cat cppcheck/cppcheck_all.log | grep \"(style)\" > cppcheck/cppcheck_style.log\n-cat cppcheck/cppcheck_all.log | grep \"(portability)\" > cppcheck/cppcheck_portability.log\n-cat cppcheck/cppcheck_all.log | grep \"(information)\" > cppcheck/cppcheck_information.log\n-cat cppcheck/cppcheck_all.log | grep \"(unusedFunction)\" > cppcheck/cppcheck_unusedFunction.log\n-cat cppcheck/cppcheck_all.log | grep \"(missingInclude)\" > cppcheck/cppcheck_missingInclude.log\n+cat cppcheck/cppcheck_all.log | grep \"error:\" > cppcheck/cppcheck_error.log\n+cat cppcheck/cppcheck_all.log | grep \"warning:\" > cppcheck/cppcheck_warning.log\n+cat cppcheck/cppcheck_all.log | grep \"performance:\" > cppcheck/cppcheck_performance.log\n+cat cppcheck/cppcheck_all.log | grep \"style:\" > cppcheck/cppcheck_style.log\n+cat cppcheck/cppcheck_all.log | grep \"portability:\" > cppcheck/cppcheck_portability.log\n+cat cppcheck/cppcheck_all.log | grep \"information:\" > cppcheck/cppcheck_information.log\n+cat cppcheck/cppcheck_all.log | grep \"unusedFunction:\" > cppcheck/cppcheck_unusedFunction.log\n+cat cppcheck/cppcheck_all.log | grep \"missingInclude:\" > cppcheck/cppcheck_missingInclude.log\nCOUNT=$(wc -l < cppcheck/cppcheck_error.log )\n-if [ $COUNT -gt 1 ]; then\n+if [ $COUNT -gt 0 ]; then\necho \"Error count is $COUNT! cppcheck run failed :-(.\";\necho \"\"\necho \"Errors list:\"\ncat cppcheck/cppcheck_error.log\nexit 1;\n-elif [ $COUNT -gt 0 ]; then\n- echo \"There is one false positive error.\";\n- echo \"\"\n- echo \"Errors list:\"\n- cat cppcheck/cppcheck_error.log\nelse\necho \"There is no error :-).\"\nfi\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: fix cppcheck script for version 1.9.
8,490
21.05.2021 16:35:26
-7,200
be7f4a19b3342c8fca83b2f3b1a3acc75d3d807f
Fix exception destructors.
[ { "change_type": "MODIFY", "old_path": "ci/analysis-cppcheck.sh", "new_path": "ci/analysis-cppcheck.sh", "diff": "@@ -21,12 +21,17 @@ cat cppcheck/cppcheck_all.log | grep \"missingInclude:\" > cppcheck/cppcheck_missi\nCOUNT=$(wc -l < cppcheck/cppcheck_error.log )\n-if [ $COUNT -gt 0 ]; then\n+if [ $COUNT -gt 1 ]; then\necho \"Error count is $COUNT! cppcheck run failed :-(.\";\necho \"\"\necho \"Errors list:\"\ncat cppcheck/cppcheck_error.log\nexit 1;\n+elif [ $COUNT -gt 0 ]; then\n+ echo \"There is one false positive error.\";\n+ echo \"\"\n+ echo \"Errors list:\"\n+ cat cppcheck/cppcheck_error.log\nelse\necho \"There is no error :-).\"\nfi\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/cannot_allocate/cannot_allocate.hpp", "new_path": "include/Tools/Exception/cannot_allocate/cannot_allocate.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~cannot_allocate() throw() = default;\n+ virtual ~cannot_allocate() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/domain_error/domain_error.hpp", "new_path": "include/Tools/Exception/domain_error/domain_error.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~domain_error() throw() = default;\n+ virtual ~domain_error() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/exception.hpp", "new_path": "include/Tools/Exception/exception.hpp", "diff": "@@ -38,7 +38,7 @@ public:\nconst std::string &funcname,\nconst std::string &message) throw();\n- virtual ~exception() throw() = default;\n+ virtual ~exception() = default;\nvirtual const char* what() const throw(); // return the message and the back trace if enabled\n};\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/invalid_argument/invalid_argument.hpp", "new_path": "include/Tools/Exception/invalid_argument/invalid_argument.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~invalid_argument() throw() = default;\n+ virtual ~invalid_argument() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/length_error/length_error.hpp", "new_path": "include/Tools/Exception/length_error/length_error.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~length_error() throw() = default;\n+ virtual ~length_error() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/logic_error/logic_error.hpp", "new_path": "include/Tools/Exception/logic_error/logic_error.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~logic_error() throw() = default;\n+ virtual ~logic_error() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/out_of_range/out_of_range.hpp", "new_path": "include/Tools/Exception/out_of_range/out_of_range.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~out_of_range() throw() = default;\n+ virtual ~out_of_range() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/overflow_error/overflow_error.hpp", "new_path": "include/Tools/Exception/overflow_error/overflow_error.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~overflow_error() throw() = default;\n+ virtual ~overflow_error() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/processing_aborted/processing_aborted.hpp", "new_path": "include/Tools/Exception/processing_aborted/processing_aborted.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~processing_aborted() throw() = default;\n+ virtual ~processing_aborted() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/range_error/range_error.hpp", "new_path": "include/Tools/Exception/range_error/range_error.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~range_error() throw() = default;\n+ virtual ~range_error() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/runtime_error/runtime_error.hpp", "new_path": "include/Tools/Exception/runtime_error/runtime_error.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~runtime_error() throw() = default;\n+ virtual ~runtime_error() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/underflow_error/underflow_error.hpp", "new_path": "include/Tools/Exception/underflow_error/underflow_error.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~underflow_error() throw() = default;\n+ virtual ~underflow_error() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/unimplemented_error/unimplemented_error.hpp", "new_path": "include/Tools/Exception/unimplemented_error/unimplemented_error.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~unimplemented_error() throw() = default;\n+ virtual ~unimplemented_error() = default;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Exception/waiting_canceled/waiting_canceled.hpp", "new_path": "include/Tools/Exception/waiting_canceled/waiting_canceled.hpp", "diff": "@@ -27,7 +27,7 @@ public:\nconst std::string &funcname = exception::empty_string,\nconst std::string &message = exception::empty_string) throw();\n- virtual ~waiting_canceled() throw() = default;\n+ virtual ~waiting_canceled() = default;\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix exception destructors.
8,490
21.05.2021 16:51:02
-7,200
c126f71ad16adc934eb9925cb0d8b8d39560e148
CI: dockerize headers and submodules.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -15,7 +15,7 @@ before_script:\n# - pwd\nanalysis-cppcheck:\n- image: registry.gitlab.com/aff3ct/aff3ct/ubuntu_cppcheck:latest\n+ image: registry.gitlab.com/aff3ct/aff3ct/ubuntu_cppcheck:v1.9\nstage: analysis\nallow_failure: false\nartifacts:\n@@ -58,6 +58,7 @@ analysis-clang:\n- ./ci/analysis-clang.sh\nanalysis-headers:\n+ image: ubuntu:20.04\nstage: analysis\nartifacts:\nname: analysis-headers\n@@ -66,11 +67,13 @@ analysis-headers:\n- aff3ct.hpp\ntags:\n- linux\n+ - docker\nscript:\n- ./scripts/generate_aff3ct_header.sh aff3ct.hpp\n- diff aff3ct.hpp include/aff3ct.hpp\nanalysis-git-submodules:\n+ image: registry.gitlab.com/aff3ct/aff3ct/ubuntu_git:v2.25.1\nstage: analysis\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -78,6 +81,7 @@ analysis-git-submodules:\n- schedules\ntags:\n- linux\n+ - docker\nonly:\n- master\n- development\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: dockerize headers and submodules.
8,490
21.05.2021 19:06:12
-7,200
f268af12119b06e98da3f2fd3bd9910fa1d55017
CI: dockerize many Linux jobs.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -15,7 +15,7 @@ before_script:\n# - pwd\nanalysis-cppcheck:\n- image: registry.gitlab.com/aff3ct/aff3ct/ubuntu_cppcheck:v1.9\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_cppcheck:v1.9\nstage: analysis\nallow_failure: false\nartifacts:\n@@ -24,12 +24,13 @@ analysis-cppcheck:\npaths:\n- cppcheck/\ntags:\n- - docker\n- linux\n+ - docker\nscript:\n- ./ci/analysis-cppcheck.sh\nanalysis-clang:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_clang:v10.0.0\nstage: analysis\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -45,10 +46,7 @@ analysis-clang:\n- development\ntags:\n- linux\n- - clang\n- - scan-build\n- - clang-tidy\n- - python\n+ - docker\nscript:\n- export CFLAGS=\"-pedantic -fdiagnostics-show-option -Wall -Wno-overloaded-virtual\"\n- export CMAKE_OPT=\"-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=OFF -DAFF3CT_COMPILE_SHARED_LIB=OFF -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF\"\n@@ -73,7 +71,7 @@ analysis-headers:\n- diff aff3ct.hpp include/aff3ct.hpp\nanalysis-git-submodules:\n- image: registry.gitlab.com/aff3ct/aff3ct/ubuntu_git:v2.25.1\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_git:v2.25.1\nstage: analysis\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -90,24 +88,24 @@ analysis-git-submodules:\n- ./ci/analysis-git-submodule.sh\nanalysis-documentation:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_doc\nstage: analysis\nartifacts:\nname: analysis-documentation\nwhen: always\npaths:\n- doc/build/html\n- - doc/build/latex\n+# - doc/build/latex\n- doc/build/doxygen\ntags:\n- - pip3\n- - doxygen\n- - latex\n- - powerful\n+ - linux\n+ - docker\nscript:\n- export THREADS=\"1\"\n- ./ci/analysis-documentation.sh\nbuild-linux-gcc-nointr:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_gcc:v9.3.0\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -119,10 +117,9 @@ build-linux-gcc-nointr:\n- job: analysis-headers\nartifacts: false\ntags:\n+ - x86_64\n- linux\n- - gcc\n- - cmake\n- - x86\n+ - docker\nartifacts:\nname: build-linux-gcc-nointr\npaths:\n@@ -138,6 +135,7 @@ build-linux-gcc-nointr:\n- ./ci/build-linux-macos.sh\nbuild-linux-gcc-x64-sse4.2:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_gcc:v9.3.0\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -149,11 +147,9 @@ build-linux-gcc-x64-sse4.2:\n- job: analysis-documentation\nartifacts: true\ntags:\n+ - x86_64\n- linux\n- - gcc\n- - cmake\n- - x86\n- - 64-bit\n+ - docker\nartifacts:\nname: build-linux-gcc-x64-sse4.2\npaths:\n@@ -169,6 +165,7 @@ build-linux-gcc-x64-sse4.2:\n- ./ci/build-linux-macos.sh\nbuild-linux-gcc-x64-avx2:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_gcc:v9.3.0\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -182,11 +179,9 @@ build-linux-gcc-x64-avx2:\n- job: analysis-documentation\nartifacts: true\ntags:\n+ - x86_64\n- linux\n- - gcc\n- - cmake\n- - x86\n- - 64-bit\n+ - docker\nartifacts:\nname: build-linux-gcc-x64-avx2\npaths:\n@@ -202,6 +197,7 @@ build-linux-gcc-x64-avx2:\n- ./ci/build-linux-macos.sh\nbuild-linux-gcc-8-bit:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_gcc:v9.3.0\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -213,11 +209,9 @@ build-linux-gcc-8-bit:\n- job: analysis-headers\nartifacts: false\ntags:\n+ - x86_64\n- linux\n- - gcc\n- - arm\n- - cmake\n- - gsl\n+ - docker\nartifacts:\nname: build-linux-gcc-8-bit\npaths:\n@@ -232,6 +226,7 @@ build-linux-gcc-8-bit:\n- ./ci/build-linux-macos.sh\nbuild-linux-gcc-mpi:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_openmpi:v4.0.3\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -243,11 +238,9 @@ build-linux-gcc-mpi:\n- job: analysis-headers\nartifacts: false\ntags:\n+ - x86_64\n- linux\n- - gcc\n- - mpi\n- - cmake\n- - gsl\n+ - docker\nartifacts:\nname: build-linux-gcc-mpi\npaths:\n@@ -262,6 +255,7 @@ build-linux-gcc-mpi:\n- ./ci/build-linux-macos.sh\nbuild-linux-clang:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_clang:v10.0.0\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -273,10 +267,9 @@ build-linux-clang:\n- job: analysis-headers\nartifacts: false\ntags:\n+ - x86_64\n- linux\n- - clang\n- - cmake\n- - gsl\n+ - docker\nartifacts:\nname: build-linux-clang\npaths:\n@@ -290,35 +283,6 @@ build-linux-clang:\n- source ./ci/tools/threads.sh\n- ./ci/build-linux-macos.sh\n-build-linux-gcc-4.8:\n- stage: build\n- variables:\n- GIT_SUBMODULE_STRATEGY: recursive\n- except:\n- - schedules\n- needs:\n- - job: analysis-cppcheck\n- artifacts: false\n- - job: analysis-headers\n- artifacts: false\n- tags:\n- - linux\n- - gcc-4.8\n- - cmake\n- - gsl\n- artifacts:\n- name: build-linux-gcc-4.8\n- paths:\n- - build_linux_gcc-4.8\n- script:\n- - export CC=\"gcc-4.8\"\n- - export CXX=\"g++-4.8\"\n- - export CFLAGS=\"-Wall -funroll-loops -march=native\"\n- - export CMAKE_OPT=\"-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF -DAFF3CT_LINK_GSL=ON\"\n- - export NAME=\"build_linux_gcc-4.8\"\n- - source ./ci/tools/threads.sh\n- - ./ci/build-linux-macos.sh\n-\nbuild-linux-icpc:\nimage: intel/oneapi-hpckit\nstage: build\n@@ -332,7 +296,7 @@ build-linux-icpc:\n- job: analysis-headers\nartifacts: false\ntags:\n- - x86\n+ - x86_64\n- linux\n- docker\nartifacts:\n@@ -469,6 +433,7 @@ build-macos-clang-x64-sse4.2:\n- ./ci/build-linux-macos.sh\ncheck-debug-parser:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: check\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -478,12 +443,10 @@ check-debug-parser:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n- - python3.5\n- - mat4py\n+ - linux\n+ - docker\nartifacts:\nname: debug-parser-output\nwhen: always\n@@ -492,10 +455,12 @@ check-debug-parser:\nscript:\n- source ./ci/tools/git-version.sh\n- cd ./scripts/debug_parser/\n+ - pip3 install -r requirements.txt\n- export AFF3CT_PATH=\"../../../build_linux_gcc_x64_sse4.2/bin/aff3ct-$GIT_VERSION\"\n- ./test/test.sh\ncheck-documentation:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: check\nexcept:\n- schedules\n@@ -503,15 +468,15 @@ check-documentation:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n- - python3.5\n+ - linux\n+ - docker\nscript:\n- ./ci/check-documentation.py --aff3ct \"build_linux_gcc_x64_sse4.2/bin/aff3ct\"\ntest-regression-bch:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -520,11 +485,10 @@ test-regression-bch:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n- - python3.4\n+ - linux\n+ - docker\nartifacts:\nname: test-regression-results-bch\nwhen: always\n@@ -538,6 +502,7 @@ test-regression-bch:\n- ./ci/test-regression.py --refs-path refs/BCH --results-path test-regression-results-bch --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-ldpc:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -546,12 +511,11 @@ test-regression-ldpc:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n+ - linux\n+ - docker\n- powerful\n- - python3.4\nartifacts:\nname: test-regression-results-ldpc\nwhen: always\n@@ -565,6 +529,7 @@ test-regression-ldpc:\n- ./ci/test-regression.py --refs-path refs/LDPC --results-path test-regression-results-ldpc --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-polar:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -573,12 +538,11 @@ test-regression-polar:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n+ - linux\n+ - docker\n- powerful\n- - python3.4\nartifacts:\nname: test-regression-results-polar\nwhen: always\n@@ -592,6 +556,7 @@ test-regression-polar:\n- ./ci/test-regression.py --refs-path refs/POLAR --results-path test-regression-results-polar --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-polar-mk:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -600,12 +565,11 @@ test-regression-polar-mk:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n+ - linux\n+ - docker\n- powerful\n- - python3.4\nartifacts:\nname: test-regression-results-polar-mk\nwhen: always\n@@ -619,6 +583,7 @@ test-regression-polar-mk:\n- ./ci/test-regression.py --refs-path refs/POLAR_MK --results-path test-regression-results-polar-mk --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-ra:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -629,11 +594,10 @@ test-regression-ra:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n- - python3.4\n+ - linux\n+ - docker\nartifacts:\nname: test-regression-results-ra\nwhen: always\n@@ -647,6 +611,7 @@ test-regression-ra:\n- ./ci/test-regression.py --refs-path refs/RA --results-path test-regression-results-ra --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-rep:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -655,11 +620,10 @@ test-regression-rep:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n- - python3.4\n+ - linux\n+ - docker\nartifacts:\nname: test-regression-results-rep\nwhen: always\n@@ -673,6 +637,7 @@ test-regression-rep:\n- ./ci/test-regression.py --refs-path refs/REP --results-path test-regression-results-rep --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-rs:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -681,11 +646,10 @@ test-regression-rs:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n- - python3.4\n+ - linux\n+ - docker\nartifacts:\nname: test-regression-results-rs\nwhen: always\n@@ -707,11 +671,10 @@ test-regression-rsc:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n- - python3.4\n+ - linux\n+ - docker\nartifacts:\nname: test-regression-results-rsc\nwhen: always\n@@ -725,6 +688,7 @@ test-regression-rsc:\n- ./ci/test-regression.py --refs-path refs/RSC --results-path test-regression-results-rsc --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-rsc-db:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -733,11 +697,10 @@ test-regression-rsc-db:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n- - python3.4\n+ - linux\n+ - docker\nartifacts:\nname: test-regression-results-rsc-db\nwhen: always\n@@ -751,6 +714,7 @@ test-regression-rsc-db:\n- ./ci/test-regression.py --refs-path refs/RSC_DB --results-path test-regression-results-rsc-db --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-turbo:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -759,12 +723,11 @@ test-regression-turbo:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n+ - linux\n+ - docker\n- powerful\n- - python3.4\nartifacts:\nname: test-regression-results-turbo\nwhen: always\n@@ -778,6 +741,7 @@ test-regression-turbo:\n- ./ci/test-regression.py --refs-path refs/TURBO --results-path test-regression-results-turbo --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-turbo-db:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -786,12 +750,11 @@ test-regression-turbo-db:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n+ - linux\n+ - docker\n- powerful\n- - python3.4\nartifacts:\nname: test-regression-results-turbo-db\nwhen: always\n@@ -805,6 +768,7 @@ test-regression-turbo-db:\n- ./ci/test-regression.py --refs-path refs/TURBO_DB --results-path test-regression-results-turbo-db --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-turbo-prod:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -813,12 +777,11 @@ test-regression-turbo-prod:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n+ - linux\n+ - docker\n- powerful\n- - python3.4\nartifacts:\nname: test-regression-results-turbo-prod\nwhen: always\n@@ -832,6 +795,7 @@ test-regression-turbo-prod:\n- ./ci/test-regression.py --refs-path refs/TURBO_PROD --results-path test-regression-results-turbo-prod --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-uncoded:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -840,11 +804,10 @@ test-regression-uncoded:\n- job: build-linux-gcc-x64-sse4.2\nartifacts: true\ntags:\n- - linux\n- - x86\n- - 64-bit\n+ - x86_64\n- sse4.2\n- - python3.4\n+ - linux\n+ - docker\nartifacts:\nname: test-regression-results-uncoded\nwhen: always\n" }, { "change_type": "MODIFY", "old_path": "ci/analysis-clang.sh", "new_path": "ci/analysis-clang.sh", "diff": "@@ -22,23 +22,26 @@ fi\nmkdir -p $NAME\ncd $NAME\n-scan-build -v -plist --intercept-first --analyze-headers -o $REPORTS_DIR \\\n+# scan-build -v -plist --intercept-first --analyze-headers -o $REPORTS_DIR \\\n+scan-build -v -plist -o $REPORTS_DIR \\\ncmake .. -G\"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug \\\n-DCMAKE_CXX_FLAGS=\"$CFLAGS\" -DCMAKE_VERBOSE_MAKEFILE=ON \\\n-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \\\n-DCMAKE_EXE_LINKER_FLAGS=\"$LFLAGS\" $CMAKE_OPT\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n-scan-build -v -plist --intercept-first --analyze-headers -o $REPORTS_DIR \\\n+#scan-build -v -plist --intercept-first --analyze-headers -o $REPORTS_DIR \\\n+scan-build -v -plist -o $REPORTS_DIR \\\nmake -j $THREADS -k 2>&1 | tee aff3ct-build.log\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\nmv aff3ct-build.log $REPORTS_DIR\nCLANG_TIDY_MAJOR=$(clang-tidy --version | grep version | awk -F \" \" '{print $3}' | awk -F \".\" '{print $1}')\n-CLANG_TIDY_MINOR=$(clang-tidy --version | grep version | awk -F \" \" '{print $3}' | awk -F \".\" '{print $2}')\n+# CLANG_TIDY_MINOR=$(clang-tidy --version | grep version | awk -F \" \" '{print $3}' | awk -F \".\" '{print $2}')\n-run-clang-tidy-$CLANG_TIDY_MAJOR.$CLANG_TIDY_MINOR.py -checks='*' -header-filter=.. -p . -j$THREADS > clang-tidy-report.txt\n+# run-clang-tidy-$CLANG_TIDY_MAJOR.$CLANG_TIDY_MINOR.py -checks='*' -header-filter=.. -p . -j$THREADS > clang-tidy-report.txt\n+run-clang-tidy-$CLANG_TIDY_MAJOR.py -checks='*' -header-filter=.. -p . -j$THREADS > clang-tidy-report.txt\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\nmv clang-tidy-report.txt $REPORTS_DIR\n" }, { "change_type": "MODIFY", "old_path": "ci/analysis-documentation.sh", "new_path": "ci/analysis-documentation.sh", "diff": "@@ -8,14 +8,15 @@ then\nfi\ncd doc/\n-pip3 install --user -r requirements.txt\n+pip3 install -r requirements.txt\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n-export SPHINX_BUILDERNAME=\"latex\"\n-make clean\n-sphinx-build -M latexpdf source build -j $THREADS\n-rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n+# export SPHINX_BUILDERNAME=\"latex\"\n+# make clean\n+# sphinx-build -M latexpdf source build -j $THREADS\n+# rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\nexport SPHINX_BUILDERNAME=\"html\"\n+make clean\nsphinx-build -M html source build -j $THREADS\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n" }, { "change_type": "MODIFY", "old_path": "scripts/debug_parser/README.md", "new_path": "scripts/debug_parser/README.md", "diff": "@@ -5,7 +5,7 @@ This debug parser supports the hex debug format (`--sim-debug-hex`), which is h\n## Dependencies\n```\n-pip3 install argparse mat4py\n+pip3 install --user -r requirements.txt\n```\nFor dynamic parsing, on Ubuntu, run the following command (and add it to your bashrc !)\n```\n" }, { "change_type": "ADD", "old_path": null, "new_path": "scripts/debug_parser/requirements.txt", "diff": "+mat4py==0.5.0\n+argparse==1.4.0\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: dockerize many Linux jobs.
8,490
21.05.2021 23:33:34
-7,200
1d18c7d82bfa80ce0a1cce92b970435026dbdc36
CI: fix missing docker image for RSC tests.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -663,6 +663,7 @@ test-regression-rs:\n- ./ci/test-regression.py --refs-path refs/RS --results-path test-regression-results-rs --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-regression-rsc:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_python:v3.8.5\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: fix missing docker image for RSC tests.
8,490
22.05.2021 12:33:37
-7,200
368d1946e26501cb12dc19e254e999b8ba15004c
CI: dockerize Linux jobs again.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -822,6 +822,7 @@ test-regression-uncoded:\n- ./ci/test-regression.py --refs-path refs/UNCODED --results-path test-regression-results-uncoded --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\ntest-build-coverage-regression:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_coverage\nstage: test\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -833,10 +834,10 @@ test-build-coverage-regression:\n- job: analysis-headers\nartifacts: false\ntags:\n- - linux\n- - gcc\n- - lcov\n+ - x86_64\n- sse4.2\n+ - linux\n+ - docker\n- powerful\nartifacts:\nname: code-coverage-files\n@@ -849,6 +850,7 @@ test-build-coverage-regression:\n- ./ci/test-build-coverage-regression.sh\ncoverage-linux:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_coverage\nstage: coverage\nexcept:\n- schedules\n@@ -856,9 +858,9 @@ coverage-linux:\n- job: test-build-coverage-regression\nartifacts: true\ntags:\n+ - x86_64\n- linux\n- - lcov\n- - lcov_cobertura\n+ - docker\ncoverage: '/.*lines\\.*: (\\d+.\\d+\\%)/'\nartifacts:\nname: code-coverage-report\n@@ -869,6 +871,7 @@ coverage-linux:\n- ./ci/coverage-linux.sh\ndeploy-sonarqube-linux:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_sonarqube:v3.0.3\nstage: deploy\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -879,9 +882,9 @@ deploy-sonarqube-linux:\n- coverage-linux\n- analysis-clang\ntags:\n+ - x86_64\n- linux\n- - sonarqube\n- - gcc\n+ - docker\nonly:\n- master\n- development\n@@ -893,6 +896,7 @@ deploy-sonarqube-linux:\n- ./ci/deploy-sonarqube-linux.sh\ndeploy-builds-linux:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_git:v2.25.1\nstage: deploy\nexcept:\n- schedules\n@@ -903,8 +907,9 @@ deploy-builds-linux:\n- build-windows-gcc-x64-avx2\n- build-macos-clang-x64-sse4.2\ntags:\n+ - x86_64\n- linux\n- - github\n+ - docker\nonly:\n- master\n- development\n@@ -914,6 +919,15 @@ deploy-builds-linux:\npaths:\n- builds/\nallow_failure: true\n+ before_script:\n+ ## https://docs.gitlab.com/ee/ci/ssh_keys/\n+ - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'\n+ - eval $(ssh-agent -s)\n+ - echo \"$SSH_PRIVATE_KEY\" | tr -d '\\r' | ssh-add -\n+ - mkdir -p ~/.ssh\n+ - chmod 700 ~/.ssh\n+ - git config --global user.email \"adrien.cassagne@inria.fr\"\n+ - git config --global user.name \"Adrien Cassagne\"\nscript:\n- source ./ci/tools/git-branch.sh\n- source ./ci/tools/git-tag.sh\n@@ -925,6 +939,7 @@ deploy-builds-linux:\n- ./ci/deploy-builds-linux.sh build_linux_gcc_x64_sse4.2 build_linux_gcc_x64_avx2 build_windows_gcc_x86_sse4.2 build_windows_gcc_x64_avx2 build_macos_clang_x64_sse4.2\ndeploy-upload-ppa:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_gcc:v9.3.0\nstage: deploy\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -934,12 +949,9 @@ deploy-upload-ppa:\n- analysis-documentation\nallow_failure: true\ntags:\n+ - x86_64\n- linux\n- - gcc\n- - cmake\n- - x86\n- - 64-bit\n- - ppa\n+ - docker\nonly:\n- master\n- development\n" }, { "change_type": "MODIFY", "old_path": "ci/deploy-sonarqube-linux.sh", "new_path": "ci/deploy-sonarqube-linux.sh", "diff": "@@ -44,6 +44,7 @@ GCC_REGEX='(?<file>.*):(?<line>[0-9]+):[0-9]+:\\\\x20warning:\\\\x20(?<message>.*)\\\\\nGIT_SHORT_TAG=$(echo $GIT_TAG | cut -d $'v' -f2-)\necho \"sonar.projectKey=storm:aff3ct:gitlab:$GIT_BRANCH\" > sonar-project.properties\necho \"sonar.projectVersion=$GIT_SHORT_TAG\" >> sonar-project.properties\n+echo \"sonar.host.url=$SONARQUBE_HOST\" >> sonar-project.properties\necho \"sonar.scm.disabled=false\" >> sonar-project.properties\necho \"sonar.scm.provider=git\" >> sonar-project.properties\necho \"sonar.login=$SONARQUBE_TOKEN\" >> sonar-project.properties\n" }, { "change_type": "MODIFY", "old_path": "ci/test-build-coverage-regression.sh", "new_path": "ci/test-build-coverage-regression.sh", "diff": "@@ -33,7 +33,7 @@ function gen_coverage_info\nci=$(awk -F \"=\" '/ci/ {print $2}' $path)\nif [ \"$ci\" != \"off\" ]; then\ncd $build\n- eval \"${cmd} --sim-threads 1 --sim-max-fra 1 --sim-crit-nostop --ter-freq 0 --sim-sequence\"\n+ eval \"${cmd} --sim-threads 1 --sim-max-fra 1 --sim-crit-nostop --ter-freq 0\"\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\ncd ..\nelse\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: dockerize Linux jobs again.
8,490
22.05.2021 17:38:59
-7,200
8063134368bcc48ed8b7206d61aa4289822e70e7
Fix link error on MSVC.
[ { "change_type": "MODIFY", "old_path": "include/Module/Reducer/Reducer.hpp", "new_path": "include/Module/Reducer/Reducer.hpp", "diff": "@@ -55,15 +55,15 @@ protected:\nvirtual void _reduce(const TI *in, TO *out, const size_t frame_id);\n};\n-template <typename TI, typename TO = TI> using Reducer_add = Reducer<TI,TO,tools::bop_add<TI,TO>>;\n-template <typename TI, typename TO = TI> using Reducer_sub = Reducer<TI,TO,tools::bop_sub<TI,TO>>;\n-template <typename TI, typename TO = TI> using Reducer_mul = Reducer<TI,TO,tools::bop_mul<TI,TO>>;\n-template <typename TI, typename TO = TI> using Reducer_div = Reducer<TI,TO,tools::bop_div<TI,TO>>;\n-template <typename TI, typename TO = TI> using Reducer_or = Reducer<TI,TO,tools::bop_or <TI,TO>>;\n-template <typename TI, typename TO = TI> using Reducer_xor = Reducer<TI,TO,tools::bop_xor<TI,TO>>;\n-template <typename TI, typename TO = TI> using Reducer_and = Reducer<TI,TO,tools::bop_and<TI,TO>>;\n-template <typename TI, typename TO = TI> using Reducer_min = Reducer<TI,TO,tools::bop_min<TI,TO>>;\n-template <typename TI, typename TO = TI> using Reducer_max = Reducer<TI,TO,tools::bop_max<TI,TO>>;\n+template <typename TI, typename TO = TI, tools::proto_bop<TI, TO> BOP = tools::bop_add<TI, TO>> using Reducer_add = Reducer<TI, TO, BOP>;\n+template <typename TI, typename TO = TI, tools::proto_bop<TI, TO> BOP = tools::bop_sub<TI, TO>> using Reducer_sub = Reducer<TI, TO, BOP>;\n+template <typename TI, typename TO = TI, tools::proto_bop<TI, TO> BOP = tools::bop_mul<TI, TO>> using Reducer_mul = Reducer<TI, TO, BOP>;\n+template <typename TI, typename TO = TI, tools::proto_bop<TI, TO> BOP = tools::bop_div<TI, TO>> using Reducer_div = Reducer<TI, TO, BOP>;\n+template <typename TI, typename TO = TI, tools::proto_bop<TI, TO> BOP = tools::bop_or <TI, TO>> using Reducer_or = Reducer<TI, TO, BOP>;\n+template <typename TI, typename TO = TI, tools::proto_bop<TI, TO> BOP = tools::bop_xor<TI, TO>> using Reducer_xor = Reducer<TI, TO, BOP>;\n+template <typename TI, typename TO = TI, tools::proto_bop<TI, TO> BOP = tools::bop_and<TI, TO>> using Reducer_and = Reducer<TI, TO, BOP>;\n+template <typename TI, typename TO = TI, tools::proto_bop<TI, TO> BOP = tools::bop_min<TI, TO>> using Reducer_min = Reducer<TI, TO, BOP>;\n+template <typename TI, typename TO = TI, tools::proto_bop<TI, TO> BOP = tools::bop_max<TI, TO>> using Reducer_max = Reducer<TI, TO, BOP>;\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix link error on MSVC.
8,490
23.05.2021 11:04:23
-7,200
7955dca193b8125f8df6c4ad2a57107f877b3e97
CI: improve coverage workflow.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -254,6 +254,33 @@ build-linux-gcc-mpi:\n- source ./ci/tools/threads.sh\n- ./ci/build-linux-macos.sh\n+build-linux-gcc-coverage:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_gcc:v9.3.0\n+ stage: build\n+ variables:\n+ GIT_SUBMODULE_STRATEGY: recursive\n+ needs:\n+ - job: analysis-cppcheck\n+ artifacts: false\n+ - job: analysis-headers\n+ artifacts: false\n+ tags:\n+ - x86_64\n+ - linux\n+ - docker\n+ artifacts:\n+ name: build\n+ paths:\n+ - build\n+ script:\n+ - export CC=\"gcc\"\n+ - export CXX=\"g++\"\n+ - export CFLAGS=\"-Wall -funroll-loops -msse4.2 --coverage\"\n+ - export LFLAGS=\"--coverage\"\n+ - export CMAKE_OPT=\"-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG=-O0 -DAFF3CT_COMPILE_EXE=ON -DAFF3CT_PREC=MULTI\"\n+ - source ./ci/tools/threads.sh\n+ - ./ci/build-linux-macos.sh\n+\nbuild-linux-clang:\nimage: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_clang:v10.0.0\nstage: build\n@@ -821,7 +848,7 @@ test-regression-uncoded:\n- export TIME_SEC=$CI_AFF3CT_TEST_UNCODED_TIME_SEC\n- ./ci/test-regression.py --refs-path refs/UNCODED --results-path test-regression-results-uncoded --build-path build_linux_gcc_x64_sse4.2 --binary-path bin/aff3ct-$GIT_VERSION --max-snr-time $TIME_SEC --sensibility 2.5 --weak-rate 0.9 --verbose 1 --n-threads $THREADS\n-test-build-coverage-regression:\n+test-coverage-regression:\nimage: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_coverage\nstage: test\nvariables:\n@@ -829,10 +856,8 @@ test-build-coverage-regression:\nexcept:\n- schedules\nneeds:\n- - job: analysis-cppcheck\n- artifacts: false\n- - job: analysis-headers\n- artifacts: false\n+ - job: build-linux-gcc-coverage\n+ artifacts: true\ntags:\n- x86_64\n- sse4.2\n@@ -845,9 +870,8 @@ test-build-coverage-regression:\npaths:\n- code_coverage_files/\nscript:\n- - source ./ci/tools/threads.sh\n- source ./ci/tools/git-version.sh\n- - ./ci/test-build-coverage-regression.sh\n+ - ./ci/test-coverage-regression.sh\ncoverage-linux:\nimage: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_coverage\n@@ -855,7 +879,7 @@ coverage-linux:\nexcept:\n- schedules\nneeds:\n- - job: test-build-coverage-regression\n+ - job: test-coverage-regression\nartifacts: true\ntags:\n- x86_64\n" }, { "change_type": "RENAME", "old_path": "ci/test-build-coverage-regression.sh", "new_path": "ci/test-coverage-regression.sh", "diff": "#!/bin/bash\nset -x\n-if [ -z \"$THREADS\" ]\n-then\n- echo \"The 'THREADS' environment variable is not set, default value = 1.\"\n- THREADS=1\n-fi\n-\nWD=$(pwd)\n-build_root=build_coverage_linux_x86_gcc\n-\n-function compile {\n- build=$1\n- mkdir $build\n- cd $build\n- cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG=\"-O0\" -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -msse4.2 --coverage\" -DCMAKE_EXE_LINKER_FLAGS=\"--coverage\" -DAFF3CT_COMPILE_EXE=\"ON\" -DAFF3CT_PREC=\"MULTI\"\n- rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n- make -j $THREADS\n- rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n- cd ..\n-}\n+build_root=build\nfunction gen_coverage_info\n{\n@@ -50,8 +33,6 @@ function gen_coverage_info\ndone\n}\n-compile \"${build_root}\"\n-cd ${WD}\ngen_coverage_info \"${build_root}\" \"refs\"\ncd ${WD}\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: improve coverage workflow.
8,490
23.05.2021 11:55:15
-7,200
a3e400b1a95cad69aa4e08b9ccc64e95f94a4185
CI: improve deploy ppa job.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -963,7 +963,7 @@ deploy-builds-linux:\n- ./ci/deploy-builds-linux.sh build_linux_gcc_x64_sse4.2 build_linux_gcc_x64_avx2 build_windows_gcc_x86_sse4.2 build_windows_gcc_x64_avx2 build_macos_clang_x64_sse4.2\ndeploy-upload-ppa:\n- image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_gcc:v9.3.0\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_ubuntu_ppa\nstage: deploy\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -987,6 +987,9 @@ deploy-upload-ppa:\n- build/Debian/xenial/*.xz\n- build/Debian/xenial/*.dsc\n- build/Debian/xenial/*.build\n+ before_script:\n+ - apk add --no-cache gnupg\n+ - echo \"$GPG_PRIVATE_KEY\" | gpg --batch --import --pinentry-mode loopback --no-tty\nscript:\n- source ./ci/tools/git-branch.sh\n- source ./ci/tools/threads.sh\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: improve deploy ppa job.
8,490
23.05.2021 21:25:02
-7,200
6b81dbb25a2eec8c749a26416637c79fab3c1c66
CI: dockerize Windows jobs.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -340,6 +340,7 @@ build-linux-icpc:\n- ./ci/build-linux-macos.sh\nbuild-windows-gcc-x86-sse4.2:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_windows_gcc:v8.1.0\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -353,24 +354,21 @@ build-windows-gcc-x86-sse4.2:\n- job: analysis-documentation\nartifacts: true\ntags:\n+ - x86_64\n- windows\n- - gcc\n- - cmake\n- - x86\n- - 64-bit\nartifacts:\nname: build-windows-gcc-x86-sse4.2\npaths:\n- build_windows_gcc_x86_sse4.2\nscript:\n- - set \"CFLAGS=-Wall -funroll-loops -m64 -msse4.2\"\n- - set \"LFLAGS=-static -static-libgcc -static-libstdc++\"\n- - set \"CMAKE_OPT=-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF\"\n- - set \"NAME=build_windows_gcc_x86_sse4.2\"\n- - call ./ci/tools/threads.bat\n+ - $env:CFLAGS=\"-Wall -funroll-loops -m64 -msse4.2\"\n+ - $env:LFLAGS=\"-static -static-libgcc -static-libstdc++\"\n+ - $env:CMAKE_OPT=\"-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF\"\n+ - $env:NAME=\"build_windows_gcc_x86_sse4.2\"\n- ./ci/build-windows-gcc.bat\nbuild-windows-gcc-x64-avx2:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_windows_gcc:v8.1.0\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -384,24 +382,21 @@ build-windows-gcc-x64-avx2:\n- job: analysis-documentation\nartifacts: true\ntags:\n+ - x86_64\n- windows\n- - 64-bit\n- - gcc\n- - cmake\n- - x86\nartifacts:\nname: build-windows-gcc-x64-avx2\npaths:\n- build_windows_gcc_x64_avx2\nscript:\n- - set \"CFLAGS=-Wall -funroll-loops -m64 -mavx2\"\n- - set \"LFLAGS=-static -static-libgcc -static-libstdc++\"\n- - set \"CMAKE_OPT=-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF\"\n- - set \"NAME=build_windows_gcc_x64_avx2\"\n- - call ./ci/tools/threads.bat\n+ - $env:CFLAGS=\"-Wall -funroll-loops -m64 -mavx2\"\n+ - $env:LFLAGS=\"-static -static-libgcc -static-libstdc++\"\n+ - $env:CMAKE_OPT=\"-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI -DAFF3CT_EXT_STRINGS=OFF\"\n+ - $env:NAME=\"build_windows_gcc_x64_avx2\"\n- ./ci/build-windows-gcc.bat\nbuild-windows-msvc-avx:\n+ image: registry.gitlab.com/aff3ct/aff3ct/x86_64_windows_msvc:v15\nstage: build\nvariables:\nGIT_SUBMODULE_STRATEGY: recursive\n@@ -413,19 +408,16 @@ build-windows-msvc-avx:\n- job: analysis-headers\nartifacts: false\ntags:\n+ - x86_64\n- windows\n- - msvc\n- - cmake\n- - x86\nartifacts:\nname: build-windows-msvc-avx\npaths:\n- build_windows_msvc_avx\nscript:\n- - set \"CFLAGS=-D_CRT_SECURE_NO_DEPRECATE /MT /EHsc /arch:AVX\"\n- - set \"CMAKE_OPT=-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI\"\n- - set \"NAME=build_windows_msvc_avx\"\n- - call ./ci/tools/threads.bat\n+ - $env:CFLAGS=\"-D_CRT_SECURE_NO_DEPRECATE /MT /EHsc /arch:AVX\"\n+ - $env:CMAKE_OPT=\"-DAFF3CT_COMPILE_EXE=ON -DAFF3CT_COMPILE_STATIC_LIB=ON -DAFF3CT_COMPILE_SHARED_LIB=ON -DAFF3CT_PREC=MULTI\"\n+ - $env:NAME=\"build_windows_msvc_avx\"\n- ./ci/build-windows-msvc.bat\nbuild-macos-clang-x64-sse4.2:\n" }, { "change_type": "MODIFY", "old_path": "ci/build-windows-gcc.bat", "new_path": "ci/build-windows-gcc.bat", "diff": "@echo on\n+call ./ci/tools/threads.bat\n+\ncmake --version\nmkdir build\ncd build\n-cmake .. -G\"MinGW Makefiles\" -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Release %CMAKE_OPT% -DCMAKE_CXX_FLAGS=\"%CFLAGS%\" -DCMAKE_EXE_LINKER_FLAGS=\"%LFLAGS%\" -DCMAKE_INSTALL_PREFIX=\"%NAME%\"\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Release %CMAKE_OPT% -DCMAKE_CXX_FLAGS=\"%CFLAGS%\" -DCMAKE_EXE_LINKER_FLAGS=\"%LFLAGS%\" -DCMAKE_INSTALL_PREFIX=\"%NAME%\"\nif %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%\n-mingw32-make -j %THREADS%\n+make -j %THREADS%\nif %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%\nrd /s /q %NAME%\n-mingw32-make install > nul\n+make install > nul\nif %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%\nmove %NAME% ..\\\n" }, { "change_type": "MODIFY", "old_path": "ci/build-windows-msvc.bat", "new_path": "ci/build-windows-msvc.bat", "diff": "@echo on\n+call ./ci/tools/threads.bat\n+\nset \"VSCMD_START_DIR=%CD%\"\ncall \"%VS_PATH%\\VC\\Auxiliary\\Build\\vcvars64.bat\"\n@@ -8,10 +10,14 @@ mkdir build\ncd build\ncmake .. -G\"Visual Studio 15 2017 Win64\" %CMAKE_OPT% -DCMAKE_CXX_FLAGS=\"%CFLAGS% /MP%THREADS%\" -DCMAKE_INSTALL_PREFIX=\"%NAME%\"\nif %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%\n-devenv /build Release aff3ct.sln\n-rem msbuild aff3ct.sln /t:Build /p:Configuration=Release\n+rem devenv /build Release aff3ct.sln\n+msbuild aff3ct.sln /t:Build /p:Configuration=Release\nif %ERRORLEVEL% neq 0 exit /B %ERRORLEVEL%\n-rd /s /q %NAME%\n-devenv /build Release aff3ct.sln /project INSTALL > nul\n-if %ERRORLEVEL% neq 0 exit %ERRORLEVEL%\n-move %NAME% ..\\\n+cd ..\n+move build %NAME%\n+\n+rem Comment : impossible to run the INSTALL target with MSBuild\n+rem rd /s /q %NAME%\n+rem devenv /build Release aff3ct.sln /project INSTALL > nul\n+rem if %ERRORLEVEL% neq 0 exit %ERRORLEVEL%\n+rem move %NAME% ..\\\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: dockerize Windows jobs.
8,490
24.05.2021 16:13:30
-7,200
a028638730ac839b7df376e685867bf3dae3ca61
CI: fix clang analysis.
[ { "change_type": "MODIFY", "old_path": "ci/analysis-clang.sh", "new_path": "ci/analysis-clang.sh", "diff": "@@ -24,8 +24,9 @@ cd $NAME\n# scan-build -v -plist --intercept-first --analyze-headers -o $REPORTS_DIR \\\nscan-build -v -plist -o $REPORTS_DIR \\\n- cmake .. -G\"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug \\\n- -DCMAKE_CXX_FLAGS=\"$CFLAGS\" -DCMAKE_VERBOSE_MAKEFILE=ON \\\n+ cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ \\\n+ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=\"$CFLAGS\" \\\n+ -DCMAKE_VERBOSE_MAKEFILE=ON \\\n-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \\\n-DCMAKE_EXE_LINKER_FLAGS=\"$LFLAGS\" $CMAKE_OPT\nrc=$?; if [[ $rc != 0 ]]; then exit $rc; fi\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: fix clang analysis.
8,490
24.05.2021 21:02:39
-7,200
d34a8950e6be037755dff57ed2076de6345f8f24
CI: remove useless line.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -980,7 +980,6 @@ deploy-upload-ppa:\n- build/Debian/xenial/*.dsc\n- build/Debian/xenial/*.build\nbefore_script:\n- - apk add --no-cache gnupg\n- echo \"$GPG_PRIVATE_KEY\" | gpg --batch --import --pinentry-mode loopback --no-tty\nscript:\n- source ./ci/tools/git-branch.sh\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: remove useless line.
8,490
25.05.2021 17:24:01
-7,200
a016c82e79224f89dd1148a26f75ef6399694bec
CI: add `no_proxy` tag.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -901,6 +901,7 @@ deploy-sonarqube-linux:\n- x86_64\n- linux\n- docker\n+ - no_proxy\nonly:\n- master\n- development\n@@ -926,6 +927,7 @@ deploy-builds-linux:\n- x86_64\n- linux\n- docker\n+ - no_proxy\nonly:\n- master\n- development\n@@ -968,6 +970,7 @@ deploy-upload-ppa:\n- x86_64\n- linux\n- docker\n+ - no_proxy\nonly:\n- master\n- development\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: add `no_proxy` tag.
8,490
25.05.2021 17:46:24
-7,200
2f18ff2a29eaffc35b400e283cee3a297fa85317
CI: do not supply PDF anymore in PPA.
[ { "change_type": "MODIFY", "old_path": "cmake/Modules/UploadPPA.cmake", "new_path": "cmake/Modules/UploadPPA.cmake", "diff": "@@ -95,8 +95,8 @@ foreach(DISTRI ${AFF3CT_PPA_DISTRIB})\n\"usr/include/aff3ct-${AFF3CT_VERSION_FULL}/*\\n\")\nfile(WRITE \"${DEBIAN_SOURCE_DIR}/debian/${CPACK_DEBIAN_PACKAGE_NAME}-doc.install\"\n- \"doc/built/html/* usr/share/aff3ct-${AFF3CT_VERSION_FULL}/doc/html\\n\"\n- \"doc/built/latex/AFF3CT.pdf usr/share/aff3ct-${AFF3CT_VERSION_FULL}/doc/pdf/\\n\")\n+ \"doc/built/html/* usr/share/aff3ct-${AFF3CT_VERSION_FULL}/doc/html\\n\")\n+# \"doc/built/latex/AFF3CT.pdf usr/share/aff3ct-${AFF3CT_VERSION_FULL}/doc/pdf/\\n\")\n##############################################################################\n# debian/copyright\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: do not supply PDF anymore in PPA.
8,490
26.05.2021 14:22:32
-7,200
d62d50e2fb5980b53b51b7d253a32eb2831ac791
CI: rm flags for macos build job.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -24,6 +24,7 @@ analysis-cppcheck:\npaths:\n- cppcheck/\ntags:\n+ - x86_64\n- linux\n- docker\nscript:\n@@ -434,10 +435,8 @@ build-macos-clang-x64-sse4.2:\n- job: analysis-documentation\nartifacts: true\ntags:\n+ - x86_64\n- macos\n- - apple-clang\n- - cmake\n- - x86\nartifacts:\nname: build-macos-clang-x64-sse4.2\npaths:\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: rm flags for macos build job.
8,486
27.05.2021 15:59:13
-7,200
08c77d68cc47e7e9120b408c6366ed62f0bcb875
Fix py_aff3ct related issue in interleaver cores row_column and column_row.
[ { "change_type": "MODIFY", "old_path": "include/Tools/Interleaver/Column_row/Interleaver_core_column_row.hpp", "new_path": "include/Tools/Interleaver/Column_row/Interleaver_core_column_row.hpp", "diff": "@@ -36,7 +36,7 @@ private:\npublic:\nInterleaver_core_column_row(const int size, const int n_cols, const std::string& read_order);\n- Interleaver_core_column_row(const int size, const int n_cols, const READ_ORDER read_order);\n+ Interleaver_core_column_row(const int size, const int n_cols, const aff3ct::tools::Interleaver_core_column_row<T>::READ_ORDER read_order);\nvirtual ~Interleaver_core_column_row() = default;\nvirtual Interleaver_core_column_row<T>* clone() const;\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Interleaver/Row_column/Interleaver_core_row_column.hpp", "new_path": "include/Tools/Interleaver/Row_column/Interleaver_core_row_column.hpp", "diff": "@@ -38,7 +38,7 @@ private:\npublic:\nInterleaver_core_row_column(const int size, const int n_cols, const std::string& read_order);\n- Interleaver_core_row_column(const int size, const int n_cols, const READ_ORDER read_order);\n+ Interleaver_core_row_column(const int size, const int n_cols, const aff3ct::tools::Interleaver_core_row_column<T>::READ_ORDER read_order);\nvirtual ~Interleaver_core_row_column() = default;\nvirtual Interleaver_core_row_column<T>* clone() const;\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix py_aff3ct related issue in interleaver cores row_column and column_row.
8,486
27.05.2021 18:30:38
-7,200
ec0b3322541b90668e39b4ed44b16e5fb584ece5
Add Interface_get_trellis inheritance for RSC_DB encoder.
[ { "change_type": "MODIFY", "old_path": "include/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp", "new_path": "include/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp", "diff": "#include <vector>\n#include \"Module/Encoder/Encoder.hpp\"\n+#include \"Tools/Interface/Interface_get_trellis.hpp\"\nnamespace aff3ct\n{\n@@ -19,7 +20,7 @@ template <typename B>\nclass Encoder_turbo_DB;\ntemplate <typename B = int>\n-class Encoder_RSC_DB: public Encoder<B>\n+class Encoder_RSC_DB: public Encoder<B>, public tools::Interface_get_trellis\n{\n#ifndef DOXYGEN_SHOULD_SKIP_THIS\nfriend Encoder_turbo_DB<B>;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add Interface_get_trellis inheritance for RSC_DB encoder.
8,490
28.05.2021 10:06:23
-7,200
ea7ce530a0ec861ca21e65016fc4c9a49eb352a5
CI: add missing tags.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -46,6 +46,7 @@ analysis-clang:\n- master\n- development\ntags:\n+ - x86_64\n- linux\n- docker\nscript:\n@@ -65,6 +66,7 @@ analysis-headers:\npaths:\n- aff3ct.hpp\ntags:\n+ - x86_64\n- linux\n- docker\nscript:\n@@ -79,6 +81,7 @@ analysis-git-submodules:\nexcept:\n- schedules\ntags:\n+ - x86_64\n- linux\n- docker\nonly:\n@@ -99,6 +102,7 @@ analysis-documentation:\n# - doc/build/latex\n- doc/build/doxygen\ntags:\n+ - x86_64\n- linux\n- docker\nscript:\n" } ]
C++
MIT License
aff3ct/aff3ct
CI: add missing tags.
8,490
04.06.2021 11:42:33
-7,200
87215f5d1e8af93ddf736b5acc706c622e5781d2
Add a new `operator=` for sockets binding.
[ { "change_type": "MODIFY", "old_path": "include/Module/Socket.hpp", "new_path": "include/Module/Socket.hpp", "diff": "@@ -41,10 +41,11 @@ protected:\nvoid* dataptr;\nstd::vector<Socket*> bound_sockets;\nSocket* bound_socket;\n+ socket_t type;\npublic:\ninline Socket(Task &task, const std::string &name, const std::type_index datatype, const size_t databytes,\n- const bool fast = false, void *dataptr = nullptr);\n+ const socket_t type, const bool fast = false, void *dataptr = nullptr);\nvirtual ~Socket() = default;\ninline const std::string& get_name () const;\n@@ -59,6 +60,7 @@ public:\ninline const std::vector<Socket*>& get_bound_sockets () const;\ninline const Socket& get_bound_socket () const;\ninline Socket& get_bound_socket ();\n+ inline socket_t get_type () const;\ninline void set_fast(const bool fast);\n@@ -66,6 +68,10 @@ public:\ninline void operator()(Socket &s_out, const int priority = -1);\n+ inline void operator=(Socket &s);\n+\n+ inline void operator=(Task &t);\n+\ntemplate <typename T, class A = std::allocator<T>>\ninline void bind(const std::vector<T,A> &vector);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Socket.hxx", "new_path": "include/Module/Socket.hxx", "diff": "@@ -25,8 +25,9 @@ static std::unordered_map<std::type_index,uint8_t> type_to_size = {{typeid(int8_\nSocket\n::Socket(Task &task, const std::string &name, const std::type_index datatype, const size_t databytes,\n- const bool fast, void *dataptr)\n-: task(task), name(name), datatype(datatype), databytes(databytes), fast(fast), dataptr(dataptr), bound_socket(nullptr)\n+ const socket_t type, const bool fast, void *dataptr)\n+: task(task), name(name), datatype(datatype), databytes(databytes), fast(fast), dataptr(dataptr), bound_socket(nullptr),\n+ type(type)\n{\nif (databytes % type_to_size[datatype] != 0)\n{\n@@ -123,6 +124,12 @@ const Socket& Socket\nreturn *this->bound_socket;\n}\n+socket_t Socket\n+::get_type() const\n+{\n+ return this->type;\n+}\n+\nvoid Socket\n::set_fast(const bool fast)\n{\n@@ -229,6 +236,51 @@ void Socket\nbind(s_out, priority);\n}\n+void Socket\n+::operator=(Socket &s)\n+{\n+ if (s.get_type() == socket_t::SOUT && this->get_type() == socket_t::SIN)\n+ this->bind(s);\n+ else if (s.get_type() == socket_t::SIN && this->get_type() == socket_t::SOUT)\n+ s.bind(*this);\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"Binding of output and input socket is required (\"\n+ << \"'s.datatype'\" << \" = \" << type_to_string[s.datatype] << \", \"\n+ << \"'s.name'\" << \" = \" << s.get_name() << \", \"\n+ << \"'s.task.name'\" << \" = \" << s.task.get_name() << \", \"\n+ << \"'s.type'\" << \" = \" << (s.get_type() == socket_t::SIN ? \"SIN\" : \"SOUT\") << \", \"\n+// << \"'s.task.module.name'\" << \" = \" << s.task.get_module_name() << \", \"\n+ << \"'datatype'\" << \" = \" << type_to_string[this->datatype] << \", \"\n+ << \"'name'\" << \" = \" << get_name() << \", \"\n+ << \"'task.name'\" << \" = \" << task.get_name() << \", \"\n+ << \"'type'\" << \" = \" << (get_type() == socket_t::SIN ? \"SIN\" : \"SOUT\") /*<< \", \"*/\n+// << \"'task.module.name'\" << \" = \" << task.get_module_name()\n+ << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\n+void Socket\n+::operator=(Task &t)\n+{\n+ if (this->get_type() == socket_t::SOUT)\n+ t.bind(*this);\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"The current socket should be and output socket (\"\n+ << \"'datatype'\" << \" = \" << type_to_string[this->datatype] << \", \"\n+ << \"'name'\" << \" = \" << get_name() << \", \"\n+ << \"'task.name'\" << \" = \" << task.get_name() << \", \"\n+ << \"'type'\" << \" = \" << (get_type() == socket_t::SIN ? \"SIN\" : \"SOUT\") /*<< \", \"*/\n+// << \"'task.module.name'\" << \" = \" << task.get_module_name()\n+ << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\ntemplate <typename T, class A>\nvoid Socket\n::bind(const std::vector<T,A> &vector)\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Task.hpp", "new_path": "include/Module/Task.hpp", "diff": "@@ -141,6 +141,7 @@ public:\ninline const std::vector<int>& get_status() const;\nvoid bind (Socket &s_out, const int priority = -1);\n+ void operator=(Socket &s_out );\nsize_t unbind (Socket &s_out );\nbool is_no_input_socket() const;\n@@ -169,7 +170,7 @@ protected:\nprivate:\ntemplate <typename T>\n- inline Socket& create_socket(const std::string &name, const size_t n_elmts, const bool hack_status = false);\n+ inline Socket& create_socket(const std::string &name, const size_t n_elmts, const socket_t type, const bool hack_status = false);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -490,7 +490,7 @@ const std::vector<int>& Task\ntemplate <typename T>\nSocket& Task\n-::create_socket(const std::string &name, const size_t n_elmts, const bool hack_status)\n+::create_socket(const std::string &name, const size_t n_elmts, const socket_t type, const bool hack_status)\n{\nif (name.empty())\n{\n@@ -525,7 +525,7 @@ Socket& Task\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n- auto s = std::make_shared<Socket>(*this, name, typeid(T), n_elmts * sizeof(T), this->is_fast());\n+ auto s = std::make_shared<Socket>(*this, name, typeid(T), n_elmts * sizeof(T), type, this->is_fast());\nsockets.push_back(std::move(s));\n@@ -542,7 +542,7 @@ template <typename T>\nsize_t Task\n::create_socket_in(const std::string &name, const size_t n_elmts)\n{\n- auto &s = create_socket<T>(name, n_elmts);\n+ auto &s = create_socket<T>(name, n_elmts, socket_t::SIN);\nsocket_type.push_back(socket_t::SIN);\nlast_input_socket = &s;\n@@ -572,7 +572,7 @@ template <typename T>\nsize_t Task\n::create_socket_out(const std::string &name, const size_t n_elmts, const bool hack_status)\n{\n- auto &s = create_socket<T>(name, n_elmts, hack_status);\n+ auto &s = create_socket<T>(name, n_elmts, socket_t::SOUT, hack_status);\nsocket_type.push_back(socket_t::SOUT);\n// memory allocation\n@@ -801,6 +801,7 @@ Task* Task\ns->get_name(),\ns->get_datatype(),\ns->get_databytes(),\n+ s->get_type(),\ns->is_fast(),\ndataptr));\nt->sockets.push_back(s_new);\n@@ -833,6 +834,7 @@ void Task\n\"fake\",\ns_out.get_datatype(),\ns_out.get_databytes(),\n+ socket_t::SIN,\nthis->is_fast()));\nthis->fake_input_socket->bind(s_out, priority);\nthis->last_input_socket = this->fake_input_socket.get();\n@@ -845,6 +847,25 @@ void Task\n}\n}\n+void Task\n+::operator=(Socket &s_out)\n+{\n+ if (s_out.get_type() == socket_t::SOUT)\n+ this->bind(s_out);\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"'s_out' should be and output socket (\"\n+ << \"'s_out.datatype'\" << \" = \" << type_to_string[s_out.get_datatype()] << \", \"\n+ << \"'s_out.name'\" << \" = \" << s_out.get_name() << \", \"\n+ << \"'s_out.task.name'\" << \" = \" << s_out.task.get_name() << \", \"\n+ << \"'s_out.type'\" << \" = \" << (s_out.get_type() == socket_t::SIN ? \"SIN\" : \"SOUT\") /*<< \", \"*/\n+// << \"'s_out.task.module.name'\" << \" = \" << s_out.task.get_module_name()\n+ << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\nsize_t Task\n::unbind(Socket &s_out)\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a new `operator=` for sockets binding.
8,486
24.06.2021 10:24:25
-7,200
91a34498381ef77a44841d7dc85d236f10455893
Add documentation for some tasks.
[ { "change_type": "MODIFY", "old_path": "include/Module/Channel/Channel.hpp", "new_path": "include/Module/Channel/Channel.hpp", "diff": "@@ -74,7 +74,7 @@ public:\nvirtual void set_seed(const int seed);\n/*!\n- * \\brief Adds the noise to a perfectly clear signal.\n+ * \\brief Task method that adds the noise to a perfectly clear signal.\n*\n* \\param X_N: a perfectly clear message.\n* \\param Y_N: a noisy signal.\n@@ -86,7 +86,7 @@ public:\nvoid add_noise(const float *CP, const R *X_N, R *Y_N, const int frame_id = -1, const bool managed_memory = true);\n/*!\n- * \\brief Adds the noise to a perfectly clear signal.\n+ * \\brief Task method that adds the noise to a perfectly clear signal.\n*\n* \\param X_N: a perfectly clear message.\n* \\param H_N: the channel gains.\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Decoder_HIHO.hpp", "new_path": "include/Module/Decoder/Decoder_HIHO.hpp", "diff": "@@ -51,7 +51,7 @@ public:\nvirtual Decoder_HIHO<B>* clone() const;\n/*!\n- * \\brief Decodes the noisy frame.\n+ * \\brief Task method that decodes the noisy frame.\n*\n* \\param Y_N: a noisy frame.\n* \\param V_K: a decoded codeword (only the information bits).\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Decoder_SIHO.hpp", "new_path": "include/Module/Decoder/Decoder_SIHO.hpp", "diff": "@@ -57,7 +57,7 @@ public:\nvirtual Decoder_SIHO<B,R>* clone() const;\n/*!\n- * \\brief Decodes the noisy frame.\n+ * \\brief Task method that decodes the noisy frame.\n*\n* \\param Y_N: a noisy frame.\n* \\param V_K: a decoded codeword (only the information bits).\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/Decoder_SISO.hpp", "new_path": "include/Module/Decoder/Decoder_SISO.hpp", "diff": "@@ -53,7 +53,7 @@ public:\nvirtual Decoder_SISO<B,R>* clone() const;\n/*!\n- * \\brief Decodes a given noisy codeword.\n+ * \\brief Task method that decodes a given noisy codeword.\n*\n* \\param Y_N1: a completely noisy codeword from the channel.\n* \\param Y_N2: an extrinsic information about all the bits in the frame.\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Encoder/Encoder.hpp", "new_path": "include/Module/Encoder/Encoder.hpp", "diff": "@@ -86,7 +86,7 @@ public:\nconst std::vector<B>& get_X_N(const size_t frame_id = 0) const;\n/*!\n- * \\brief Encodes a vector of information bits (a message).\n+ * \\brief Task method that encodes a vector of information bits (a message).\n*\n* \\param U_K: a vector of information bits (a message).\n* \\param X_N: an encoded frame with redundancy added (parity bits).\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Modem/Modem.hpp", "new_path": "include/Module/Modem/Modem.hpp", "diff": "@@ -113,7 +113,7 @@ public:\nbool is_demodulator() const;\n/*!\n- * \\brief Modulates a vector of bits or symbols.\n+ * \\brief Task method that modulates a vector of bits or symbols.\n*\n* \\param X_N1: a vector of bits or symbols.\n* \\param X_N2: a vector of modulated bits or symbols.\n@@ -125,7 +125,7 @@ public:\nvoid modulate(const B *X_N1, R *X_N2, const int frame_id = -1, const bool managed_memory = true);\n/*!\n- * \\brief soft Modulates a vector of LLRs.\n+ * \\brief Task method that modulates softly a vector of LLRs.\n*\n* \\param X_N1: a vector of LLRs.\n* \\param X_N2: a vector of soft symbols.\n@@ -137,7 +137,7 @@ public:\nvoid tmodulate(const Q *X_N1, R *X_N2, const int frame_id = -1, const bool managed_memory = true);\n/*!\n- * \\brief Filters a vector of noised and modulated bits/symbols.\n+ * \\brief Task method that filters a vector of noised and modulated bits/symbols.\n*\n* By default this method does nothing.\n*\n@@ -151,7 +151,7 @@ public:\nvoid filter(const float *CP, const R *Y_N1, R *Y_N2, const int frame_id = -1, const bool managed_memory = true);\n/*!\n- * \\brief Demodulates a vector of noised and modulated bits/symbols (after the filtering process if required).\n+ * \\brief Task method that demodulates a vector of noised and modulated bits/symbols (after the filtering process if required).\n*\n* \\param Y_N1: a vector of noised and modulated bits/symbols.\n* \\param Y_N2: a demodulated vector.\n@@ -164,7 +164,7 @@ public:\nconst bool managed_memory = true);\n/*!\n- * \\brief Demodulates a vector of noised and modulated bits/symbols (after the filtering process if required).\n+ * \\brief Task method that demodulates a vector of noised and modulated bits/symbols (after the filtering process if required).\n*\n* \\param H_N: channel gains.\n* \\param Y_N1: a vector of noised and modulated bits/symbols.\n@@ -178,7 +178,7 @@ public:\nconst bool managed_memory = true);\n/*!\n- * \\brief Demodulates a vector of noised and modulated bits/symbols (after the filtering process if required).\n+ * \\brief Task method that demodulates a vector of noised and modulated bits/symbols (after the filtering process if required).\n*\n* Used for the iterative turbo demodulation technique, this type of demodulation takes the decoder information\n* into account.\n@@ -196,7 +196,7 @@ public:\nconst bool managed_memory = true);\n/*!\n- * \\brief Demodulates a vector of noised and modulated bits/symbols (after the filtering process if required).\n+ * \\brief Task that demodulates a vector of noised and modulated bits/symbols (after the filtering process if required).\n*\n* Used for the iterative turbo demodulation technique, this type of demodulation takes the decoder information\n* into account.\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Source/Source.hpp", "new_path": "include/Module/Source/Source.hpp", "diff": "@@ -69,7 +69,7 @@ public:\nvirtual int get_K() const;\n/*!\n- * \\brief Fulfills a vector with bits.\n+ * \\brief Task method method fulfills a vector with bits.\n*\n* \\param U_K: a vector of bits to fill.\n*/\n" } ]
C++
MIT License
aff3ct/aff3ct
Add documentation for some tasks.
8,486
24.06.2021 16:52:48
-7,200
3f4f4106b879aad10fe15573d0f09814b44e858e
Add a method for creating a reset task for Module heritating from Interface_reset.
[ { "change_type": "MODIFY", "old_path": "include/Module/Module.hpp", "new_path": "include/Module/Module.hpp", "diff": "@@ -87,6 +87,9 @@ public:\ninline Task& operator()(const std::string &tsk_name);\nvoid set_fast(const bool fast);\n+\n+ void create_reset_task();\n+\nprotected:\nvirtual void deep_copy(const Module &m);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.cpp", "new_path": "src/Module/Module.cpp", "diff": "#include <cmath>\n#include <sstream>\n+#include \"Tools/Interface/Interface_reset.hpp\"\n#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Module.hpp\"\n@@ -155,6 +156,17 @@ void Module\nTask& Module\n::create_task(const std::string &name, const int id)\n{\n+\n+ auto it = find_if(this->tasks.begin(), this->tasks.end(),\n+ [name](std::shared_ptr<Task> t){return t->get_name()==name;});\n+\n+ if (it != this->tasks.end())\n+ {\n+ std::stringstream message;\n+ message << \"Task '\" << name << \"' already exists.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nauto t = std::make_shared<Task>(*this, name);\nif (id < 0)\n@@ -209,3 +221,23 @@ void Module\nfor (auto &t : this->tasks)\nt->set_fast(fast);\n}\n+\n+void Module\n+::create_reset_task()\n+{\n+ auto iface = dynamic_cast<aff3ct::tools::Interface_reset*>(this);\n+ if (iface == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"This module does not inherits from the interface Interface_reset.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ auto &p = this->create_task(\"reset\");\n+ this->create_codelet(p, [](Module &m, Task &t, const size_t frame_id) -> int\n+ {\n+ auto &iface = dynamic_cast<aff3ct::tools::Interface_reset&>(m);\n+ iface.reset();\n+ return 0;\n+ });\n+}\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a method for creating a reset task for Module heritating from Interface_reset.
8,490
28.06.2021 13:23:39
-7,200
7324975d066e3a7302f44421b2f15c1393bf1c61
Add a step by step method to execute a 'tools::Sequence'.
[ { "change_type": "MODIFY", "old_path": "include/Tools/Sequence/Sequence.hpp", "new_path": "include/Tools/Sequence/Sequence.hpp", "diff": "@@ -80,6 +80,11 @@ protected:\nstd::vector<std::vector<tools::Interface_reset*>> switchers_reset;\nbool auto_stop;\n+ // internal state for the `exec_step` method\n+ std::vector<bool> next_round_is_over;\n+ std::vector<size_t> cur_task_id;\n+ std::vector<Digraph_node<Sub_sequence>*> cur_ss;\n+\npublic:\nSequence(const std::vector<const module::Task*> &firsts,\nconst size_t n_threads = 1,\n@@ -146,6 +151,8 @@ public:\nvoid exec (std::function<bool( )> stop_condition);\nvoid exec ( );\nvoid exec_seq (const size_t tid = 0, const int frame_id = -1 );\n+ module::Task* exec_step(const size_t tid = 0, const int frame_id = -1 );\n+\ninline size_t get_n_threads() const;\ntemplate <class C = module::Module>\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Sequence/Sequence.cpp", "new_path": "src/Tools/Sequence/Sequence.cpp", "diff": "@@ -41,7 +41,11 @@ Sequence\nno_copy_mode(true),\nsaved_exclusions(exclusions),\nswitchers_reset(n_threads),\n- auto_stop(true)\n+ auto_stop(true),\n+ next_round_is_over(n_threads, false),\n+ cur_task_id(n_threads,0),\n+ cur_ss(n_threads, nullptr)\n+\n{\n#ifndef AFF3CT_HWLOC\nif (thread_pinning)\n@@ -126,7 +130,10 @@ Sequence\nno_copy_mode(true),\nsaved_exclusions(exclusions_convert_to_const(exclusions)),\nswitchers_reset(n_threads),\n- auto_stop(true)\n+ auto_stop(true),\n+ next_round_is_over(n_threads, false),\n+ cur_task_id(n_threads,0),\n+ cur_ss(n_threads, nullptr)\n{\nif (thread_pinning && puids.size() < n_threads)\n{\n@@ -298,6 +305,9 @@ void Sequence\nfor (auto &mdl : this->all_modules[tid])\nif (auto swi = dynamic_cast<module::Switcher*>(mdl))\nthis->switchers_reset[tid].push_back(dynamic_cast<tools::Interface_reset*>(swi));\n+\n+ for (size_t tid = 0; tid < this->sequences.size(); tid++)\n+ this->cur_ss[tid] = this->sequences[tid];\n}\nSequence* Sequence\n@@ -724,6 +734,69 @@ void Sequence\nexec_sequence(this->sequences[tid]);\n}\n+module::Task* Sequence\n+::exec_step(const size_t tid, const int frame_id)\n+{\n+ if (tid >= this->sequences.size())\n+ {\n+ std::stringstream message;\n+ message << \"'tid' has to be smaller than 'sequences.size()' ('tid' = \" << tid\n+ << \", 'sequences.size()' = \" << this->sequences.size() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ module::Task* executed_task = nullptr;\n+ if (this->next_round_is_over[tid])\n+ {\n+ this->next_round_is_over[tid] = false;\n+ this->cur_ss[tid] = this->sequences[tid];\n+ this->cur_task_id[tid] = 0;\n+ }\n+ else\n+ {\n+ executed_task = this->cur_ss[tid]->get_c()->tasks[cur_task_id[tid]];\n+ const std::vector<int>& ret = executed_task->exec(frame_id);\n+\n+ auto type = this->cur_ss[tid]->get_c()->type;\n+ if (type == subseq_t::COMMUTE)\n+ {\n+ const size_t path = (size_t)ret[0];\n+ if (this->cur_ss[tid]->get_children().size() > path)\n+ {\n+ this->cur_ss[tid] = this->cur_ss[tid]->get_children()[path];\n+ this->cur_task_id[tid] = 0;\n+ }\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"This should never happen ('path' = \" << path\n+ << \", 'cur_ss[tid]->get_children().size()' = \" << this->cur_ss[tid]->get_children().size()\n+ << \", 'tid' = \" << tid << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n+ else\n+ {\n+ this->cur_task_id[tid]++;\n+ if (this->cur_task_id[tid] == (this->cur_ss[tid]->get_c()->tasks.size()))\n+ {\n+ // skip nodes without tasks if any\n+ while (this->cur_ss[tid]->get_children().size() > 0)\n+ {\n+ this->cur_ss[tid] = this->cur_ss[tid]->get_children()[0];\n+ this->cur_task_id[tid] = 0;\n+ if (this->cur_ss[tid]->get_c() && this->cur_ss[tid]->get_c()->tasks.size() > 0)\n+ break;\n+ }\n+ if (this->cur_task_id[tid] >= this->cur_ss[tid]->get_c()->tasks.size())\n+ this->next_round_is_over[tid] = true;\n+ }\n+ }\n+ }\n+\n+ return executed_task;\n+}\n+\ntemplate <class SS, class TA>\nDigraph_node<SS>* Sequence\n::init_recursive(Digraph_node<SS> *cur_subseq,\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a step by step method to execute a 'tools::Sequence'.
8,490
28.06.2021 13:24:13
-7,200
c89c27abdc8c3513118fc862e0f2b4f7b4a377c6
Add `is_done` method to 'tools::Sequence'.
[ { "change_type": "MODIFY", "old_path": "include/Tools/Sequence/Sequence.hpp", "new_path": "include/Tools/Sequence/Sequence.hpp", "diff": "@@ -53,7 +53,7 @@ public:\nusing Sub_sequence = Sub_sequence_generic<std::vector< module::Task*>>;\nusing Sub_sequence_const = Sub_sequence_generic<std::vector<const module::Task*>>;\n-class Sequence : public Interface_clone, public Interface_get_set_n_frames\n+class Sequence : public Interface_clone, public Interface_get_set_n_frames, public Interface_is_done\n{\nfriend Pipeline;\n@@ -180,6 +180,8 @@ public:\ninline size_t get_n_frames() const;\nvoid set_n_frames(const size_t n_frames);\n+ virtual bool is_done() const;\n+\nprotected:\ntemplate <class SS>\nvoid delete_tree(Digraph_node<SS> *node, std::vector<Digraph_node<SS>*> &already_deleted_nodes);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Sequence/Sequence.cpp", "new_path": "src/Tools/Sequence/Sequence.cpp", "diff": "@@ -446,6 +446,15 @@ std::vector<std::vector<module::Task*>> Sequence\nreturn tasks_per_types;\n}\n+bool Sequence\n+::is_done() const\n+{\n+ for (auto donner : this->donners)\n+ if (donner->is_done())\n+ return true;\n+ return false;\n+}\n+\nvoid Sequence\n::_exec(const size_t tid,\nstd::function<bool(const std::vector<const int*>&)> &stop_condition,\n@@ -619,10 +628,7 @@ void Sequence\nreal_stop_condition = [this, stop_condition](const std::vector<const int*>& statuses)\n{\nbool res = stop_condition(statuses);\n- for (auto donner : this->donners)\n- if (donner->is_done())\n- return true;\n- return res;\n+ return res || this->is_done();\n};\nelse\nreal_stop_condition = stop_condition;\n@@ -661,10 +667,7 @@ void Sequence\nreal_stop_condition = [this, stop_condition]()\n{\nbool res = stop_condition();\n- for (auto donner : this->donners)\n- if (donner->is_done())\n- return true;\n- return res;\n+ return res || this->is_done();\n};\nelse\nreal_stop_condition = stop_condition;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add `is_done` method to 'tools::Sequence'.
8,490
28.06.2021 16:52:31
-7,200
0718d23dd3c6c589be0efbb75820dd6b7ebc2180
Unbind adaptors when deleting a 'tools::Pipeline'.
[ { "change_type": "MODIFY", "old_path": "include/Tools/Sequence/Pipeline.hpp", "new_path": "include/Tools/Sequence/Pipeline.hpp", "diff": "@@ -109,7 +109,7 @@ public:\nconst std::vector<std::vector<size_t>> &puids = {}/*,\nconst std::vector<bool> &tasks_inplace = {}*/);\n- virtual ~Pipeline() = default;\n+ virtual ~Pipeline();\nvoid exec(const std::vector<std::function<bool(const std::vector<const int*>&)>> &stop_conditions);\nvoid exec(const std::vector<std::function<bool( )>> &stop_conditions);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Sequence/Pipeline.cpp", "new_path": "src/Tools/Sequence/Pipeline.cpp", "diff": "@@ -210,6 +210,13 @@ Pipeline\n{\n}\n+\n+Pipeline\n+::~Pipeline()\n+{\n+ this->unbind_adaptors();\n+}\n+\nstd::vector<Sequence*> Pipeline\n::get_stages()\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Unbind adaptors when deleting a 'tools::Pipeline'.
8,490
06.07.2021 12:02:03
-7,200
330cd7521cbf9719b7e808bbf89c69ea71570ce3
Fix a bug in the 'tools::Sequence' `exec_step` method.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Sequence/Sequence.cpp", "new_path": "src/Tools/Sequence/Sequence.cpp", "diff": "@@ -768,6 +768,20 @@ module::Task* Sequence\n{\nthis->cur_ss[tid] = this->cur_ss[tid]->get_children()[path];\nthis->cur_task_id[tid] = 0;\n+\n+ if (this->cur_ss[tid]->get_c()->tasks.size() == 0)\n+ {\n+ // skip nodes without tasks if any\n+ while (this->cur_ss[tid]->get_children().size() > 0)\n+ {\n+ this->cur_ss[tid] = this->cur_ss[tid]->get_children()[0];\n+ this->cur_task_id[tid] = 0;\n+ if (this->cur_ss[tid]->get_c() && this->cur_ss[tid]->get_c()->tasks.size() > 0)\n+ break;\n+ }\n+ if (this->cur_task_id[tid] >= this->cur_ss[tid]->get_c()->tasks.size())\n+ this->next_round_is_over[tid] = true;\n+ }\n}\nelse\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix a bug in the 'tools::Sequence' `exec_step` method.
8,486
10.09.2021 10:55:44
-7,200
4aecfbeebc23f2cbaa0584b39f2a73c2a74c31d8
Remove ref for parity check matrix in LDPC decoders.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Decoder_LDPC_BP.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Decoder_LDPC_BP.hpp", "diff": "@@ -15,7 +15,7 @@ class Decoder_LDPC_BP\n{\nprotected:\nconst int n_ite;\n- const tools::Sparse_matrix &H;\n+ const tools::Sparse_matrix H;\nconst bool enable_syndrome;\nconst int syndrome_depth;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.hpp", "diff": "@@ -21,7 +21,7 @@ template <typename B = int, typename R = float, class Update_rule = tools::Updat\nclass Decoder_LDPC_BP_flooding : public Decoder_SISO<B,R>, public Decoder_LDPC_BP\n{\nprotected:\n- const std::vector<uint32_t> &info_bits_pos;\n+ const std::vector<uint32_t> info_bits_pos;\nUpdate_rule up_rule;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_inter.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_inter.hpp", "diff": "@@ -23,7 +23,7 @@ template <typename B = int, typename R = float, class Update_rule = tools::Updat\nclass Decoder_LDPC_BP_flooding_inter : public Decoder_SISO<B,R>, public Decoder_LDPC_BP\n{\nprotected:\n- const std::vector<unsigned> &info_bits_pos;\n+ const std::vector<unsigned> info_bits_pos;\nUpdate_rule up_rule;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/Decoder_LDPC_BP_horizontal_layered.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/Decoder_LDPC_BP_horizontal_layered.hpp", "diff": "@@ -21,7 +21,7 @@ template <typename B = int, typename R = float, class Update_rule = tools::Updat\nclass Decoder_LDPC_BP_horizontal_layered : public Decoder_SISO<B,R>, public Decoder_LDPC_BP\n{\nprotected:\n- const std::vector<uint32_t> &info_bits_pos;\n+ const std::vector<uint32_t> info_bits_pos;\nUpdate_rule up_rule;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/Decoder_LDPC_BP_horizontal_layered_inter.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/Decoder_LDPC_BP_horizontal_layered_inter.hpp", "diff": "@@ -22,7 +22,7 @@ template <typename B = int, typename R = float, class Update_rule = tools::Updat\nclass Decoder_LDPC_BP_horizontal_layered_inter : public Decoder_SISO<B,R>, public Decoder_LDPC_BP\n{\nprotected:\n- const std::vector<unsigned> &info_bits_pos;\n+ const std::vector<unsigned> info_bits_pos;\nUpdate_rule up_rule;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/ONMS/Decoder_LDPC_BP_horizontal_layered_ONMS_inter.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/ONMS/Decoder_LDPC_BP_horizontal_layered_ONMS_inter.hpp", "diff": "@@ -27,7 +27,7 @@ private:\nprotected:\nconst R saturation;\n- const std::vector<unsigned> &info_bits_pos;\n+ const std::vector<unsigned> info_bits_pos;\n// data structures for iterative decoding\nstd::vector<mipp::vector<mipp::Reg<R>>> var_nodes;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Peeling/Decoder_LDPC_BP_peeling.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Peeling/Decoder_LDPC_BP_peeling.hpp", "diff": "@@ -20,7 +20,7 @@ template<typename B = int, typename R = float>\nclass Decoder_LDPC_BP_peeling : public Decoder_SIHO<B,R>, public Decoder_LDPC_BP\n{\nprotected:\n- const std::vector<unsigned> &info_bits_pos;\n+ const std::vector<unsigned> info_bits_pos;\n// data structures for iterative decoding\nstd::vector<B> var_nodes;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Vertical_layered/Decoder_LDPC_BP_vertical_layered.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Vertical_layered/Decoder_LDPC_BP_vertical_layered.hpp", "diff": "@@ -21,7 +21,7 @@ template <typename B = int, typename R = float, class Update_rule = tools::Updat\nclass Decoder_LDPC_BP_vertical_layered : public Decoder_SISO<B,R>, public Decoder_LDPC_BP\n{\nprotected:\n- const std::vector<uint32_t> &info_bits_pos;\n+ const std::vector<uint32_t> info_bits_pos;\nUpdate_rule up_rule;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Vertical_layered/Decoder_LDPC_BP_vertical_layered_inter.hpp", "new_path": "include/Module/Decoder/LDPC/BP/Vertical_layered/Decoder_LDPC_BP_vertical_layered_inter.hpp", "diff": "@@ -23,7 +23,7 @@ template <typename B = int, typename R = float, class Update_rule = tools::Updat\nclass Decoder_LDPC_BP_vertical_layered_inter : public Decoder_SISO<B,R>, public Decoder_LDPC_BP\n{\nprotected:\n- const std::vector<unsigned> &info_bits_pos;\n+ const std::vector<unsigned> info_bits_pos;\nUpdate_rule up_rule;\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove ref for parity check matrix in LDPC decoders.
8,490
10.09.2021 11:17:22
-7,200
80eb5a706c4554a071af013b8edc4b38fced85af
Fix wrong variable name in LDPC decoders when using `-faligned-new`.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_inter.hxx", "new_path": "include/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding_inter.hxx", "diff": "@@ -135,7 +135,7 @@ int Decoder_LDPC_BP_flooding_inter<B,R,Update_rule>\n::_decode_siho(const R *Y_N, int8_t *CWD, B *V_K, const size_t frame_id)\n{\n// auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nstd::vector<const R*> frames_in(mipp::N<R>());\nfor (auto f = 0; f < mipp::N<R>(); f++) frames_in[f] = Y_N + f * this->N;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/Decoder_LDPC_BP_horizontal_layered_inter.hxx", "new_path": "include/Module/Decoder/LDPC/BP/Horizontal_layered/Decoder_LDPC_BP_horizontal_layered_inter.hxx", "diff": "@@ -80,7 +80,7 @@ template <typename B, typename R, class Update_rule>\nvoid Decoder_LDPC_BP_horizontal_layered_inter<B,R,Update_rule>\n::_reset(const size_t frame_id)\n{\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nconst auto zero = mipp::Reg<R>((R)0);\nstd::fill(this->messages [cur_wave].begin(), this->messages [cur_wave].end(), zero);\nstd::fill(this->var_nodes[cur_wave].begin(), this->var_nodes[cur_wave].end(), zero);\n@@ -90,7 +90,7 @@ template <typename B, typename R, class Update_rule>\nvoid Decoder_LDPC_BP_horizontal_layered_inter<B,R,Update_rule>\n::_load(const R *Y_N, const size_t frame_id)\n{\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nstd::vector<const R*> frames(mipp::N<R>());\nfor (auto f = 0; f < mipp::N<R>(); f++) frames[f] = Y_N + f * this->N;\n@@ -110,7 +110,7 @@ int Decoder_LDPC_BP_horizontal_layered_inter<B,R,Update_rule>\nauto status = this->_decode(frame_id);\n// prepare for next round by processing extrinsic information\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nfor (auto v = 0; v < this->N; v++)\nthis->var_nodes[cur_wave][v] -= Y_N_reorderered[v];\n@@ -137,7 +137,7 @@ int Decoder_LDPC_BP_horizontal_layered_inter<B,R,Update_rule>\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n// take the hard decision\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nfor (auto v = 0; v < this->K; v++)\n{\nconst auto k = this->info_bits_pos[v];\n@@ -172,7 +172,7 @@ int Decoder_LDPC_BP_horizontal_layered_inter<B,R,Update_rule>\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n// take the hard decision\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nfor (auto v = 0; v < this->N; v++)\nV_reorderered[v] = mipp::cast<R,B>(this->var_nodes[cur_wave][v]) >> (sizeof(B) * 8 - 1);\n@@ -194,7 +194,7 @@ template <typename B, typename R, class Update_rule>\nint Decoder_LDPC_BP_horizontal_layered_inter<B,R,Update_rule>\n::_decode(const size_t frame_id)\n{\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nthis->up_rule.begin_decoding(this->n_ite);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Decoder/LDPC/BP/Vertical_layered/Decoder_LDPC_BP_vertical_layered_inter.hxx", "new_path": "include/Module/Decoder/LDPC/BP/Vertical_layered/Decoder_LDPC_BP_vertical_layered_inter.hxx", "diff": "@@ -74,7 +74,7 @@ template <typename B, typename R, class Update_rule>\nvoid Decoder_LDPC_BP_vertical_layered_inter<B,R,Update_rule>\n::_reset(const size_t frame_id)\n{\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nconst auto zero = mipp::Reg<R>((R)0);\nstd::fill(this->messages [cur_wave].begin(), this->messages [cur_wave].end(), zero);\nstd::fill(this->var_nodes[cur_wave].begin(), this->var_nodes[cur_wave].end(), zero);\n@@ -84,7 +84,7 @@ template <typename B, typename R, class Update_rule>\nvoid Decoder_LDPC_BP_vertical_layered_inter<B,R,Update_rule>\n::_load(const R *Y_N, const size_t frame_id)\n{\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nstd::vector<const R*> frames(mipp::N<R>());\nfor (auto f = 0; f < mipp::N<R>(); f++) frames[f] = Y_N + f * this->N;\n@@ -104,7 +104,7 @@ int Decoder_LDPC_BP_vertical_layered_inter<B,R,Update_rule>\nauto status = this->_decode(frame_id);\n// prepare for next round by processing extrinsic information\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nfor (auto v = 0; v < this->N; v++)\nthis->var_nodes[cur_wave][v] -= Y_N_reorderered[v];\n@@ -131,7 +131,7 @@ int Decoder_LDPC_BP_vertical_layered_inter<B,R,Update_rule>\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n// take the hard decision\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nfor (auto v = 0; v < this->K; v++)\n{\nconst auto k = this->info_bits_pos[v];\n@@ -166,7 +166,7 @@ int Decoder_LDPC_BP_vertical_layered_inter<B,R,Update_rule>\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n// take the hard decision\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nfor (auto v = 0; v < this->N; v++)\nV_reorderered[v] = mipp::cast<R,B>(this->var_nodes[cur_wave][v]) >> (sizeof(B) * 8 - 1);\n@@ -188,7 +188,7 @@ template <typename B, typename R, class Update_rule>\nint Decoder_LDPC_BP_vertical_layered_inter<B,R,Update_rule>\n::_decode(const size_t frame_id)\n{\n- const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+ const auto cur_wave = frame_id / this->get_n_frames_per_wave();\nthis->up_rule.begin_decoding(this->n_ite);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix wrong variable name in LDPC decoders when using `-faligned-new`.
8,490
10.09.2021 15:59:06
-7,200
5326b0db4f573f753f5fd5fcaef10ce11a1ee653
Disable backtrace on Android NDK.
[ { "change_type": "MODIFY", "old_path": "lib/MIPP", "new_path": "lib/MIPP", "diff": "-Subproject commit b876293fcfe86e91be1569f3227606d0b45517de\n+Subproject commit eb4db98807e0c785e31ef7e51bf5e1bca7e30357\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/system_functions.cpp", "new_path": "src/Tools/system_functions.cpp", "diff": "-#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__)) && !defined(__ANDROID__)\n#include <execinfo.h> // backtrace, backtrace_symbols\n#include <cxxabi.h> // __cxa_demangle\n#endif\n@@ -26,7 +26,7 @@ std::string aff3ct::tools::get_back_trace(int first_call)\n{\nstd::string bt_str;\n-#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__)) && !defined(__ANDROID__)\nconst int bt_max_depth = 32;\nvoid *bt_array[bt_max_depth];\n@@ -94,7 +94,7 @@ std::string aff3ct::tools::run_system_command(std::string cmd)\ncmd.append(\" 2>&1\");\n-#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__)) && !defined(__ANDROID__)\nFILE *stream = popen(cmd.c_str(), \"r\");\n#elif defined(_WIN64) || defined(_WIN32)\nFILE *stream = _popen(cmd.c_str(), \"r\");\n@@ -110,7 +110,7 @@ std::string aff3ct::tools::run_system_command(std::string cmd)\nif (fgets(buffer, max_buffer, stream) != NULL)\ndata.append(buffer);\n-#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__)) && !defined(__ANDROID__)\npclose(stream);\n#elif defined(_WIN64) || defined(_WIN32)\n_pclose(stream);\n@@ -126,7 +126,7 @@ std::string aff3ct::tools::addr_to_line(const std::string& backtrace)\n{\n#ifdef NDEBUG\nreturn backtrace;\n-#elif (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n+#elif (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__)) && !defined(__ANDROID__)\n// TODO Bug: lines does not always match with the real line where are called the functions.\nstd::string bt_str;\n" } ]
C++
MIT License
aff3ct/aff3ct
Disable backtrace on Android NDK.
8,486
19.09.2021 21:01:56
-7,200
d25713f501e3db696f5b32d0e7a8df9c1b9ab810
Allow Switcher select and commute to have different data size and type.
[ { "change_type": "MODIFY", "old_path": "include/Module/Switcher/Switcher.hpp", "new_path": "include/Module/Switcher/Switcher.hpp", "diff": "@@ -36,15 +36,24 @@ public:\nprotected:\nconst size_t n_data_sockets;\n- const size_t n_elmts;\n- const size_t n_bytes;\n- const std::type_index datatype;\n+ const size_t n_elmts_commute;\n+ const size_t n_elmts_select;\n+ const size_t n_bytes_commute;\n+ const size_t n_bytes_select;\n+ const std::type_index datatype_select;\n+ const std::type_index datatype_commute;\nsize_t path;\nbool no_copy_commute;\nbool no_copy_select;\npublic:\n+ inline Switcher(const size_t n_data_sockets,\n+ const size_t n_elmts_commute,\n+ const std::type_index datatype_commute,\n+ const size_t n_elmts_select,\n+ const std::type_index datatype_select);\n+\ninline Switcher(const size_t n_data_sockets,\nconst size_t n_elmts,\nconst std::type_index datatype);\n@@ -53,9 +62,12 @@ public:\ninline size_t get_n_data_sockets () const;\n- inline size_t get_n_elmts () const;\n- inline size_t get_n_bytes () const;\n- inline std::type_index get_datatype () const;\n+ inline size_t get_n_elmts_commute () const;\n+ inline size_t get_n_elmts_select () const;\n+ inline size_t get_n_bytes_commute () const;\n+ inline size_t get_n_bytes_select () const;\n+ inline std::type_index get_datatype_commute() const;\n+ inline std::type_index get_datatype_select () const;\ninline size_t get_path () const;\ninline bool is_no_copy_commute() const;\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Switcher/Switcher.hxx", "new_path": "include/Module/Switcher/Switcher.hxx", "diff": "@@ -25,13 +25,18 @@ const Task& Switcher\nSwitcher\n::Switcher(const size_t n_data_sockets,\n- const size_t n_elmts,\n- const std::type_index datatype)\n+ const size_t n_elmts_commute,\n+ const std::type_index datatype_commute,\n+ const size_t n_elmts_select,\n+ const std::type_index datatype_select)\n: Module(),\nn_data_sockets(n_data_sockets),\n- n_elmts(n_elmts),\n- n_bytes(tools::compute_bytes(n_elmts, datatype)),\n- datatype(datatype),\n+ n_elmts_commute(n_elmts_commute),\n+ n_elmts_select(n_elmts_select),\n+ n_bytes_commute(tools::compute_bytes(n_elmts_commute, datatype_commute)),\n+ n_bytes_select(tools::compute_bytes(n_elmts_select, datatype_select)),\n+ datatype_commute(datatype_commute),\n+ datatype_select(datatype_select),\npath(n_data_sockets -1),\nno_copy_commute(false),\nno_copy_select (false)\n@@ -48,20 +53,27 @@ Switcher\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (n_elmts == 0)\n+ if (n_elmts_commute == 0)\n+ {\n+ std::stringstream message;\n+ message << \"'n_elmts_commute' has to be greater than 0 ('n_elmts_commute' = \" << n_elmts_commute << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (n_elmts_select == 0)\n{\nstd::stringstream message;\n- message << \"'n_elmts' has to be greater than 0 ('n_elmts' = \" << n_elmts << \").\";\n+ message << \"'n_elmts_select' has to be greater than 0 ('n_elmts_select' = \" << n_elmts_select << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\nauto &p1 = this->create_task(\"commute\");\n- const auto p1s_in_data = this->create_socket_in(p1, \"data\", n_elmts, datatype);\n+ const auto p1s_in_data = this->create_socket_in(p1, \"data\", n_elmts_commute, datatype_commute);\nconst auto p1s_in_ctrl = this->create_socket_in(p1, \"ctrl\", 1, typeid(int8_t));\nstd::vector<size_t> p1s_out_data;\nfor (size_t s = 0; s < this->get_n_data_sockets(); s++)\n- p1s_out_data.push_back(this->create_socket_out(p1, \"data\" + std::to_string(s), n_elmts, datatype));\n+ p1s_out_data.push_back(this->create_socket_out(p1, \"data\" + std::to_string(s), n_elmts_commute, datatype_commute));\nthis->create_codelet(p1, [p1s_in_data, p1s_in_ctrl, p1s_out_data](Module &m, Task &t, const size_t frame_id) -> int\n{\n@@ -77,7 +89,7 @@ Switcher\nauto data_socket_out = static_cast< int8_t*>(t[p1s_out_data[path]].get_dataptr());\nstd::copy(data_socket_in,\n- data_socket_in + swi.get_n_frames() * swi.get_n_bytes(),\n+ data_socket_in + swi.get_n_frames() * swi.get_n_bytes_commute(),\ndata_socket_out);\n}\n@@ -87,8 +99,8 @@ Switcher\nauto &p2 = this->create_task(\"select\");\nstd::vector<size_t> p2s_in_data;\nfor (size_t s = 0; s < this->get_n_data_sockets(); s++)\n- p2s_in_data.push_back(this->create_socket_in(p2, \"data\" + std::to_string(s), n_elmts, datatype));\n- auto p2s_out_data = this->create_socket_out(p2, \"data\", n_elmts, datatype);\n+ p2s_in_data.push_back(this->create_socket_in(p2, \"data\" + std::to_string(s), n_elmts_select, datatype_select));\n+ auto p2s_out_data = this->create_socket_out(p2, \"data\", n_elmts_select, datatype_select);\nthis->create_codelet(p2, [p2s_in_data, p2s_out_data](Module &m, Task &t, const size_t frame_id) -> int\n{\n@@ -102,7 +114,7 @@ Switcher\nauto data_socket_out = static_cast< int8_t*>(t[p2s_out_data ].get_dataptr());\nstd::copy(data_socket_in,\n- data_socket_in + swi.get_n_frames() * swi.get_n_bytes(),\n+ data_socket_in + swi.get_n_frames() * swi.get_n_bytes_select(),\ndata_socket_out);\n}\n@@ -110,6 +122,14 @@ Switcher\n});\n}\n+Switcher\n+::Switcher(const size_t n_data_sockets,\n+ const size_t n_elmts,\n+ const std::type_index datatype)\n+: Switcher(n_data_sockets, n_elmts, datatype, n_elmts, datatype)\n+{\n+}\n+\nvoid Switcher\n::set_no_copy_commute(const bool no_copy_commute)\n{\n@@ -141,21 +161,39 @@ size_t Switcher\n}\nsize_t Switcher\n-::get_n_elmts() const\n+::get_n_elmts_commute() const\n{\n- return this->n_elmts;\n+ return this->n_elmts_commute;\n}\nsize_t Switcher\n-::get_n_bytes() const\n+::get_n_elmts_select() const\n+{\n+ return this->n_elmts_select;\n+}\n+\n+size_t Switcher\n+::get_n_bytes_commute() const\n+{\n+ return this->n_bytes_commute;\n+}\n+\n+size_t Switcher\n+::get_n_bytes_select() const\n+{\n+ return this->n_bytes_select;\n+}\n+\n+std::type_index Switcher\n+::get_datatype_commute() const\n{\n- return this->n_bytes;\n+ return this->datatype_commute;\n}\nstd::type_index Switcher\n-::get_datatype() const\n+::get_datatype_select() const\n{\n- return this->datatype;\n+ return this->datatype_select;\n}\nsize_t Switcher\n" } ]
C++
MIT License
aff3ct/aff3ct
Allow Switcher select and commute to have different data size and type.
8,490
30.09.2021 14:58:30
-7,200
9d6e2bb8ef7142ca2b4fe4aca7e7979f366c4940
Fix members order.
[ { "change_type": "MODIFY", "old_path": "include/Module/Switcher/Switcher.hpp", "new_path": "include/Module/Switcher/Switcher.hpp", "diff": "@@ -40,8 +40,8 @@ protected:\nconst size_t n_elmts_select;\nconst size_t n_bytes_commute;\nconst size_t n_bytes_select;\n- const std::type_index datatype_select;\nconst std::type_index datatype_commute;\n+ const std::type_index datatype_select;\nsize_t path;\nbool no_copy_commute;\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix members order.
8,490
30.09.2021 14:59:13
-7,200
3503dc74826261d2f6b54a24eae64f852c581341
Fix `module::Extractor_RSC`.
[ { "change_type": "MODIFY", "old_path": "src/Module/Extractor/RSC/Extractor_RSC.cpp", "new_path": "src/Module/Extractor/RSC/Extractor_RSC.cpp", "diff": "@@ -14,6 +14,13 @@ Extractor_RSC<B,Q>\n{\nconst std::string name = \"Extractor_RSC\";\nthis->set_name(name);\n+\n+ if (buffered_encoding)\n+ for (auto i = 0; i < K; i++)\n+ info_bits_pos[i] = i;\n+ else\n+ for (auto i = 0; i < K; i++)\n+ info_bits_pos[i] = 2*i;\n}\ntemplate <typename B, typename Q>\n@@ -87,7 +94,7 @@ template <typename B, typename Q>\nconst std::vector<uint32_t>& Extractor_RSC<B,Q>\n::get_info_bits_pos()\n{\n- throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ return info_bits_pos;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix `module::Extractor_RSC`.
8,490
05.10.2021 14:52:35
-7,200
c67754ebe1368dbf305d203eb30a4e7fc3cafd4c
Improve `tools::Sequence` construction rules.
[ { "change_type": "MODIFY", "old_path": "include/Module/Task.hpp", "new_path": "include/Module/Task.hpp", "diff": "@@ -58,6 +58,8 @@ protected:\nuint8_t debug_precision;\nint32_t debug_frame_max;\nstd::function<int(Module &m, Task& t, const size_t frame_id)> codelet;\n+ size_t n_input_sockets;\n+ size_t n_output_sockets;\nstd::vector<int> status;\nstd::vector<mipp::vector<uint8_t>> out_buffers;\n@@ -130,6 +132,9 @@ public:\nconst std::vector<std::chrono::nanoseconds>& get_timers_min () const;\nconst std::vector<std::chrono::nanoseconds>& get_timers_max () const;\n+ size_t get_n_input_sockets() const;\n+ size_t get_n_output_sockets() const;\n+\nconst std::vector<int>& exec(const int frame_id = -1, const bool managed_memory = true);\ninline Socket& operator[](const size_t id);\n" }, { "change_type": "MODIFY", "old_path": "include/Tools/Sequence/Sequence.hpp", "new_path": "include/Tools/Sequence/Sequence.hpp", "diff": "@@ -197,7 +197,9 @@ protected:\nconst std::vector<TA*> &lasts,\nconst std::vector<TA*> &exclusions,\nstd::vector<size_t> &real_lasts_id,\n- std::vector<TA*> &real_lasts);\n+ std::vector<TA*> &real_lasts,\n+ std::map<TA*,unsigned> &in_sockets_feed,\n+ std::map<TA*,std::pair<Digraph_node<SS>*,size_t>> &task_subseq);\ntemplate <class VTA>\nvoid export_dot_subsequence(const VTA &subseq,\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -30,6 +30,8 @@ Task\ndebug_frame_max(-1),\ncodelet([](Module &m, Task &t, const size_t frame_id) -> int\n{ throw tools::unimplemented_error(__FILE__, __LINE__, __func__); return 0; }),\n+ n_input_sockets(0),\n+ n_output_sockets(0),\nstatus(module.get_n_waves()),\nn_calls(0),\nduration_total(std::chrono::nanoseconds(0)),\n@@ -547,6 +549,7 @@ size_t Task\nlast_input_socket = &s;\nthis->set_no_input_socket(false);\n+ this->n_input_sockets++;\nreturn socket_type.size() -1;\n}\n@@ -575,6 +578,8 @@ size_t Task\nauto &s = create_socket<T>(name, n_elmts, socket_t::SOUT, hack_status);\nsocket_type.push_back(socket_t::SOUT);\n+ this->n_output_sockets++;\n+\n// memory allocation\nif (is_autoalloc())\n{\n@@ -748,6 +753,18 @@ socket_t Task\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n+size_t Task\n+::get_n_input_sockets() const\n+{\n+ return this->n_input_sockets;\n+}\n+\n+size_t Task\n+::get_n_output_sockets() const\n+{\n+ return this->n_output_sockets;\n+}\n+\nvoid Task\n::register_timer(const std::string &name)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Sequence/Sequence.cpp", "new_path": "src/Tools/Sequence/Sequence.cpp", "diff": "@@ -45,7 +45,6 @@ Sequence\nnext_round_is_over(n_threads, false),\ncur_task_id(n_threads,0),\ncur_ss(n_threads, nullptr)\n-\n{\n#ifndef AFF3CT_HWLOC\nif (thread_pinning)\n@@ -261,6 +260,8 @@ void Sequence\nauto last_subseq = root;\nfor (auto first : firsts)\n{\n+ std::map<TA*,unsigned> in_sockets_feed;\n+ std::map<TA*,std::pair<Digraph_node<SS>*,size_t>> task_subseq;\nauto contents = last_subseq->get_contents();\nthis->firsts_tasks_id.push_back(contents ? contents->tasks_id[contents->tasks_id.size() -1] : 0);\nlast_subseq = this->init_recursive<SS,TA>(last_subseq,\n@@ -273,7 +274,9 @@ void Sequence\nlasts,\nexclusions,\nthis->lasts_tasks_id,\n- real_lasts);\n+ real_lasts,\n+ in_sockets_feed,\n+ task_subseq);\n}\nstd::stringstream real_lasts_ss;\n@@ -826,7 +829,9 @@ Digraph_node<SS>* Sequence\nconst std::vector<TA*> &lasts,\nconst std::vector<TA*> &exclusions,\nstd::vector<size_t> &real_lasts_id,\n- std::vector<TA*> &real_lasts)\n+ std::vector<TA*> &real_lasts,\n+ std::map<TA*,unsigned> &in_sockets_feed,\n+ std::map<TA*,std::pair<Digraph_node<SS>*,size_t>> &task_subseq)\n{\nif (this->tasks_inplace && !current_task.is_autoalloc())\n{\n@@ -864,7 +869,7 @@ Digraph_node<SS>* Sequence\nif (auto switcher = dynamic_cast<const module::Switcher*>(&current_task.get_module()))\n{\nconst auto current_task_name = current_task.get_name();\n- if (current_task_name == \"commute\")\n+ if (current_task_name == \"commute\") // ---------------------------------------------------------------- COMMUTE\n{\nif (std::find(switchers.begin(), switchers.end(), &current_task) == switchers.end())\n{\n@@ -897,11 +902,20 @@ Digraph_node<SS>* Sequence\nauto &t = bs->get_task();\nif (std::find(exclusions.begin(), exclusions.end(), &t) == exclusions.end())\n{\n- if (t.is_last_input_socket(*bs))\n+ if (task_subseq.find(&t) == task_subseq.end() || task_subseq[&t].second < ssid)\n+ task_subseq[&t] = {node_switcher_son, ssid};\n+\n+ in_sockets_feed.find(&t) != in_sockets_feed.end() ? in_sockets_feed[&t]++ :\n+ in_sockets_feed[&t] = 1;\n+ bool t_is_select = dynamic_cast<const module::Switcher*>(&(t.get_module())) &&\n+ t.get_name() == \"select\";\n+ if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets()) ||\n+ ( t_is_select && t.is_last_input_socket(*bs)))\n{\nis_last = false;\n- last_subseq = Sequence::init_recursive<SS,TA>(node_switcher_son, ssid, taid,\n- selectors, switchers, first, t, lasts, exclusions, real_lasts_id, real_lasts);\n+ last_subseq = Sequence::init_recursive<SS,TA>(task_subseq[&t].first,\n+ task_subseq[&t].second, taid, selectors, switchers, first, t, lasts, exclusions,\n+ real_lasts_id, real_lasts, in_sockets_feed, task_subseq);\n}\nelse\n{\n@@ -941,18 +955,27 @@ Digraph_node<SS>* Sequence\nauto &t = bs->get_task();\nif (std::find(exclusions.begin(), exclusions.end(), &t) == exclusions.end())\n{\n- if (t.is_last_input_socket(*bs))\n+ if (task_subseq.find(&t) == task_subseq.end() || task_subseq[&t].second < ssid)\n+ task_subseq[&t] = {node_switcher, ssid};\n+\n+ in_sockets_feed.find(&t) != in_sockets_feed.end() ? in_sockets_feed[&t]++ :\n+ in_sockets_feed[&t] = 1;\n+ bool t_is_select = dynamic_cast<const module::Switcher*>(&(t.get_module())) &&\n+ t.get_name() == \"select\";\n+ if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets()) ||\n+ ( t_is_select && t.is_last_input_socket(*bs)))\n{\nis_last = false;\n- last_subseq = Sequence::init_recursive<SS,TA>(node_switcher, ssid, taid, selectors,\n- switchers, first, t, lasts, exclusions, real_lasts_id, real_lasts);\n+ last_subseq = Sequence::init_recursive<SS,TA>(task_subseq[&t].first,\n+ task_subseq[&t].second, taid, selectors, switchers, first, t, lasts, exclusions,\n+ real_lasts_id, real_lasts, in_sockets_feed, task_subseq);\n}\n}\n}\n}\n}\n}\n- else if (current_task_name == \"select\")\n+ else if (current_task_name == \"select\") // ------------------------------------------------------------- SELECT\n{\nDigraph_node<SS>* node_selector = nullptr;\n@@ -996,11 +1019,21 @@ Digraph_node<SS>* Sequence\nauto &t = bs->get_task();\nif (std::find(exclusions.begin(), exclusions.end(), &t) == exclusions.end())\n{\n- if (t.is_last_input_socket(*bs))\n+ if (task_subseq.find(&t) == task_subseq.end() || task_subseq[&t].second < ssid)\n+ task_subseq[&t] = {node_selector_son, ssid};\n+\n+ in_sockets_feed.find(&t) != in_sockets_feed.end() ? in_sockets_feed[&t]++ :\n+ in_sockets_feed[&t] = 1;\n+ bool t_is_select = dynamic_cast<const module::Switcher*>(&(t.get_module())) &&\n+ t.get_name() == \"select\";\n+\n+ if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets()) ||\n+ ( t_is_select && t.is_last_input_socket(*bs)))\n{\nis_last = false;\n- last_subseq = Sequence::init_recursive<SS,TA>(node_selector_son, ssid, taid,\n- selectors, switchers, first, t, lasts, exclusions, real_lasts_id, real_lasts);\n+ last_subseq = Sequence::init_recursive<SS,TA>(task_subseq[&t].first,\n+ task_subseq[&t].second, taid, selectors, switchers, first, t, lasts, exclusions,\n+ real_lasts_id, real_lasts, in_sockets_feed, task_subseq);\n}\nelse\n{\n@@ -1033,7 +1066,7 @@ Digraph_node<SS>* Sequence\n}\n}\n}\n- else\n+ else // --------------------------------------------------------------------------------------------- STANDARD CASE\n{\ncur_subseq->get_c()->tasks.push_back(&current_task);\ncur_subseq->get_c()->tasks_id.push_back(taid++);\n@@ -1052,11 +1085,20 @@ Digraph_node<SS>* Sequence\nauto &t = bs->get_task();\nif (std::find(exclusions.begin(), exclusions.end(), &t) == exclusions.end())\n{\n- if (t.is_last_input_socket(*bs))\n+ if (task_subseq.find(&t) == task_subseq.end() || task_subseq[&t].second < ssid)\n+ task_subseq[&t] = {cur_subseq, ssid};\n+\n+ in_sockets_feed.find(&t) != in_sockets_feed.end() ? in_sockets_feed[&t]++ :\n+ in_sockets_feed[&t] = 1;\n+ bool t_is_select = dynamic_cast<const module::Switcher*>(&(t.get_module())) &&\n+ t.get_name() == \"select\";\n+ if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets()) ||\n+ ( t_is_select && t.is_last_input_socket(*bs)))\n{\nis_last = false;\n- last_subseq = Sequence::init_recursive<SS,TA>(cur_subseq, ssid, taid, selectors,\n- switchers, first, t, lasts, exclusions, real_lasts_id, real_lasts);\n+ last_subseq = Sequence::init_recursive<SS,TA>(task_subseq[&t].first,\n+ task_subseq[&t].second, taid, selectors, switchers, first, t, lasts, exclusions,\n+ real_lasts_id, real_lasts, in_sockets_feed, task_subseq);\n}\nelse\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve `tools::Sequence` construction rules.
8,490
05.10.2021 17:32:30
-7,200
6b327aec12db2b117a21e0c5f5d492578b793f58
Accept static input sockets (from data ptr instead of output socket).
[ { "change_type": "MODIFY", "old_path": "include/Module/Task.hpp", "new_path": "include/Module/Task.hpp", "diff": "@@ -134,6 +134,7 @@ public:\nsize_t get_n_input_sockets() const;\nsize_t get_n_output_sockets() const;\n+ size_t get_n_static_input_sockets() const;\nconst std::vector<int>& exec(const int frame_id = -1, const bool managed_memory = true);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -901,6 +901,18 @@ size_t Task\n}\n}\n+size_t Task\n+::get_n_static_input_sockets() const\n+{\n+ size_t n = 0;\n+ for (auto &s : this->sockets)\n+ if (s->get_type() == socket_t::SIN &&\n+ s->get_dataptr() != nullptr &&\n+ s->bound_socket == nullptr)\n+ n++;\n+ return n;\n+}\n+\n// ==================================================================================== explicit template instantiation\ntemplate size_t Task::create_socket_in<int8_t >(const std::string&, const size_t);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Sequence/Sequence.cpp", "new_path": "src/Tools/Sequence/Sequence.cpp", "diff": "@@ -909,7 +909,7 @@ Digraph_node<SS>* Sequence\nin_sockets_feed[&t] = 1;\nbool t_is_select = dynamic_cast<const module::Switcher*>(&(t.get_module())) &&\nt.get_name() == \"select\";\n- if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets()) ||\n+ if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets() - t.get_n_static_input_sockets()) ||\n( t_is_select && t.is_last_input_socket(*bs)))\n{\nis_last = false;\n@@ -962,7 +962,7 @@ Digraph_node<SS>* Sequence\nin_sockets_feed[&t] = 1;\nbool t_is_select = dynamic_cast<const module::Switcher*>(&(t.get_module())) &&\nt.get_name() == \"select\";\n- if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets()) ||\n+ if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets() - t.get_n_static_input_sockets()) ||\n( t_is_select && t.is_last_input_socket(*bs)))\n{\nis_last = false;\n@@ -1027,7 +1027,7 @@ Digraph_node<SS>* Sequence\nbool t_is_select = dynamic_cast<const module::Switcher*>(&(t.get_module())) &&\nt.get_name() == \"select\";\n- if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets()) ||\n+ if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets() - t.get_n_static_input_sockets()) ||\n( t_is_select && t.is_last_input_socket(*bs)))\n{\nis_last = false;\n@@ -1092,7 +1092,7 @@ Digraph_node<SS>* Sequence\nin_sockets_feed[&t] = 1;\nbool t_is_select = dynamic_cast<const module::Switcher*>(&(t.get_module())) &&\nt.get_name() == \"select\";\n- if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets()) ||\n+ if ((!t_is_select && in_sockets_feed[&t] >= t.get_n_input_sockets() - t.get_n_static_input_sockets()) ||\n( t_is_select && t.is_last_input_socket(*bs)))\n{\nis_last = false;\n" } ]
C++
MIT License
aff3ct/aff3ct
Accept static input sockets (from data ptr instead of output socket).
8,490
05.10.2021 17:55:29
-7,200
b2f4720f168dd4fa028d7a3bd9929a371e3b1b3f
Show the static input socket in green in the dot output.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Sequence/Sequence.cpp", "new_path": "src/Tools/Sequence/Sequence.cpp", "diff": "@@ -1459,9 +1459,13 @@ void Sequence\nfor (auto &s : t->sockets)\n{\nstd::string stype;\n+ bool static_input = false;\nswitch (t->get_socket_type(*s))\n{\n- case module::socket_t::SIN: stype = \"in[\" + std::to_string(sid) + \"]\"; break;\n+ case module::socket_t::SIN:\n+ stype = \"in[\" + std::to_string(sid) + \"]\";\n+ static_input = s->get_dataptr() != nullptr && s->bound_socket == nullptr;\n+ break;\ncase module::socket_t::SOUT: stype = \"out[\" + std::to_string(sid) + \"]\"; break;\ndefault: stype = \"unkn\"; break;\n}\n@@ -1472,6 +1476,7 @@ void Sequence\nstream << tab << tab << tab << tab << \"\\\"\" << +s.get() << \"\\\"\"\n<< \"[label=\\\"\" << stype << \":\" << s->get_name() << \"\\\"\" << bold_or_not\n+ << (static_input ? \", style=filled, fillcolor=green\" : \"\")\n<< \"];\" << std::endl;\nsid++;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Show the static input socket in green in the dot output.
8,490
05.10.2021 23:27:42
-7,200
3a30862877c17c55b67d4930bd7581f3e2060db4
Add new `Socket::operator=(void*)` member.
[ { "change_type": "MODIFY", "old_path": "include/Module/Socket.hpp", "new_path": "include/Module/Socket.hpp", "diff": "@@ -68,6 +68,12 @@ public:\ninline void operator()(Socket &s_out, const int priority = -1);\n+ template <typename T>\n+ inline void operator=(const void *array);\n+\n+ template <typename T>\n+ inline void operator=(void *array);\n+\ntemplate <typename T>\ninline void operator=(const T *array);\n" }, { "change_type": "MODIFY", "old_path": "include/Module/Socket.hxx", "new_path": "include/Module/Socket.hxx", "diff": "@@ -236,6 +236,46 @@ void Socket\nbind(s_out, priority);\n}\n+template <typename T>\n+void Socket\n+::operator=(const void *array)\n+{\n+ if (this->get_type() == socket_t::SIN)\n+ this->bind(array);\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"Current socket have to be an input socket (\"\n+ << \"'datatype'\" << \" = \" << type_to_string[this->datatype] << \", \"\n+ << \"'name'\" << \" = \" << get_name() << \", \"\n+ << \"'task.name'\" << \" = \" << task.get_name() << \", \"\n+ << \"'type'\" << \" = \" << (get_type() == socket_t::SIN ? \"SIN\" : \"SOUT\") /*<< \", \"*/\n+// << \"'task.module.name'\" << \" = \" << task.get_module_name()\n+ << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\n+template <typename T>\n+void Socket\n+::operator=(void *array)\n+{\n+ if (this->get_type() == socket_t::SIN)\n+ this->bind(array);\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"Current socket have to be an input socket (\"\n+ << \"'datatype'\" << \" = \" << type_to_string[this->datatype] << \", \"\n+ << \"'name'\" << \" = \" << get_name() << \", \"\n+ << \"'task.name'\" << \" = \" << task.get_name() << \", \"\n+ << \"'type'\" << \" = \" << (get_type() == socket_t::SIN ? \"SIN\" : \"SOUT\") /*<< \", \"*/\n+// << \"'task.module.name'\" << \" = \" << task.get_module_name()\n+ << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\ntemplate <typename T>\nvoid Socket\n::operator=(const T *array)\n" } ]
C++
MIT License
aff3ct/aff3ct
Add new `Socket::operator=(void*)` member.
8,490
05.10.2021 23:28:25
-7,200
72af2d3f2b51881df93202e6c6b1774d77863096
Fix AZCW simulations.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp", "new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp", "diff": "@@ -299,7 +299,9 @@ void Simulation_BFER_ite<B,R,Q>\nif (this->params_BFER_ite.coset)\n{\n- if (this->params_BFER_ite.coded_monitoring)\n+ if (this->params_BFER_ite.src->type == \"AZCW\")\n+ csb[cst::sck::apply::ref] = enc[enc::sck::encode::X_N].get_dataptr();\n+ else if (this->params_BFER_ite.coded_monitoring)\n{\nif (this->params_BFER_ite.cdc->enc->type != \"NO\")\ncsb[cst::sck::apply::ref] = enc[enc::sck::encode::X_N];\n@@ -316,7 +318,13 @@ void Simulation_BFER_ite<B,R,Q>\ncsb[cst::sck::apply::ref] = src[src::sck::generate::U_K];\n}\n- if (this->params_BFER_ite.cdc->enc->type != \"NO\")\n+ if (this->params_BFER_ite.src->type == \"AZCW\")\n+ {\n+ csr1[cst::sck::apply::ref] = enc[enc::sck::encode::X_N].get_dataptr();\n+ csr2[cst::sck::apply::ref] = enc[enc::sck::encode::X_N].get_dataptr();\n+ csr3[cst::sck::apply::ref] = enc[enc::sck::encode::X_N].get_dataptr();\n+ }\n+ else if (this->params_BFER_ite.cdc->enc->type != \"NO\")\n{\ncsr1[cst::sck::apply::ref] = enc[enc::sck::encode::X_N];\ncsr2[cst::sck::apply::ref] = enc[enc::sck::encode::X_N];\n@@ -336,7 +344,9 @@ void Simulation_BFER_ite<B,R,Q>\n}\n}\n- if (this->params_BFER_ite.coded_monitoring)\n+ if (this->params_BFER_ite.src->type == \"AZCW\")\n+ mnt[mnt::sck::check_errors::U] = enc[enc::sck::encode::X_N].get_dataptr();\n+ else if (this->params_BFER_ite.coded_monitoring)\n{\nif (this->params_BFER_ite.cdc->enc->type != \"NO\")\nmnt[mnt::sck::check_errors::U] = enc[enc::sck::encode::X_N];\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp", "new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp", "diff": "@@ -472,6 +472,10 @@ void Simulation_BFER_std<B,R,Q>\n}\nif (this->params_BFER_std.coded_monitoring)\n+ {\n+ if (this->params_BFER_std.src->type == \"AZCW\")\n+ mnt[mnt::sck::check_errors::U] = enc[enc::sck::encode::X_N].get_dataptr();\n+ else\n{\nif (this->params_BFER_std.cdc->enc->type != \"NO\")\nmnt[mnt::sck::check_errors::U] = enc[enc::sck::encode::X_N];\n@@ -479,6 +483,7 @@ void Simulation_BFER_std<B,R,Q>\nmnt[mnt::sck::check_errors::U] = crc[crc::sck::build::U_K2];\nelse\nmnt[mnt::sck::check_errors::U] = src[src::sck::generate::U_K];\n+ }\nif (this->params_BFER_std.coset)\nmnt[mnt::sck::check_errors::V] = csb[cst::sck::apply::out];\n@@ -487,6 +492,9 @@ void Simulation_BFER_std<B,R,Q>\n}\nelse\n{\n+ if (this->params_BFER_std.src->type == \"AZCW\")\n+ mnt[mnt::sck::check_errors::U] = enc[enc::sck::encode::X_N].get_dataptr();\n+ else\nmnt[mnt::sck::check_errors::U] = src[src::sck::generate::U_K];\nif (this->params_BFER_std.crc->type != \"NO\")\nmnt[mnt::sck::check_errors::V] = crc[crc::sck::extract::V_K2];\n@@ -497,6 +505,10 @@ void Simulation_BFER_std<B,R,Q>\n}\nif (this->params_BFER_std.mnt_mutinfo)\n+ {\n+ if (this->params_BFER_std.src->type == \"AZCW\")\n+ mni[mnt::sck::get_mutual_info::X] = enc[enc::sck::encode::X_N].get_dataptr();\n+ else\n{\nif (this->params_BFER_std.cdc->pct != nullptr && this->params_BFER_std.cdc->pct->type != \"NO\")\nmni[mnt::sck::get_mutual_info::X] = pct[pct::sck::puncture::X_N2];\n@@ -506,6 +518,7 @@ void Simulation_BFER_std<B,R,Q>\nmni[mnt::sck::get_mutual_info::X] = crc[crc::sck::build::U_K2];\nelse\nmni[mnt::sck::get_mutual_info::X] = src[src::sck::generate::U_K];\n+ }\nif (mdm.is_demodulator())\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix AZCW simulations.
8,490
28.02.2022 18:16:09
-3,600
65b364fe9f8271cfc082bac49768b7e7924628b8
Fix a serious bug in the initialization of the tasks graph.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Sequence/Sequence.cpp", "new_path": "src/Tools/Sequence/Sequence.cpp", "diff": "@@ -258,9 +258,9 @@ void Sequence\nthis->lasts_tasks_id.clear();\nthis->firsts_tasks_id.clear();\nauto last_subseq = root;\n+ std::map<TA*,unsigned> in_sockets_feed;\nfor (auto first : firsts)\n{\n- std::map<TA*,unsigned> in_sockets_feed;\nstd::map<TA*,std::pair<Digraph_node<SS>*,size_t>> task_subseq;\nauto contents = last_subseq->get_contents();\nthis->firsts_tasks_id.push_back(contents ? contents->tasks_id[contents->tasks_id.size() -1] : 0);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix a serious bug in the initialization of the tasks graph.
8,486
23.03.2022 09:14:41
-3,600
f95859e9fa84fd7b1b8a9cded392c1a208652167
Fix RS decoder for returning a CWD flag.
[ { "change_type": "MODIFY", "old_path": "include/Module/Decoder/RS/Decoder_RS.hpp", "new_path": "include/Module/Decoder/RS/Decoder_RS.hpp", "diff": "@@ -42,10 +42,10 @@ public:\nprotected:\nvirtual int _decode ( S *Y_N, const size_t frame_id) = 0;\n- virtual int _decode_hiho (const B *Y_N, B *V_K, const size_t frame_id);\n- virtual int _decode_hiho_cw(const B *Y_N, B *V_N, const size_t frame_id);\n- virtual int _decode_siho (const R *Y_N, B *V_K, const size_t frame_id);\n- virtual int _decode_siho_cw(const R *Y_N, B *V_N, const size_t frame_id);\n+ virtual int _decode_hiho (const B *Y_N, int8_t *CWD, B *V_K, const size_t frame_id);\n+ virtual int _decode_hiho_cw(const B *Y_N, int8_t *CWD, B *V_N, const size_t frame_id);\n+ virtual int _decode_siho (const R *Y_N, int8_t *CWD, B *V_K, const size_t frame_id);\n+ virtual int _decode_siho_cw(const R *Y_N, int8_t *CWD, B *V_N, const size_t frame_id);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/RS/Decoder_RS.cpp", "new_path": "src/Module/Decoder/RS/Decoder_RS.cpp", "diff": "@@ -47,7 +47,7 @@ Decoder_RS<B,R>* Decoder_RS<B,R>\ntemplate <typename B, typename R>\nint Decoder_RS<B, R>\n-::_decode_hiho(const B *Y_N, B *V_K, const size_t frame_id)\n+::_decode_hiho(const B *Y_N, int8_t *CWD, B *V_K, const size_t frame_id)\n{\n// auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\ntools::Bit_packer::pack(Y_N, YH_N.data(), this->N, 1, false, this->m);\n@@ -56,7 +56,7 @@ int Decoder_RS<B, R>\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nauto status = this->_decode(YH_N.data(), frame_id);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n+ CWD[0] = !status;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\ntools::Bit_packer::unpack(YH_N.data() + this->n_rdncy, V_K, this->K, 1, false, this->m);\n// auto d_store = std::chrono::steady_clock::now() - t_store;\n@@ -70,7 +70,7 @@ int Decoder_RS<B, R>\ntemplate <typename B, typename R>\nint Decoder_RS<B, R>\n-::_decode_hiho_cw(const B *Y_N, B *V_N, const size_t frame_id)\n+::_decode_hiho_cw(const B *Y_N, int8_t *CWD, B *V_N, const size_t frame_id)\n{\n// auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\ntools::Bit_packer::pack(Y_N, YH_N.data(), this->N, 1, false, this->m);\n@@ -79,7 +79,7 @@ int Decoder_RS<B, R>\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nauto status = this->_decode(YH_N.data(), frame_id);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n+ CWD[0] = !status;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\ntools::Bit_packer::unpack(YH_N.data(), V_N, this->N, 1, false, this->m);\n// auto d_store = std::chrono::steady_clock::now() - t_store;\n@@ -93,7 +93,7 @@ int Decoder_RS<B, R>\ntemplate <typename B, typename R>\nint Decoder_RS<B, R>\n-::_decode_siho(const R *Y_N, B *V_K, const size_t frame_id)\n+::_decode_siho(const R *Y_N, int8_t *CWD, B *V_K, const size_t frame_id)\n{\n// auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\ntools::hard_decide(Y_N, YH_Nb.data(), this->N);\n@@ -103,7 +103,7 @@ int Decoder_RS<B, R>\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nauto status = this->_decode(YH_N.data(), frame_id);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n+ CWD[0] = !status;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\ntools::Bit_packer::unpack(YH_N.data() + this->n_rdncy, V_K, this->K, 1, false, this->m);\n// auto d_store = std::chrono::steady_clock::now() - t_store;\n@@ -117,7 +117,7 @@ int Decoder_RS<B, R>\ntemplate <typename B, typename R>\nint Decoder_RS<B, R>\n-::_decode_siho_cw(const R *Y_N, B *V_N, const size_t frame_id)\n+::_decode_siho_cw(const R *Y_N, int8_t *CWD, B *V_N, const size_t frame_id)\n{\n// auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\ntools::hard_decide(Y_N, YH_Nb.data(), this->N);\n@@ -126,6 +126,7 @@ int Decoder_RS<B, R>\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nauto status = this->_decode(YH_N.data(), frame_id);\n+ CWD[0] = !status;\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/RS/Standard/Decoder_RS_std.cpp", "new_path": "src/Module/Decoder/RS/Standard/Decoder_RS_std.cpp", "diff": "@@ -242,6 +242,7 @@ int Decoder_RS_std<B,R>\nY_N[loc[i]] ^= err[loc[i]]; // Y_N[i] must be in polynomial form\n}\n}\n+ syn_error = false;\n}\n// else // no. roots != degree of elp => over t errors and cannot solve\n}\n@@ -249,7 +250,7 @@ int Decoder_RS_std<B,R>\n}\n// else // no non-zero syndromes => no errors: output received codeword\n- return 0;\n+ return (int)syn_error;\n}\n// ==================================================================================== explicit template instantiation\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix RS decoder for returning a CWD flag.
8,490
21.04.2022 10:34:08
-7,200
8fa65a3ca9b0dcdd3d544363bc692d4f85f6f718
Update the year from 2021 to 2022 for the v3.0.2 release.
[ { "change_type": "MODIFY", "old_path": "LICENSE", "new_path": "LICENSE", "diff": "MIT License\n-Copyright (c) 2017-2021 aff3ct\n+Copyright (c) 2017-2022 aff3ct\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\n" }, { "change_type": "MODIFY", "old_path": "doc/source/conf.py", "new_path": "doc/source/conf.py", "diff": "@@ -36,7 +36,7 @@ if (read_the_docs_build):\n# -- Project information -----------------------------------------------------\nproject = 'AFF3CT'\n-copyright = '2021, AFF3CT team'\n+copyright = '2022, AFF3CT team'\nauthor = 'AFF3CT team'\n# get the AFF3CT version from Git\n" }, { "change_type": "MODIFY", "old_path": "src/main.cpp", "new_path": "src/main.cpp", "diff": "@@ -138,7 +138,7 @@ void print_version()\nstd::cout << \" - MPI: \" << mpi << std::endl;\nstd::cout << \" - GSL: \" << gsl << std::endl;\nstd::cout << \" - MKL: \" << mkl << std::endl;\n- std::cout << \"Copyright (c) 2016-2021 - MIT license.\" << std::endl;\n+ std::cout << \"Copyright (c) 2016-2022 - MIT license.\" << std::endl;\nstd::cout << \"This is free software; see the source for copying conditions. There is NO\" << std::endl;\nstd::cout << \"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\" << std::endl;\nexit(EXIT_SUCCESS);\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the year from 2021 to 2022 for the v3.0.2 release.
61,753
30.03.2017 09:47:22
18,000
ddadf547770ddbe8261cfd854b2a5f21b3a9074c
Typo: Dimention -> Dimension
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -237,7 +237,7 @@ astc_codec_image *load_astc_file(const char *filename, int bitness, astc_decode_\nif (xsize == 0 || ysize == 0 || zsize == 0)\n{\nfclose(f);\n- printf(\"File %s has zero dimention %d %d %d\\n\", filename, xsize, ysize, zsize);\n+ printf(\"File %s has zero dimension %d %d %d\\n\", filename, xsize, ysize, zsize);\nexit(1);\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Typo: Dimention -> Dimension
61,770
13.11.2017 12:17:07
0
8ae1e9f50a1e930e79c4cef1545a884823b04628
A small fix for msvc build and README update
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -14,7 +14,7 @@ See [license.txt](license.txt) file for details.\n# Compilation from Sources\n* You can use GCC >= 4.6 and standard GNU tools to perform make-driven compilation on Linux and/or MacOS systems.\n-* You can use Visual Studio 2010 to compile for Windows systems (using solution file from `Source/win32-2010/astcenc` directory).\n+* You can use Visual Studio 2013 to compile for Windows systems (using solution file from `Source/win32-2013/astcenc` directory).\n# ASTC Features & Benefits\n@@ -105,4 +105,4 @@ The compression speed runs from `-veryfast`, through `-fast`, `-medium` and `-th\nPlease submit your questions and issues to the [ARM Mali Graphics forums](http://community.arm.com/groups/arm-mali-graphics).\n- - -\n-_Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved._\n+_Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved._\n" }, { "change_type": "MODIFY", "old_path": "Source/mathlib.cpp", "new_path": "Source/mathlib.cpp", "diff": "@@ -52,7 +52,7 @@ float nan(int p)\nreturn v.q;\n}\n-#if __cplusplus < 201103L\n+#if (!_MSC_VER) && (__cplusplus < 201103L)\nfloat fmax(float p, float q)\n{\nif (p != p)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
A small fix for msvc build and README update
61,770
14.11.2017 10:31:38
0
0d22d5543a3b9e42cc365236db9a4a1641df1678
Producing new binaries for a release
[ { "change_type": "DELETE", "old_path": "Binary/Linux32/astcenc", "new_path": "Binary/Linux32/astcenc", "diff": "Binary files a/Binary/Linux32/astcenc and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "Binary/MacOS/astcenc", "new_path": "Binary/MacOS/astcenc", "diff": "Binary files a/Binary/MacOS/astcenc and /dev/null differ\n" }, { "change_type": "ADD", "old_path": "Binary/linux-x64/astcenc", "new_path": "Binary/linux-x64/astcenc", "diff": "Binary files /dev/null and b/Binary/linux-x64/astcenc differ\n" }, { "change_type": "ADD", "old_path": "Binary/linux-x86/astcenc", "new_path": "Binary/linux-x86/astcenc", "diff": "Binary files /dev/null and b/Binary/linux-x86/astcenc differ\n" }, { "change_type": "ADD", "old_path": "Binary/mac-x64/astcenc", "new_path": "Binary/mac-x64/astcenc", "diff": "Binary files /dev/null and b/Binary/mac-x64/astcenc differ\n" }, { "change_type": "RENAME", "old_path": "Binary/Win32/astcenc.exe", "new_path": "Binary/windows-x64/astcenc.exe", "diff": "Binary files a/Binary/Win32/astcenc.exe and b/Binary/windows-x64/astcenc.exe differ\n" }, { "change_type": "RENAME", "old_path": "Binary/Win64/astcenc.exe", "new_path": "Binary/windows-x86/astcenc.exe", "diff": "Binary files a/Binary/Win64/astcenc.exe and b/Binary/windows-x86/astcenc.exe differ\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -45,11 +45,11 @@ ASTC specification includes two profiles: LDR and Full. The smaller LDR Profile\n* Source code\n* Full specification of the ASTC data format\n-* Binaries for Windows, Mac OS X and Linux (x86, 32-bit)\n+* Binaries for Windows, Mac OS X and Linux\n# Getting Started\n-First, accept the [license](license.txt) and download the source code. In the subdirectories Win32, Mac OS X and Linux32 are binaries for Windows, Mac OS X, and Linux (x86 versions). If you are running on another system, you might like to try compiling from source.\n+First, accept the [license](license.txt) and download the source code. The `Binary` subdirectory contains executable binaries for Windows, Mac OS X, and Linux. If you are running on another system, you might like to try compiling from source.\nOpen a terminal, change to the appropriate directory for your system, and run the astcenc encoder program, like this on Linux or Mac OS:\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Producing new binaries for a release
61,770
14.11.2017 11:07:53
0
b6bf6e7a523ddafdb8cfdc84b068d8fe70ffb45e
Improved binary for windows x64
[ { "change_type": "MODIFY", "old_path": "Binary/linux-x64/astcenc", "new_path": "Binary/linux-x64/astcenc", "diff": "Binary files a/Binary/linux-x64/astcenc and b/Binary/linux-x64/astcenc differ\n" }, { "change_type": "MODIFY", "old_path": "Binary/linux-x86/astcenc", "new_path": "Binary/linux-x86/astcenc", "diff": "Binary files a/Binary/linux-x86/astcenc and b/Binary/linux-x86/astcenc differ\n" }, { "change_type": "MODIFY", "old_path": "Binary/windows-x64/astcenc.exe", "new_path": "Binary/windows-x64/astcenc.exe", "diff": "Binary files a/Binary/windows-x64/astcenc.exe and b/Binary/windows-x64/astcenc.exe differ\n" }, { "change_type": "MODIFY", "old_path": "Binary/windows-x86/astcenc.exe", "new_path": "Binary/windows-x86/astcenc.exe", "diff": "Binary files a/Binary/windows-x86/astcenc.exe and b/Binary/windows-x86/astcenc.exe differ\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Improved binary for windows x64
61,745
02.02.2018 21:13:56
0
7ad12fbd0d53ada8ab735188560465cb536861b0
Remove redundant memory allocation in struct imageblock rgb_lns, alpha_lns, and nan_texel all store one value per texel, not one value per color channel, so the multiply by 4 is superfluous.
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -190,9 +190,9 @@ struct imageblock\nfloat work_data[MAX_TEXELS_PER_BLOCK * 4]; // the data that we will compress, either linear or LNS (0..65535 in both cases)\nfloat deriv_data[MAX_TEXELS_PER_BLOCK * 4]; // derivative of the conversion function used, used to modify error weighting\n- uint8_t rgb_lns[MAX_TEXELS_PER_BLOCK * 4]; // 1 if RGB data are being treated as LNS\n- uint8_t alpha_lns[MAX_TEXELS_PER_BLOCK * 4]; // 1 if Alpha data are being treated as LNS\n- uint8_t nan_texel[MAX_TEXELS_PER_BLOCK * 4]; // 1 if the texel is a NaN-texel.\n+ uint8_t rgb_lns[MAX_TEXELS_PER_BLOCK]; // 1 if RGB data are being treated as LNS\n+ uint8_t alpha_lns[MAX_TEXELS_PER_BLOCK]; // 1 if Alpha data are being treated as LNS\n+ uint8_t nan_texel[MAX_TEXELS_PER_BLOCK]; // 1 if the texel is a NaN-texel.\nfloat red_min, red_max;\nfloat green_min, green_max;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove redundant memory allocation in struct imageblock rgb_lns, alpha_lns, and nan_texel all store one value per texel, not one value per color channel, so the multiply by 4 is superfluous.
61,745
02.02.2018 21:16:14
0
954eba4125e235674a08921380dbfd7172d00930
Remove unused stepsize entry Using it improves quality by about 0.005dB but incurs a significant performance penalty, so assume it has been disabled for performance reasons (there are similar optimizations for similar quality losses in other places in the reference codec).
[ { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1141,7 +1141,7 @@ void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * ea\ninfilled_weights[i] = compute_value_of_texel_flt(i, it, weight_set);\n}\n- const float stepsizes[3] = { 0.25f, 0.125f, 0.0625f };\n+ const float stepsizes[2] = { 0.25f, 0.125f };\nfor (j = 0; j < 2; j++)\n{\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove unused stepsize entry Using it improves quality by about 0.005dB but incurs a significant performance penalty, so assume it has been disabled for performance reasons (there are similar optimizations for similar quality losses in other places in the reference codec).
61,745
16.02.2018 22:34:44
0
a84401e44a7c878cb9156daefd42503a66fe539d
Update astc_compute_variance.cpp Avoid mixed type comparison of float and double.
[ { "change_type": "MODIFY", "old_path": "Source/astc_compute_variance.cpp", "new_path": "Source/astc_compute_variance.cpp", "diff": "@@ -115,10 +115,10 @@ static void compute_pixel_region_variance(const astc_codec_image * img, float rg\nif (!powers_are_1)\n{\n- d.x = pow(MAX(d.x, 1e-6f), (double)rgb_power_to_use);\n- d.y = pow(MAX(d.y, 1e-6f), (double)rgb_power_to_use);\n- d.z = pow(MAX(d.z, 1e-6f), (double)rgb_power_to_use);\n- d.w = pow(MAX(d.w, 1e-6f), (double)alpha_power_to_use);\n+ d.x = pow(MAX(d.x, 1e-6), (double)rgb_power_to_use);\n+ d.y = pow(MAX(d.y, 1e-6), (double)rgb_power_to_use);\n+ d.z = pow(MAX(d.z, 1e-6), (double)rgb_power_to_use);\n+ d.w = pow(MAX(d.w, 1e-6), (double)alpha_power_to_use);\n}\nvarbuf1[z][y][x] = d;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update astc_compute_variance.cpp Avoid mixed type comparison of float and double.
61,758
02.11.2018 11:43:53
18,000
8e5907a6691f07f25d1f5137338666b5c23b5009
Fix comparison that always evaluates to true
[ { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -457,7 +457,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\nscb->color_formats_matched = 0;\nif ((partition_count >= 2 && scb->color_formats[0] == scb->color_formats[1]\n- && color_quantization_level != color_quantization_level_mod)\n+ && color_quantization_level[i] != color_quantization_level_mod[i])\n&& (partition_count == 2 || (scb->color_formats[0] == scb->color_formats[2] && (partition_count == 3 || (scb->color_formats[0] == scb->color_formats[3])))))\n{\nint colorvals[4][12];\n@@ -753,7 +753,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\nscb->color_formats_matched = 0;\nif ((partition_count >= 2 && scb->color_formats[0] == scb->color_formats[1]\n- && color_quantization_level != color_quantization_level_mod)\n+ && color_quantization_level[i] != color_quantization_level_mod[i])\n&& (partition_count == 2 || (scb->color_formats[0] == scb->color_formats[2] && (partition_count == 3 || (scb->color_formats[0] == scb->color_formats[3])))))\n{\nint colorvals[4][12];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix comparison that always evaluates to true
61,768
01.05.2019 15:43:45
-3,600
bd21dc54c8fd4ff4075f3e06ef9549158778593d
Library Enable the project to be compiled as a library Fix fmax fmin on Visual Studio
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -39,6 +39,7 @@ SOURCES = \\\nastc_toplevel.cpp \\\nmathlib.cpp \\\nsoftfloat.cpp \\\n+ astc_main.cpp \\\nHEADERS = \\\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -811,5 +811,6 @@ void physical_to_symbolic(int xdim, int ydim, int zdim, physical_compressed_bloc\nuint16_t unorm16_to_sf16(uint16_t p);\nuint16_t lns_to_sf16(uint16_t p);\n+int astc_main(int argc, char ** argv);\n#endif\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Source/astc_main.cpp", "diff": "+#include \"astc_codec_internals.h\"\n+\n+int main(int argc, char **argv)\n+{\n+ return astc_main(argc, argv);\n+}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -749,7 +749,7 @@ void dump_image(astc_codec_image * img)\n}\n-int main(int argc, char **argv)\n+int astc_main(int argc, char **argv)\n{\nint i;\n" }, { "change_type": "MODIFY", "old_path": "Source/mathlib.h", "new_path": "Source/mathlib.h", "diff": "@@ -27,7 +27,7 @@ float cospi(float p);\nfloat nan(int p);\n-#if __cplusplus < 201103L\n+#if (!_MSC_VER) && (__cplusplus < 201103L)\nfloat fmax(float p, float q);\nfloat fmin(float p, float q);\n#endif // C++11\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Library - Enable the project to be compiled as a library - Fix fmax fmin on Visual Studio
61,768
02.05.2019 10:51:46
-3,600
f789719d6313ec0affb59e25f54d53a7ade7d563
Update MSVC project
[ { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/astcenc.sln", "new_path": "Source/win32-2017/astcenc/astcenc.sln", "diff": "" }, { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/astcenc.vcproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcproj", "diff": "" }, { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/astcenc.vcxproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "diff": "<ProjectGuid>{D6D60D86-0502-446A-8498-888F78B869C2}</ProjectGuid>\n<RootNamespace>astcenc</RootNamespace>\n<Keyword>Win32Proj</Keyword>\n+ <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>\n</PropertyGroup>\n<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n<ConfigurationType>Application</ConfigurationType>\n<CharacterSet>Unicode</CharacterSet>\n- <PlatformToolset>v120</PlatformToolset>\n+ <PlatformToolset>v141</PlatformToolset>\n</PropertyGroup>\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n<ConfigurationType>Application</ConfigurationType>\n<ClCompile Include=\"..\\..\\astc_integer_sequence.cpp\" />\n<ClCompile Include=\"..\\..\\astc_kmeans_partitioning.cpp\" />\n<ClCompile Include=\"..\\..\\astc_ktx_dds.cpp\" />\n+ <ClCompile Include=\"..\\..\\astc_main.cpp\" />\n<ClCompile Include=\"..\\..\\astc_partition_tables.cpp\" />\n<ClCompile Include=\"..\\..\\astc_percentile_tables.cpp\" />\n<ClCompile Include=\"..\\..\\astc_pick_best_endpoint_format.cpp\" />\n" }, { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/astcenc.vcxproj.filters", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj.filters", "diff": "<ClCompile Include=\"..\\..\\astc_weight_quant_xfer_tables.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n+ <ClCompile Include=\"..\\..\\astc_main.cpp\">\n+ <Filter>Source Files</Filter>\n+ </ClCompile>\n</ItemGroup>\n<ItemGroup>\n<ClInclude Include=\"..\\..\\astc_codec_internals.h\">\n" }, { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/stdint.h", "new_path": "Source/win32-2017/astcenc/stdint.h", "diff": "" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update MSVC project
61,745
25.06.2019 20:47:50
-3,600
480855465d5e521a6648b63224e1a19e67a25358
Remove deprecated or conflicting VS solution opts
[ { "change_type": "MODIFY", "old_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "diff": "<Optimization>Disabled</Optimization>\n<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n- <MinimalRebuild>true</MinimalRebuild>\n+ <MinimalRebuild>\n+ </MinimalRebuild>\n<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n<SubSystem>Console</SubSystem>\n<TargetMachine>MachineX86</TargetMachine>\n+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>\n</Link>\n</ItemDefinitionGroup>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n</PrecompiledHeader>\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n+ <MinimalRebuild />\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove deprecated or conflicting VS solution opts
61,745
25.06.2019 22:06:39
-3,600
3c59cf25d0c53283e8254a93d90a88f0ca1a650b
Namespace all VS build outputs by platform
[ { "change_type": "MODIFY", "old_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "diff": "<PropertyGroup Label=\"UserMacros\" />\n<PropertyGroup>\n<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\n- <OutDir Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(SolutionDir)$(Configuration)\\</OutDir>\n- <IntDir Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(Configuration)\\</IntDir>\n+ <OutDir Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(SolutionDir)$(Platform)\\$(Configuration)\\</OutDir>\n+ <IntDir Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(Platform)\\$(Configuration)\\</IntDir>\n<LinkIncremental Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</LinkIncremental>\n<LinkIncremental Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">true</LinkIncremental>\n- <OutDir Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">$(SolutionDir)$(Configuration)\\</OutDir>\n- <IntDir Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">$(Configuration)\\</IntDir>\n+ <OutDir Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">$(SolutionDir)$(Platform)\\$(Configuration)\\</OutDir>\n+ <IntDir Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">$(Platform)\\$(Configuration)\\</IntDir>\n<LinkIncremental Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">false</LinkIncremental>\n<LinkIncremental Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">false</LinkIncremental>\n</PropertyGroup>\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Namespace all VS build outputs by platform
61,745
27.06.2019 16:20:51
-3,600
16f516753d20d2ffb61c632fc0d4d70ed7c4763c
Updated README after review. Remove legacy specification PDF.
[ { "change_type": "DELETE", "old_path": "Documentation/ASTC Specification 1.0.pdf", "new_path": "Documentation/ASTC Specification 1.0.pdf", "diff": "Binary files a/Documentation/ASTC Specification 1.0.pdf and /dev/null differ\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -14,9 +14,9 @@ content creators. This allows more assets to use compression, often at a\nreduced bitrate compared to legacy formats, reducing memory bandwidth and\nenergy consumption.\n-The ASTC format specification is available here:\n+The ASTC data format specification is available here:\n-* [ASTC Specification v1.0 (PDF)](./Documentation/ASTC%20Specification%20v1.0.pdf)\n+* [OES_texture_compression_astc](https://www.khronos.org/registry/OpenGL/extensions/OES/OES_texture_compression_astc.txt)\n# Encoder feature support\n@@ -35,14 +35,14 @@ image and the compressed output.\nThe ASTC specification allows three profiles of implementation:\n-* 2D Low Dynamic Range (LDR)\n-* 2D LDR and High Dynamic Range (HDR)\n-* 2D and 3D, LDR and HDR\n+* 2D Low Dynamic Range (LDR profile)\n+* 2D LDR and High Dynamic Range (HDR profile)\n+* 2D and 3D, LDR and HDR (Full profile)\nThe `astcenc` compressor supports generation of images for all three profiles.\nIn addition it also supports all of the ASTC block sizes and compression\nmodes, allowing content creators access the full spectrum of quality-to-bitrate\n-trade options ranging from 0.89 bits/pixel up to 8bits/pixel.\n+options ranging from 0.89 bits/pixel up to 8 bits/pixel.\n# License\n@@ -77,12 +77,12 @@ the astcenc encoder program, like this on Linux or Mac OS:\n./astcenc\n-Or like this on Windows:\n+... or like this on Windows:\nastcenc\nInvoking the tool with no arguments gives an extensive help message, including\n-usage instructions, and details of all the available options.\n+usage instructions, and details of all the available command line options.\n## Compressing an image\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Updated README after review. Remove legacy specification PDF.
61,745
27.06.2019 16:46:19
-3,600
38a9535142630c1fc45b285dc0d4d71e4ee0f21b
Change specification link to the DataFormat spec
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -16,7 +16,7 @@ energy consumption.\nThe ASTC data format specification is available here:\n-* [OES_texture_compression_astc](https://www.khronos.org/registry/OpenGL/extensions/OES/OES_texture_compression_astc.txt)\n+* [Khronos Data Format Specification v1.2 # ASTC](https://www.khronos.org/registry/DataFormat/specs/1.2/dataformat.1.2.html#ASTC)\n# Encoder feature support\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Change specification link to the DataFormat spec
61,745
27.06.2019 17:17:53
-3,600
4baeb8e63cb98b5e7fb8cc8463e52b93cdbf5c34
Add note that binaries come from last stable tag
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -57,6 +57,9 @@ and macOS (x64) are available here:\n* [Binary directory](/Binary/).\n+ These binaries are built from the latest stable tag, and therefore do not\n+ necessarily represent the current state of the `master` branch source code.\n+\n# Building from source\nBuilds for Linux and macOS use GCC and Make, and are tested with GCC 4.6 and\n@@ -116,14 +119,14 @@ console.\n## Experimenting\n-Efficient real-time graphics benefits from low bandwidth texture access,\n-as it reduces bandwidth, saves energy, and can improve texture cache\n-efficiency. However, like any lossy compression format there will come a point\n-where the output compression quality is unacceptable because there are simply\n-not enough bits to represent the output at the quality needed. We recommend\n-experimenting with the block footprint to find the optimum balance between size\n-and quality, as the finely adjustable compression ratio is one of major\n-strengths of the ASTC format.\n+Efficient real-time graphics benefits from minimizing the bitrate needed to\n+store a texture, as it reduces memory bandwidth, saves energy, and can improve\n+texture cache efficiency. However, like any lossy compression format there will\n+come a point where the compressed image quality is unacceptable because there\n+are simply not enough bits to represent the output with the precision needed.\n+We recommend experimenting with the block footprint to find the optimum balance\n+between size and quality, as the finely adjustable compression ratio is one of\n+major strengths of the ASTC format.\nThe compression speed can be controlled from `-veryfast`, through `-fast`,\n`-medium` and `-thorough`, up to `-exhaustive`. In general, the more time the\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add note that binaries come from last stable tag
61,745
27.06.2019 23:31:00
-3,600
8f6db5a0e1cbfb115f06c29291d6ee0a76f172ef
Add declarative Jenkinsfile for Jenkins CI builds (Windows builds only) Add a Jenkinsfile to automate some basic builds CI testing.
[ { "change_type": "ADD", "old_path": null, "new_path": "Jenkinsfile", "diff": "+pipeline {\n+ agent any\n+ options {\n+ buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))\n+ }\n+ tools {\n+ msbuild 'MSBuild-15.0'\n+ }\n+ stages {\n+ stage('Build') {\n+ parallel {\n+ stage('x64 Release') {\n+ steps {\n+ script {\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Release /p:Platform=x64\", returnStatus: false, returnStdout: false)\n+ }\n+ }\n+ }\n+ stage('x64 Debug') {\n+ steps {\n+ script {\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Debug /p:Platform=x64\", returnStatus: false, returnStdout: false)\n+ }\n+\n+ }\n+ }\n+ stage('x86 Release') {\n+ steps {\n+ script {\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Release /p:Platform=Win32\", returnStatus: false, returnStdout: false)\n+ }\n+\n+ }\n+ }\n+ stage('x86 Debug') {\n+ steps {\n+ script {\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Debug /p:Platform=Win32\", returnStatus: false, returnStdout: false)\n+ }\n+\n+ }\n+ }\n+ }\n+ }\n+ stage('Archive') {\n+ steps {\n+ archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\Win32\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\Win32\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\x64\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\x64\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n+ }\n+ }\n+ }\n+ post {\n+ always {\n+ recordIssues(enabledForFailure: true, tool: msBuild())\n+ }\n+ }\n+ triggers {\n+ pollSCM('H/15 * * * *')\n+ }\n+}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add declarative Jenkinsfile for Jenkins CI builds (Windows builds only) (#45) Add a Jenkinsfile to automate some basic builds CI testing.
61,745
05.07.2019 08:18:35
-3,600
62fadfcaf5bb8a9cc8ffa1370fc12b55f20f972c
Fix success path memory leaks Errors still expected on the failure path, but this is a harder one to fix with the current code, so not part of this commit
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -2352,11 +2352,6 @@ int astc_main(int argc, char **argv)\nprintf(\"3D source images not supported with -array option: %s\\n\", new_input_filename);\nexit(1);\n}\n-\n- // BCJ(DEBUG)\n- // printf(\"\\n\\n Image %d \\n\", image_index);\n- // dump_image( input_images[image_index] );\n- // printf(\"\\n\\n\");\n}\n// Check load result.\n@@ -2414,15 +2409,17 @@ int astc_main(int argc, char **argv)\n{\ndestroy_image(input_images[i]);\n}\n- input_images = NULL;\n// Clamp texels outside the actual image area.\nfill_image_padding_area(input_image);\n-\n- // BCJ(DEBUG)\n- // dump_image( input_image );\n}\n+ delete[] input_images;\n+ input_images = NULL;\n+\n+ delete[] load_results;\n+ load_results = NULL;\n+\ninput_components = load_result & 7;\ninput_image_is_hdr = (load_result & 0x80) ? 1 : 0;\n@@ -2511,11 +2508,13 @@ int astc_main(int argc, char **argv)\n}\n}\n}\n+\nif (opmode == 0)\n{\nstore_astc_file(input_image, output_filename, xdim, ydim, zdim, &ewp, decode_mode, swz_encode, thread_count);\n}\n+ destroy_image(input_image);\nif (print_block_mode_histogram)\n{\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix success path memory leaks (#49) Errors still expected on the failure path, but this is a harder one to fix with the current code, so not part of this commit
61,745
05.07.2019 09:30:27
-3,600
a8f9dd778f9fbbbed206e0e703e9630674acac62
Update Encoding.md Add a missing "-"
[ { "change_type": "MODIFY", "old_path": "Docs/Encoding.md", "new_path": "Docs/Encoding.md", "diff": "@@ -135,7 +135,7 @@ Most other texture compression formats have a static channel assignment in\nterms of the expected data correlation. For example, ETC2+EAC assumes that RGB\nare always correlated and that alpha is non-correlated. ASTC can automatically\nencode data as either fully correlated across all 4 channels, or with any one\n-channel assigned to a separate non correlated partition to the other three.\n+channel assigned to a separate non-correlated partition to the other three.\nThe non-correlated channel can be changed on a block-by-block basis, so the\ncompressor can dynamically adjust the coding based on the data present in the\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update Encoding.md Add a missing "-"
61,745
06.07.2019 21:15:30
-3,600
b49291a9efca81a6e991beb9612ce93766e9cad7
Use <cmath> to get C++ overloaded math functions This avoids many double to float cast precision warnings which we get using the C versions of e.g. min/max/sqrt from <math.h>.
[ { "change_type": "MODIFY", "old_path": "Source/astc_averages_and_directions.cpp", "new_path": "Source/astc_averages_and_directions.cpp", "diff": "#include \"astc_codec_internals.h\"\n-#include <math.h>\n+#include <cmath>\n#include \"mathlib.h\"\n#ifdef DEBUG_CAPTURE_NAN\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_quantize.cpp", "new_path": "Source/astc_color_quantize.cpp", "diff": "#include \"astc_codec_internals.h\"\n#include \"softfloat.h\"\n-#include <math.h>\n+#include <cmath>\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n#include <stdio.h>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "#include \"astc_codec_internals.h\"\n#include \"softfloat.h\"\n-#include <math.h>\n+#include <cmath>\n#include <string.h>\n#include <stdio.h>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compute_variance.cpp", "new_path": "Source/astc_compute_variance.cpp", "diff": "#include \"astc_codec_internals.h\"\n-#include <math.h>\n+#include <cmath>\n#include \"mathlib.h\"\n#include \"softfloat.h\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_decompress_symbolic.cpp", "new_path": "Source/astc_decompress_symbolic.cpp", "diff": "*/\n/*----------------------------------------------------------------------------*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_encoding_choice_error.cpp", "new_path": "Source/astc_encoding_choice_error.cpp", "diff": "#include \"astc_codec_internals.h\"\n-#include <math.h>\n+#include <cmath>\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n#include <stdio.h>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_find_best_partitioning.cpp", "new_path": "Source/astc_find_best_partitioning.cpp", "diff": "* each element in the table is an uint8_t indicating partition index (0, 1, 2 or 3)\n*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "*/\n/*----------------------------------------------------------------------------*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_image_load_store.cpp", "new_path": "Source/astc_image_load_store.cpp", "diff": "*/\n/*----------------------------------------------------------------------------*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n@@ -1272,7 +1272,7 @@ astc_codec_image *astc_codec_load_image(const char *input_filename, int padding,\n// check the ending of the input filename\nint load_fileformat = LOAD_STB_IMAGE;\n- int filename_len = strlen(input_filename);\n+ size_t filename_len = strlen(input_filename);\nconst char *eptr = input_filename + filename_len - 5;\nif (eptr > input_filename && (strcmp(eptr, \".htga\") == 0 || strcmp(eptr, \".HTGA\") == 0))\n@@ -1346,7 +1346,7 @@ int get_output_filename_enforced_bitness(const char *output_filename)\nif (output_filename == NULL)\nreturn -1;\n- int filename_len = strlen(output_filename);\n+ size_t filename_len = strlen(output_filename);\nconst char *eptr = output_filename + filename_len - 5;\nif (eptr > output_filename && (strcmp(eptr, \".htga\") == 0 || strcmp(eptr, \".HTGA\") == 0))\n@@ -1380,7 +1380,7 @@ int astc_codec_store_image(const astc_codec_image * output_image, const char *ou\n#define STORE_DDS 3\n#define STORE_EXR 4\n- int filename_len = strlen(output_filename);\n+ size_t filename_len = strlen(output_filename);\nint store_fileformat = STORE_TGA;\nconst char *eptr = output_filename + filename_len - 5;\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_pick_best_endpoint_format.cpp", "new_path": "Source/astc_pick_best_endpoint_format.cpp", "diff": "#include <stdio.h>\n#endif\n-#include <math.h>\n+#include <cmath>\n// clamp an input value to [0,1]; Nan is turned into 0.\nstatic inline float clamp01(float val)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "#include <stdio.h>\n#include <stdlib.h>\n-#include <math.h>\n+#include <cmath>\n#ifndef WIN32\n#include <sys/time.h>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_align.cpp", "new_path": "Source/astc_weight_align.cpp", "diff": "*/\n/*----------------------------------------------------------------------------*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n" }, { "change_type": "MODIFY", "old_path": "Source/mathlib.cpp", "new_path": "Source/mathlib.cpp", "diff": "#include <time.h>\n#include <stdlib.h>\n#include <stdio.h>\n-#include <math.h>\n+#include <cmath>\n#include \"mathlib.h\"\n/**************************\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Use <cmath> to get C++ overloaded math functions (#42) This avoids many double to float cast precision warnings which we get using the C versions of e.g. min/max/sqrt from <math.h>.
61,745
07.07.2019 22:03:23
-3,600
9c93e80a3b3a7988a38a11a8efe1433eaf192ab4
Re-enable JPEG and GIF input texture support
[ { "change_type": "MODIFY", "old_path": "Source/astc_stb_tga.cpp", "new_path": "Source/astc_stb_tga.cpp", "diff": "* @brief Functions for loading and storing files via stb_image.\n*/\n-\n#include \"astc_codec_internals.h\"\n#include \"softfloat.h\"\n#include <stdio.h>\n#define STB_IMAGE_IMPLEMENTATION\n-#define STBI_NO_JPEG\n#define STBI_NO_PSD\n-#define STBI_NO_GIF\n#define STBI_NO_PIC\n#define STBI_NO_PNM\n#include \"stb_image.h\"\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Re-enable JPEG and GIF input texture support (#55)
61,745
07.07.2019 22:04:20
-3,600
da70ab4e7a9c0b9761d9c19b127c5f8db9b7bb79
Remove support for non-standard block sizes
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "#include <fenv.h>\n#endif\n-// Define this to be 1 to allow \"illegal\" block sizes\n-#define DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES 0\n-\nextern int block_mode_histogram[2048];\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -566,7 +563,7 @@ astc_codec_image *pack_and_unpack_astc_image(const astc_codec_image * input_imag\nreturn img;\n}\n-void find_closest_blockdim_2d(float target_bitrate, int *x, int *y, int consider_illegal)\n+void find_closest_blockdim_2d(float target_bitrate, int *x, int *y)\n{\nint blockdims[6] = { 4, 5, 6, 8, 10, 12 };\n@@ -582,8 +579,7 @@ void find_closest_blockdim_2d(float target_bitrate, int *x, int *y, int consider\n{\n// NxN MxN 8x5 10x5 10x6\nint is_legal = (j==i) || (j==i+1) || (j==3 && i==1) || (j==4 && i==1) || (j==4 && i==2);\n-\n- if(consider_illegal || is_legal)\n+ if(is_legal)\n{\nfloat bitrate = 128.0f / (blockdims[i] * blockdims[j]);\nfloat bitrate_error = fabs(bitrate - target_bitrate);\n@@ -600,7 +596,7 @@ void find_closest_blockdim_2d(float target_bitrate, int *x, int *y, int consider\n}\n}\n-void find_closest_blockdim_3d(float target_bitrate, int *x, int *y, int *z, int consider_illegal)\n+void find_closest_blockdim_3d(float target_bitrate, int *x, int *y, int *z)\n{\nint blockdims[4] = { 3, 4, 5, 6 };\n@@ -616,8 +612,7 @@ void find_closest_blockdim_3d(float target_bitrate, int *x, int *y, int *z, int\n{\n// NxNxN MxNxN MxMxN\nint is_legal = ((k==j)&&(j==i)) || ((k==j+1)&&(j==i)) || ((k==j)&&(j==i+1));\n-\n- if(consider_illegal || is_legal)\n+ if(is_legal)\n{\nfloat bitrate = 128.0f / (blockdims[i] * blockdims[j] * blockdims[k]);\nfloat bitrate_error = fabs(bitrate - target_bitrate);\n@@ -1342,8 +1337,8 @@ int astc_main(int argc, char **argv)\n{\ntarget_bitrate = static_cast < float >(atof(argv[4]));\ntarget_bitrate_set = 1;\n- find_closest_blockdim_2d(target_bitrate, &xdim_2d, &ydim_2d, DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES);\n- find_closest_blockdim_3d(target_bitrate, &xdim_3d, &ydim_3d, &zdim_3d, DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES);\n+ find_closest_blockdim_2d(target_bitrate, &xdim_2d, &ydim_2d);\n+ find_closest_blockdim_3d(target_bitrate, &xdim_3d, &ydim_3d, &zdim_3d);\n}\nelse\n{\n@@ -1370,7 +1365,7 @@ int astc_main(int argc, char **argv)\nint is_legal_2d = (xdim_3d==ydim_3d) || (xdim_3d==ydim_3d+1) || ((xdim_3d==ydim_3d+2) && !(xdim_3d==6 && ydim_3d==4)) ||\n(xdim_3d==8 && ydim_3d==5) || (xdim_3d==10 && ydim_3d==5) || (xdim_3d==10 && ydim_3d==6);\n- if(!DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES && !is_legal_2d)\n+ if(!is_legal_2d)\n{\nprintf(\"Block dimensions %d x %d disallowed\\n\", xdim_3d, ydim_3d);\nexit(1);\n@@ -1388,7 +1383,7 @@ int astc_main(int argc, char **argv)\nint is_legal_3d = ((xdim_3d==ydim_3d)&&(ydim_3d==zdim_3d)) || ((xdim_3d==ydim_3d+1)&&(ydim_3d==zdim_3d)) || ((xdim_3d==ydim_3d)&&(ydim_3d==zdim_3d+1));\n- if(!DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES && !is_legal_3d)\n+ if(!is_legal_3d)\n{\nprintf(\"Block dimensions %d x %d x %d disallowed\\n\", xdim_3d, ydim_3d, zdim_3d);\nexit(1);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove support for non-standard block sizes (#56)
61,745
07.07.2019 22:05:04
-3,600
f5304a604212f548346d17a72cc864fde9a84897
Remove all IGNORED parameters from interfaces
[ { "change_type": "MODIFY", "old_path": "Source/astc_block_sizes2.cpp", "new_path": "Source/astc_block_sizes2.cpp", "diff": "@@ -169,11 +169,8 @@ const float *get_2d_percentile_table(int blockdim_x, int blockdim_y)\n// stubbed for the time being.\nstatic const float dummy_percentile_table_3d[2048] = { 0 };\n-const float *get_3d_percentile_table(int blockdim_x, int blockdim_y, int blockdim_z)\n+const float *get_3d_percentile_table()\n{\n- IGNORE(blockdim_x);\n- IGNORE(blockdim_y);\n- IGNORE(blockdim_z);\nreturn dummy_percentile_table_3d;\n}\n@@ -864,7 +861,7 @@ void construct_block_size_descriptor_3d(int xdim, int ydim, int zdim, block_size\nbsd->decimation_mode_count = decimation_mode_count;\n- const float *percentiles = get_3d_percentile_table(xdim, ydim, zdim);\n+ const float *percentiles = get_3d_percentile_table();\n// then construct the list of block formats\nfor (i = 0; i < 2048; i++)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "#define MAX(x,y) ((x)>(y)?(x):(y))\n#endif\n-// Macro to silence warnings on ignored parameters.\n-// The presence of this macro should be a signal to look at refactoring.\n-#define IGNORE(param) ((void)&param)\n-\n#define astc_isnan(p) ((p)!=(p))\n// ASTC parameters\n@@ -567,7 +563,7 @@ void write_imageblock(astc_codec_image * img, const imageblock * pb, // picture-\n// helper function to check whether a given picture-block has alpha that is not\n// just uniformly 1.\n-int imageblock_uses_alpha(int xdim, int ydim, int zdim, const imageblock * pb);\n+int imageblock_uses_alpha(const imageblock * pb);\nfloat compute_imageblock_difference(int xdim, int ydim, int zdim, const imageblock * p1, const imageblock * p2, const error_weight_block * ewb);\n@@ -616,7 +612,7 @@ void merge_endpoints(const endpoints * ep1, // contains three of the color compo\n// function to pack a pair of color endpoints into a series of integers.\n// the format used may or may not match the format specified;\n// the return value is the format actually used.\n-int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, float2 luminances, int format, int *output, int quantization_level);\n+int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, int format, int *output, int quantization_level);\n// unpack a pair of color endpoints from a series of integers.\nvoid unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_quantize.cpp", "new_path": "Source/astc_color_quantize.cpp", "diff": "@@ -695,15 +695,9 @@ void quantize_luminance_alpha(float4 color0, float4 color1, int output[4], int q\noutput[3] = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)];\n}\n-void quantize0(float4 color0, float4 color1, int output[8], int quantization_level)\n+void quantize0(int output[8])\n{\n- IGNORE(color0);\n- IGNORE(color1);\n- IGNORE(output);\n- IGNORE(quantization_level);\n-\n- int i;\n- for (i = 0; i < 8; i++)\n+ for (int i = 0; i < 8; i++)\noutput[i] = 0;\n}\n@@ -1829,12 +1823,9 @@ void quantize_hdr_rgb_alpha3(float4 color0, float4 color1, int output[8], int qu\nQuantize a color. When quantizing an RGB or RGBA color, the quantizer may choose a\ndelta-based representation; as such, it will report back the format it actually used.\n*/\n-int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, float2 luminances, // ! Unused\n+int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color,\nint format, int *output, int quantization_level)\n{\n-\n- IGNORE(luminances);\n-\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n{\n@@ -1972,7 +1963,7 @@ int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 col\ndefault:\nASTC_CODEC_INTERNAL_ERROR;\n- quantize0(color0, color1, output, quantization_level);\n+ quantize0(output);\nretval = FMT_LUMINANCE;\nbreak;\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -427,7 +427,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\nscb->color_formats[j] = pack_color_endpoints(decode_mode,\neix[decimation_mode].ep.endpt0[j],\neix[decimation_mode].ep.endpt1[j],\n- rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n+ rgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n}\n// if all the color endpoint modes are the same, we get a few more\n@@ -447,7 +447,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\ncolor_formats_mod[j] = pack_color_endpoints(decode_mode,\neix[decimation_mode].ep.endpt0[j],\neix[decimation_mode].ep.endpt1[j],\n- rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n+ rgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n}\nif (color_formats_mod[0] == color_formats_mod[1]\n&& (partition_count == 2 || (color_formats_mod[0] == color_formats_mod[2] && (partition_count == 3 || (color_formats_mod[0] == color_formats_mod[3])))))\n@@ -717,7 +717,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\nscb->color_formats[j] = pack_color_endpoints(decode_mode,\nepm.endpt0[j],\nepm.endpt1[j],\n- rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n+ rgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n}\nscb->color_formats_matched = 0;\n@@ -732,7 +732,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\ncolor_formats_mod[j] = pack_color_endpoints(decode_mode,\nepm.endpt0[j],\nepm.endpt1[j],\n- rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n+ rgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n}\nif (color_formats_mod[0] == color_formats_mod[1]\n&& (partition_count == 2 || (color_formats_mod[0] == color_formats_mod[2] && (partition_count == 3 || (color_formats_mod[0] == color_formats_mod[3])))))\n@@ -1382,7 +1382,7 @@ float compress_symbolic_block(const astc_codec_image * input_image,\nfor (i = 0; i < 17; i++)\nbest_errorvals_in_modes[i] = 1e30f;\n- int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, blk);\n+ int uses_alpha = imageblock_uses_alpha(blk);\n// compression of average-color blocks disabled for the time being;\n// they produce extremely severe block artifacts.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_find_best_partitioning.cpp", "new_path": "Source/astc_find_best_partitioning.cpp", "diff": "#include <stdio.h>\n#endif\n-int imageblock_uses_alpha(int xdim, int ydim, int zdim, const imageblock * pb)\n+int imageblock_uses_alpha(const imageblock * pb)\n{\n- IGNORE(xdim);\n- IGNORE(ydim);\n- IGNORE(zdim);\n-\nreturn pb->alpha_max != pb->alpha_min;\n}\n@@ -227,7 +223,7 @@ void find_best_partitionings(int partition_search_limit, int xdim, int ydim, int\nprintf(\"weight_imprecision_estim = %g\\n\", weight_imprecision_estim);\n#endif\n- int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, pb);\n+ int uses_alpha = imageblock_uses_alpha(pb);\nconst partition_info *ptab = get_partition_table(xdim, ydim, zdim, partition_count);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -858,7 +858,7 @@ void compute_endpoints_and_ideal_weights_1_plane(int xdim, int ydim, int zdim, c\nprintf(\"%s: texels_per_block=%dx%dx%d\\n\\n\", __func__, xdim, ydim, zdim);\n#endif\n- int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, blk);\n+ int uses_alpha = imageblock_uses_alpha(blk);\nif (uses_alpha)\n{\ncompute_endpoints_and_ideal_weights_rgba(xdim, ydim, zdim, pt, blk, ewb, ei);\n@@ -878,7 +878,7 @@ void compute_endpoints_and_ideal_weights_2_planes(int xdim, int ydim, int zdim,\nprintf(\"%s: texels_per_block=%dx%dx%d, separate_component=%d\\n\\n\", __func__, xdim, ydim, zdim, separate_component);\n#endif\n- int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, blk);\n+ int uses_alpha = imageblock_uses_alpha(blk);\nswitch (separate_component)\n{\ncase 0: // separate weights for red\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "}\n#else\n- // Windows.h defines IGNORE, so we must #undef our own version.\n- #undef IGNORE\n-\n// Define pthread-like functions in terms of Windows threading API\n#define WIN32_LEAN_AND_MEAN\n#include <windows.h>\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove all IGNORED parameters from interfaces (#57)
61,745
08.07.2019 09:18:41
-3,600
5208b9f9aed8d42aaf59d59b0d6f9bb9e7280367
Specify Makefile build as C++ 11
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -43,7 +43,7 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -O3 -Wall -W -Wextra -msse2 -mfpmath=sse\n+CPPFLAGS = -std=c++11 -O3 -Wall -W -Wextra -msse2 -mfpmath=sse\nastcenc: $(OBJECTS)\ng++ -o $@ $^ $(CPPFLAGS) -lpthread\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Specify Makefile build as C++ 11
61,745
08.07.2019 09:26:29
-3,600
e5617947c6a573c3513bcc851d438d11b7eb50ee
Update --help message Version string update Typo fixes Copyright year ARM -> Arm
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -736,8 +736,8 @@ int astc_main(int argc, char **argv)\nif (argc < 4)\n{\n- printf( \"ASTC codec version 1.3\\n\"\n- \"Copyright (C) 2011-2013 ARM Limited\\n\"\n+ printf( \"ASTC codec version 1.7\\n\"\n+ \"Copyright (C) 2011-2019 Arm Limited\\n\"\n\"All rights reserved. Use of this software is subject to terms of its license.\\n\\n\"\n\"Usage:\\n\"\n\"Compress to texture file:\\n\"\n@@ -786,7 +786,7 @@ int astc_main(int argc, char **argv)\n\" * KTX (*.ktx)\\n\"\n\" * DDS (*.dds)\\n\"\n\" * Half-Float-TGA (*.htga)\\n\"\n- \" * OpenEXR (*.exr; only if t'exr_to_htga' is present in the path)\\n\"\n+ \" * OpenEXR (*.exr; only if 'exr_to_htga' is present in the path)\\n\"\n\"\\n\"\n\"Targa is suitable only for 2D LDR images; for HDR and/or 3D images,\\n\"\n\"please use KTX or DDS.\\n\"\n@@ -796,7 +796,7 @@ int astc_main(int argc, char **argv)\n\" * A decimal number (at least one actual decimal needed). This will cause \\n\"\n\" the codec to interpret the number as a desired bitrate, and pick a block\\n\"\n\" size to match that bitrate as closely as possible. For example, if you want a\\n\"\n- \" bitrate of 2.0 bits per texel, then specifiy the <rate> argument as 2.0\\n\"\n+ \" bitrate of 2.0 bits per texel, then specify the <rate> argument as 2.0\\n\"\n\" * A block size. This specifies the block dimensions to use along the\\n\"\n\" X, Y (and for 3D textures) Z axes. The dimensions are separated with\\n\"\n\" the character x, with no spaces. For 2D textures, the supported\\n\"\n@@ -967,7 +967,7 @@ int astc_main(int argc, char **argv)\n\" Assign relative weight to each color channel.\\n\"\n\" If this option is combined with any of the other options above,\\n\"\n\" the other options are used to compute a weighting, then the \\n\"\n- \" weigthing is multiplied by the weighting provided by this argument.\\n\"\n+ \" weighting is multiplied by the weighting provided by this argument.\\n\"\n\"\\n\"\n\" -rn\\n\"\n\" Assume that the red and alpha color channels (after swizzle)\\n\"\n@@ -1111,7 +1111,7 @@ int astc_main(int argc, char **argv)\n\"\\n\"\n\" -dsw <swizzlepattern>\\n\"\n\" Swizzle pattern to apply after decoding a texture. This pattern is\\n\"\n- \" specified in the samw way as the pre-encoding swizzle pattern\\n\"\n+ \" specified in the same way as the pre-encoding swizzle pattern\\n\"\n\" for the -sw switch. However, one additional character is supported,\\n\"\n\" namely 'z' for constructing the third component of a normal map.\\n\"\n\"\\n\"\n" }, { "change_type": "MODIFY", "old_path": "Source/mathlib.h", "new_path": "Source/mathlib.h", "diff": "@@ -24,15 +24,14 @@ float fmax(float p, float q);\nfloat fmin(float p, float q);\n#endif // C++11\n-float2 fmax(float2 p, float2 q);\n-\n-float3 fmax(float3 p, float3 q);\n-\n-float4 fmax(float4 p, float4 q);\nfloat2 fmin(float2 p, float2 q);\nfloat3 fmin(float3 p, float3 q);\nfloat4 fmin(float4 p, float4 q);\n+float2 fmax(float2 p, float2 q);\n+float3 fmax(float3 p, float3 q);\n+float4 fmax(float4 p, float4 q);\n+\nstatic inline float dot(float2 p, float2 q)\n{\nreturn p.x * q.x + p.y * q.y;\n" }, { "change_type": "MODIFY", "old_path": "Source/softfloat.cpp", "new_path": "Source/softfloat.cpp", "diff": "-/*----------------------------------------------------------------------------*/\n+// ----------------------------------------------------------------------------\n+// This confidential and proprietary software may be used only as authorised\n+// by a licensing agreement from Arm Limited.\n+// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// The entire notice above must be reproduced on all authorised copies and\n+// copies may only be made to the extent permitted by a licensing agreement\n+// from Arm Limited.\n+// ----------------------------------------------------------------------------\n+\n/**\n- * This confidential and proprietary software may be used only as\n- * authorised by a licensing agreement from ARM Limited\n- * (C) COPYRIGHT 2011-2012 ARM Limited\n- * ALL RIGHTS RESERVED\n- *\n- * The entire notice above must be reproduced on all authorised\n- * copies and copies may only be made to the extent permitted\n- * by a licensing agreement from ARM Limited.\n- *\n- * @brief Soft IEEE-754 floating point library.\n+ * @brief Soft-float library for IEEE-754.\n*/\n-/*----------------------------------------------------------------------------*/\n#include \"softfloat.h\"\n};\n#endif\n-\n/*\n32-bit count-leading-zeros function: use the Assembly instruction whenever possible. */\nSOFTFLOAT_INLINE uint32_t clz32(uint32_t inp)\n@@ -103,7 +100,6 @@ static SOFTFLOAT_INLINE uint32_t rtna_shift32(uint32_t inp, uint32_t shamt)\nreturn inp;\n}\n-\nstatic SOFTFLOAT_INLINE uint32_t rtup_shift32(uint32_t inp, uint32_t shamt)\n{\nuint32_t vl1 = UINT32_C(1) << shamt;\n@@ -113,9 +109,6 @@ static SOFTFLOAT_INLINE uint32_t rtup_shift32(uint32_t inp, uint32_t shamt)\nreturn inp;\n}\n-\n-\n-\n/* convert from FP16 to FP32. */\nsf32 sf16_to_sf32(sf16 inp)\n{\n@@ -168,7 +161,6 @@ sf32 sf16_to_sf32(sf16 inp)\n}\n/* Conversion routine that converts from FP32 to FP16. It supports denormals and all rounding modes. If a NaN is given as input, it is quietened. */\n-\nsf16 sf32_to_sf16(sf32 inp, roundmode rmode)\n{\n/* for each possible sign/exponent combination, store a case index. This gives a 512-byte table */\n@@ -370,8 +362,6 @@ sf16 sf32_to_sf16(sf32 inp, roundmode rmode)\nreturn 0;\n}\n-\n-\ntypedef union if32_\n{\nuint32_t u;\n@@ -380,7 +370,6 @@ typedef union if32_\n} if32;\n/* convert from soft-float to native-float */\n-\nfloat sf16_to_float(sf16 p)\n{\nif32 i;\n@@ -389,7 +378,6 @@ float sf16_to_float(sf16 p)\n}\n/* convert from native-float to soft-float */\n-\nsf16 float_to_sf16(float p, roundmode rm)\n{\nif32 i;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update --help message - Version string update - Typo fixes - Copyright year - ARM -> Arm
61,745
08.07.2019 21:22:07
-3,600
4c820b65d52ba7b2df17bf1fce2c407ddf7fcf6a
Cleanup handling of ASTC_CODEC_INTERNAL_ERROR Error function calls exit(), so mark as [[noreturn]]. Remove duplicate calls to exit(). Remove functional logic which is redundant due to erro.
[ { "change_type": "MODIFY", "old_path": "Source/astc_averages_and_directions.cpp", "new_path": "Source/astc_averages_and_directions.cpp", "diff": "@@ -223,11 +223,9 @@ void compute_averages_and_directions_3_components(const partition_info * pt,\ntexel_weights = ewb->texel_weight_rgb;\nelse\n{\n- texel_weights = ewb->texel_weight_gba;\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n-\nfor (partition = 0; partition < partition_count; partition++)\n{\nconst uint8_t *weights = pt->texels_of_partition[partition];\n@@ -316,10 +314,7 @@ void compute_averages_and_directions_2_components(const partition_info * pt,\ntexel_weights = ewb->texel_weight_gb;\nelse\n{\n- texel_weights = ewb->texel_weight_rg;\n- // unsupported set of color components.\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nfor (partition = 0; partition < partition_count; partition++)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "#define MAX_WEIGHT_MODES 2048\n// error reporting for codec internal errors.\n-#define ASTC_CODEC_INTERNAL_ERROR astc_codec_internal_error(__FILE__, __LINE__)\n-\n-void astc_codec_internal_error(const char *filename, int linenumber);\n+#define ASTC_CODEC_INTERNAL_ERROR() astc_codec_internal_error(__FILE__, __LINE__)\n+[[noreturn]] void astc_codec_internal_error(const char *filename, int linenumber);\n// uncomment this macro to enable checking for inappropriate NaNs;\n// works on Linux only, and slows down encoding significantly.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_quantize.cpp", "new_path": "Source/astc_color_quantize.cpp", "diff": "@@ -695,12 +695,6 @@ void quantize_luminance_alpha(float4 color0, float4 color1, int output[4], int q\noutput[3] = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)];\n}\n-void quantize0(int output[8])\n-{\n- for (int i = 0; i < 8; i++)\n- output[i] = 0;\n-}\n-\n// quantize and unquantize a number, wile making sure to retain the top two bits.\nstatic inline void quantize_and_unquantize_retain_top_two_bits(int quantization_level, int value_to_quantize, // 0 to 255.\nint *quantized_value, int *unquantized_value)\n@@ -1962,10 +1956,7 @@ int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 col\nbreak;\ndefault:\n- ASTC_CODEC_INTERNAL_ERROR;\n- quantize0(output);\n- retval = FMT_LUMINANCE;\n- break;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_unquantize.cpp", "new_path": "Source/astc_color_unquantize.cpp", "diff": "@@ -825,7 +825,7 @@ void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quanti\nbreak;\ndefault:\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nif (*alpha_hdr == -1)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -337,7 +337,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\nint decimation_mode = bsd->block_modes[i].decimation_mode;\nif (bsd->decimation_mode_percentile[decimation_mode] > mode_cutoff)\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n// compute weight bitcount for the mode\nint bits_used_by_weights = compute_ise_bitcount(ixtab2[decimation_mode]->num_weights,\n@@ -1023,7 +1023,7 @@ static void compute_covariance_matrix(int xdim, int ydim, int zdim, const imageb\n{\nfloat weight = ewb->texel_weight[i];\nif (weight < 0.0f)\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\nweight_sum += weight;\nfloat r = blk->work_data[4 * i];\nfloat g = blk->work_data[4 * i + 1];\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -60,8 +60,7 @@ static void compute_endpoints_and_ideal_weights_1_component(int xdim, int ydim,\nerror_weights = ewb->texel_weight_a;\nbreak;\ndefault:\n- error_weights = ewb->texel_weight_r;\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nfor (i = 0; i < partition_count; i++)\n@@ -112,7 +111,7 @@ static void compute_endpoints_and_ideal_weights_1_component(int xdim, int ydim,\nei->weight_error_scale[i] = partition_error_scale[partition] * error_weights[i];\nif (astc_isnan(ei->weight_error_scale[i]))\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -187,7 +186,7 @@ static void compute_endpoints_and_ideal_weights_2_components(int xdim, int ydim,\nelse\n{\nerror_weights = ewb->texel_weight_rg;\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nint texels_per_block = xdim * ydim * zdim;\n@@ -377,7 +376,7 @@ static void compute_endpoints_and_ideal_weights_2_components(int xdim, int ydim,\nei->weight_error_scale[i] = length_squared[partition] * error_weights[i];\nif (astc_isnan(ei->weight_error_scale[i]))\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -430,8 +429,7 @@ static void compute_endpoints_and_ideal_weights_3_components(int xdim, int ydim,\nerror_weights = ewb->texel_weight_rgb;\nelse\n{\n- error_weights = ewb->texel_weight_gba;\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\ncompute_partition_error_color_weightings(xdim, ydim, zdim, ewb, pt, error_weightings, color_scalefactors);\n@@ -657,7 +655,7 @@ static void compute_endpoints_and_ideal_weights_3_components(int xdim, int ydim,\nei->weight_error_scale[i] = length_squared[partition] * error_weights[i];\nif (astc_isnan(ei->weight_error_scale[i]))\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -817,7 +815,7 @@ static void compute_endpoints_and_ideal_weights_rgba(int xdim, int ydim, int zdi\nei->weight_error_scale[i] = error_weights[i] * length_squared[partition];\nif (astc_isnan(ei->weight_error_scale[i]))\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -908,7 +906,7 @@ void compute_endpoints_and_ideal_weights_2_planes(int xdim, int ydim, int zdim,\ncase 3: // separate weights for alpha\nif (uses_alpha == 0)\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\ncompute_endpoints_and_ideal_weights_3_components(xdim, ydim, zdim, pt, blk, ewb, ei1, 0, 1, 2);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_image_load_store.cpp", "new_path": "Source/astc_image_load_store.cpp", "diff": "@@ -88,8 +88,7 @@ astc_codec_image *allocate_image(int bitness, int xsize, int ysize, int zsize, i\n}\nelse\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nreturn img;\n@@ -129,8 +128,7 @@ void initialize_image(astc_codec_image * img)\n}\nelse\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -1287,8 +1285,7 @@ astc_codec_image *astc_codec_load_image(const char *input_filename, int padding,\ninput_image = load_image_with_stb(input_filename, padding, load_result);\nbreak;\ndefault:\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nif (load_exr)\n@@ -1399,9 +1396,7 @@ int astc_codec_store_image(const astc_codec_image * output_image, const char *ou\nstore_result = -99;\nbreak;\ndefault:\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n- break;\n+ ASTC_CODEC_INTERNAL_ERROR();\n};\nreturn store_result;\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -150,7 +150,7 @@ unsigned get_number_of_cpus(void)\nreturn n_cpus;\n}\n-void astc_codec_internal_error(const char *filename, int linenum)\n+[[noreturn]] void astc_codec_internal_error(const char *filename, int linenum)\n{\nprintf(\"Internal error: File=%s Line=%d\\n\", filename, linenum);\nexit(1);\n" }, { "change_type": "MODIFY", "old_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "diff": "<SubSystem>Console</SubSystem>\n<TargetMachine>MachineX86</TargetMachine>\n<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>\n+ <AdditionalDependencies>\n+ </AdditionalDependencies>\n</Link>\n</ItemDefinitionGroup>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n<SubSystem>Console</SubSystem>\n+ <AdditionalDependencies>\n+ </AdditionalDependencies>\n</Link>\n</ItemDefinitionGroup>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\n<OptimizeReferences>true</OptimizeReferences>\n<EnableCOMDATFolding>true</EnableCOMDATFolding>\n<TargetMachine>MachineX86</TargetMachine>\n+ <AdditionalDependencies />\n+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>\n</Link>\n</ItemDefinitionGroup>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n</PrecompiledHeader>\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n+ <StringPooling>true</StringPooling>\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n<SubSystem>Console</SubSystem>\n<OptimizeReferences>true</OptimizeReferences>\n<EnableCOMDATFolding>true</EnableCOMDATFolding>\n+ <AdditionalDependencies>\n+ </AdditionalDependencies>\n+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>\n</Link>\n</ItemDefinitionGroup>\n<ItemGroup>\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Cleanup handling of ASTC_CODEC_INTERNAL_ERROR (#63) - Error function calls exit(), so mark as [[noreturn]]. - Remove duplicate calls to exit(). - Remove functional logic which is redundant due to erro.
61,745
08.07.2019 23:07:01
-3,600
d675f437254928e855a3dfdcf9dd2789e6908df4
Remove support for 32-bit (Win32) Windows builds
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": ".vscode\nSource/*.o\nSource/astcenc\n-Source/win32-2017/astcenc/.vs\n-Source/win32-2017/astcenc/Win32\n-Source/win32-2017/astcenc/x64\n-Source/win32-2017/astcenc/astcenc.vcxproj.user\n+Source/VS2017/.vs\n+Source/VS2017/Release\n+Source/VS2017/Debug\n+Source/VS2017/astcenc.vcxproj.user\nTestOutput\n" }, { "change_type": "DELETE", "old_path": "Binary/windows-x86/astcenc.exe", "new_path": "Binary/windows-x86/astcenc.exe", "diff": "Binary files a/Binary/windows-x86/astcenc.exe and /dev/null differ\n" }, { "change_type": "MODIFY", "old_path": "Docs/Building.md", "new_path": "Docs/Building.md", "diff": "@@ -6,11 +6,12 @@ this repository.\n## Windows\nBuilds for Windows use Visual Studio 2017, using the solution file located in\n-the `Source/win32-2017/astcenc/` directory. To compile a release build from\n-the command line, it is possible to use the `msbuild` utility:\n+the `Source/VS2017/` directory. To compile a release build from the command\n+line, it is possible to use the `msbuild` utility from the Visual Studio 2017\n+installation:\n```\n-msbuild .\\Source\\win32-2017\\astcenc\\astcenc.sln /p:Configuration=Release /p:Platform=x64\n+msbuild .\\Source\\VS2017\\astcenc.sln /p:Configuration=Release /p:Platform=x64\n```\n## macOS\n" }, { "change_type": "MODIFY", "old_path": "Jenkinsfile", "new_path": "Jenkinsfile", "diff": "@@ -12,28 +12,14 @@ pipeline {\nstage('x64 Release') {\nsteps {\nscript {\n- bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Release /p:Platform=x64\", returnStatus: false, returnStdout: false)\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\VS2017\\\\astcenc.sln /p:Configuration=Release /p:Platform=x64\", returnStatus: false, returnStdout: false)\n}\n}\n}\nstage('x64 Debug') {\nsteps {\nscript {\n- bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Debug /p:Platform=x64\", returnStatus: false, returnStdout: false)\n- }\n- }\n- }\n- stage('x86 Release') {\n- steps {\n- script {\n- bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Release /p:Platform=Win32\", returnStatus: false, returnStdout: false)\n- }\n- }\n- }\n- stage('x86 Debug') {\n- steps {\n- script {\n- bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Debug /p:Platform=Win32\", returnStatus: false, returnStdout: false)\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\VS2017\\\\astcenc.sln /p:Configuration=Debug /p:Platform=x64\", returnStatus: false, returnStdout: false)\n}\n}\n}\n@@ -41,10 +27,8 @@ pipeline {\n}\nstage('Archive') {\nsteps {\n- archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\Win32\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n- archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\Win32\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n- archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\x64\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n- archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\x64\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\VS2017\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\VS2017\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n}\n}\nstage('Test') {\n" }, { "change_type": "RENAME", "old_path": "Source/win32-2017/astcenc/astcenc.vcxproj.filters", "new_path": "Source/VS2017/astcenc.vcxproj.filters", "diff": "</Filter>\n</ItemGroup>\n<ItemGroup>\n- <ClCompile Include=\"..\\..\\astc_block_sizes2.cpp\">\n+ <ClCompile Include=\"..\\astc_averages_and_directions.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_color_quantize.cpp\">\n+ <ClCompile Include=\"..\\astc_block_sizes2.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_color_unquantize.cpp\">\n+ <ClCompile Include=\"..\\astc_color_quantize.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_compress_symbolic.cpp\">\n+ <ClCompile Include=\"..\\astc_color_unquantize.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_compute_variance.cpp\">\n+ <ClCompile Include=\"..\\astc_compress_symbolic.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_decompress_symbolic.cpp\">\n+ <ClCompile Include=\"..\\astc_compute_variance.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_encoding_choice_error.cpp\">\n+ <ClCompile Include=\"..\\astc_decompress_symbolic.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_find_best_partitioning.cpp\">\n+ <ClCompile Include=\"..\\astc_encoding_choice_error.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_image_load_store.cpp\">\n+ <ClCompile Include=\"..\\astc_find_best_partitioning.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_integer_sequence.cpp\">\n+ <ClCompile Include=\"..\\astc_ideal_endpoints_and_weights.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_kmeans_partitioning.cpp\">\n+ <ClCompile Include=\"..\\astc_image_load_store.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_ktx_dds.cpp\">\n+ <ClCompile Include=\"..\\astc_integer_sequence.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_partition_tables.cpp\">\n+ <ClCompile Include=\"..\\astc_kmeans_partitioning.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_pick_best_endpoint_format.cpp\">\n+ <ClCompile Include=\"..\\astc_ktx_dds.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_quantization.cpp\">\n+ <ClCompile Include=\"..\\astc_main.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_symbolic_physical.cpp\">\n+ <ClCompile Include=\"..\\astc_partition_tables.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_toplevel.cpp\">\n+ <ClCompile Include=\"..\\astc_percentile_tables.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\mathlib.cpp\">\n+ <ClCompile Include=\"..\\astc_pick_best_endpoint_format.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\softfloat.cpp\">\n+ <ClCompile Include=\"..\\astc_quantization.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_percentile_tables.cpp\">\n+ <ClCompile Include=\"..\\astc_stb_tga.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_averages_and_directions.cpp\">\n+ <ClCompile Include=\"..\\astc_symbolic_physical.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_stb_tga.cpp\">\n+ <ClCompile Include=\"..\\astc_toplevel.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_ideal_endpoints_and_weights.cpp\">\n+ <ClCompile Include=\"..\\astc_weight_align.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_weight_align.cpp\">\n+ <ClCompile Include=\"..\\astc_weight_quant_xfer_tables.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_weight_quant_xfer_tables.cpp\">\n+ <ClCompile Include=\"..\\mathlib.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_main.cpp\">\n+ <ClCompile Include=\"..\\softfloat.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n</ItemGroup>\n<ItemGroup>\n- <ClInclude Include=\"..\\..\\astc_codec_internals.h\">\n+ <ClInclude Include=\"..\\astc_codec_internals.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\..\\mathlib.h\">\n+ <ClInclude Include=\"..\\mathlib.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\..\\softfloat.h\">\n+ <ClInclude Include=\"..\\softfloat.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\..\\vectypes.h\">\n+ <ClInclude Include=\"..\\stb_image.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\..\\stb_image.h\">\n+ <ClInclude Include=\"..\\vectypes.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n</ItemGroup>\n" }, { "change_type": "DELETE", "old_path": "Source/win32-2017/astcenc/astcenc.vcproj", "new_path": null, "diff": "-<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n-<VisualStudioProject\n- ProjectType=\"Visual C++\"\n- Version=\"8.00\"\n- Name=\"astcenc\"\n- ProjectGUID=\"{D6D60D86-0502-446A-8498-888F78B869C2}\"\n- RootNamespace=\"astcenc\"\n- Keyword=\"Win32Proj\"\n- >\n- <Platforms>\n- <Platform\n- Name=\"Win32\"\n- />\n- </Platforms>\n- <ToolFiles>\n- </ToolFiles>\n- <Configurations>\n- <Configuration\n- Name=\"Debug|Win32\"\n- OutputDirectory=\"$(SolutionDir)$(ConfigurationName)\"\n- IntermediateDirectory=\"$(ConfigurationName)\"\n- ConfigurationType=\"1\"\n- CharacterSet=\"1\"\n- >\n- <Tool\n- Name=\"VCPreBuildEventTool\"\n- />\n- <Tool\n- Name=\"VCCustomBuildTool\"\n- />\n- <Tool\n- Name=\"VCXMLDataGeneratorTool\"\n- />\n- <Tool\n- Name=\"VCWebServiceProxyGeneratorTool\"\n- />\n- <Tool\n- Name=\"VCMIDLTool\"\n- />\n- <Tool\n- Name=\"VCCLCompilerTool\"\n- Optimization=\"0\"\n- AdditionalIncludeDirectories=\"C:\\work\\ASTC3\\codec\\win32\\astcenc\"\n- PreprocessorDefinitions=\"WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS\"\n- MinimalRebuild=\"true\"\n- BasicRuntimeChecks=\"3\"\n- RuntimeLibrary=\"3\"\n- EnableEnhancedInstructionSet=\"0\"\n- UsePrecompiledHeader=\"0\"\n- WarningLevel=\"3\"\n- Detect64BitPortabilityProblems=\"true\"\n- DebugInformationFormat=\"4\"\n- />\n- <Tool\n- Name=\"VCManagedResourceCompilerTool\"\n- />\n- <Tool\n- Name=\"VCResourceCompilerTool\"\n- />\n- <Tool\n- Name=\"VCPreLinkEventTool\"\n- />\n- <Tool\n- Name=\"VCLinkerTool\"\n- LinkIncremental=\"2\"\n- GenerateDebugInformation=\"true\"\n- SubSystem=\"1\"\n- TargetMachine=\"1\"\n- />\n- <Tool\n- Name=\"VCALinkTool\"\n- />\n- <Tool\n- Name=\"VCManifestTool\"\n- />\n- <Tool\n- Name=\"VCXDCMakeTool\"\n- />\n- <Tool\n- Name=\"VCBscMakeTool\"\n- />\n- <Tool\n- Name=\"VCFxCopTool\"\n- />\n- <Tool\n- Name=\"VCAppVerifierTool\"\n- />\n- <Tool\n- Name=\"VCWebDeploymentTool\"\n- />\n- <Tool\n- Name=\"VCPostBuildEventTool\"\n- />\n- </Configuration>\n- <Configuration\n- Name=\"Release|Win32\"\n- OutputDirectory=\"$(SolutionDir)$(ConfigurationName)\"\n- IntermediateDirectory=\"$(ConfigurationName)\"\n- ConfigurationType=\"1\"\n- CharacterSet=\"1\"\n- WholeProgramOptimization=\"1\"\n- >\n- <Tool\n- Name=\"VCPreBuildEventTool\"\n- />\n- <Tool\n- Name=\"VCCustomBuildTool\"\n- />\n- <Tool\n- Name=\"VCXMLDataGeneratorTool\"\n- />\n- <Tool\n- Name=\"VCWebServiceProxyGeneratorTool\"\n- />\n- <Tool\n- Name=\"VCMIDLTool\"\n- />\n- <Tool\n- Name=\"VCCLCompilerTool\"\n- AdditionalIncludeDirectories=\"C:\\work\\ASTC3\\codec\\win32\\astcenc\"\n- PreprocessorDefinitions=\"WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS\"\n- RuntimeLibrary=\"2\"\n- BufferSecurityCheck=\"false\"\n- EnableEnhancedInstructionSet=\"0\"\n- FloatingPointModel=\"0\"\n- UsePrecompiledHeader=\"0\"\n- WarningLevel=\"3\"\n- Detect64BitPortabilityProblems=\"true\"\n- DebugInformationFormat=\"3\"\n- />\n- <Tool\n- Name=\"VCManagedResourceCompilerTool\"\n- />\n- <Tool\n- Name=\"VCResourceCompilerTool\"\n- />\n- <Tool\n- Name=\"VCPreLinkEventTool\"\n- />\n- <Tool\n- Name=\"VCLinkerTool\"\n- LinkIncremental=\"1\"\n- GenerateDebugInformation=\"true\"\n- SubSystem=\"1\"\n- OptimizeReferences=\"2\"\n- EnableCOMDATFolding=\"2\"\n- TargetMachine=\"1\"\n- />\n- <Tool\n- Name=\"VCALinkTool\"\n- />\n- <Tool\n- Name=\"VCManifestTool\"\n- />\n- <Tool\n- Name=\"VCXDCMakeTool\"\n- />\n- <Tool\n- Name=\"VCBscMakeTool\"\n- />\n- <Tool\n- Name=\"VCFxCopTool\"\n- />\n- <Tool\n- Name=\"VCAppVerifierTool\"\n- />\n- <Tool\n- Name=\"VCWebDeploymentTool\"\n- />\n- <Tool\n- Name=\"VCPostBuildEventTool\"\n- />\n- </Configuration>\n- </Configurations>\n- <References>\n- </References>\n- <Files>\n- <Filter\n- Name=\"Source Files\"\n- Filter=\"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx\"\n- UniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\"\n- >\n- <File\n- RelativePath=\"..\\..\\astc_block_sizes2.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_color_quantize.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_color_unquantize.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_compress_symbolic.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_compute_variance.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_decompress_symbolic.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_encoding_choice_error.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_find_best_partitioning.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_ideal_endpoints_and_weights.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_image_load_store.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_integer_sequence.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_kmeans_partitioning.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_ktx_dds.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_partition_tables.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_pick_best_endpoint_format.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_quantization.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_symbolic_physical.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_toplevel.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_weight_align.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_weight_quant_xfer_tables.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\mathlib.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\softfloat.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\stb_image.c\"\n- >\n- </File>\n- </Filter>\n- <Filter\n- Name=\"Header Files\"\n- Filter=\"h;hpp;hxx;hm;inl;inc;xsd\"\n- UniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\"\n- >\n- <File\n- RelativePath=\"..\\..\\astc_codec_internals.h\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\mathlib.h\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\softfloat.h\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\vectypes.h\"\n- >\n- </File>\n- </Filter>\n- <Filter\n- Name=\"Resource Files\"\n- Filter=\"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav\"\n- UniqueIdentifier=\"{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}\"\n- >\n- </Filter>\n- </Files>\n- <Globals>\n- </Globals>\n-</VisualStudioProject>\n" }, { "change_type": "MODIFY", "old_path": "Test/runner.py", "new_path": "Test/runner.py", "diff": "@@ -239,7 +239,7 @@ def get_test_binary():\nelif sys.platform == \"darwin\":\nreturn \"./Source/astcenc\"\nelif sys.platform == \"win32\":\n- return \"./Source/win32-2017/astcenc/x64/Release/astcenc.exe\"\n+ return \"./Source/VS2017/Release/astcenc.exe\"\nassert False, \"Unknown operating system %s\" % sys.platform\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove support for 32-bit (Win32) Windows builds
61,745
09.07.2019 11:25:36
-3,600
8cbe69831abbc7279eaa447c2201e7d3dda73693
Temporary backwards compatibility for VS2013 Expect this to get removed later once the nightly build machine is upgraded to VS2017 ...
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "#include <stdlib.h>\n#include \"mathlib.h\"\n+// Temporary workaround to build machine still running VS2013\n+// Version 1910 is Visual Studio 2017\n+#if !defined(_MSC_VER) || (_MSC_VER >= 1910)\n+ #define NORETURN [[noreturn]]\n+#else\n+ #define NORETURN\n+ #define __func__ __FUNCTION__\n+#endif\n+\n#ifndef MIN\n#define MIN(x,y) ((x)<(y)?(x):(y))\n#endif\n// error reporting for codec internal errors.\n#define ASTC_CODEC_INTERNAL_ERROR() astc_codec_internal_error(__FILE__, __LINE__)\n-[[noreturn]] void astc_codec_internal_error(const char *filename, int linenumber);\n+NORETURN void astc_codec_internal_error(const char *filename, int linenumber);\n// uncomment this macro to enable checking for inappropriate NaNs;\n// works on Linux only, and slows down encoding significantly.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -149,7 +149,7 @@ unsigned get_number_of_cpus(void)\nreturn n_cpus;\n}\n-[[noreturn]] void astc_codec_internal_error(const char *filename, int linenum)\n+NORETURN void astc_codec_internal_error(const char *filename, int linenum)\n{\nprintf(\"Internal error: File=%s Line=%d\\n\", filename, linenum);\nexit(1);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Temporary backwards compatibility for VS2013 Expect this to get removed later once the nightly build machine is upgraded to VS2017 ...
61,745
14.07.2019 23:44:52
-3,600
0c749dfc0cb6b1e563348c2926be65def2add96e
Remove duplicate half table for weight alignment Current table is 256 entries, but consists of 128 entries repeated twice. This patch halves the size of the table, and clamps index values to the narrower range.
[ { "change_type": "MODIFY", "old_path": "Source/VS2017/astcenc.sln", "new_path": "Source/VS2017/astcenc.sln", "diff": "@@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"astcenc\", \"astcenc.vcxproj\", \"{D6D60D86-0502-446A-8498-888F78B869C2}\"\nEndProject\nGlobal\n+ GlobalSection(Performance) = preSolution\n+ HasPerformanceSessions = true\n+ EndGlobalSection\nGlobalSection(SolutionConfigurationPlatforms) = preSolution\nDebug|x64 = Debug|x64\nRelease|x64 = Release|x64\n@@ -22,4 +25,10 @@ Global\nGlobalSection(ExtensibilityGlobals) = postSolution\nSolutionGuid = {867DE95A-BBF0-43D6-B199-4678354DB74B}\nEndGlobalSection\n+ GlobalSection(Performance) = preSolution\n+ HasPerformanceSessions = true\n+ EndGlobalSection\n+ GlobalSection(Performance) = preSolution\n+ HasPerformanceSessions = true\n+ EndGlobalSection\nEndGlobal\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_align.cpp", "new_path": "Source/astc_weight_align.cpp", "diff": "@@ -186,37 +186,16 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nint8_t * lowest_weight, int8_t * highest_weight,\nfloat *error, float *cut_low_weight_error, float *cut_high_weight_error)\n{\n- int i;\n-\n- int sp;\n-\nfloat error_from_forcing_weight_down[60];\nfloat error_from_forcing_weight_either_way[60];\n- for (i = 0; i < 60; i++)\n+ for (int i = 0; i < 60; i++)\n{\nerror_from_forcing_weight_down[i] = 0;\nerror_from_forcing_weight_either_way[i] = 0;\n}\n// weight + 12\n- static const unsigned int idxtab[256] = {\n- 12, 13, 14, 15, 16, 17, 18, 19,\n- 20, 21, 22, 23, 24, 25, 26, 27,\n- 28, 29, 30, 31, 32, 33, 34, 35,\n- 36, 37, 38, 39, 40, 41, 42, 43,\n- 44, 45, 46, 47, 48, 49, 50, 51,\n- 52, 53, 54, 55, 55, 55, 55, 55,\n- 55, 55, 55, 55, 55, 55, 55, 55,\n- 55, 55, 55, 55, 55, 55, 55, 55,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 1, 2, 3,\n- 4, 5, 6, 7, 8, 9, 10, 11,\n-\n+ static const unsigned int idxtab[128] = {\n12, 13, 14, 15, 16, 17, 18, 19,\n20, 21, 22, 23, 24, 25, 26, 27,\n28, 29, 30, 31, 32, 33, 34, 35,\n@@ -235,7 +214,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\n4, 5, 6, 7, 8, 9, 10, 11\n};\n- for (sp = 0; sp < max_angular_steps; sp++)\n+ for (int sp = 0; sp < max_angular_steps; sp++)\n{\nunsigned int minidx_bias12 = 55;\nunsigned int maxidx_bias12 = 0;\n@@ -247,7 +226,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nfloat scaled_offset = rcp_stepsize * offset;\n- for (i = 0; i < samplecount - 1; i += 2)\n+ for (int i = 0; i < samplecount - 1; i += 2)\n{\nfloat wt1 = sample_weights[i];\nfloat wt2 = sample_weights[i + 1];\n@@ -265,8 +244,8 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nerrval += (dif2 * wt2) * dif2;\n// table lookups that really perform a minmax function.\n- unsigned int idx1_bias12 = idxtab[p1.u & 0xFF];\n- unsigned int idx2_bias12 = idxtab[p2.u & 0xFF];\n+ unsigned int idx1_bias12 = idxtab[p1.u & 0x7F];\n+ unsigned int idx2_bias12 = idxtab[p2.u & 0x7F];\nif (idx1_bias12 < minidx_bias12)\nminidx_bias12 = idx1_bias12;\n@@ -286,7 +265,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nif (samplecount & 1)\n{\n- i = samplecount - 1;\n+ int i = samplecount - 1;\nfloat wt = sample_weights[i];\nif32 p;\nfloat sval = (samples[i] * rcp_stepsize) - scaled_offset;\n@@ -296,7 +275,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nerrval += (dif * wt) * dif;\n- unsigned int idx_bias12 = idxtab[p.u & 0xFF];\n+ unsigned int idx_bias12 = idxtab[p.u & 0x7F];\nif (idx_bias12 < minidx_bias12)\nminidx_bias12 = idx_bias12;\n@@ -307,7 +286,6 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nerror_from_forcing_weight_down[idx_bias12] += dif * wt;\n}\n-\nlowest_weight[sp] = (int)minidx_bias12 - 12;\nhighest_weight[sp] = (int)maxidx_bias12 - 12;\nerror[sp] = errval;\n@@ -320,8 +298,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\n// clear out the error-from-forcing values we actually used in this pass\n// so that these are clean for the next pass.\n- unsigned int ui;\n- for (ui = minidx_bias12 & ~0x3; ui <= maxidx_bias12; ui += 4)\n+ for (unsigned int ui = minidx_bias12 & ~0x3; ui <= maxidx_bias12; ui += 4)\n{\nerror_from_forcing_weight_either_way[ui] = 0;\nerror_from_forcing_weight_down[ui] = 0;\n@@ -334,7 +311,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\n}\n}\n- for (sp = 0; sp < max_angular_steps; sp++)\n+ for (int sp = 0; sp < max_angular_steps; sp++)\n{\nfloat errscale = stepsizes_sqr[sp];\nerror[sp] *= errscale;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove duplicate half table for weight alignment (#66) Current table is 256 entries, but consists of 128 entries repeated twice. This patch halves the size of the table, and clamps index values to the narrower range.
61,744
05.09.2019 22:08:07
-10,800
e811f4abf83b60a6e512b48aa50288ebdf6f53d1
Fixed parse -va commandline argument
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -1443,7 +1443,7 @@ int astc_main(int argc, char **argv)\nprintf(\"-va switch with less than 4 arguments, quitting\\n\");\nexit(1);\n}\n- ewp.alpha_power = static_cast < float >(atof(argv[argidx - 5]));\n+ ewp.alpha_power = static_cast < float >(atof(argv[argidx - 4]));\newp.alpha_base_weight = static_cast < float >(atof(argv[argidx - 3]));\newp.alpha_mean_weight = static_cast < float >(atof(argv[argidx - 2]));\newp.alpha_stdev_weight = static_cast < float >(atof(argv[argidx - 1]));\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fixed parse -va commandline argument (#68)
61,756
05.09.2019 12:11:23
25,200
64c718ed55a298b3a517b7767fcc2bdb063dc63c
Fix GCC 8 compile warnings
[ { "change_type": "MODIFY", "old_path": "Source/vectypes.h", "new_path": "Source/vectypes.h", "diff": "@@ -13364,361 +13364,362 @@ static inline ushort4 convert_ushort4(ushort4 p)\nstatic inline float2 as_float2(float2 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(float2 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(float2 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline double2 as_double2(double2 inp)\n{\ndouble2 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline float2 as_float2(int2 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(int2 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(int2 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float2 as_float2(uint2 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(uint2 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(uint2 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline short2 as_short2(short2 inp)\n{\nshort2 val1;\n- memcpy(&val1, &inp, 4);\n+ memcpy((void*)&val1, &inp, 4);\nreturn val1;\n}\nstatic inline ushort2 as_ushort2(short2 inp)\n{\nushort2 val1;\n- memcpy(&val1, &inp, 4);\n+ memcpy((void*)&val1, &inp, 4);\nreturn val1;\n}\nstatic inline short2 as_short2(ushort2 inp)\n{\nshort2 val1;\n- memcpy(&val1, &inp, 4);\n+ memcpy((void*)&val1, &inp, 4);\nreturn val1;\n}\nstatic inline ushort2 as_ushort2(ushort2 inp)\n{\nushort2 val1;\n- memcpy(&val1, &inp, 4);\n+ memcpy((void*)&val1, &inp, 4);\nreturn val1;\n}\nstatic inline short4 as_short4(float2 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(float2 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float4 as_float4(double2 inp)\n{\nfloat4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline int4 as_int4(double2 inp)\n{\nint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline uint4 as_uint4(double2 inp)\n{\nuint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline short4 as_short4(int2 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(int2 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline short4 as_short4(uint2 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(uint2 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float3 as_float3(float3 inp)\n{\nfloat3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline int3 as_int3(float3 inp)\n{\nint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline uint3 as_uint3(float3 inp)\n{\nuint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline double3 as_double3(double3 inp)\n{\ndouble3 val1;\n- memcpy(&val1, &inp, 24);\n+ memcpy((void*)&val1, &inp, 24);\nreturn val1;\n}\n+\nstatic inline float3 as_float3(int3 inp)\n{\nfloat3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline int3 as_int3(int3 inp)\n{\nint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline uint3 as_uint3(int3 inp)\n{\nuint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline float3 as_float3(uint3 inp)\n{\nfloat3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline int3 as_int3(uint3 inp)\n{\nint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline uint3 as_uint3(uint3 inp)\n{\nuint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline short3 as_short3(short3 inp)\n{\nshort3 val1;\n- memcpy(&val1, &inp, 6);\n+ memcpy((void*)&val1, &inp, 6);\nreturn val1;\n}\nstatic inline ushort3 as_ushort3(short3 inp)\n{\nushort3 val1;\n- memcpy(&val1, &inp, 6);\n+ memcpy((void*)&val1, &inp, 6);\nreturn val1;\n}\nstatic inline short3 as_short3(ushort3 inp)\n{\nshort3 val1;\n- memcpy(&val1, &inp, 6);\n+ memcpy((void*)&val1, &inp, 6);\nreturn val1;\n}\nstatic inline ushort3 as_ushort3(ushort3 inp)\n{\nushort3 val1;\n- memcpy(&val1, &inp, 6);\n+ memcpy((void*)&val1, &inp, 6);\nreturn val1;\n}\nstatic inline double2 as_double2(float4 inp)\n{\ndouble2 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline double2 as_double2(int4 inp)\n{\ndouble2 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline double2 as_double2(uint4 inp)\n{\ndouble2 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline float2 as_float2(short4 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(short4 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(short4 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float2 as_float2(ushort4 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(ushort4 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(ushort4 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float4 as_float4(float4 inp)\n{\nfloat4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline int4 as_int4(float4 inp)\n{\nint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline uint4 as_uint4(float4 inp)\n{\nuint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline double4 as_double4(double4 inp)\n{\ndouble4 val1;\n- memcpy(&val1, &inp, 32);\n+ memcpy((void*)&val1, &inp, 32);\nreturn val1;\n}\nstatic inline float4 as_float4(int4 inp)\n{\nfloat4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline int4 as_int4(int4 inp)\n{\nint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline uint4 as_uint4(int4 inp)\n{\nuint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline float4 as_float4(uint4 inp)\n{\nfloat4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline int4 as_int4(uint4 inp)\n{\nint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline uint4 as_uint4(uint4 inp)\n{\nuint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline short4 as_short4(short4 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(short4 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline short4 as_short4(ushort4 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(ushort4 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix GCC 8 compile warnings
61,745
28.11.2019 16:56:21
0
fd077aba89e1862f6b0583070a085e736393068e
Add RGBM encoding blockify helper utility
[ { "change_type": "ADD", "old_path": null, "new_path": "Utils/astc_rgbm_blockify.cpp", "diff": "+\n+// ----------------------------------------------------------------------------\n+// This confidential and proprietary software may be used only as authorised\n+// by a licensing agreement from Arm Limited.\n+// (C) COPYRIGHT 2019 Arm Limited, ALL RIGHTS RESERVED\n+// The entire notice above must be reproduced on all authorised copies and\n+// copies may only be made to the extent permitted by a licensing agreement\n+// from Arm Limited.\n+// ----------------------------------------------------------------------------\n+\n+// This is a utility tool to blockify the M channel of an RGBM image, writing\n+// the result back to a file on disk.\n+//\n+// This tool requires stb_image.h and stb_image_write.h single header libraries\n+// from: https://github.com/nothings/stb.\n+\n+#include <stdint.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+\n+#define STB_IMAGE_IMPLEMENTATION\n+#include \"stb_image.h\"\n+\n+#define STB_IMAGE_WRITE_IMPLEMENTATION\n+#include \"stb_image_write.h\"\n+\n+// Force val[N+1] to be contrained to not be less than val[N]*(R/256)\n+void impose_ratio(uint8_t *data, int length, int stride, uint32_t ratio) {\n+ uint8_t val = *data;\n+ for (int i = 1; i < length; i++) {\n+ data += stride;\n+\n+ int min_val = (val * ratio) >> 8;\n+ uint8_t vl2 = *data;\n+ if (vl2 < min_val) {\n+ *data = vl2 = min_val;\n+ }\n+ val = vl2;\n+ }\n+}\n+\n+int main( int argc, char **argv ) {\n+ // Parse command line\n+ if (argc < 5) {\n+ printf(\"Usage:\\n\"\n+ \" %s <source> <dest> <blocksize> <ratio>\\n\"\n+ \"where the arguments are:\\n\"\n+ \"\\n\"\n+ \"<source> : Source image in RGBM representation.\\n\"\n+ \"<dest> : Destination PNG image file to write.\\n\"\n+ \"<blocksize> : ASTC block size we are blockifying for; e.g. 6x6.\\n\"\n+ \"<ratio> : The maximum permitted ratio of M between two\\n\"\n+ \" adjacent blocks. Can be set to any value between\\n\"\n+ \" 0.01 and 0.99. Recommend 0.7 to start with.\\n\"\n+ , argv[0]);\n+ exit(1);\n+ }\n+\n+ int x_blockdim, y_blockdim;\n+ if (sscanf(argv[3], \"%dx%d\", &x_blockdim, &y_blockdim) < 2) {\n+ printf(\"Blockdim must be of form WxH; e.g. 8x4\\n\");\n+ exit(1);\n+ }\n+\n+ double ratio_f = atof(argv[4]);\n+ if (ratio_f < 0.01 || ratio_f > 0.99) {\n+ printf(\"Ratio parameter must be in range 0.01 to 0.99\\n\");\n+ }\n+\n+ int ratio_i = (int)floor(ratio_f * 256.0 + 0.5);\n+\n+ // Load the image\n+ int xdim, ydim, ncomp;\n+ uint8_t *data = (uint8_t *)stbi_load(argv[1], &xdim, &ydim, &ncomp, 4);\n+ if (!data) {\n+ printf(\"Failed to load image \\\"%s\\\"\\n\", data );\n+ exit(1);\n+ }\n+\n+ int x_blockcount = (xdim + x_blockdim - 1) / x_blockdim;\n+ int y_blockcount = (ydim + y_blockdim - 1) / y_blockdim;\n+ int y_leftover = y_blockdim * y_blockcount - ydim;\n+\n+ uint8_t *mbuf = (uint8_t *)calloc(x_blockcount * y_blockcount, 1);\n+\n+ // For each block, obtain the maximum M-value\n+ for (int y = 0; y < ydim; y++) {\n+ int ctr = 0;\n+ uint8_t *s = data + 4 * y * xdim + 3;\n+ uint8_t *d = mbuf + ((y + y_leftover) / y_blockdim) * x_blockcount;\n+\n+ int accum = *d;\n+ for (int x = 0; x < xdim; x++) {\n+ uint8_t p = s[4*x];\n+ if (p > accum) {\n+ accum = p;\n+ }\n+\n+ if(++ctr == x_blockdim) {\n+ *d++ = accum;\n+ accum = *d;\n+ ctr = 0;\n+ }\n+ }\n+\n+ if (ctr != 0) {\n+ *d = accum;\n+ }\n+ }\n+\n+ // Impose ratio restriction on M-values in adjacent blocks.\n+ for (int y = 0; y < y_blockcount; y++) {\n+ impose_ratio(mbuf + y * x_blockcount, x_blockcount, 1, ratio_i);\n+ impose_ratio(mbuf + ((y + 1) * x_blockcount) - 1, x_blockcount, - 1, ratio_i);\n+ }\n+\n+ for (int x = 0; x < x_blockcount; x++) {\n+ impose_ratio(mbuf + x, y_blockcount, x_blockcount, ratio_i);\n+ impose_ratio(mbuf + x + (x_blockcount * (y_blockcount - 1)), y_blockcount, -x_blockcount, ratio_i);\n+ }\n+\n+ // For each pixel, scale the pixel RGB values based on chosen M\n+ for (int y = 0; y < ydim; y++) {\n+ int ctr = 0;\n+ uint8_t *s = data + 4 * y * xdim;\n+ uint8_t *d = mbuf + ((y + y_leftover) / y_blockdim) * x_blockcount;\n+ int mm = *d++;\n+ for (int x = 0; x < xdim; x++) {\n+ uint8_t m = s[4 * x + 3];\n+ if(m != mm) {\n+ uint8_t r = s[4 * x];\n+ uint8_t g = s[4 * x + 1];\n+ uint8_t b = s[4 * x + 2];\n+ s[4 * x] = (r * m + (mm >> 1)) / mm;\n+ s[4 * x + 1] = (g * m + (mm >> 1)) / mm;\n+ s[4 * x + 2] = (b * m + (mm >> 1)) / mm;\n+ s[4 * x + 3] = mm;\n+ }\n+\n+ if (++ctr == x_blockdim) {\n+ ctr = 0;\n+ mm = *d++;\n+ }\n+ }\n+ }\n+\n+ // Write out the result\n+ stbi_write_png(argv[2], xdim, ydim, 4, data, 4*xdim);\n+ return 0;\n+}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add RGBM encoding blockify helper utility
61,745
02.01.2020 23:18:01
0
917c08aeb2677c3c9693119ed2e4e3244fc2d90c
Improve Make build Enable more warnings Improve log clarity
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -43,16 +43,19 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -std=c++11 -O3 -Wall -W -Wextra -Werror=shadow -msse2 -mfpmath=sse\n+CPPFLAGS = -std=c++11 -O3 -Wall -W -Wall -Wextra -Wpedantic -Werror -Werror=shadow -msse2 -mfpmath=sse\nastcenc: $(OBJECTS)\n- g++ -o $@ $^ $(CPPFLAGS) -lpthread\n+ @g++ -o $@ $^ $(CPPFLAGS) -lpthread\n+ @echo \"[Link] $@\"\n$(OBJECTS): %.o: %.cpp $(HEADERS)\n- g++ -c -o $@ $< $(CPPFLAGS)\n+ @g++ -c -o $@ $< $(CPPFLAGS)\n+ @echo \"[C++] $<\"\nclean:\n- rm -f *.o\n- rm -f *.obj\n- rm -f astcenc\n- rm -f astcenc.exe\n+ @rm -f *.o\n+ @rm -f *.obj\n+ @rm -f astcenc\n+ @rm -f astcenc.exe\n+ @echo \"[Clean] Removing build outputs\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -2090,7 +2090,7 @@ int astc_main(int argc, char **argv)\nargidx++;\n// Read array size (image depth).\n- if (!sscanf(argv[argidx], \"%u\", &array_size) || array_size == 0)\n+ if (!sscanf(argv[argidx], \"%d\", &array_size) || array_size == 0)\n{\nprintf(\"Invalid array size (image depth) given with -array option: \\\"%s\\\".\\n\", argv[argidx]);\nexit(1);\n" }, { "change_type": "MODIFY", "old_path": "Source/stb_image.h", "new_path": "Source/stb_image.h", "diff": "@@ -994,7 +994,7 @@ STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip)\nstbi__vertically_flip_on_load = flag_true_if_should_flip;\n}\n-static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc)\n+static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri)\n{\nmemset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields\nri->bits_per_channel = 8; // default is 8 so most paths don't have to be changed\n@@ -1112,7 +1112,7 @@ static void stbi__vertical_flip_slices(void *image, int w, int h, int z, int byt\nstatic unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\nstbi__result_info ri;\n- void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8);\n+ void *result = stbi__load_main(s, x, y, comp, req_comp, &ri);\nif (result == NULL)\nreturn NULL;\n@@ -1136,7 +1136,7 @@ static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x,\nstatic stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\nstbi__result_info ri;\n- void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 16);\n+ void *result = stbi__load_main(s, x, y, comp, req_comp, &ri);\nif (result == NULL)\nreturn NULL;\n@@ -5103,7 +5103,7 @@ static int stbi__shiftsigned(unsigned int v, int shift, int bits)\nv <<= -shift;\nelse\nv >>= shift;\n- STBI_ASSERT(v >= 0 && v < 256);\n+ STBI_ASSERT(v < 256);\nv >>= (8-bits);\nSTBI_ASSERT(bits >= 0 && bits <= 8);\nreturn (int) ((unsigned) v * mul_table[bits]) >> shift_table[bits];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Improve Make build - Enable more warnings - Improve log clarity
61,745
03.01.2020 00:08:20
0
7b4415478a9d790536f2fc998165a174e61d64e1
Add helper scripts for profiling
[ { "change_type": "ADD", "old_path": null, "new_path": "Test/astc_run.py", "diff": "+#!/usr/bin/env python3\n+# -----------------------------------------------------------------------------\n+# This confidential and proprietary software may be used only as authorised by\n+# a licensing agreement from Arm Limited.\n+# (C) COPYRIGHT 2019-2020 Arm Limited, ALL RIGHTS RESERVED\n+# The entire notice above must be reproduced on all authorised copies and\n+# copies may only be made to the extent permitted by a licensing agreement from\n+# Arm Limited.\n+# -----------------------------------------------------------------------------\n+\n+import argparse\n+import os\n+from PIL import Image\n+import re\n+import shutil\n+import subprocess as sp\n+import sys\n+\n+\n+class TestImage():\n+ \"\"\"\n+ A single test definition, and the test results if it is actually run.\n+ \"\"\"\n+\n+ def __init__(self, filePath):\n+ \"\"\"\n+ Construct a new test definition.\n+ \"\"\"\n+ # Remove any leading \"./\" or \".\\\" prefix\n+ if filePath.startswith(\"./\") or filePath.startswith(\".\\\\\"):\n+ filePath = filePath[2:]\n+\n+ name = os.path.basename(filePath)\n+ nameParts = name.split(\"-\")\n+\n+ self.filePath = filePath\n+ self.dynamicRange = nameParts[0]\n+ self.format = nameParts[1]\n+\n+ def run_once(self, testBinary, blockSize, profile):\n+ \"\"\"\n+ Run a single compression pass.\n+ \"\"\"\n+ pathParts = splitall(self.filePath)\n+\n+ # Create the test output directory if it doesn't exist\n+ outDir = os.path.join(\"TestOutput\", \"Images\", pathParts[2], blockSize)\n+ os.makedirs(outDir, exist_ok=True)\n+\n+ if self.dynamicRange == \"ldr\":\n+ outFile = pathParts[-1].replace(\".png\", \".tga\")\n+ else:\n+ outFile = pathParts[-1].replace(\".hdr\", \".htga\")\n+ outFilePath = os.path.join(outDir, outFile)\n+\n+ if self.dynamicRange == \"ldr\":\n+ outFile = pathParts[-1].replace(\".png\", \"-out.png\")\n+ outFilePath2 = os.path.join(outDir, outFile)\n+\n+ # Run the compressor\n+ args = [testBinary, \"-t\", self.filePath, outFilePath,\n+ blockSize, \"-thorough\", \"-time\", \"-showpsnr\", \"-silentmode\"]\n+\n+ # Switch normal maps into angular error metrics\n+ if self.format == \"xy\":\n+ args.append(\"-normal_psnr\")\n+\n+ # Inject the callgrind profiler prefix\n+ if profile:\n+ args.insert(0, \"--callgrind-out-file=callgrind.out\")\n+ args.insert(0, \"--tool=callgrind\")\n+ args.insert(0, \"valgrind\")\n+ if os.path.exists(\"callgrind.out\"):\n+ os.remove(\"callgrind.out\")\n+ if os.path.exists(\"callgrind.dot\"):\n+ os.remove(\"callgrind.dot\")\n+ if os.path.exists(\"callgrind.png\"):\n+ os.remove(\"callgrind.png\")\n+\n+ try:\n+ result = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\n+ check=True, universal_newlines=True)\n+ except (OSError, sp.CalledProcessError):\n+ print(\"ERROR: Test run failed\")\n+ print(\" + %s\" % \" \".join(args))\n+ sys.exit(1)\n+\n+ # Convert the TGA to PNG and delete the TGA (LDR only)\n+ if self.dynamicRange == \"ldr\":\n+ im = Image.open(outFilePath)\n+ im.save(outFilePath2)\n+ os.remove(outFilePath)\n+ outFilePath = outFilePath2\n+\n+ # Create log parsing patterns\n+ if self.dynamicRange == \"ldr\":\n+ if self.format in (\"rgb\", \"xy\"):\n+ patternPSNR = \"PSNR \\\\(LDR-RGB\\\\): ([0-9.]*) dB\"\n+ elif self.format == \"rgba\":\n+ patternPSNR = \"PSNR \\\\(LDR-RGBA\\\\): ([0-9.]*) dB\"\n+ else:\n+ assert False, \"Unsupported LDR color format %s\" % self.format\n+ else:\n+ patternPSNR = \"PSNR \\\\(RGB normalized to peak\\\\): ([0-9.]*) dB\"\n+\n+ patternPSNR = re.compile(patternPSNR)\n+ patternTime = re.compile(\".* coding time: ([0-9.]*) seconds\")\n+\n+ # Extract results from the log\n+ runPSNR = None\n+ runTime = None\n+\n+ for line in result.stdout.splitlines():\n+ match = patternPSNR.match(line)\n+ if match:\n+ runPSNR = float(match.group(1))\n+\n+ match = patternTime.match(line)\n+ if match:\n+ runTime = float(match.group(1))\n+\n+ # Convert the callgrind log to an image\n+ if profile:\n+ os.system(\"gprof2dot ./callgrind.out -f callgrind -s -z \\\"astc_main(int, char*)\\\" > callgrind.dot\")\n+ os.system(\"dot -Tpng callgrind.dot -o callgrind.png\")\n+ os.remove(\"callgrind.dot\")\n+\n+ assert runPSNR is not None, \"No coding PSNR found %s\" % result.stdout\n+ assert runTime is not None, \"No coding time found %s\" % result.stdout\n+ return (runPSNR, runTime, outFilePath)\n+\n+\n+def splitall(path):\n+ \"\"\"\n+ Completely tokenize a path into its component pieces.\n+ \"\"\"\n+ allparts = []\n+ while True:\n+ parts = os.path.split(path)\n+ if parts[0] == path:\n+ allparts.insert(0, parts[0])\n+ break\n+ elif parts[1] == path:\n+ allparts.insert(0, parts[1])\n+ break\n+ else:\n+ path = parts[0]\n+ allparts.insert(0, parts[1])\n+\n+ return allparts\n+\n+\n+def get_test_binary():\n+ \"\"\"\n+ Return the test binary path for the current host machine.\n+ \"\"\"\n+ if \"linux\" in sys.platform:\n+ return \"./Source/astcenc\"\n+ elif sys.platform == \"darwin\":\n+ return \"./Source/astcenc\"\n+ elif sys.platform == \"win32\":\n+ return \"./Source/VS2017/Release/astcenc.exe\"\n+\n+ assert False, \"Unknown operating system %s\" % sys.platform\n+\n+\n+def get_reference_binary():\n+ \"\"\"\n+ Return the reference binary path for the current host machine.\n+ \"\"\"\n+ if \"linux\" in sys.platform:\n+ return \"./Binary/linux-x64/astcenc\"\n+ elif sys.platform == \"darwin\":\n+ return \"./Binary/mac-x64/astcenc\"\n+ elif sys.platform == \"win32\":\n+ return \"./Binary/windows-x64/astcenc.exe\"\n+\n+ assert False, \"Unknown operating system %s\" % sys.platform\n+\n+\n+def parse_command_line():\n+ \"\"\"\n+ Parse the command line.\n+ \"\"\"\n+\n+ parser = argparse.ArgumentParser()\n+\n+ parser.add_argument(\"image\", help=\"image to compress\")\n+\n+ parser.add_argument(\"block\", nargs=\"?\", default=\"6x6\",\n+ choices=[\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\n+ help=\"block size\")\n+\n+ parser.add_argument(\"--profile\", dest=\"profile\", default=False,\n+ action=\"store_true\", help=\"use callgrind profiler\")\n+\n+ parser.add_argument(\"--reference\", dest=\"useReference\", default=False,\n+ action=\"store_true\", help=\"use reference binary\")\n+\n+ parser.add_argument(\"--repeats\", dest=\"testRepeats\", default=1,\n+ type=int, help=\"test iteration count\")\n+\n+ parser.add_argument(\"--warmup\", dest=\"testWarmups\", default=0,\n+ type=int, help=\"warmup iteration count\")\n+\n+ args = parser.parse_args()\n+ return args\n+\n+\n+def main():\n+ \"\"\"\n+ The main function.\n+ \"\"\"\n+ # Parse command lines\n+ args = parse_command_line()\n+\n+ app = get_test_binary()\n+ if args.useReference:\n+ app = get_reference_binary()\n+\n+ image = TestImage(args.image)\n+\n+ # Run the test scenario\n+ times = []\n+ for _ in range(0, args.testRepeats + args.testWarmups):\n+ psnr, secs, output = image.run_once(app, args.block, args.profile)\n+ times.append(secs)\n+\n+ # Strip off the warmup times and average the rest\n+ times = times[args.testWarmups:]\n+ secs = sum(times) / len(times)\n+\n+ # Print summary results\n+ print(\"PSNR: %0.3f dB\" % psnr)\n+ print(\"Time: %0.3f s (avg of %u runs)\" % (secs, len(times)))\n+ print(\"Image: %s\" % output)\n+\n+\n+if __name__ == \"__main__\":\n+ sys.exit(main())\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/astc_size.py", "diff": "+#!/usr/bin/env python3\n+# -----------------------------------------------------------------------------\n+# This confidential and proprietary software may be used only as authorised by\n+# a licensing agreement from Arm Limited.\n+# (C) COPYRIGHT 2019-2020 Arm Limited, ALL RIGHTS RESERVED\n+# The entire notice above must be reproduced on all authorised copies and\n+# copies may only be made to the extent permitted by a licensing agreement from\n+# Arm Limited.\n+# -----------------------------------------------------------------------------\n+\n+import argparse\n+import os\n+import shutil\n+import subprocess as sp\n+import sys\n+\n+\n+def get_test_binary():\n+ \"\"\"\n+ Return the test binary path for the current host machine.\n+ \"\"\"\n+ return \"./Source/astcenc\"\n+\n+\n+def get_reference_binary():\n+ \"\"\"\n+ Return the reference binary path for the current host machine.\n+ \"\"\"\n+ return \"./Binary/linux-x64/astcenc\"\n+\n+\n+def run_size(binary):\n+ args = [\"size\", binary]\n+ result = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\n+ check=True, universal_newlines=True)\n+\n+ lines = result.stdout.splitlines()\n+ assert len(lines) == 2\n+ values = lines[1].split()\n+\n+ codeSection = float(values[0])\n+ roSection = float(values[1])\n+ ziSection = float(values[2])\n+ return (codeSection, roSection, ziSection)\n+\n+\n+def main():\n+ \"\"\"\n+ The main function.\n+ \"\"\"\n+ refApp = get_reference_binary()\n+ newApp = get_test_binary()\n+\n+ refSize = run_size(refApp)\n+ newSize = run_size(newApp)\n+\n+ print(\"%8s % 8s % 8s % 8s\" % (\"\", \"Code\", \"RO\", \"ZI\"))\n+ print(\"%8s % 8u % 8u % 8u\" % (\"Ref\", *refSize))\n+ print(\"%8s % 8u % 8u % 8u\" % (\"New\", *newSize))\n+\n+ diffAbs = []\n+ diffRel = []\n+ for a, b in zip(refSize, newSize):\n+ diff = b - a\n+ diffAbs.append(diff)\n+ rel = diff / a\n+ diffRel.append((diff / a) * 100.0)\n+\n+ print(\"%8s % 8u % 8u % 8u\" % (\"Abs D\", *diffAbs))\n+ print(\"%8s % 7.2f%% % 7.2f%% % 7.2f%%\" % (\"Rel D\", *diffRel))\n+\n+\n+if __name__ == \"__main__\":\n+ sys.exit(main())\n" }, { "change_type": "RENAME", "old_path": "Test/reference.csv", "new_path": "Test/astc_test_reference.csv", "diff": "" }, { "change_type": "RENAME", "old_path": "Test/runner.py", "new_path": "Test/astc_test_run.py", "diff": "# -----------------------------------------------------------------------------\n# This confidential and proprietary software may be used only as authorised by\n# a licensing agreement from Arm Limited.\n-# (C) COPYRIGHT 2019 Arm Limited, ALL RIGHTS RESERVED\n+# (C) COPYRIGHT 2019-2020 Arm Limited, ALL RIGHTS RESERVED\n# The entire notice above must be reproduced on all authorised copies and\n# copies may only be made to the extent permitted by a licensing agreement from\n# Arm Limited.\n@@ -28,6 +28,8 @@ else:\nTEST_EXTENSIONS = [\".png\", \".hdr\"]\n+TEST_REFERENCE = \"Test/astc_test_reference.csv\"\n+\nclass TestReference():\n\"\"\"\n@@ -129,12 +131,13 @@ class TestImage():\nargs.append(\"-normal_psnr\")\ntry:\n- result = sp.run(args, capture_output=True, check=True, text=True)\n- except OSError:\n- print(args)\n+ result = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\n+ check=True, universal_newlines=True)\n+ except (OSError, sp.CalledProcessError):\n+ print(\"ERROR: Test run failed\")\n+ print(\" + %s\" % \" \".join(args))\nsys.exit(1)\n-\n# Convert the TGA to PNG and delete the TGA (LDR only)\nif self.dynamicRange == \"ldr\":\nim = Image.open(outFilePath)\n@@ -294,7 +297,7 @@ def get_test_reference_scores():\nReturn the test reference score listing.\n\"\"\"\nreferenceResults = []\n- with open('Test/reference.csv') as csvfile:\n+ with open(TEST_REFERENCE) as csvfile:\nreader = csv.reader(csvfile)\nnext(reader)\nfor row in reader:\n@@ -329,23 +332,27 @@ def run_tests(args):\nmaxCount = len(args.testBlockSize) * len(testList)\ncurCount = 0\n+ statRun = 0\n+ statSkip = 0\n+ statPass = 0\n+\nfor blockSize in args.testBlockSize:\nfor test in testList:\ncurCount += 1\n# Skip tests not enabled for the current testing throughness level\nif args.testLevel not in test.useLevel:\n- # TODO: Flag these as skipped in juxml?\n+ statSkip += 1\ncontinue\n# Skip tests not enabled for the current dynamic range level\nif args.testRange not in test.useRange:\n- # TODO: Flag these as skipped in juxml?\n+ statSkip += 1\ncontinue\n# Skip tests not enabled for the current data format\nif args.testFormat not in test.useFormat:\n- # TODO: Flag these as skipped in juxml?\n+ statSkip += 1\ncontinue\n# Start a new suite if the format changes\n@@ -362,6 +369,12 @@ def run_tests(args):\ndat = (curCount, maxCount, test.name, blockSize,\ntest.runPSNR[blockSize], test.runTime[blockSize],\ntest.status[blockSize])\n+\n+ # Log results\n+ statRun += 1\n+ if \"pass\" in test.status[blockSize]:\n+ statPass += 1\n+\nlog = \"Ran test %u/%u: %s %s, %0.3f dB, %0.3f s, %s\" % dat\nprint(\" + %s\" % log)\n@@ -377,6 +390,13 @@ def run_tests(args):\nmsg = \"PSNR fail %0.3f dB is worse than %s dB\" % dat\ncase.add_failure_info(msg)\n+ # Print summary results\n+ print(\"\\nSummary\")\n+ if statRun == statPass:\n+ print(\"+ PASS (%u ran)\" % statRun)\n+ else:\n+ print(\"+ FAIL (%u ran, %u failed)\" % (statRun, statRun - statPass))\n+\n# Write the JUnit results file\nwith open(\"TestOutput/results.xml\", \"w\") as fileHandle:\njuxml.TestSuite.to_file(fileHandle, suites)\n@@ -420,7 +440,7 @@ def run_reference_rebuild():\nprint(\" + %s dB / %s s\" % (runPSNR, runTime))\n# Write CSV\n- with open(\"Test/reference.csv\", \"w\", newline=\"\") as fileHandle:\n+ with open(TEST_REFERENCE, \"w\", newline=\"\") as fileHandle:\nwriter = csv.writer(fileHandle)\nwriter.writerow([\"Name\", \"Block Size\", \"PSNR (dB)\", \"Time (s)\"])\nfor blockSize in TEST_BLOCK_SIZES:\n@@ -439,7 +459,7 @@ def run_reference_update():\nTestImage.testRuns = 1\nTestImage.warmupRuns = 0\nelse:\n- TestImage.testRuns = 10\n+ TestImage.testRuns = 3\nTestImage.warmupRuns = 1\n# Delete and recreate test output location\n@@ -473,7 +493,7 @@ def run_reference_update():\nprint(\" + %s dB / %s s\" % (runPSNR, runTime))\n# Write CSV\n- with open(\"Test/reference.csv\", \"w\", newline=\"\") as fileHandle:\n+ with open(TEST_REFERENCE, \"w\", newline=\"\") as fileHandle:\nwriter = csv.writer(fileHandle)\nwriter.writerow([\"Name\", \"Block Size\", \"PSNR (dB)\", \"Time (s)\"])\nfor blockSize in TEST_BLOCK_SIZES:\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add helper scripts for profiling
61,745
03.01.2020 00:17:02
0
c4ff635a28aa2295687b8d6af7151965b987fe6f
Disable compressor diagnostic support by default
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -58,9 +58,9 @@ NORETURN void astc_codec_internal_error(const char *filename, int linenumber);\n// works on Linux only, and slows down encoding significantly.\n// #define DEBUG_CAPTURE_NAN\n-// the PRINT_DIAGNOSTICS macro enables the -diag command line switch,\n-// which can be used to look for codec bugs\n-#define DEBUG_PRINT_DIAGNOSTICS\n+// uncomment this macro to enable the ability to log diagnostics using the\n+// -diag command line switch, which is useful for bug hunting in the encoder\n+// #define DEBUG_PRINT_DIAGNOSTICS\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nextern int print_diagnostics;\n@@ -620,7 +620,7 @@ void merge_endpoints(const endpoints * ep1, // contains three of the color compo\n// function to pack a pair of color endpoints into a series of integers.\n// the format used may or may not match the format specified;\n// the return value is the format actually used.\n-int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, int format, int *output, int quantization_level);\n+int pack_color_endpoints(float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, int format, int *output, int quantization_level);\n// unpack a pair of color endpoints from a series of integers.\nvoid unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_quantize.cpp", "new_path": "Source/astc_color_quantize.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -1816,7 +1816,7 @@ void quantize_hdr_rgb_alpha3(float4 color0, float4 color1, int output[8], int qu\nQuantize a color. When quantizing an RGB or RGBA color, the quantizer may choose a\ndelta-based representation; as such, it will report back the format it actually used.\n*/\n-int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color,\n+int pack_color_endpoints(float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color,\nint format, int *output, int quantization_level)\n{\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -1967,18 +1967,6 @@ int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 col\nfor (i = 0; i < 8; i++)\nprintf(\" %X\", output[i]);\n-\n- ushort4 res0;\n- ushort4 res1;\n- int rgb_hdr;\n- int alpha_hdr;\n- int nan_endpoint;\n-\n- unpack_color_endpoints(decode_mode, retval, quantization_level, output, &rgb_hdr, &alpha_hdr, &nan_endpoint, &res0, &res1);\n- printf(\"rgb-hdr=%d alpha-hdr=%d nan-endpoint=%d\\n\", rgb_hdr, alpha_hdr, nan_endpoint);\n-\n- printf(\"Unquantized color 0: <%u %u %u %u>\\n\", res0.x, res0.y, res0.z, res0.w);\n- printf(\"Unquantized color 1: <%u %u %u %u>\\n\", res1.x, res1.y, res1.z, res1.w);\nprintf(\"\\n\\n\");\n}\n#endif\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -423,8 +423,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\n// store the colors for the block\nfor (j = 0; j < partition_count; j++)\n{\n- scb->color_formats[j] = pack_color_endpoints(decode_mode,\n- eix[decimation_mode].ep.endpt0[j],\n+ scb->color_formats[j] = pack_color_endpoints(eix[decimation_mode].ep.endpt0[j],\neix[decimation_mode].ep.endpt1[j],\nrgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n}\n@@ -443,8 +442,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\nint color_formats_mod[4];\nfor (j = 0; j < partition_count; j++)\n{\n- color_formats_mod[j] = pack_color_endpoints(decode_mode,\n- eix[decimation_mode].ep.endpt0[j],\n+ color_formats_mod[j] = pack_color_endpoints(eix[decimation_mode].ep.endpt0[j],\neix[decimation_mode].ep.endpt1[j],\nrgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n}\n@@ -713,8 +711,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\n// store the colors for the block\nfor (j = 0; j < partition_count; j++)\n{\n- scb->color_formats[j] = pack_color_endpoints(decode_mode,\n- epm.endpt0[j],\n+ scb->color_formats[j] = pack_color_endpoints(epm.endpt0[j],\nepm.endpt1[j],\nrgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n}\n@@ -728,8 +725,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\nint color_formats_mod[4];\nfor (j = 0; j < partition_count; j++)\n{\n- color_formats_mod[j] = pack_color_endpoints(decode_mode,\n- epm.endpt0[j],\n+ color_formats_mod[j] = pack_color_endpoints(epm.endpt0[j],\nepm.endpt1[j],\nrgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n}\n@@ -1256,7 +1252,6 @@ float compress_symbolic_block(const astc_codec_image * input_image,\nint xpos = blk->xpos;\nint ypos = blk->ypos;\nint zpos = blk->zpos;\n- int x, y, z;\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n@@ -1271,9 +1266,9 @@ float compress_symbolic_block(const astc_codec_image * input_image,\nprintf(\"Alpha-min: %f Alpha-max: %f\\n\", blk->alpha_min, blk->alpha_max);\nprintf(\"Grayscale: %d\\n\", blk->grayscale);\n- for (z = 0; z < zdim; z++)\n- for (y = 0; y < ydim; y++)\n- for (x = 0; x < xdim; x++)\n+ for (int z = 0; z < zdim; z++)\n+ for (int y = 0; y < ydim; y++)\n+ for (int x = 0; x < xdim; x++)\n{\nint idx = ((z * ydim + y) * xdim + x) * 4;\nprintf(\"Texel (%d %d %d) : orig=< %g, %g, %g, %g >, work=< %g, %g, %g, %g >\\n\",\n@@ -1357,9 +1352,9 @@ float compress_symbolic_block(const astc_codec_image * input_image,\nif (print_diagnostics)\n{\nprintf(\"\\n\");\n- for (z = 0; z < zdim; z++)\n- for (y = 0; y < ydim; y++)\n- for (x = 0; x < xdim; x++)\n+ for (int z = 0; z < zdim; z++)\n+ for (int y = 0; y < ydim; y++)\n+ for (int x = 0; x < xdim; x++)\n{\nint idx = (z * ydim + y) * xdim + x;\nprintf(\"ErrorWeight (%d %d %d) : < %g, %g, %g, %g >\\n\", x, y, z, ewb->error_weights[idx].x, ewb->error_weights[idx].y, ewb->error_weights[idx].z, ewb->error_weights[idx].w);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -1018,13 +1018,13 @@ void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * ea\n{\nint i, j, k;\n- int blockdim = (int)floor(sqrt((float)it->num_texels) + 0.5f);\nint texels_per_block = it->num_texels;\nint weight_count = it->num_weights;\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n{\n+ int blockdim = (int)floor(sqrt((float)it->num_texels) + 0.5f);\nprintf(\"%s : decimation from %d to %d weights\\n\\n\", __func__, it->num_texels, it->num_weights);\nprintf(\"Input weight set:\\n\");\nfor (i = 0; i < it->num_texels; i++)\n@@ -1054,7 +1054,6 @@ void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * ea\n// if the shortcut is not available, we will instead compute a simple estimate\n// and perform three rounds of refinement on that estimate.\n- float initial_weight_set[MAX_WEIGHTS_PER_BLOCK];\nfloat infilled_weights[MAX_TEXELS_PER_BLOCK];\n// compute an initial average for each weight.\n@@ -1078,6 +1077,7 @@ void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * ea\n}\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n+ float initial_weight_set[MAX_WEIGHTS_PER_BLOCK];\nif (print_diagnostics)\n{\n// stash away the initial-weight estimates for later printing\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_pick_best_endpoint_format.cpp", "new_path": "Source/astc_pick_best_endpoint_format.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -45,7 +45,7 @@ static void compute_color_error_for_every_integer_count_and_quantization_level(i\n// arrays to return results back through.\nfloat best_error[21][4], int format_of_choice[21][4])\n{\n- int i, j;\n+ int i;\nint partition_size = pi->texels_per_partition[partition_index];\nstatic const float baseline_quant_error[21] = {\n@@ -286,7 +286,7 @@ static void compute_color_error_for_every_integer_count_and_quantization_level(i\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n{\n- for (j = 0; j < 4; j++)\n+ for (int j = 0; j < 4; j++)\n{\nprintf(\"(hdr) quant-level=%d ints=%d format=%d error=%f\\n\", i, j, format_of_choice[i][j], best_error[i][j]);\n}\n@@ -383,7 +383,7 @@ static void compute_color_error_for_every_integer_count_and_quantization_level(i\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n{\n- for (j = 0; j < 4; j++)\n+ for (int j = 0; j < 4; j++)\n{\nprintf(\" (ldr) quant-level=%d ints=%d format=%d error=%f\\n\", i, j, format_of_choice[i][j], best_error[i][j]);\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_align.cpp", "new_path": "Source/astc_weight_align.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n#include \"astc_codec_internals.h\"\n-#ifdef DEBUG_PRINT_DIAGNOSTICS\n#include <stdio.h>\n-#endif\nstatic const float angular_steppings[] = {\n1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875,\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Disable compressor diagnostic support by default (#73)
61,745
03.01.2020 00:30:44
0
ff880faf267895761eae4242506c6a99c9c770a2
Remove unused lum path from recompute_ideal_colors
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -673,7 +673,6 @@ void determine_optimal_set_of_endpoint_formats_to_use(int xdim, int ydim, int zd\nvoid recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantization_mode, endpoints * ep, // contains the endpoints we wish to update\nfloat4 * rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6\nfloat4 * rgbo_vectors, // used to return RGBS-vectors for endpoint mode #7\n- float2 * lum_vectors, // used to return luminance-vectors.\nconst uint8_t * weight_set, // the current set of weight values\nconst uint8_t * plane2_weight_set, // NULL if plane 2 is not actually used.\nint plane2_color_component, // color component for 2nd plane of weights; -1 if the 2nd plane of weights is not present\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -411,12 +411,11 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\n// recompute the ideal color endpoints before storing them.\nfloat4 rgbs_colors[4];\nfloat4 rgbo_colors[4];\n- float2 lum_intervals[4];\nint l;\nfor (l = 0; l < max_refinement_iters; l++)\n{\n- recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &(eix[decimation_mode].ep), rgbs_colors, rgbo_colors, lum_intervals, u8_weight_src, NULL, -1, pi, it, blk, ewb);\n+ recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &(eix[decimation_mode].ep), rgbs_colors, rgbo_colors, u8_weight_src, NULL, -1, pi, it, blk, ewb);\n// quantize the chosen color\n@@ -701,12 +700,11 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\nfloat4 rgbs_colors[4];\nfloat4 rgbo_colors[4];\n- float2 lum_intervals[4];\nint l;\nfor (l = 0; l < max_refinement_iters; l++)\n{\n- recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &epm, rgbs_colors, rgbo_colors, lum_intervals, u8_weight1_src, u8_weight2_src, separate_component, pi, it, blk, ewb);\n+ recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &epm, rgbs_colors, rgbo_colors, u8_weight1_src, u8_weight2_src, separate_component, pi, it, blk, ewb);\n// store the colors for the block\nfor (j = 0; j < partition_count; j++)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1467,7 +1467,6 @@ static inline float mat_square_sum(mat2 p)\nvoid recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantization_mode, endpoints * ep, // contains the endpoints we wish to update\nfloat4 * rgbs_vectors, // used to return RGBS-vectors. (endpoint mode #6)\nfloat4 * rgbo_vectors, // used to return RGBO-vectors. (endpoint mode #7)\n- float2 * lum_vectors, // used to return luminance-vectors.\nconst uint8_t * weight_set8, // the current set of weight values\nconst uint8_t * plane2_weight_set8, // NULL if plane 2 is not actually used.\nint plane2_color_component, // color component for 2nd plane of weights; -1 if the 2nd plane of weights is not present\n@@ -1510,13 +1509,12 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\n}\n#endif\n- mat2 pmat1_red[4], pmat1_green[4], pmat1_blue[4], pmat1_alpha[4], pmat1_lum[4], pmat1_scale[4]; // matrices for plane of weights 1\n+ mat2 pmat1_red[4], pmat1_green[4], pmat1_blue[4], pmat1_alpha[4], pmat1_scale[4]; // matrices for plane of weights 1\nmat2 pmat2_red[4], pmat2_green[4], pmat2_blue[4], pmat2_alpha[4]; // matrices for plane of weights 2\nfloat2 red_vec[4];\nfloat2 green_vec[4];\nfloat2 blue_vec[4];\nfloat2 alpha_vec[4];\n- float2 lum_vec[4];\nfloat2 scale_vec[4];\nfor (i = 0; i < partition_count; i++)\n@@ -1531,7 +1529,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\npmat2_blue[i].v[j] = float2(0, 0);\npmat1_alpha[i].v[j] = float2(0, 0);\npmat2_alpha[i].v[j] = float2(0, 0);\n- pmat1_lum[i].v[j] = float2(0, 0);\npmat1_scale[i].v[j] = float2(0, 0);\n}\n@@ -1539,7 +1536,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\ngreen_vec[i] = float2(0, 0);\nblue_vec[i] = float2(0, 0);\nalpha_vec[i] = float2(0, 0);\n- lum_vec[i] = float2(0, 0);\nscale_vec[i] = float2(0, 0);\n}\n@@ -1549,7 +1545,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nfloat green_weight_sum[4];\nfloat blue_weight_sum[4];\nfloat alpha_weight_sum[4];\n- float lum_weight_sum[4];\nfloat scale_weight_sum[4];\nfloat red_weight_weight_sum[4];\n@@ -1570,7 +1565,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nblue_weight_sum[i] = 1e-17f;\nalpha_weight_sum[i] = 1e-17f;\n- lum_weight_sum[i] = 1e-17f;\nscale_weight_sum[i] = 1e-17f;\nred_weight_weight_sum[i] = 1e-17f;\n@@ -1587,8 +1581,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nfloat3 scale_directions[4];\nfloat scale_min[4];\nfloat scale_max[4];\n- float lum_min[4];\n- float lum_max[4];\nfor (i = 0; i < partition_count; i++)\n{\n@@ -1613,8 +1605,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nscale_directions[i] = normalize(rgb_sum[i] / rgb_weight_sum[i]);\nscale_max[i] = 0.0f;\nscale_min[i] = 1e10f;\n- lum_max[i] = 0.0f;\n- lum_min[i] = 1e10f;\n}\nfor (i = 0; i < texels_per_block; i++)\n@@ -1638,16 +1628,10 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nfloat blue_weight = ewb->texel_weight_b[i];\nfloat alpha_weight = ewb->texel_weight_a[i];\n- float lum_weight = (red_weight + green_weight + blue_weight);\n- float scale_weight = lum_weight;\n+ float scale_weight = (red_weight + green_weight + blue_weight);\n- float lum = (r * red_weight + g * green_weight + b * blue_weight) / lum_weight;\nfloat3 scale_direction = scale_directions[part];\nfloat scale = dot(scale_direction, float3(r, g, b));\n- if (lum < lum_min[part])\n- lum_min[part] = scale;\n- if (lum > lum_max[part])\n- lum_max[part] = scale;\nif (scale < scale_min[part])\nscale_min[part] = scale;\nif (scale > scale_max[part])\n@@ -1657,7 +1641,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\ngreen_weight_sum[part] += green_weight;\nblue_weight_sum[part] += blue_weight;\nalpha_weight_sum[part] += alpha_weight;\n- lum_weight_sum[part] += lum_weight;\nscale_weight_sum[part] += scale_weight;\npmat1_red[part].v[0].x += om_idx0 * om_idx0 * red_weight;\n@@ -1680,11 +1663,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\npmat1_alpha[part].v[1].x += idx0 * om_idx0 * alpha_weight;\npmat1_alpha[part].v[1].y += idx0 * idx0 * alpha_weight;\n- pmat1_lum[part].v[0].x += om_idx0 * om_idx0 * lum_weight;\n- pmat1_lum[part].v[0].y += idx0 * om_idx0 * lum_weight;\n- pmat1_lum[part].v[1].x += idx0 * om_idx0 * lum_weight;\n- pmat1_lum[part].v[1].y += idx0 * idx0 * lum_weight;\n-\npmat1_scale[part].v[0].x += om_idx0 * om_idx0 * scale_weight;\npmat1_scale[part].v[0].y += idx0 * om_idx0 * scale_weight;\npmat1_scale[part].v[1].x += idx0 * om_idx0 * scale_weight;\n@@ -1730,14 +1708,12 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\ngreen_vec[part].x += (green_weight * g) * (1.0f - green_idx);\nblue_vec[part].x += (blue_weight * b) * (1.0f - blue_idx);\nalpha_vec[part].x += (alpha_weight * a) * (1.0f - alpha_idx);\n- lum_vec[part].x += (lum_weight * lum) * om_idx0;\nscale_vec[part].x += (scale_weight * scale) * om_idx0;\nred_vec[part].y += (red_weight * r) * red_idx;\ngreen_vec[part].y += (green_weight * g) * green_idx;\nblue_vec[part].y += (blue_weight * b) * blue_idx;\nalpha_vec[part].y += (alpha_weight * a) * alpha_idx;\n- lum_vec[part].y += (lum_weight * lum) * idx0;\nscale_vec[part].y += (scale_weight * scale) * idx0;\nred_weight_weight_sum[part] += red_weight * red_idx;\n@@ -1812,7 +1788,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nscalediv = 1.0f;\nrgbs_vectors[i] = float4(scale_directions[i] * scale_max[i], scalediv);\n- lum_vectors[i] = float2(lum_min[i], lum_max[i]);\n}\nfor (i = 0; i < partition_count; i++)\n@@ -1836,8 +1811,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nep->endpt0[i].w = ep->endpt1[i].w = avg.w;\nrgbs_vectors[i] = float4(scale_directions[i] * scale_max[i], 1.0f);\n- float lumval = (red_vec[i].x + red_vec[i].y + green_vec[i].x + green_vec[i].y + blue_vec[i].x + blue_vec[i].y) / (red_weight_sum[i] + green_weight_sum[i] + blue_weight_sum[i]);\n- lum_vectors[i] = float2(lumval, lumval);\n}\nelse\n{\n@@ -1852,14 +1825,12 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nfloat green_det1 = determinant(pmat1_green[i]);\nfloat blue_det1 = determinant(pmat1_blue[i]);\nfloat alpha_det1 = determinant(pmat1_alpha[i]);\n- float lum_det1 = determinant(pmat1_lum[i]);\nfloat scale_det1 = determinant(pmat1_scale[i]);\nfloat red_mss1 = mat_square_sum(pmat1_red[i]);\nfloat green_mss1 = mat_square_sum(pmat1_green[i]);\nfloat blue_mss1 = mat_square_sum(pmat1_blue[i]);\nfloat alpha_mss1 = mat_square_sum(pmat1_alpha[i]);\n- float lum_mss1 = mat_square_sum(pmat1_lum[i]);\nfloat scale_mss1 = mat_square_sum(pmat1_scale[i]);\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -1871,7 +1842,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\npmat1_green[i] = invert(pmat1_green[i]);\npmat1_blue[i] = invert(pmat1_blue[i]);\npmat1_alpha[i] = invert(pmat1_alpha[i]);\n- pmat1_lum[i] = invert(pmat1_lum[i]);\npmat1_scale[i] = invert(pmat1_scale[i]);\nfloat4 ep0 = float4(dot(pmat1_red[i].v[0], red_vec[i]),\n@@ -1883,8 +1853,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\ndot(pmat1_blue[i].v[1], blue_vec[i]),\ndot(pmat1_alpha[i].v[1], alpha_vec[i]));\n- float lum_ep0 = dot(pmat1_lum[i].v[0], lum_vec[i]);\n- float lum_ep1 = dot(pmat1_lum[i].v[1], lum_vec[i]);\nfloat scale_ep0 = dot(pmat1_scale[i].v[0], scale_vec[i]);\nfloat scale_ep1 = dot(pmat1_scale[i].v[1], scale_vec[i]);\n@@ -1909,11 +1877,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nep->endpt1[i].w = ep1.w;\n}\n- if (fabs(lum_det1) > (lum_mss1 * 1e-4f) && lum_ep0 == lum_ep0 && lum_ep1 == lum_ep1 && lum_ep0 < lum_ep1)\n- {\n- lum_vectors[i].x = lum_ep0;\n- lum_vectors[i].y = lum_ep1;\n- }\nif (fabs(scale_det1) > (scale_mss1 * 1e-4f) && scale_ep0 == scale_ep0 && scale_ep1 == scale_ep1 && scale_ep0 < scale_ep1)\n{\nfloat scalediv = scale_ep0 / scale_ep1;\n@@ -2038,12 +2001,8 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\n{\nprintf(\"%d Low <%g %g %g %g>\\n\", i, ep->endpt0[i].x, ep->endpt0[i].y, ep->endpt0[i].z, ep->endpt0[i].w);\nprintf(\"%d High <%g %g %g %g>\\n\", i, ep->endpt1[i].x, ep->endpt1[i].y, ep->endpt1[i].z, ep->endpt1[i].w);\n-\nprintf(\"%d RGBS: <%g %g %g %g>\\n\", i, rgbs_vectors[i].x, rgbs_vectors[i].y, rgbs_vectors[i].z, rgbs_vectors[i].w);\n-\nprintf(\"%d RGBO <%g %g %g %g>\\n\", i, rgbo_vectors[i].x, rgbo_vectors[i].y, rgbo_vectors[i].z, rgbo_vectors[i].w);\n-\n- printf(\"%d Lum: <%g %g>\\n\", i, lum_vectors[i].x, lum_vectors[i].y);\n}\n}\n#endif\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove unused lum path from recompute_ideal_colors
61,745
03.01.2020 00:32:36
0
daea597c13e6feaf7505235186b86c01eaa59e40
Remove unused lum diagnostic print
[ { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1835,7 +1835,7 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n- printf(\"Plane-1 partition %d determinants: R=%g G=%g B=%g A=%g L=%g S=%g\\n\", i, red_det1, green_det1, blue_det1, alpha_det1, lum_det1, scale_det1);\n+ printf(\"Plane-1 partition %d determinants: R=%g G=%g B=%g A=%g S=%g\\n\", i, red_det1, green_det1, blue_det1, alpha_det1, scale_det1);\n#endif\npmat1_red[i] = invert(pmat1_red[i]);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove unused lum diagnostic print
61,745
03.01.2020 09:39:05
0
218fcdaa8e6534e9a6286ef59eb76f6ac6d65c9b
Clean up Makefile options
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -43,7 +43,8 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -std=c++11 -O3 -Wall -W -Wall -Wextra -Wpedantic -Werror -Werror=shadow -msse2 -mfpmath=sse\n+CPPFLAGS = -std=c++11 -O3 -msse2 -mfpmath=sse \\\n+ -Wall -Wextra -Wpedantic -Werror -Werror=shadow\nastcenc: $(OBJECTS)\n@g++ -o $@ $^ $(CPPFLAGS) -lpthread\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Clean up Makefile options
61,745
04.01.2020 02:32:34
0
79dc6767ed124a279a9c98afa3b8c61e6c655b68
Bump version number on the command line
[ { "change_type": "MODIFY", "old_path": "Docs/ChangeLog.md", "new_path": "Docs/ChangeLog.md", "diff": "@@ -7,8 +7,8 @@ bisection easier, the list is maintained in approximate chronological order\n## Maths library changes\n-The astc_mathlib library has been cleaned up, with a lot of unused\n-functionality stripped out.\n+The astc_mathlib library has been cleaned up, with all unused functionality\n+stripped out.\nThe vector template classes have been stripped back to a basic implementation,\nwith the flexible channel swizzle functionality removed. This makes it easier\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -728,8 +728,8 @@ int astc_main(int argc, char **argv)\nif (argc < 4)\n{\n- printf( \"ASTC codec version 1.7\\n\"\n- \"Copyright (C) 2011-2019 Arm Limited\\n\"\n+ printf( \"ASTC codec version 2.0 (alpha)\\n\"\n+ \"Copyright (C) 2011-2020 Arm Limited\\n\"\n\"All rights reserved. Use of this software is subject to terms of its license.\\n\\n\"\n\"Usage:\\n\"\n\"Compress to texture file:\\n\"\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Bump version number on the command line
61,745
04.01.2020 14:49:10
0
c6e90e45f1fa7fd607de567fdc9977bd3e5cb5c1
Swap all ushort4 for uint4 and remove ushort4 support
[ { "change_type": "ADD", "old_path": null, "new_path": "Docs/BranchNotes.md", "diff": "+# Branch 2.0 design notes\n+\n+# Objectives\n+\n+The aim of the 2.0 work is to achieve the equivalent of `-thorough` encoding\n+quality with `-medium` performance. This equates to an ~8x performance\n+improvement over the version 1.x codec, at the same output quality, and without\n+losing any of the format features (e.g. block sizes and modes) currently\n+supported.\n+\n+There are four main approaches which will be used to achieve this.\n+\n+* Code simplification\n+* Datapath restructuring\n+* Algorithm tuning\n+* CPU SIMD vectorization\n+\n+We are currently focussing on the code simplification and algorithm review.\n+\n+## Code simplification\n+\n+The version 1.0 codec was initially developed as part of the the ASTC format\n+design, evolving as the format was developed and refined. A lot of the v1.x\n+implementation was therefore built to be modular and easy to adapt as the\n+format design changed, rather than for the best possible performance. Now that\n+the format has been published we can review all of the existing code, and\n+rework it for performance rather than ease of modification.\n+\n+## Datapath restructuring\n+\n+The current code does one block at a time, in a depth-first search with full\n+iterative refinement at each stage until the target quality is either hit or we\n+run out of codec options to try. This approach is easier to understand, but the\n+resulting code is control plane heavy and includes a lot of overhead which\n+cannot be amoritzed over multiple blocks. As a first step for SIMD\n+vectorization the data path must be reviewed to make sure that it can be\n+vectorized efficiently.\n+\n+* Batching processing passes for multiple blocks.\n+* Reducing branching and branch divergence to allow SIMD batching.\n+* Reducing scatter/gather loads to ensure efficient memory access.\n+* Amortizing memory access cost over multiple blocks\n+\n+The restructure becomes particular important with an eye on a long-term\n+objective (v3?) to support compression passes running on a GPU, as it is\n+necessary to offload relatively large batches of work, while also avoiding\n+bottlenecking GPU performance on memory access overheads rather than useful\n+processing.\n+\n+## Algorithm tuning\n+\n+As part of the restructuring we will review the effectiveness of the existing\n+optimization passes that we have in the code, to see what can be removed. We\n+know that some passes are expensive and/or difficult to vectorize, and do not\n+actually justify that cost in significant quality improvements.\n+\n+In addition many math library operations will be reviewed and replaced with\n+faster implementations which are less accurate but more friendly towards\n+vectorization in future.\n+\n+## CPU SIMD vectorization\n+\n+The final stage, once we are happy with the data path design, will be to look\n+at implementing a true SIMD data path for the CPU. This could be done using\n+manual SIMD code, such as intrinsics, or a compiled SIMD generator,\n+such as ISPC; the decision here can happen later.\n+\n+# TODOs\n+\n+* The `double4` vector type doesn't vectorize well with SIMD; it should be\n+ removed, but this probably means we need a new algorithm for that part\n+ of the code.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -604,7 +604,7 @@ void merge_endpoints(const endpoints * ep1, // contains three of the color compo\nint pack_color_endpoints(float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, int format, int *output, int quantization_level);\n// unpack a pair of color endpoints from a series of integers.\n-void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1);\n+void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, uint4 * output0, uint4 * output1);\nstruct encoding_choice_errors\n{\n@@ -692,7 +692,7 @@ float4 lerp_color_flt(const float4 color0, const float4 color1, float weight, //\nint plane2_color_component // 0..3; -1 if only one plane of weights is present.\n);\n-ushort4 lerp_color_int(astc_decode_mode decode_mode, ushort4 color0, ushort4 color1, int weight, // 0..64\n+uint4 lerp_color_int(astc_decode_mode decode_mode, uint4 color0, uint4 color1, int weight, // 0..64\nint plane2_weight, // 0..64\nint plane2_color_component // 0..3; -1 if only one plane of weights is present.\n);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_unquantize.cpp", "new_path": "Source/astc_color_unquantize.cpp", "diff": "#include \"astc_codec_internals.h\"\n-int rgb_delta_unpack(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1)\n+int rgb_delta_unpack(const int input[6], int quantization_level, uint4 * output0, uint4 * output1)\n{\n// unquantize the color endpoints\nint r0 = color_unquantization_tables[quantization_level][input[0]];\n@@ -124,7 +124,7 @@ int rgb_delta_unpack(const int input[6], int quantization_level, ushort4 * outpu\nreturn retval;\n}\n-int rgb_unpack(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1)\n+int rgb_unpack(const int input[6], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint ri0b = color_unquantization_tables[quantization_level][input[0]];\n@@ -168,7 +168,7 @@ int rgb_unpack(const int input[6], int quantization_level, ushort4 * output0, us\n}\n}\n-void rgba_unpack(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void rgba_unpack(const int input[8], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint order = rgb_unpack(input, quantization_level, output0, output1);\nif (order == 0)\n@@ -183,7 +183,7 @@ void rgba_unpack(const int input[8], int quantization_level, ushort4 * output0,\n}\n}\n-void rgba_delta_unpack(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void rgba_delta_unpack(const int input[8], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint a0 = color_unquantization_tables[quantization_level][input[6]];\nint a1 = color_unquantization_tables[quantization_level][input[7]];\n@@ -213,7 +213,7 @@ void rgba_delta_unpack(const int input[8], int quantization_level, ushort4 * out\n}\n}\n-void rgb_scale_unpack(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void rgb_scale_unpack(const int input[4], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint ir = color_unquantization_tables[quantization_level][input[0]];\nint ig = color_unquantization_tables[quantization_level][input[1]];\n@@ -221,26 +221,26 @@ void rgb_scale_unpack(const int input[4], int quantization_level, ushort4 * outp\nint iscale = color_unquantization_tables[quantization_level][input[3]];\n- *output1 = ushort4(ir, ig, ib, 255);\n- *output0 = ushort4((ir * iscale) >> 8, (ig * iscale) >> 8, (ib * iscale) >> 8, 255);\n+ *output1 = uint4(ir, ig, ib, 255);\n+ *output0 = uint4((ir * iscale) >> 8, (ig * iscale) >> 8, (ib * iscale) >> 8, 255);\n}\n-void rgb_scale_alpha_unpack(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void rgb_scale_alpha_unpack(const int input[6], int quantization_level, uint4 * output0, uint4 * output1)\n{\nrgb_scale_unpack(input, quantization_level, output0, output1);\noutput0->w = color_unquantization_tables[quantization_level][input[4]];\noutput1->w = color_unquantization_tables[quantization_level][input[5]];\n}\n-void luminance_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void luminance_unpack(const int input[2], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint lum0 = color_unquantization_tables[quantization_level][input[0]];\nint lum1 = color_unquantization_tables[quantization_level][input[1]];\n- *output0 = ushort4(lum0, lum0, lum0, 255);\n- *output1 = ushort4(lum1, lum1, lum1, 255);\n+ *output0 = uint4(lum0, lum0, lum0, 255);\n+ *output1 = uint4(lum1, lum1, lum1, 255);\n}\n-void luminance_delta_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void luminance_delta_unpack(const int input[2], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\nint v1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -250,21 +250,21 @@ void luminance_delta_unpack(const int input[2], int quantization_level, ushort4\nif (l1 > 255)\nl1 = 255;\n- *output0 = ushort4(l0, l0, l0, 255);\n- *output1 = ushort4(l1, l1, l1, 255);\n+ *output0 = uint4(l0, l0, l0, 255);\n+ *output1 = uint4(l1, l1, l1, 255);\n}\n-void luminance_alpha_unpack(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void luminance_alpha_unpack(const int input[4], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint lum0 = color_unquantization_tables[quantization_level][input[0]];\nint lum1 = color_unquantization_tables[quantization_level][input[1]];\nint alpha0 = color_unquantization_tables[quantization_level][input[2]];\nint alpha1 = color_unquantization_tables[quantization_level][input[3]];\n- *output0 = ushort4(lum0, lum0, lum0, alpha0);\n- *output1 = ushort4(lum1, lum1, lum1, alpha1);\n+ *output0 = uint4(lum0, lum0, lum0, alpha0);\n+ *output1 = uint4(lum1, lum1, lum1, alpha1);\n}\n-void luminance_alpha_delta_unpack(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void luminance_alpha_delta_unpack(const int input[4], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint lum0 = color_unquantization_tables[quantization_level][input[0]];\nint lum1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -297,12 +297,12 @@ void luminance_alpha_delta_unpack(const int input[4], int quantization_level, us\nelse if (alpha1 > 255)\nalpha1 = 255;\n- *output0 = ushort4(lum0, lum0, lum0, alpha0);\n- *output1 = ushort4(lum1, lum1, lum1, alpha1);\n+ *output0 = uint4(lum0, lum0, lum0, alpha0);\n+ *output1 = uint4(lum1, lum1, lum1, alpha1);\n}\n// RGB-offset format\n-void hdr_rgbo_unpack3(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_rgbo_unpack3(const int input[4], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\nint v1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -438,11 +438,11 @@ void hdr_rgbo_unpack3(const int input[4], int quantization_level, ushort4 * outp\nif (blue0 < 0)\nblue0 = 0;\n- *output0 = ushort4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);\n- *output1 = ushort4(red << 4, green << 4, blue << 4, 0x7800);\n+ *output0 = uint4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);\n+ *output1 = uint4(red << 4, green << 4, blue << 4, 0x7800);\n}\n-void hdr_rgb_unpack3(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_rgb_unpack3(const int input[6], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\n@@ -459,8 +459,8 @@ void hdr_rgb_unpack3(const int input[6], int quantization_level, ushort4 * outpu\nif (majcomp == 3)\n{\n- *output0 = ushort4(v0 << 8, v2 << 8, (v4 & 0x7F) << 9, 0x7800);\n- *output1 = ushort4(v1 << 8, v3 << 8, (v5 & 0x7F) << 9, 0x7800);\n+ *output0 = uint4(v0 << 8, v2 << 8, (v4 & 0x7F) << 9, 0x7800);\n+ *output1 = uint4(v1 << 8, v3 << 8, (v5 & 0x7F) << 9, 0x7800);\nreturn;\n}\n@@ -612,11 +612,11 @@ void hdr_rgb_unpack3(const int input[6], int quantization_level, ushort4 * outpu\nbreak;\n}\n- *output0 = ushort4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);\n- *output1 = ushort4(red1 << 4, green1 << 4, blue1 << 4, 0x7800);\n+ *output0 = uint4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);\n+ *output1 = uint4(red1 << 4, green1 << 4, blue1 << 4, 0x7800);\n}\n-void hdr_rgb_ldr_alpha_unpack3(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_rgb_ldr_alpha_unpack3(const int input[8], int quantization_level, uint4 * output0, uint4 * output1)\n{\nhdr_rgb_unpack3(input, quantization_level, output0, output1);\n@@ -626,7 +626,7 @@ void hdr_rgb_ldr_alpha_unpack3(const int input[8], int quantization_level, ushor\noutput1->w = v7;\n}\n-void hdr_luminance_small_range_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_luminance_small_range_unpack(const int input[2], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\nint v1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -647,11 +647,11 @@ void hdr_luminance_small_range_unpack(const int input[2], int quantization_level\nif (y1 > 0xFFF)\ny1 = 0xFFF;\n- *output0 = ushort4(y0 << 4, y0 << 4, y0 << 4, 0x7800);\n- *output1 = ushort4(y1 << 4, y1 << 4, y1 << 4, 0x7800);\n+ *output0 = uint4(y0 << 4, y0 << 4, y0 << 4, 0x7800);\n+ *output1 = uint4(y1 << 4, y1 << 4, y1 << 4, 0x7800);\n}\n-void hdr_luminance_large_range_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_luminance_large_range_unpack(const int input[2], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\nint v1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -667,8 +667,8 @@ void hdr_luminance_large_range_unpack(const int input[2], int quantization_level\ny0 = (v1 << 4) + 8;\ny1 = (v0 << 4) - 8;\n}\n- *output0 = ushort4(y0 << 4, y0 << 4, y0 << 4, 0x7800);\n- *output1 = ushort4(y1 << 4, y1 << 4, y1 << 4, 0x7800);\n+ *output0 = uint4(y0 << 4, y0 << 4, y0 << 4, 0x7800);\n+ *output1 = uint4(y1 << 4, y1 << 4, y1 << 4, 0x7800);\n}\nvoid hdr_alpha_unpack(const int input[2], int quantization_level, int *a0, int *a1)\n@@ -708,7 +708,7 @@ void hdr_alpha_unpack(const int input[2], int quantization_level, int *a0, int *\n*a1 <<= 4;\n}\n-void hdr_rgb_hdr_alpha_unpack3(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_rgb_hdr_alpha_unpack3(const int input[8], int quantization_level, uint4 * output0, uint4 * output1)\n{\nhdr_rgb_unpack3(input, quantization_level, output0, output1);\n@@ -719,7 +719,7 @@ void hdr_rgb_hdr_alpha_unpack3(const int input[8], int quantization_level, ushor\noutput1->w = alpha1;\n}\n-void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1)\n+void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, uint4 * output0, uint4 * output1)\n{\n*nan_endpoint = 0;\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -46,8 +46,8 @@ int realign_weights(astc_decode_mode decode_mode,\nint weight_quantization_level = bsd->block_modes[scb->block_mode].quantization_mode;\n// decode the color endpoints\n- ushort4 color_endpoint0[4];\n- ushort4 color_endpoint1[4];\n+ uint4 color_endpoint0[4];\n+ uint4 color_endpoint1[4];\nint rgb_hdr[4];\nint alpha_hdr[4];\nint nan_endpoint[4];\n@@ -92,7 +92,7 @@ int realign_weights(astc_decode_mode decode_mode,\nplane2_weight = compute_value_of_texel_flt( texel, it, uq_plane2_weights ); \\\nint int_plane1_weight = static_cast<int>(floor( plane1_weight*64.0f + 0.5f ) ); \\\nint int_plane2_weight = static_cast<int>(floor( plane2_weight*64.0f + 0.5f ) ); \\\n- ushort4 lrp_color = lerp_color_int( \\\n+ uint4 lrp_color = lerp_color_int( \\\ndecode_mode, \\\ncolor_endpoint0[partition], \\\ncolor_endpoint1[partition], \\\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_decompress_symbolic.cpp", "new_path": "Source/astc_decompress_symbolic.cpp", "diff": "@@ -27,7 +27,7 @@ int compute_value_of_texel_int(int texel_to_get, const decimation_table * it, co\nreturn summed_value >> 4;\n}\n-ushort4 lerp_color_int(astc_decode_mode decode_mode, ushort4 color0, ushort4 color1, int weight, int plane2_weight, int plane2_color_component // -1 in 1-plane mode\n+uint4 lerp_color_int(astc_decode_mode decode_mode, uint4 color0, uint4 color1, int weight, int plane2_weight, int plane2_color_component // -1 in 1-plane mode\n)\n{\nint4 ecolor0 = int4(color0.x, color0.y, color0.z, color0.w);\n@@ -65,7 +65,7 @@ ushort4 lerp_color_int(astc_decode_mode decode_mode, ushort4 color0, ushort4 col\nif (decode_mode == DECODE_LDR_SRGB)\ncolor = color * 257;\n- return ushort4(color.x, color.y, color.z, color.w);\n+ return uint4(color.x, color.y, color.z, color.w);\n}\nvoid decompress_symbolic_block(astc_decode_mode decode_mode,\n@@ -196,8 +196,8 @@ void decompress_symbolic_block(astc_decode_mode decode_mode,\nint weight_quantization_level = bsd->block_modes[scb->block_mode].quantization_mode;\n// decode the color endpoints\n- ushort4 color_endpoint0[4];\n- ushort4 color_endpoint1[4];\n+ uint4 color_endpoint0[4];\n+ uint4 color_endpoint1[4];\nint rgb_hdr_endpoint[4];\nint alpha_hdr_endpoint[4];\nint nan_endpoint[4];\n@@ -245,7 +245,7 @@ void decompress_symbolic_block(astc_decode_mode decode_mode,\n{\nint partition = pt->partition_of_texel[i];\n- ushort4 color = lerp_color_int(decode_mode,\n+ uint4 color = lerp_color_int(decode_mode,\ncolor_endpoint0[partition],\ncolor_endpoint1[partition],\nweights[i],\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_mathlib.h", "new_path": "Source/astc_mathlib.h", "diff": "@@ -53,18 +53,15 @@ typedef vtype2<float> float2;\ntypedef vtype3<float> float3;\ntypedef vtype4<float> float4;\ntypedef vtype4<double> double4;\n-typedef vtype4<unsigned short> ushort4;\ntypedef vtype4<int> int4;\ntypedef vtype4<unsigned int> uint4;\n-// TODO: Optimizations need to get rid of double and ushort from here (double\n-// is large and slow and ushort has weaker support in SSE and AVX than uint)\n+// TODO: Optimizations need to get rid of double; it's slow\nstatic inline float2 operator+(float2 p, float2 q) { return float2( p.x + q.x, p.y + q.y ); }\nstatic inline float3 operator+(float3 p, float3 q) { return float3( p.x + q.x, p.y + q.y, p.z + q.z ); }\nstatic inline float4 operator+(float4 p, float4 q) { return float4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\nstatic inline double4 operator+(double4 p, double4 q) { return double4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\n-static inline ushort4 operator+(ushort4 p, ushort4 q) { return ushort4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\nstatic inline int4 operator+(int4 p, int4 q) { return int4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\nstatic inline uint4 operator+(uint4 p, uint4 q) { return uint4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\n@@ -72,7 +69,6 @@ static inline float2 operator-(float2 p, float2 q) { return float2( p.x - q\nstatic inline float3 operator-(float3 p, float3 q) { return float3( p.x - q.x, p.y - q.y, p.z - q.z ); }\nstatic inline float4 operator-(float4 p, float4 q) { return float4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\nstatic inline double4 operator-(double4 p, double4 q) { return double4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\n-static inline ushort4 operator-(ushort4 p, ushort4 q) { return ushort4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\nstatic inline int4 operator-(int4 p, int4 q) { return int4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\nstatic inline uint4 operator-(uint4 p, uint4 q) { return uint4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\n@@ -80,7 +76,6 @@ static inline float2 operator*(float2 p, float2 q) { return float2( p.x * q\nstatic inline float3 operator*(float3 p, float3 q) { return float3( p.x * q.x, p.y * q.y, p.z * q.z ); }\nstatic inline float4 operator*(float4 p, float4 q) { return float4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\nstatic inline double4 operator*(double4 p, double4 q) { return double4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\n-static inline ushort4 operator*(ushort4 p, ushort4 q) { return ushort4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\nstatic inline int4 operator*(int4 p, int4 q) { return int4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\nstatic inline uint4 operator*(uint4 p, uint4 q) { return uint4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Swap all ushort4 for uint4 and remove ushort4 support
61,745
04.01.2020 17:18:24
0
21b9fa84158b70778c7ff567b7ad614a228f0583
Fix bug in cross() and add regression test
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "+.vs\n.vscode\n+*.log\n+*.diff\nSource/*.o\nSource/astcenc\nSource/VS2017/.vs\n" }, { "change_type": "MODIFY", "old_path": "Docs/BranchNotes.md", "new_path": "Docs/BranchNotes.md", "diff": "@@ -70,3 +70,4 @@ such as ISPC; the decision here can happen later.\n* The `double4` vector type doesn't vectorize well with SIMD; it should be\nremoved, but this probably means we need a new algorithm for that part\nof the code.\n+* Remove globals.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_mathlib.cpp", "new_path": "Source/astc_mathlib.cpp", "diff": "@@ -364,7 +364,7 @@ float3 cross(float3 p, float3 q)\n{\nreturn float3(p.y * q.z - p.z * q.y,\np.z * q.x - p.x * q.z,\n- p.x * q.y - p.y * q.z);\n+ p.x * q.y - p.y * q.x);\n}\n@@ -374,15 +374,6 @@ float determinant(mat2 p)\nreturn v.x - v.y;\n}\n-float determinant(mat4 p)\n-{\n- return dot(p.v[0],\n- float4(dot(float3(p.v[1].y, p.v[1].z, p.v[1].w), cross(float3(p.v[2].y, p.v[2].z, p.v[2].w), float3(p.v[3].y, p.v[3].z, p.v[3].w))),\n- -dot(float3(p.v[1].x, p.v[1].z, p.v[1].w), cross(float3(p.v[2].x, p.v[2].z, p.v[2].w), float3(p.v[3].x, p.v[3].z, p.v[3].w))),\n- dot(float3(p.v[1].x, p.v[1].y, p.v[1].w), cross(float3(p.v[2].x, p.v[2].y, p.v[2].w), float3(p.v[3].x, p.v[3].y, p.v[3].w))),\n- -dot(float3(p.v[1].x, p.v[1].y, p.v[1].z), cross(float3(p.v[2].x, p.v[2].y, p.v[2].z), float3(p.v[3].x, p.v[3].y, p.v[3].z)))));\n-}\n-\nfloat2 transform(mat2 p, float2 q)\n{\nreturn float2(dot(p.v[0], q), dot(p.v[1], q));\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_mathlib.h", "new_path": "Source/astc_mathlib.h", "diff": "@@ -168,11 +168,6 @@ struct mat2\nfloat2 v[2];\n};\n-struct mat3\n-{\n- float3 v[3];\n-};\n-\nstruct mat4\n{\nfloat4 v[4];\n@@ -223,7 +218,6 @@ struct processed_line4\n};\nfloat determinant(mat2 p);\n-float determinant(mat4 p);\nfloat2 transform(mat2 p, float2 q);\nfloat4 transform(mat4 p, float4 q);\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_reference.csv", "new_path": "Test/astc_test_reference.csv", "diff": "Name,Block Size,PSNR (dB),Time (s)\n-hdr-rgb-00,4x4,38.855,2.077\n-ldr-rgb-00,4x4,39.193,1.230\n-ldr-rgb-01,4x4,40.370,1.021\n-ldr-rgb-02,4x4,35.458,0.927\n-ldr-rgb-03,4x4,47.483,1.201\n-ldr-rgb-04,4x4,42.300,0.918\n-ldr-rgb-05,4x4,38.003,0.995\n-ldr-rgb-06,4x4,35.452,0.879\n-ldr-rgb-07,4x4,39.762,1.266\n-ldr-rgb-08,4x4,45.781,1.171\n-ldr-rgb-09,4x4,42.162,0.996\n-ldr-rgba-00,4x4,37.065,1.215\n-ldr-rgba-01,4x4,39.032,1.098\n-ldr-rgba-02,4x4,35.025,1.410\n-ldr-xy-00,4x4,34.063,0.976\n-ldr-xy-01,4x4,34.733,1.160\n-ldr-xy-02,4x4,54.330,1.414\n-hdr-rgb-00,5x5,35.036,1.236\n-ldr-rgb-00,5x5,35.387,1.337\n-ldr-rgb-01,5x5,36.544,1.196\n-ldr-rgb-02,5x5,31.189,1.093\n-ldr-rgb-03,5x5,44.547,1.286\n-ldr-rgb-04,5x5,37.947,1.033\n-ldr-rgb-05,5x5,33.761,1.197\n-ldr-rgb-06,5x5,31.156,1.054\n-ldr-rgb-07,5x5,36.717,1.481\n-ldr-rgb-08,5x5,42.299,1.334\n-ldr-rgb-09,5x5,37.709,1.116\n-ldr-rgba-00,5x5,33.490,1.465\n-ldr-rgba-01,5x5,35.381,1.275\n-ldr-rgba-02,5x5,31.184,1.796\n-ldr-xy-00,5x5,33.898,0.862\n-ldr-xy-01,5x5,34.370,1.458\n-ldr-xy-02,5x5,51.346,1.630\n-hdr-rgb-00,6x6,32.385,1.462\n-ldr-rgb-00,6x6,32.739,1.681\n-ldr-rgb-01,6x6,33.246,1.682\n-ldr-rgb-02,6x6,27.569,1.783\n-ldr-rgb-03,6x6,42.525,0.922\n-ldr-rgb-04,6x6,34.496,1.716\n-ldr-rgb-05,6x6,30.444,1.785\n-ldr-rgb-06,6x6,27.572,1.796\n-ldr-rgb-07,6x6,34.549,1.751\n-ldr-rgb-08,6x6,39.939,0.982\n-ldr-rgb-09,6x6,33.861,1.646\n-ldr-rgba-00,6x6,30.959,1.723\n-ldr-rgba-01,6x6,32.344,1.393\n-ldr-rgba-02,6x6,27.900,2.046\n-ldr-xy-00,6x6,33.531,0.708\n-ldr-xy-01,6x6,33.740,1.309\n-ldr-xy-02,6x6,48.673,1.589\n-hdr-rgb-00,8x8,28.643,1.512\n-ldr-rgb-00,8x8,29.096,1.782\n-ldr-rgb-01,8x8,29.135,1.666\n-ldr-rgb-02,8x8,23.223,1.865\n-ldr-rgb-03,8x8,39.343,0.346\n-ldr-rgb-04,8x8,29.875,1.730\n-ldr-rgb-05,8x8,26.150,1.857\n-ldr-rgb-06,8x8,23.326,1.869\n-ldr-rgb-07,8x8,31.297,1.801\n-ldr-rgb-08,8x8,36.574,0.704\n-ldr-rgb-09,8x8,29.177,1.423\n-ldr-rgba-00,8x8,26.892,1.829\n-ldr-rgba-01,8x8,28.519,1.394\n-ldr-rgba-02,8x8,23.988,1.976\n-ldr-xy-00,8x8,32.378,0.710\n-ldr-xy-01,8x8,32.549,0.730\n-ldr-xy-02,8x8,44.943,0.688\n+hdr-rgb-00,4x4,21.400,1.084\n+ldr-rgb-00,4x4,39.193,1.054\n+ldr-rgb-01,4x4,40.370,0.958\n+ldr-rgb-02,4x4,35.458,0.844\n+ldr-rgb-03,4x4,47.483,1.087\n+ldr-rgb-04,4x4,42.300,0.829\n+ldr-rgb-05,4x4,38.003,0.925\n+ldr-rgb-06,4x4,35.452,0.782\n+ldr-rgb-07,4x4,39.762,1.201\n+ldr-rgb-08,4x4,45.781,1.104\n+ldr-rgb-09,4x4,42.162,0.922\n+ldr-rgba-00,4x4,37.065,1.150\n+ldr-rgba-01,4x4,39.032,1.035\n+ldr-rgba-02,4x4,35.025,1.361\n+ldr-xy-00,4x4,34.063,0.966\n+ldr-xy-01,4x4,34.733,1.101\n+ldr-xy-02,4x4,54.330,1.337\n+hdr-rgb-00,5x5,20.206,1.205\n+ldr-rgb-00,5x5,35.387,1.291\n+ldr-rgb-01,5x5,36.544,1.167\n+ldr-rgb-02,5x5,31.189,1.055\n+ldr-rgb-03,5x5,44.547,1.241\n+ldr-rgb-04,5x5,37.947,0.995\n+ldr-rgb-05,5x5,33.761,1.167\n+ldr-rgb-06,5x5,31.156,0.999\n+ldr-rgb-07,5x5,36.717,1.421\n+ldr-rgb-08,5x5,42.299,1.278\n+ldr-rgb-09,5x5,37.709,1.062\n+ldr-rgba-00,5x5,33.490,1.407\n+ldr-rgba-01,5x5,35.381,1.228\n+ldr-rgba-02,5x5,31.184,1.767\n+ldr-xy-00,5x5,33.898,0.828\n+ldr-xy-01,5x5,34.370,1.418\n+ldr-xy-02,5x5,51.346,1.539\n+hdr-rgb-00,6x6,23.292,1.217\n+ldr-rgb-00,6x6,32.739,1.660\n+ldr-rgb-01,6x6,33.246,1.622\n+ldr-rgb-02,6x6,27.569,1.719\n+ldr-rgb-03,6x6,42.525,0.863\n+ldr-rgb-04,6x6,34.496,1.630\n+ldr-rgb-05,6x6,30.444,1.721\n+ldr-rgb-06,6x6,27.572,1.714\n+ldr-rgb-07,6x6,34.549,1.658\n+ldr-rgb-08,6x6,39.939,0.933\n+ldr-rgb-09,6x6,33.861,1.580\n+ldr-rgba-00,6x6,30.959,1.662\n+ldr-rgba-01,6x6,32.344,1.321\n+ldr-rgba-02,6x6,27.900,1.975\n+ldr-xy-00,6x6,33.531,0.668\n+ldr-xy-01,6x6,33.740,1.256\n+ldr-xy-02,6x6,48.673,1.490\n+hdr-rgb-00,8x8,20.331,1.169\n+ldr-rgb-00,8x8,29.096,1.628\n+ldr-rgb-01,8x8,29.135,1.587\n+ldr-rgb-02,8x8,23.223,1.739\n+ldr-rgb-03,8x8,39.343,0.304\n+ldr-rgb-04,8x8,29.875,1.587\n+ldr-rgb-05,8x8,26.150,1.721\n+ldr-rgb-06,8x8,23.326,1.731\n+ldr-rgb-07,8x8,31.297,1.635\n+ldr-rgb-08,8x8,36.574,0.635\n+ldr-rgb-09,8x8,29.177,1.304\n+ldr-rgba-00,8x8,26.892,1.671\n+ldr-rgba-01,8x8,28.519,1.318\n+ldr-rgba-02,8x8,23.988,1.845\n+ldr-xy-00,8x8,32.378,0.670\n+ldr-xy-01,8x8,32.549,0.669\n+ldr-xy-02,8x8,44.943,0.635\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_run.py", "new_path": "Test/astc_test_run.py", "diff": "@@ -19,11 +19,8 @@ import subprocess as sp\nimport sys\n-DEBUG = False\n+LOG_CLI = False\n-if DEBUG:\n- TEST_BLOCK_SIZES = [\"4x4\", \"8x8\"]\n-else:\nTEST_BLOCK_SIZES = [\"4x4\", \"5x5\", \"6x6\", \"8x8\"]\nTEST_EXTENSIONS = [\".png\", \".hdr\"]\n@@ -101,7 +98,7 @@ class TestImage():\nself.runPSNR = dict()\nself.status = dict()\n- def run_once(self, testBinary, blockSize):\n+ def run_once(self, testBinary, blockSize, firstRun):\n\"\"\"\nRun a single compression pass.\n\"\"\"\n@@ -130,6 +127,14 @@ class TestImage():\nif self.format == \"xy\":\nargs.append(\"-normal_psnr\")\n+ # Switch HDR data formats into HDR compression mode; note that this\n+ # mode assumes that the alpha channel is non-correlated\n+ if self.dynamicRange == \"hdr\":\n+ args.append(\"-hdr\")\n+\n+ if LOG_CLI:\n+ print(\" + %s \" % \" \".join(args))\n+\ntry:\nresult = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\ncheck=True, universal_newlines=True)\n@@ -185,10 +190,10 @@ class TestImage():\n\"\"\"\nresults = []\nfor i in range(0, self.warmupRuns):\n- self.run_once(testBinary, blockSize)\n+ self.run_once(testBinary, blockSize, False)\nfor i in range(0, self.testRuns):\n- result = self.run_once(testBinary, blockSize)\n+ result = self.run_once(testBinary, blockSize, i == 0)\nresults.append(result)\nlistPSNR, timeList = list(zip(*results))\n@@ -406,10 +411,6 @@ def run_reference_rebuild():\n\"\"\"\nRun the reference test generator rebuild process.\n\"\"\"\n- if DEBUG:\n- TestImage.testRuns = 1\n- TestImage.warmupRuns = 0\n- else:\nTestImage.testRuns = 10\nTestImage.warmupRuns = 1\n@@ -455,10 +456,6 @@ def run_reference_update():\n\"\"\"\nRun the reference test generator update process.\n\"\"\"\n- if DEBUG:\n- TestImage.testRuns = 1\n- TestImage.warmupRuns = 0\n- else:\nTestImage.testRuns = 3\nTestImage.warmupRuns = 1\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix bug in cross() and add regression test
61,745
04.01.2020 17:39:46
0
1e5b364844f2173b4bfa2ea3430e05fa2b6269d4
Enable -hdr for the helper run utility
[ { "change_type": "MODIFY", "old_path": "Test/astc_run.py", "new_path": "Test/astc_run.py", "diff": "@@ -65,6 +65,11 @@ class TestImage():\nif self.format == \"xy\":\nargs.append(\"-normal_psnr\")\n+ # Switch HDR data formats into HDR compression mode; note that this\n+ # mode assumes that the alpha channel is non-correlated\n+ if self.dynamicRange == \"hdr\":\n+ args.append(\"-hdr\")\n+\n# Inject the callgrind profiler prefix\nif profile:\nargs.insert(0, \"--callgrind-out-file=callgrind.out\")\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Enable -hdr for the helper run utility
61,745
06.01.2020 23:00:46
0
1ef41839f04d574ea4beb679efea9da6b13f2dad
Remove global partition tables, move to bsd
[ { "change_type": "MODIFY", "old_path": "Source/astc_block_sizes2.cpp", "new_path": "Source/astc_block_sizes2.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -897,10 +897,13 @@ static void construct_block_size_descriptor_3d(int xdim, int ydim, int zdim, blo\n}\n}\n+/* Public function, see header file for detailed documentation */\nvoid init_block_size_descriptor(int xdim, int ydim, int zdim, block_size_descriptor* bsd)\n{\nif (zdim > 1)\nconstruct_block_size_descriptor_3d(xdim, ydim, zdim, bsd);\nelse\nconstruct_block_size_descriptor_2d(xdim, ydim, bsd);\n+\n+ init_partition_tables(bsd);\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -147,6 +147,9 @@ struct block_size_descriptor\n// which 64 texels (if that many) to consider.\nint texelcount_for_bitmap_partitioning;\nint texels_for_bitmap_partitioning[64];\n+\n+ // All the partitioning information for this block size\n+ partition_info partitions[(3*PARTITION_COUNT)+1];\n};\n// data structure representing one block of an image.\n@@ -341,12 +344,45 @@ struct physical_compressed_block\nuint8_t data[16];\n};\n+/**\n+ * @brief Populate the blocksize descriptor for the target block size.\n+ *\n+ * This will also initialize the partition table metadata, which is stored\n+ * as part of the BSD structure.\n+ *\n+ * @param xdim The x axis size of the block.\n+ * @param ydim The y axis size of the block.\n+ * @param zdim The z axis size of the block.\n+ * @param bsd The structure to populate.\n+ */\nvoid init_block_size_descriptor(\nint xdim,\nint ydim,\nint zdim,\nblock_size_descriptor* bsd);\n+/**\n+ * @brief Populate the partition tables for the target block size.\n+ *\n+ * Note the block_size_size descriptor must be initialized before calling this\n+ * function.\n+ *\n+ * @param bsd The structure to populate.\n+ */\n+void init_partition_tables(\n+ block_size_descriptor* bsd);\n+\n+static inline const partition_info *get_partition_table(\n+ const block_size_descriptor* bsd,\n+ int partition_count\n+) {\n+ if (partition_count == 1) {\n+ partition_count = 5;\n+ }\n+ int index = (partition_count - 2) * PARTITION_COUNT;\n+ return bsd->partitions + index;\n+}\n+\n// ***********************************************************\n// functions and data pertaining to quantization and encoding\n// **********************************************************\n@@ -368,10 +404,7 @@ extern int quantization_mode_table[17][128];\n// functions and data pertaining to partitioning\n// **********************************************\n-// function to get a pointer to a partition table or an array thereof.\n-const partition_info *get_partition_table(\n- const block_size_descriptor* bsd,\n- int partition_count);\n+\n// functions to compute color averages and dominant directions\n// for each partition in a block\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_partition_tables.cpp", "new_path": "Source/astc_partition_tables.cpp", "diff": "#include \"astc_codec_internals.h\"\n-static partition_info **partition_tables[4096];\n-\n/*\nProduce a canonicalized representation of a partition pattern\n@@ -258,45 +256,24 @@ void generate_one_partition_table(\n}\n}\n-static void generate_partition_tables(\n- const block_size_descriptor* bsd\n+/* Public function, see header file for detailed documentation */\n+void init_partition_tables(\n+ block_size_descriptor* bsd\n) {\n- int i;\n-\n- partition_info *one_partition = new partition_info;\n- partition_info *two_partitions = new partition_info[1024];\n- partition_info *three_partitions = new partition_info[1024];\n- partition_info *four_partitions = new partition_info[1024];\n+ partition_info *par_tab2 = bsd->partitions;\n+ partition_info *par_tab3 = par_tab2 + PARTITION_COUNT;\n+ partition_info *par_tab4 = par_tab3 + PARTITION_COUNT;\n+ partition_info *par_tab1 = par_tab4 + PARTITION_COUNT;\n- partition_info **partition_table = new partition_info *[5];\n- partition_table[0] = NULL;\n- partition_table[1] = one_partition;\n- partition_table[2] = two_partitions;\n- partition_table[3] = three_partitions;\n- partition_table[4] = four_partitions;\n-\n- generate_one_partition_table(bsd, 1, 0, one_partition);\n- for (i = 0; i < 1024; i++)\n+ generate_one_partition_table(bsd, 1, 0, par_tab1);\n+ for (int i = 0; i < 1024; i++)\n{\n- generate_one_partition_table(bsd, 2, i, two_partitions + i);\n- generate_one_partition_table(bsd, 3, i, three_partitions + i);\n- generate_one_partition_table(bsd, 4, i, four_partitions + i);\n- }\n-\n- partition_table_zap_equal_elements(bsd->texel_count, two_partitions);\n- partition_table_zap_equal_elements(bsd->texel_count, three_partitions);\n- partition_table_zap_equal_elements(bsd->texel_count, four_partitions);\n-\n- partition_tables[bsd->xdim + 16 * bsd->ydim + 256 * bsd->zdim] = partition_table;\n+ generate_one_partition_table(bsd, 2, i, par_tab2 + i);\n+ generate_one_partition_table(bsd, 3, i, par_tab3 + i);\n+ generate_one_partition_table(bsd, 4, i, par_tab4 + i);\n}\n-const partition_info *get_partition_table(\n- const block_size_descriptor* bsd,\n- int partition_count\n-) {\n- int ptindex = bsd->xdim + 16 * bsd->ydim + 256 * bsd->zdim;\n- if (partition_tables[ptindex] == NULL)\n- generate_partition_tables(bsd);\n-\n- return partition_tables[ptindex][partition_count];\n+ partition_table_zap_equal_elements(bsd->texel_count, par_tab2);\n+ partition_table_zap_equal_elements(bsd->texel_count, par_tab3);\n+ partition_table_zap_equal_elements(bsd->texel_count, par_tab4);\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove global partition tables, move to bsd
61,745
06.01.2020 23:45:17
0
32eb3e2bffb076fe6024516b15b488afd98f2b65
Formatting cleanup of the main codec header
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -203,11 +203,19 @@ struct error_weighting_params\nint max_refinement_iters;\n};\n-void update_imageblock_flags(imageblock * pb, int xdim, int ydim, int zdim);\n+void update_imageblock_flags(\n+ imageblock* pb,\n+ int xdim,\n+ int ydim,\n+ int zdim);\n-void imageblock_initialize_orig_from_work(imageblock * pb, int pixelcount);\n+void imageblock_initialize_orig_from_work(\n+ imageblock * pb,\n+ int pixelcount);\n-void imageblock_initialize_work_from_orig(imageblock * pb, int pixelcount);\n+void imageblock_initialize_work_from_orig(\n+ imageblock * pb,\n+ int pixelcount);\n/*\nData structure representing error weighting for one block of an image. this is used as\n@@ -389,91 +397,149 @@ static inline const partition_info *get_partition_table(\nextern const uint8_t color_quantization_tables[21][256];\nextern const uint8_t color_unquantization_tables[21][256];\n+extern int quantization_mode_table[17][128];\n-void encode_ise(int quantization_level, int elements, const uint8_t * input_data, uint8_t * output_data, int bit_offset);\n+void encode_ise(\n+ int quantization_level,\n+ int elements,\n+ const uint8_t* input_data,\n+ uint8_t* output_data,\n+ int bit_offset);\n-void decode_ise(int quantization_level, int elements, const uint8_t * input_data, uint8_t * output_data, int bit_offset);\n+void decode_ise(\n+ int quantization_level,\n+ int elements,\n+ const uint8_t* input_data,\n+ uint8_t* output_data,\n+ int bit_offset);\n-int compute_ise_bitcount(int items, quantization_method quant);\n+int compute_ise_bitcount(\n+ int items,\n+ quantization_method quant);\nvoid build_quantization_mode_table(void);\n-extern int quantization_mode_table[17][128];\n-\n// **********************************************\n// functions and data pertaining to partitioning\n// **********************************************\n-\n-\n// functions to compute color averages and dominant directions\n// for each partition in a block\n-void compute_averages_and_directions_rgb(const partition_info * pt,\n+void compute_averages_and_directions_rgb(\n+ const partition_info* pt,\nconst imageblock* blk,\nconst error_weight_block* ewb,\n- const float4 * color_scalefactors, float3 * averages, float3 * directions_rgb, float2 * directions_rg, float2 * directions_rb, float2 * directions_gb);\n+ const float4* color_scalefactors,\n+ float3* averages,\n+ float3* directions_rgb,\n+ float2* directions_rg,\n+ float2* directions_rb,\n+ float2* directions_gb);\n-void compute_averages_and_directions_rgba(const partition_info * pt,\n+void compute_averages_and_directions_rgba(\n+ const partition_info* pt,\nconst imageblock* blk,\nconst error_weight_block* ewb,\nconst float4* color_scalefactors,\n- float4 * averages, float4 * directions_rgba, float3 * directions_gba, float3 * directions_rba, float3 * directions_rga, float3 * directions_rgb);\n-\n-void compute_averages_and_directions_3_components(const partition_info * pt,\n+ float4* averages,\n+ float4* directions_rgba,\n+ float3* directions_gba,\n+ float3* directions_rba,\n+ float3* directions_rga,\n+ float3* directions_rgb);\n+\n+void compute_averages_and_directions_3_components(\n+ const partition_info* pt,\nconst imageblock* blk,\nconst error_weight_block* ewb,\n- const float3 * color_scalefactors, int component1, int component2, int component3, float3 * averages, float3 * directions);\n-\n-void compute_averages_and_directions_2_components(const partition_info * pt,\n+ const float3 * color_scalefactors,\n+ int component1,\n+ int component2,\n+ int component3,\n+ float3* averages,\n+ float3* directions);\n+\n+void compute_averages_and_directions_2_components(\n+ const partition_info* pt,\nconst imageblock* blk,\n- const error_weight_block * ewb, const float2 * color_scalefactors, int component1, int component2, float2 * averages, float2 * directions);\n+ const error_weight_block* ewb,\n+ const float2* color_scalefactors,\n+ int component1,\n+ int component2,\n+ float2* averages,\n+ float2* directions);\n// functions to compute error value across a tile given a partitioning\n// (with the assumption that each partitioning has colors lying on a line where\n// they are represented with infinite precision. Also return the length of the line\n// segments that the partition's colors are actually projected onto.\n-float compute_error_squared_gba(const partition_info * pt, // the partition that we use when computing the squared-error.\n- const imageblock * blk, const error_weight_block * ewb, const processed_line3 * plines,\n- // output: computed length of the partitioning's line. This is not part of the\n- // error introduced by partitioning itself, but us used to estimate the error introduced by quantization\n+float compute_error_squared_gba(\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line3* plines,\n+ // output: computed length of the partitioning's line. This is not part of\n+ // the error introduced by partitioning itself, but is used to estimate the\n+ // error introduced by quantization\nfloat* length_of_lines);\n-float compute_error_squared_rba(const partition_info * pt, // the partition that we use when computing the squared-error.\n- const imageblock * blk, const error_weight_block * ewb, const processed_line3 * plines,\n- // output: computed length of the partitioning's line. This is not part of the\n- // error introduced by partitioning itself, but us used to estimate the error introduced by quantization\n+float compute_error_squared_rba(\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line3* plines,\nfloat* length_of_lines);\n-float compute_error_squared_rga(const partition_info * pt, // the partition that we use when computing the squared-error.\n- const imageblock * blk, const error_weight_block * ewb, const processed_line3 * plines,\n- // output: computed length of the partitioning's line. This is not part of the\n- // error introduced by partitioning itself, but us used to estimate the error introduced by quantization\n+float compute_error_squared_rga(\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line3* plines,\nfloat* length_of_lines);\n-float compute_error_squared_rgb(const partition_info * pt, // the partition that we use when computing the squared-error.\n- const imageblock * blk, const error_weight_block * ewb, const processed_line3 * plines,\n- // output: computed length of the partitioning's line. This is not part of the\n- // error introduced by partitioning itself, but us used to estimate the error introduced by quantization\n+float compute_error_squared_rgb(\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line3* plines,\nfloat* length_of_lines);\n-\n-float compute_error_squared_rgba(const partition_info * pt, // the partition that we use when computing the squared-error.\n- const imageblock * blk, const error_weight_block * ewb, const processed_line4 * lines, // one line for each of the partitions. The lines are assumed to be normalized.\n+float compute_error_squared_rgba(\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line4* plines,\nfloat* length_of_lines);\n-float compute_error_squared_rg(const partition_info * pt, // the partition that we use when computing the squared-error.\n- const imageblock * blk, const error_weight_block * ewb, const processed_line2 * plines, float *length_of_lines);\n+float compute_error_squared_rg(\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line2* plines,\n+ float* length_of_lines);\n-float compute_error_squared_rb(const partition_info * pt, // the partition that we use when computing the squared-error.\n- const imageblock * blk, const error_weight_block * ewb, const processed_line2 * plines, float *length_of_lines);\n+float compute_error_squared_rb(\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line2* plines,\n+ float* length_of_lines);\n-float compute_error_squared_gb(const partition_info * pt, // the partition that we use when computing the squared-error.\n- const imageblock * blk, const error_weight_block * ewb, const processed_line2 * plines, float *length_of_lines);\n+float compute_error_squared_gb(\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line2* plines,\n+ float* length_of_lines);\n-float compute_error_squared_ra(const partition_info * pt, // the partition that we use when computing the squared-error.\n- const imageblock * blk, const error_weight_block * ewb, const processed_line2 * plines, float *length_of_lines);\n+float compute_error_squared_ra(\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line2* plines,\n+ float* length_of_lines);\n// functions to compute error value across a tile for a particular line function\n// for a single partition.\n@@ -503,11 +569,8 @@ void find_best_partitionings(\nconst imageblock* pb,\nconst error_weight_block* ewb,\nint candidates_to_return,\n- // best partitionings to use if the endpoint colors are assumed to be uncorrelated\nint* best_partitions_uncorrelated,\n- // best partitionings to use if the endpoint colors have the same chroma\nint* best_partitions_samechroma,\n- // best partitionings to use if dual plane of weights are present\nint* best_partitions_dual_weight_planes);\n// use k-means clustering to compute a partition ordering for a block.\n@@ -538,10 +601,24 @@ struct astc_codec_image\nfloat *input_alpha_averages;\n};\n-void destroy_image(astc_codec_image * img);\n-astc_codec_image *allocate_image(int bitness, int xsize, int ysize, int zsize, int padding);\n-void initialize_image(astc_codec_image * img);\n-void fill_image_padding_area(astc_codec_image * img);\n+astc_codec_image *allocate_image(\n+ int bitness,\n+ int xsize,\n+ int ysize,\n+ int zsize,\n+ int padding);\n+\n+void initialize_image(\n+ astc_codec_image * img);\n+\n+void destroy_image(\n+ astc_codec_image * img);\n+\n+void fill_image_padding_area(\n+ astc_codec_image * img);\n+\n+int determine_image_channels(\n+ const astc_codec_image * img);\n// the entries here : 0=red, 1=green, 2=blue, 3=alpha, 4=0.0, 5=1.0\nstruct swizzlepattern\n@@ -552,8 +629,6 @@ struct swizzlepattern\nuint8_t a;\n};\n-int determine_image_channels(const astc_codec_image * img);\n-\n/**\n* @brief Compute regional averages and variances in an image.\n*\n@@ -653,7 +728,8 @@ void write_imageblock(\n// helper function to check whether a given picture-block has alpha that is not\n// just uniformly 1.\n-int imageblock_uses_alpha(const imageblock * pb);\n+int imageblock_uses_alpha(\n+ const imageblock * pb);\nfloat compute_imageblock_difference(\nconst block_size_descriptor* bsd,\n@@ -694,19 +770,39 @@ void compute_endpoints_and_ideal_weights_2_planes(\nendpoints_and_weights* ei1, // primary plane weights\nendpoints_and_weights* ei2); // secondary plane weights\n-void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * eai, const decimation_table * it, float *weight_set, float *weights);\n-\n-void compute_ideal_quantized_weights_for_decimation_table(const endpoints_and_weights * eai,\n+void compute_ideal_weights_for_decimation_table(\n+ const endpoints_and_weights* eai,\nconst decimation_table* it,\n- float low_bound, float high_bound, const float *weight_set_in, float *weight_set_out, uint8_t * quantized_weight_set, int quantization_level);\n+ float* weight_set,\n+ float* weights);\n-float compute_error_of_weight_set(const endpoints_and_weights * eai, const decimation_table * it, const float *weights);\n+void compute_ideal_quantized_weights_for_decimation_table(\n+ const endpoints_and_weights* eai,\n+ const decimation_table* it,\n+ float low_bound,\n+ float high_bound,\n+ const float* weight_set_in,\n+ float* weight_set_out,\n+ uint8_t* quantized_weight_set,\n+ int quantization_level);\n+\n+float compute_error_of_weight_set(\n+ const endpoints_and_weights* eai,\n+ const decimation_table* it,\n+ const float *weights);\n-float compute_value_of_texel_flt(int texel_to_get, const decimation_table * it, const float *weights);\n+float compute_value_of_texel_flt(\n+ int texel_to_get,\n+ const decimation_table * it,\n+ const float *weights);\n-int compute_value_of_texel_int(int texel_to_get, const decimation_table * it, const int *weights);\n+int compute_value_of_texel_int(\n+ int texel_to_get,\n+ const decimation_table* it,\n+ const int* weights);\n-void merge_endpoints(const endpoints * ep1, // contains three of the color components\n+void merge_endpoints(\n+ const endpoints* ep1, // contains three of the color components\nconst endpoints* ep2, // contains the remaining color component\nint separate_component, endpoints* res);\n@@ -715,10 +811,26 @@ void merge_endpoints(const endpoints * ep1, // contains three of the color compo\n// function to pack a pair of color endpoints into a series of integers.\n// the format used may or may not match the format specified;\n// the return value is the format actually used.\n-int pack_color_endpoints(float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, int format, int *output, int quantization_level);\n+int pack_color_endpoints(\n+ float4 color0,\n+ float4 color1,\n+ float4 rgbs_color,\n+ float4 rgbo_color,\n+ int format,\n+ int* output,\n+ int quantization_level);\n// unpack a pair of color endpoints from a series of integers.\n-void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, uint4 * output0, uint4 * output1);\n+void unpack_color_endpoints(\n+ astc_decode_mode decode_mode,\n+ int format,\n+ int quantization_level,\n+ const int* input,\n+ int* rgb_hdr,\n+ int* alpha_hdr,\n+ int* nan_endpoint,\n+ uint4* output0,\n+ uint4* output1);\nstruct encoding_choice_errors\n{\n@@ -830,15 +942,20 @@ float compress_symbolic_block(\nsymbolic_compressed_block* scb,\ncompress_symbolic_block_buffers* tmpbuf);\n-float4 lerp_color_flt(const float4 color0, const float4 color1, float weight, // 0..1\n+float4 lerp_color_flt(\n+ const float4 color0,\n+ const float4 color1,\n+ float weight, // 0..1\nfloat plane2_weight, // 0..1\n- int plane2_color_component // 0..3; -1 if only one plane of weights is present.\n- );\n+ int plane2_color_component); // 0..3; -1 if only one plane of weights is present.\n-uint4 lerp_color_int(astc_decode_mode decode_mode, uint4 color0, uint4 color1, int weight, // 0..64\n+uint4 lerp_color_int(\n+ astc_decode_mode decode_mode,\n+ uint4 color0,\n+ uint4 color1,\n+ int weight, // 0..64\nint plane2_weight, // 0..64\n- int plane2_color_component // 0..3; -1 if only one plane of weights is present.\n- );\n+ int plane2_color_component); // 0..3; -1 if only one plane of weights is present.\nvoid decompress_symbolic_block(\nastc_decode_mode decode_mode,\n@@ -858,9 +975,14 @@ void physical_to_symbolic(\nphysical_compressed_block pb,\nsymbolic_compressed_block* res);\n-uint16_t unorm16_to_sf16(uint16_t p);\n-uint16_t lns_to_sf16(uint16_t p);\n+uint16_t unorm16_to_sf16(\n+ uint16_t p);\n+\n+uint16_t lns_to_sf16(\n+ uint16_t p);\n-int astc_main(int argc, char ** argv);\n+int astc_main(\n+ int argc,\n+ char** argv);\n#endif\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Formatting cleanup of the main codec header
61,745
06.01.2020 23:45:50
0
32795286af33e060bcbd08be4b007369a0d8dab2
Compute only the upper-left corner for covariance The matrix is symmetrical, so 6 of the 16 values are redundant
[ { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -1031,31 +1031,27 @@ static float prepare_error_weight_block(\nreturn dot(error_weight_sum, float4(1, 1, 1, 1));\n}\n-/*\n- functions to analyze block statistical properties:\n- * simple properties: * mean * variance\n- * covariance-matrix correllation coefficients\n- */\n-\n-// compute averages and covariance matrices for 4 components\n-static void compute_covariance_matrix(int texels_per_block, const imageblock * blk, const error_weight_block * ewb, mat4 * cov_matrix)\n+static void prepare_block_statistics(int texels_per_block, const imageblock * blk, const error_weight_block * ewb, int *is_normal_map, float *lowest_correl)\n{\nint i;\n- float r_sum = 0.0f;\n- float g_sum = 0.0f;\n- float b_sum = 0.0f;\n- float a_sum = 0.0f;\n- float rr_sum = 0.0f;\n- float gg_sum = 0.0f;\n- float bb_sum = 0.0f;\n- float aa_sum = 0.0f;\n- float rg_sum = 0.0f;\n- float rb_sum = 0.0f;\n- float ra_sum = 0.0f;\n- float gb_sum = 0.0f;\n- float ga_sum = 0.0f;\n- float ba_sum = 0.0f;\n+ // compute covariance matrix, as a collection of 10 scalars\n+ // (that form the upper-triangular row of the matrix; the matrix is\n+ // symmetric, so this is all we need)\n+ float rs = 0.0f;\n+ float gs = 0.0f;\n+ float bs = 0.0f;\n+ float as = 0.0f;\n+ float rr_var = 0.0f;\n+ float gg_var = 0.0f;\n+ float bb_var = 0.0f;\n+ float aa_var = 0.0f;\n+ float rg_cov = 0.0f;\n+ float rb_cov = 0.0f;\n+ float ra_cov = 0.0f;\n+ float gb_cov = 0.0f;\n+ float ga_cov = 0.0f;\n+ float ba_cov = 0.0f;\nfloat weight_sum = 0.0f;\n@@ -1065,78 +1061,71 @@ static void compute_covariance_matrix(int texels_per_block, const imageblock * b\nif (weight < 0.0f)\nASTC_CODEC_INTERNAL_ERROR();\nweight_sum += weight;\n+\nfloat r = blk->work_data[4 * i];\nfloat g = blk->work_data[4 * i + 1];\nfloat b = blk->work_data[4 * i + 2];\nfloat a = blk->work_data[4 * i + 3];\n- r_sum += r * weight;\n- rr_sum += r * (r * weight);\n- rg_sum += g * (r * weight);\n- rb_sum += b * (r * weight);\n- ra_sum += a * (r * weight);\n- g_sum += g * weight;\n- gg_sum += g * (g * weight);\n- gb_sum += b * (g * weight);\n- ga_sum += a * (g * weight);\n- b_sum += b * weight;\n- bb_sum += b * (b * weight);\n- ba_sum += a * (b * weight);\n- a_sum += a * weight;\n- aa_sum += a * (a * weight);\n+\n+ float rw = r * weight;\n+ rs += rw;\n+ rr_var += r * rw;\n+ rg_cov += g * rw;\n+ rb_cov += b * rw;\n+ ra_cov += a * rw;\n+\n+ float gw = g * weight;\n+ gs += gw;\n+ gg_var += g * gw;\n+ gb_cov += b * gw;\n+ ga_cov += a * gw;\n+\n+ float bw = b * weight;\n+ bs += bw;\n+ bb_var += b * bw;\n+ ba_cov += a * bw;\n+\n+ float aw = a * weight;\n+ as += aw;\n+ aa_var += a * aw;\n}\nfloat rpt = 1.0f / MAX(weight_sum, 1e-7f);\n- float rs = r_sum;\n- float gs = g_sum;\n- float bs = b_sum;\n- float as = a_sum;\n- cov_matrix->v[0] = float4(rr_sum - rs * rs * rpt, rg_sum - rs * gs * rpt, rb_sum - rs * bs * rpt, ra_sum - rs * as * rpt);\n- cov_matrix->v[1] = float4(rg_sum - rs * gs * rpt, gg_sum - gs * gs * rpt, gb_sum - gs * bs * rpt, ga_sum - gs * as * rpt);\n- cov_matrix->v[2] = float4(rb_sum - rs * bs * rpt, gb_sum - gs * bs * rpt, bb_sum - bs * bs * rpt, ba_sum - bs * as * rpt);\n- cov_matrix->v[3] = float4(ra_sum - rs * as * rpt, ga_sum - gs * as * rpt, ba_sum - bs * as * rpt, aa_sum - as * as * rpt);\n-}\n+ rr_var -= rs*(rs*rpt);\n+ rg_cov -= gs*(rs*rpt);\n+ rb_cov -= bs*(rs*rpt);\n+ ra_cov -= as*(rs*rpt);\n-static void prepare_block_statistics(int texels_per_block, const imageblock * blk, const error_weight_block * ewb, int *is_normal_map, float *lowest_correl)\n-{\n- int i;\n+ gg_var -= gs*(gs*rpt);\n+ gb_cov -= bs*(gs*rpt);\n+ ga_cov -= as*(gs*rpt);\n+\n+ bb_var -= bs*(bs*rpt);\n+ ba_cov -= as*(bs*rpt);\n+\n+ aa_var -= as*(as*rpt);\n+\n+\n+ rg_cov *= 1.0f / sqrtf(MAX(rr_var * gg_var, 1e-30f));\n+ rb_cov *= 1.0f / sqrtf(MAX(rr_var * bb_var, 1e-30f));\n+ ra_cov *= 1.0f / sqrtf(MAX(rr_var * aa_var, 1e-30f));\n+ gb_cov *= 1.0f / sqrtf(MAX(gg_var * bb_var, 1e-30f));\n+ ga_cov *= 1.0f / sqrtf(MAX(gg_var * aa_var, 1e-30f));\n+ ba_cov *= 1.0f / sqrtf(MAX(bb_var * aa_var, 1e-30f));\n+\n+ if (astc_isnan(rg_cov)) rg_cov = 1.0f;\n+ if (astc_isnan(rb_cov)) rb_cov = 1.0f;\n+ if (astc_isnan(ra_cov)) ra_cov = 1.0f;\n+ if (astc_isnan(gb_cov)) gb_cov = 1.0f;\n+ if (astc_isnan(ga_cov)) ga_cov = 1.0f;\n+ if (astc_isnan(ba_cov)) ba_cov = 1.0f;\n- mat4 cov_matrix;\n-\n- compute_covariance_matrix(texels_per_block, blk, ewb, &cov_matrix);\n-\n- // use the covariance matrix to compute\n- // correllation coefficients\n- float rr_var = cov_matrix.v[0].x;\n- float gg_var = cov_matrix.v[1].y;\n- float bb_var = cov_matrix.v[2].z;\n- float aa_var = cov_matrix.v[3].w;\n-\n- float rg_correlation = cov_matrix.v[0].y / sqrtf(MAX(rr_var * gg_var, 1e-30f));\n- float rb_correlation = cov_matrix.v[0].z / sqrtf(MAX(rr_var * bb_var, 1e-30f));\n- float ra_correlation = cov_matrix.v[0].w / sqrtf(MAX(rr_var * aa_var, 1e-30f));\n- float gb_correlation = cov_matrix.v[1].z / sqrtf(MAX(gg_var * bb_var, 1e-30f));\n- float ga_correlation = cov_matrix.v[1].w / sqrtf(MAX(gg_var * aa_var, 1e-30f));\n- float ba_correlation = cov_matrix.v[2].w / sqrtf(MAX(bb_var * aa_var, 1e-30f));\n-\n- if (astc_isnan(rg_correlation))\n- rg_correlation = 1.0f;\n- if (astc_isnan(rb_correlation))\n- rb_correlation = 1.0f;\n- if (astc_isnan(ra_correlation))\n- ra_correlation = 1.0f;\n- if (astc_isnan(gb_correlation))\n- gb_correlation = 1.0f;\n- if (astc_isnan(ga_correlation))\n- ga_correlation = 1.0f;\n- if (astc_isnan(ba_correlation))\n- ba_correlation = 1.0f;\n-\n- float lowest_correlation = MIN(fabsf(rg_correlation), fabsf(rb_correlation));\n- lowest_correlation = MIN(lowest_correlation, fabsf(ra_correlation));\n- lowest_correlation = MIN(lowest_correlation, fabsf(gb_correlation));\n- lowest_correlation = MIN(lowest_correlation, fabsf(ga_correlation));\n- lowest_correlation = MIN(lowest_correlation, fabsf(ba_correlation));\n+ float lowest_correlation = MIN(fabsf(rg_cov), fabsf(rb_cov));\n+ lowest_correlation = MIN(lowest_correlation, fabsf(ra_cov));\n+ lowest_correlation = MIN(lowest_correlation, fabsf(gb_cov));\n+ lowest_correlation = MIN(lowest_correlation, fabsf(ga_cov));\n+ lowest_correlation = MIN(lowest_correlation, fabsf(ba_cov));\n*lowest_correl = lowest_correlation;\n// compute a \"normal-map\" factor\n@@ -1155,8 +1144,7 @@ static void prepare_block_statistics(int texels_per_block, const imageblock * bl\nfloat nf = fabsf(length_squared - 1.0f);\nnf_sum += nf;\n}\n- float nf_avg = nf_sum / texels_per_block;\n- *is_normal_map = nf_avg < 0.2f;\n+ *is_normal_map = nf_sum < (0.2f * (float)texels_per_block);\n}\nint block_mode_histogram[2048];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Compute only the upper-left corner for covariance The matrix is symmetrical, so 6 of the 16 values are redundant
61,745
07.01.2020 00:08:54
0
10179e4923f70f97790f213639fbb1950798f6f8
Change size utility to parse sysv output format
[ { "change_type": "MODIFY", "old_path": "Test/astc_size.py", "new_path": "Test/astc_size.py", "diff": "@@ -30,17 +30,23 @@ def get_reference_binary():\ndef run_size(binary):\n- args = [\"size\", binary]\n+ args = [\"size\", \"--format=sysv\", binary]\nresult = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\ncheck=True, universal_newlines=True)\n- lines = result.stdout.splitlines()\n- assert len(lines) == 2\n- values = lines[1].split()\n+ data = {}\n+ patterns = {\"Code\": \".text\", \"RO\": \".rodata\", \"ZI\": \".bss\"}\n- codeSection = float(values[0])\n- roSection = float(values[1])\n- ziSection = float(values[2])\n+ lines = result.stdout.splitlines()\n+ for line in lines:\n+ for key, value in patterns.items():\n+ if line.startswith(value):\n+ size = float(line.split()[1])\n+ data[key] = size\n+\n+ codeSection = data[\"Code\"]\n+ roSection = data[\"RO\"]\n+ ziSection = data[\"ZI\"]\nreturn (codeSection, roSection, ziSection)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Change size utility to parse sysv output format
61,745
07.01.2020 00:18:10
0
6f67a04e84b893882ead817d4efcd92604c4f114
Add warning to 2.0 branch Readme.md
[ { "change_type": "MODIFY", "old_path": "Binary/linux-x64/astcenc", "new_path": "Binary/linux-x64/astcenc", "diff": "Binary files a/Binary/linux-x64/astcenc and b/Binary/linux-x64/astcenc differ\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_integer_sequence.cpp", "new_path": "Source/astc_integer_sequence.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_kmeans_partitioning.cpp", "new_path": "Source/astc_kmeans_partitioning.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_main.cpp", "new_path": "Source/astc_main.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_partition_tables.cpp", "new_path": "Source/astc_partition_tables.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_percentile_tables.cpp", "new_path": "Source/astc_percentile_tables.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_quantization.cpp", "new_path": "Source/astc_quantization.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_symbolic_physical.cpp", "new_path": "Source/astc_symbolic_physical.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_quant_xfer_tables.cpp", "new_path": "Source/astc_weight_quant_xfer_tables.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add warning to 2.0 branch Readme.md
61,745
08.01.2020 00:38:39
0
515c09501115f8b2313ae6af89606db96f0d562c
Reduce complexity of compute_avgs_and_dirs
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "@@ -9,3 +9,4 @@ Source/VS2017/Release\nSource/VS2017/Debug\nSource/VS2017/astcenc.vcxproj.user\nTestOutput\n+Binary/linux-x64/astcenc-base\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_averages_and_directions.cpp", "new_path": "Source/astc_averages_and_directions.cpp", "diff": "@@ -34,11 +34,7 @@ void compute_averages_and_directions_rgba(\nconst error_weight_block* ewb,\nconst float4* color_scalefactors,\nfloat4* averages,\n- float4* directions_rgba,\n- float3* directions_gba,\n- float3* directions_rba,\n- float3* directions_rga,\n- float3* directions_rgb\n+ float4* directions_rgba\n) { int i;\nint partition_count = pt->partition_count;\nint partition;\n@@ -117,10 +113,6 @@ void compute_averages_and_directions_rgba(\n}\ndirections_rgba[partition] = best_vector;\n- directions_rgb[partition] = float3(best_vector.x, best_vector.y, best_vector.z);\n- directions_rga[partition] = float3(best_vector.x, best_vector.y, best_vector.w);\n- directions_rba[partition] = float3(best_vector.x, best_vector.z, best_vector.w);\n- directions_gba[partition] = float3(best_vector.y, best_vector.z, best_vector.w);\n}\n}\n@@ -130,10 +122,7 @@ void compute_averages_and_directions_rgb(\nconst error_weight_block* ewb,\nconst float4* color_scalefactors,\nfloat3* averages,\n- float3* directions_rgb,\n- float2* directions_rg,\n- float2* directions_rb,\n- float2* directions_gb\n+ float3* directions_rgb\n) {\nint i;\nint partition_count = pt->partition_count;\n@@ -204,9 +193,6 @@ void compute_averages_and_directions_rgb(\n}\ndirections_rgb[partition] = best_vector;\n- directions_gb[partition] = float2(best_vector.y, best_vector.z);\n- directions_rb[partition] = float2(best_vector.x, best_vector.z);\n- directions_rg[partition] = float2(best_vector.x, best_vector.y);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -432,10 +432,7 @@ void compute_averages_and_directions_rgb(\nconst error_weight_block* ewb,\nconst float4* color_scalefactors,\nfloat3* averages,\n- float3* directions_rgb,\n- float2* directions_rg,\n- float2* directions_rb,\n- float2* directions_gb);\n+ float3* directions_rgb);\nvoid compute_averages_and_directions_rgba(\n@@ -444,11 +441,7 @@ void compute_averages_and_directions_rgba(\nconst error_weight_block* ewb,\nconst float4* color_scalefactors,\nfloat4* averages,\n- float4* directions_rgba,\n- float3* directions_gba,\n- float3* directions_rba,\n- float3* directions_rga,\n- float3* directions_rgb);\n+ float4* directions_rgba);\nvoid compute_averages_and_directions_3_components(\nconst partition_info* pt,\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_encoding_choice_error.cpp", "new_path": "Source/astc_encoding_choice_error.cpp", "diff": "@@ -116,9 +116,6 @@ void compute_encoding_choice_errors(\nfloat3 averages[4];\nfloat3 directions_rgb[4];\n- float2 directions_rg[4];\n- float2 directions_rb[4];\n- float2 directions_gb[4];\nfloat4 error_weightings[4];\nfloat4 color_scalefactors[4];\n@@ -126,7 +123,7 @@ void compute_encoding_choice_errors(\ncompute_partition_error_color_weightings(bsd, ewb, pi, error_weightings, color_scalefactors);\n- compute_averages_and_directions_rgb(pi, pb, ewb, color_scalefactors, averages, directions_rgb, directions_rg, directions_rb, directions_gb);\n+ compute_averages_and_directions_rgb(pi, pb, ewb, color_scalefactors, averages, directions_rgb);\nline3 uncorr_rgb_lines[4];\nline3 samechroma_rgb_lines[4]; // for LDR-RGB-scale\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_find_best_partitioning.cpp", "new_path": "Source/astc_find_best_partitioning.cpp", "diff": "@@ -320,16 +320,10 @@ void find_best_partitionings(\nfloat4 averages[4];\nfloat4 directions_rgba[4];\n- float3 directions_gba[4];\n- float3 directions_rba[4];\n- float3 directions_rga[4];\n- float3 directions_rgb[4];\ncompute_averages_and_directions_rgba(ptab + partition, pb, ewb,\ncolor_scalefactors, averages,\n- directions_rgba, directions_gba,\n- directions_rba, directions_rga,\n- directions_rgb);\n+ directions_rgba);\nline4 uncorr_lines[4];\nline4 samechroma_lines[4];\n@@ -375,28 +369,32 @@ void find_best_partitionings(\nproc_samechroma_lines[j].bis = (samechroma_lines[j].b * inverse_color_scalefactors[j]);\nseparate_red_lines[j].a = float3(averages[j].y, averages[j].z, averages[j].w);\n- if (dot(directions_gba[j], directions_gba[j]) == 0.0f)\n+ float3 dirs_gba = float3(directions_rgba[j].y, directions_rgba[j].z, directions_rgba[j].w);\n+ if (dot(dirs_gba, dirs_gba) == 0.0f)\nseparate_red_lines[j].b = normalize(float3(1, 1, 1));\nelse\n- separate_red_lines[j].b = normalize(directions_gba[j]);\n+ separate_red_lines[j].b = normalize(dirs_gba);\nseparate_green_lines[j].a = float3(averages[j].x, averages[j].z, averages[j].w);\n- if (dot(directions_rba[j], directions_rba[j]) == 0.0f)\n+ float3 dirs_rba = float3(directions_rgba[j].x, directions_rgba[j].z, directions_rgba[j].w);\n+ if (dot(dirs_rba, dirs_rba) == 0.0f)\nseparate_green_lines[j].b = normalize(float3(1, 1, 1));\nelse\n- separate_green_lines[j].b = normalize(directions_rba[j]);\n+ separate_green_lines[j].b = normalize(dirs_rba);\nseparate_blue_lines[j].a = float3(averages[j].x, averages[j].y, averages[j].w);\n- if (dot(directions_rga[j], directions_rga[j]) == 0.0f)\n+ float3 dirs_rga = float3(directions_rgba[j].x, directions_rgba[j].y, directions_rgba[j].w);\n+ if (dot(dirs_rga, dirs_rga ) == 0.0f)\nseparate_blue_lines[j].b = normalize(float3(1, 1, 1));\nelse\n- separate_blue_lines[j].b = normalize(directions_rga[j]);\n+ separate_blue_lines[j].b = normalize(dirs_rga);\nseparate_alpha_lines[j].a = float3(averages[j].x, averages[j].y, averages[j].z);\n- if (dot(directions_rgb[j], directions_rgb[j]) == 0.0f)\n+ float3 dirs_rgb = float3(directions_rgba[j].x, directions_rgba[j].y, directions_rgba[j].z);\n+ if (dot(dirs_rgb, dirs_rgb) == 0.0f)\nseparate_alpha_lines[j].b = normalize(float3(1, 1, 1));\nelse\n- separate_alpha_lines[j].b = normalize(directions_rgb[j]);\n+ separate_alpha_lines[j].b = normalize(dirs_rgb);\nproc_separate_red_lines[j].amod = (separate_red_lines[j].a - separate_red_lines[j].b * dot(separate_red_lines[j].a, separate_red_lines[j].b)) * float3(inverse_color_scalefactors[j].y, inverse_color_scalefactors[j].z, inverse_color_scalefactors[j].w);\nproc_separate_red_lines[j].bs = (separate_red_lines[j].b * float3(color_scalefactors[j].y, color_scalefactors[j].z, color_scalefactors[j].w));\n@@ -594,11 +592,8 @@ void find_best_partitionings(\nfloat3 averages[4];\nfloat3 directions_rgb[4];\n- float2 directions_rg[4];\n- float2 directions_rb[4];\n- float2 directions_gb[4];\n- compute_averages_and_directions_rgb(ptab + partition, pb, ewb, color_scalefactors, averages, directions_rgb, directions_rg, directions_rb, directions_gb);\n+ compute_averages_and_directions_rgb(ptab + partition, pb, ewb, color_scalefactors, averages, directions_rgb);\nline3 uncorr_lines[4];\nline3 samechroma_lines[4];\n@@ -644,22 +639,25 @@ void find_best_partitionings(\nproc_samechroma_lines[j].bis = (samechroma_lines[j].b * float3(inverse_color_scalefactors[j].x, inverse_color_scalefactors[j].y, inverse_color_scalefactors[j].z));\nseparate_red_lines[j].a = float2(averages[j].y, averages[j].z);\n- if (dot(directions_gb[j], directions_gb[j]) == 0.0f)\n+ float2 dirs_gb = float2(directions_rgb[j].y, directions_rgb[j].z);\n+ if (dot(dirs_gb, dirs_gb) == 0.0f)\nseparate_red_lines[j].b = normalize(float2(1, 1));\nelse\n- separate_red_lines[j].b = normalize(directions_gb[j]);\n+ separate_red_lines[j].b = normalize(dirs_gb);\nseparate_green_lines[j].a = float2(averages[j].x, averages[j].z);\n- if (dot(directions_rb[j], directions_rb[j]) == 0.0f)\n+ float2 dirs_rb = float2(directions_rgb[j].x, directions_rgb[j].z);\n+ if (dot(dirs_rb, dirs_rb) == 0.0f)\nseparate_green_lines[j].b = normalize(float2(1, 1));\nelse\n- separate_green_lines[j].b = normalize(directions_rb[j]);\n+ separate_green_lines[j].b = normalize(dirs_rb);\nseparate_blue_lines[j].a = float2(averages[j].x, averages[j].y);\n- if (dot(directions_rg[j], directions_rg[j]) == 0.0f)\n+ float2 dirs_rg = float2(directions_rgb[j].x, directions_rgb[j].y);\n+ if (dot(dirs_rg, dirs_rg) == 0.0f)\nseparate_blue_lines[j].b = normalize(float2(1, 1));\nelse\n- separate_blue_lines[j].b = normalize(directions_rg[j]);\n+ separate_blue_lines[j].b = normalize(dirs_rg);\nproc_separate_red_lines[j].amod = (separate_red_lines[j].a - separate_red_lines[j].b * dot(separate_red_lines[j].a, separate_red_lines[j].b)) * float2(inverse_color_scalefactors[j].y, inverse_color_scalefactors[j].z);\nproc_separate_red_lines[j].bs = (separate_red_lines[j].b * float2(color_scalefactors[j].y, color_scalefactors[j].z));\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -718,10 +718,6 @@ static void compute_endpoints_and_ideal_weights_rgba(\nfloat4 averages[4];\nfloat4 directions_rgba[4];\n- float3 directions_gba[4];\n- float3 directions_rba[4];\n- float3 directions_rga[4];\n- float3 directions_rgb[4];\nline4 lines[4];\n@@ -739,7 +735,7 @@ static void compute_endpoints_and_ideal_weights_rgba(\nfor (i = 0; i < partition_count; i++)\nscalefactors[i] = normalize(color_scalefactors[i]) * 2.0f;\n- compute_averages_and_directions_rgba(pt, blk, ewb, scalefactors, averages, directions_rgba, directions_gba, directions_rba, directions_rga, directions_rgb);\n+ compute_averages_and_directions_rgba(pt, blk, ewb, scalefactors, averages, directions_rgba);\n// if the direction-vector ends up pointing from light to dark, FLIP IT!\n// this will make the first endpoint the darkest one.\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Reduce complexity of compute_avgs_and_dirs
61,745
09.01.2020 01:08:18
0
5ce42a94814e8ed5f290d2420682e3f244a6f4cd
Clean up platform-specific code Platform specific code migrated to a separate file, and added a new helper utility to spawn N threads executing a partitioned workload.
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -28,6 +28,7 @@ SOURCES = \\\nastc_partition_tables.cpp \\\nastc_percentile_tables.cpp \\\nastc_pick_best_endpoint_format.cpp \\\n+ astc_platform_dependents.cpp \\\nastc_quantization.cpp \\\nastc_stb_tga.cpp \\\nastc_symbolic_physical.cpp \\\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -465,33 +465,22 @@ void compute_averages_and_directions_2_components(\nfloat2* averages,\nfloat2* directions);\n-// functions to compute error value across a tile given a partitioning\n-// (with the assumption that each partitioning has colors lying on a line where\n-// they are represented with infinite precision. Also return the length of the line\n-// segments that the partition's colors are actually projected onto.\n-float compute_error_squared_gba(\n- const partition_info* pt, // the partition that we use when computing the squared-error.\n- const imageblock* blk,\n- const error_weight_block* ewb,\n- const processed_line3* plines,\n- // output: computed length of the partitioning's line. This is not part of\n- // the error introduced by partitioning itself, but is used to estimate the\n- // error introduced by quantization\n- float* length_of_lines);\n-\n-float compute_error_squared_rba(\n- const partition_info* pt, // the partition that we use when computing the squared-error.\n- const imageblock* blk,\n- const error_weight_block* ewb,\n- const processed_line3* plines,\n- float* length_of_lines);\n-\n-float compute_error_squared_rga(\n+void compute_error_squared_rgba(\nconst partition_info* pt, // the partition that we use when computing the squared-error.\nconst imageblock* blk,\nconst error_weight_block* ewb,\n- const processed_line3* plines,\n- float* length_of_lines);\n+ const processed_line4* plines_uncorr,\n+ const processed_line4* plines_samechroma,\n+ const processed_line3* plines_separate_red,\n+ const processed_line3* plines_separate_green,\n+ const processed_line3* plines_separate_blue,\n+ const processed_line3* plines_separate_alpha,\n+ float* length_uncorr,\n+ float* length_samechroma,\n+ float4* length_separate,\n+ float* uncorr_error,\n+ float* samechroma_error,\n+ float4* separate_color_error);\nvoid compute_error_squared_rgb(\nconst partition_info* pt, // the partition that we use when computing the squared-error.\n@@ -509,23 +498,6 @@ void compute_error_squared_rgb(\nfloat* samechroma_error,\nfloat3* separate_color_error);\n-void compute_error_squared_rgba(\n- const partition_info* pt, // the partition that we use when computing the squared-error.\n- const imageblock* blk,\n- const error_weight_block* ewb,\n- const processed_line4* plines_uncorr,\n- const processed_line4* plines_samechroma,\n- const processed_line3* plines_separate_red,\n- const processed_line3* plines_separate_green,\n- const processed_line3* plines_separate_blue,\n- const processed_line3* plines_separate_alpha,\n- float* length_uncorr,\n- float* length_samechroma,\n- float4* length_separate,\n- float* uncorr_error,\n- float* samechroma_error,\n- float4* separate_color_error);\n-\n// functions to compute error value across a tile for a particular line function\n// for a single partition.\nfloat compute_error_squared_rgb_single_partition(\n@@ -627,6 +599,7 @@ struct swizzlepattern\n* @param alpha_kernel_radius The kernel radius (in pixels) for alpha mods.\n* @param need_srgb_transform Do we need srgb transform or not?\n* @param swz Input data channel swizzle.\n+ * @param thread_count The number of threads to use.\n*/\nvoid compute_averages_and_variances(\nastc_codec_image * img,\n@@ -635,7 +608,8 @@ void compute_averages_and_variances(\nint avg_var_kernel_radius,\nint alpha_kernel_radius,\nint need_srgb_transform,\n- swizzlepattern swz);\n+ swizzlepattern swz,\n+ int thread_count);\n/*\nFunctions to load image from file.\n@@ -655,7 +629,6 @@ astc_codec_image *load_tga_image(const char *tga_filename, int padding, int *res\nastc_codec_image *load_image_with_stb(const char *filename, int padding, int *result);\nastc_codec_image *astc_codec_load_image(const char *filename, int padding, int *result);\n-int astc_codec_unlink(const char *filename);\n// function to store image to file\n// If successful, returns the number of channels in input image\n@@ -966,6 +939,58 @@ uint16_t unorm16_to_sf16(\nuint16_t lns_to_sf16(\nuint16_t p);\n+/* ============================================================================\n+ Platform-specific functions\n+============================================================================ */\n+\n+/**\n+ * @brief Get the current time.\n+ *\n+ * @returns The current time in seconds since arbitrary epoch.\n+ */\n+double get_time();\n+\n+/**\n+ * @brief Get the number of CPU cores.\n+ *\n+ * @returns The number of online or onlineable CPU cores in the system.\n+ */\n+int get_cpu_count();\n+\n+/**\n+ * @brief Delete (unlink) a file on the filesystem.\n+ *\n+|* @param filename The file to delete.\n+ *\n+ * @returns Zero on success, non-zero otherwise.\n+ */\n+int unlink_file(const char *filename);\n+\n+/**\n+ * @brief Launch N worker threads and wait for them to complete.\n+ *\n+ * All threads run the same thread function, and have the same thread payload,\n+ * but are given a unique thread ID (0 .. N-1) as a parameter to the run\n+ * function to allow thread-specific behavior.\n+ *\n+|* @param thread_count The number of threads to spawn.\n+ * @param func The function to execute. Must have the signature:\n+ * void (int thread_count, int thread_id, void* payload)\n+ * @param payload Pointer to an opaque thread payload object.\n+ */\n+void launch_threads(\n+ int thread_count,\n+ void (*func)(int, int, void*),\n+ void *payload);\n+\n+/**\n+ * @brief The main entry point.\n+ *\n+ * @param argc The number of arguments.\n+ * @param argb The array of command line arguments.\n+ *\n+ * @returns Zero on success, non-zero otherwise.\n+ */\nint astc_main(\nint argc,\nchar** argv);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -449,7 +449,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\n&& (partition_count == 2 || (scb->color_formats[0] == scb->color_formats[2] && (partition_count == 3 || (scb->color_formats[0] == scb->color_formats[3])))))\n{\nint colorvals[4][12];\n- int color_formats_mod[4];\n+ int color_formats_mod[4] = { 0 };\nfor (j = 0; j < partition_count; j++)\n{\ncolor_formats_mod[j] = pack_color_endpoints(eix[decimation_mode].ep.endpt0[j],\n@@ -742,7 +742,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(\n&& (partition_count == 2 || (scb->color_formats[0] == scb->color_formats[2] && (partition_count == 3 || (scb->color_formats[0] == scb->color_formats[3])))))\n{\nint colorvals[4][12];\n- int color_formats_mod[4];\n+ int color_formats_mod[4] = { 0 };\nfor (j = 0; j < partition_count; j++)\n{\ncolor_formats_mod[j] = pack_color_endpoints(epm.endpt0[j],\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compute_variance.cpp", "new_path": "Source/astc_compute_variance.cpp", "diff": "@@ -534,11 +534,16 @@ static void compute_pixel_region_variance(\n}\nstatic void compute_averages_and_variances_proc(\n- const struct avg_var_args* ag\n+ int thread_count,\n+ int thread_id,\n+ void* payload\n) {\n+ const struct avg_var_args *ag = (const struct avg_var_args *)payload;\nstruct pixel_region_variance_args arg = ag->arg;\narg.work_memory = new float4[ag->work_memory_size];\n+ int block_counter = 0;\n+\nint size_x = ag->img_size.x;\nint size_y = ag->img_size.y;\nint size_z = ag->img_size.z;\n@@ -557,6 +562,8 @@ static void compute_averages_and_variances_proc(\narg.src_offset.z = z + padding_z;\nfor (int y = 0; y < size_y; y += step_y)\n+ {\n+ if (block_counter == thread_id)\n{\narg.size.y = MIN(step_y, size_y - y);\narg.dst_offset.y = y;\n@@ -567,10 +574,14 @@ static void compute_averages_and_variances_proc(\narg.size.x = MIN(step_x, size_x - x);\narg.dst_offset.x = x;\narg.src_offset.x = x + padding_xy;\n-\ncompute_pixel_region_variance(&arg);\n}\n}\n+\n+ block_counter++;\n+ if (block_counter >= thread_count)\n+ block_counter = 0;\n+ }\n}\ndelete[] arg.work_memory;\n@@ -584,7 +595,8 @@ void compute_averages_and_variances(\nint avg_var_kernel_radius,\nint alpha_kernel_radius,\nint need_srgb_transform,\n- swizzlepattern swz\n+ swizzlepattern swz,\n+ int thread_count\n) {\nint size_x = img->xsize;\nint size_y = img->ysize;\n@@ -628,7 +640,5 @@ void compute_averages_and_variances(\nag.blk_size = int3(max_blk_size_xy, max_blk_size_xy, max_blk_size_z);\nag.work_memory_size = 2 * max_padsize_xy * max_padsize_xy * max_padsize_z;\n- // TODO: This can be multi-threaded, as this is currently a single-threaded\n- // pass which is executed before the main compression workers kick off.\n- compute_averages_and_variances_proc(&ag);\n+ launch_threads(thread_count, compute_averages_and_variances_proc, &ag);\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_image_load_store.cpp", "new_path": "Source/astc_image_load_store.cpp", "diff": "@@ -1060,7 +1060,7 @@ astc_codec_image *astc_codec_load_image(\n}\nif (load_exr)\n- astc_codec_unlink(htga_load_filename);\n+ unlink_file(htga_load_filename);\nreturn input_image;\n}\n@@ -1166,7 +1166,7 @@ int astc_codec_store_image(\nstore_result = store_tga_image(output_image, htga_output_filename, 16);\nsprintf(htga_output_command, \"exr_to_htga -e %s %s\", htga_output_filename, output_filename);\nsystem_retval = system(htga_output_command);\n- astc_codec_unlink(htga_output_filename);\n+ unlink_file(htga_output_filename);\nif (system_retval != 0)\nstore_result = -99;\nbreak;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Source/astc_platform_dependents.cpp", "diff": "+// ----------------------------------------------------------------------------\n+// This confidential and proprietary software may be used only as authorised\n+// by a licensing agreement from Arm Limited.\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n+// The entire notice above must be reproduced on all authorised copies and\n+// copies may only be made to the extent permitted by a licensing agreement\n+// from Arm Limited.\n+// ----------------------------------------------------------------------------\n+\n+/**\n+ * @brief Platform-specific function implementations.\n+ *\n+ * This module contains functions with strongly OS-dependent implementations:\n+ *\n+ * * CPU count queries\n+ * * Threading\n+ * * Time\n+ *\n+ * In addition to the basic thread abstraction (which is native pthreads on\n+ * all platforms, except Windows where it is an emulation of pthreads), a\n+ * utility function to create N threads and wait for them to complete a batch\n+ * task has also been provided.\n+ */\n+\n+#include \"astc_codec_internals.h\"\n+\n+/* ============================================================================\n+ Platform code for Windows using the Win32 APIs.\n+============================================================================ */\n+#if defined(_WIN32) && !defined(__CYGWIN__)\n+\n+#define WIN32_LEAN_AND_MEAN\n+#include <windows.h>\n+\n+typedef HANDLE pthread_t;\n+typedef int pthread_attr_t;\n+\n+/* Public function, see header file for detailed documentation */\n+static int pthread_create(\n+ pthread_t* thread,\n+ const pthread_attr_t* attribs,\n+ void* (*threadfunc)(void*),\n+ void* thread_arg\n+) {\n+ LPTHREAD_START_ROUTINE func = (LPTHREAD_START_ROUTINE)threadfunc;\n+ *thread = CreateThread(nullptr, 0, func, thread_arg, 0, nullptr);\n+ return 0;\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+static int pthread_join(\n+ pthread_t thread,\n+ void** value\n+) {\n+ WaitForSingleObject(thread, INFINITE);\n+ return 0;\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+double get_time()\n+{\n+ FILETIME tv;\n+ GetSystemTimeAsFileTime(&tv);\n+ unsigned long long ticks = tv.dwHighDateTime;\n+ ticks = (ticks << 32) | tv.dwLowDateTime;\n+ return ((double)ticks) / 1.0e7;\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+int get_cpu_count()\n+{\n+ SYSTEM_INFO sysinfo;\n+ GetSystemInfo(&sysinfo);\n+ return sysinfo.dwNumberOfProcessors;\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+int unlink_file(const char *filename)\n+{\n+ BOOL res = DeleteFileA(filename);\n+ return (res ? 0 : -1);\n+}\n+\n+/* ============================================================================\n+ Platform code for an platform using POSIX APIs.\n+============================================================================ */\n+#else\n+\n+#include <sys/time.h>\n+#include <pthread.h>\n+#include <unistd.h>\n+\n+/* Public function, see header file for detailed documentation */\n+double get_time()\n+{\n+ timeval tv;\n+ gettimeofday(&tv, 0);\n+ return (double)tv.tv_sec + (double)tv.tv_usec * 1.0e-6;\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+int get_cpu_count()\n+{\n+ return sysconf(_SC_NPROCESSORS_ONLN);\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+int unlink_file(const char *filename)\n+{\n+ return unlink(filename);\n+}\n+\n+#endif\n+\n+/**\n+ * @brief Worker thread helper payload for launch_threads.\n+ */\n+struct launch_desc\n+{\n+ /** The native thread handle. */\n+ pthread_t thread_handle;\n+ /** The total number of threads in the thread pool. */\n+ int thread_count;\n+ /** The thread index in the thread pool. */\n+ int thread_id;\n+ /** The user thread function to execute. */\n+ void (*func)(int, int, void*);\n+ /** The user thread payload. */\n+ void* payload;\n+};\n+\n+/**\n+ * @brief Helper function to translate thread entry points.\n+ *\n+ * Convert a (void*) thread entry to an (int, void*) thread entry, where the\n+ * integer contains the thread ID in the thread pool.\n+ *\n+ * @param p The thread launch helper payload.\n+ */\n+static void* launch_threads_helper(void *p)\n+{\n+ launch_desc* ltd = (launch_desc*)p;\n+ ltd->func(ltd->thread_count, ltd->thread_id, ltd->payload);\n+ return nullptr;\n+}\n+\n+\n+/* Public function, see header file for detailed documentation */\n+void launch_threads(\n+ int thread_count,\n+ void (*func)(int, int, void*),\n+ void *payload\n+) {\n+ // Directly execute single threaded workloads on this thread\n+ if (thread_count <= 1)\n+ {\n+ func(1, 0, payload);\n+ return;\n+ }\n+\n+ // Otherwise spawn worker threads\n+ launch_desc *thread_descs = new launch_desc[thread_count];\n+ for (int i = 0; i < thread_count; i++)\n+ {\n+ thread_descs[i].thread_count = thread_count;\n+ thread_descs[i].thread_id = i;\n+ thread_descs[i].payload = payload;\n+ thread_descs[i].func = func;\n+\n+ pthread_create(&(thread_descs[i].thread_handle), nullptr,\n+ launch_threads_helper, (void*)&(thread_descs[i]));\n+ }\n+\n+ // ... and then wait for them to complete\n+ for (int i = 0; i < thread_count; i++)\n+ {\n+ pthread_join(thread_descs[i].thread_handle, nullptr);\n+ }\n+\n+ delete[] thread_descs;\n+}\n+\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "#include <cstdlib>\n#include <cstring>\n-#ifndef WIN32\n- #include <sys/time.h>\n- #include <pthread.h>\n- #include <unistd.h>\n-\n- double get_time()\n- {\n- timeval tv;\n- gettimeofday(&tv, 0);\n-\n- return (double)tv.tv_sec + (double)tv.tv_usec * 1.0e-6;\n- }\n-\n-\n- int astc_codec_unlink(const char *filename)\n- {\n- return unlink(filename);\n- }\n-\n-#else\n- // Define pthread-like functions in terms of Windows threading API\n- #define WIN32_LEAN_AND_MEAN\n- #include <windows.h>\n-\n- typedef HANDLE pthread_t;\n- typedef int pthread_attr_t;\n-\n- int pthread_create(pthread_t * thread, const pthread_attr_t * attribs, void *(*threadfunc) (void *), void *thread_arg)\n- {\n- *thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) threadfunc, thread_arg, 0, NULL);\n- return 0;\n- }\n-\n- int pthread_join(pthread_t thread, void **value)\n- {\n- WaitForSingleObject(thread, INFINITE);\n- CloseHandle(thread);\n- return 0;\n- }\n-\n- double get_time()\n- {\n- FILETIME tv;\n- GetSystemTimeAsFileTime(&tv);\n-\n- unsigned __int64 ticks = tv.dwHighDateTime;\n- ticks = (ticks << 32) | tv.dwLowDateTime;\n-\n- return ((double)ticks) / 1.0e7;\n- }\n-\n- // Define an unlink() function in terms of the Win32 DeleteFile function.\n- int astc_codec_unlink(const char *filename)\n- {\n- BOOL res = DeleteFileA(filename);\n- return (res ? 0 : -1);\n- }\n-#endif\n-\n#ifdef DEBUG_CAPTURE_NAN\n#ifndef _GNU_SOURCE\n#define _GNU_SOURCE\n@@ -105,52 +46,6 @@ static double end_time;\nstatic double start_coding_time;\nstatic double end_coding_time;\n-// code to discover the number of logical CPUs available.\n-#if defined(__APPLE__)\n- #define _DARWIN_C_SOURCE\n- #include <sys/types.h>\n- #include <sys/sysctl.h>\n-#endif\n-\n-#if defined(_WIN32) || defined(__CYGWIN__)\n- #include <windows.h>\n-#else\n- #include <unistd.h>\n-#endif\n-\n-unsigned get_number_of_cpus(void)\n-{\n- unsigned n_cpus = 1;\n-\n- #ifdef __linux__\n- cpu_set_t mask;\n- CPU_ZERO(&mask);\n- sched_getaffinity(getpid(), sizeof(mask), &mask);\n- n_cpus = 0;\n- for (unsigned i = 0; i < CPU_SETSIZE; ++i)\n- {\n- if (CPU_ISSET(i, &mask))\n- n_cpus++;\n- }\n- if (n_cpus == 0)\n- n_cpus = 1;\n-\n- #elif defined (_WIN32) || defined(__CYGWIN__)\n- SYSTEM_INFO sysinfo;\n- GetSystemInfo(&sysinfo);\n- n_cpus = sysinfo.dwNumberOfProcessors;\n-\n- #elif defined(__APPLE__)\n- int mib[4];\n- size_t length = 100;\n- mib[0] = CTL_HW;\n- mib[1] = HW_AVAILCPU;\n- sysctl(mib, 2, &n_cpus, &length, NULL, 0);\n- #endif\n-\n- return n_cpus;\n-}\n-\nNORETURN void astc_codec_internal_error(\nconst char *filename,\nint line\n@@ -279,20 +174,20 @@ struct encode_astc_image_info\nconst block_size_descriptor* bsd;\nconst error_weighting_params* ewp;\nuint8_t* buffer;\n- int* counters;\nint pack_and_unpack;\n- int thread_id;\nint threadcount;\nastc_decode_mode decode_mode;\nswizzlepattern swz_encode;\nswizzlepattern swz_decode;\n- int* threads_completed;\nconst astc_codec_image* input_image;\nastc_codec_image* output_image;\n};\n-void* encode_astc_image_threadfunc(void* vblk)\n-{\n+void encode_astc_image_threadfunc(\n+ int thread_count,\n+ int thread_id,\n+ void* vblk\n+) {\nconst encode_astc_image_info *blk = (const encode_astc_image_info *)vblk;\nconst block_size_descriptor *bsd = blk->bsd;\nint xdim = bsd->xdim;\n@@ -300,14 +195,10 @@ void* encode_astc_image_threadfunc(void* vblk)\nint zdim = bsd->zdim;\nuint8_t *buffer = blk->buffer;\nconst error_weighting_params *ewp = blk->ewp;\n- int thread_id = blk->thread_id;\n- int threadcount = blk->threadcount;\n- int *counters = blk->counters;\nint pack_and_unpack = blk->pack_and_unpack;\nastc_decode_mode decode_mode = blk->decode_mode;\nswizzlepattern swz_encode = blk->swz_encode;\nswizzlepattern swz_decode = blk->swz_decode;\n- int *threads_completed = blk->threads_completed;\nconst astc_codec_image *input_image = blk->input_image;\nastc_codec_image *output_image = blk->output_image;\n@@ -315,7 +206,7 @@ void* encode_astc_image_threadfunc(void* vblk)\nint ctr = thread_id;\nint pctr = 0;\n- int x, y, z, i;\n+ int x, y, z;\nint xsize = input_image->xsize;\nint ysize = input_image->ysize;\nint zsize = input_image->zsize;\n@@ -323,8 +214,6 @@ void* encode_astc_image_threadfunc(void* vblk)\nint yblocks = (ysize + ydim - 1) / ydim;\nint zblocks = (zsize + zdim - 1) / zdim;\n- int owns_progress_counter = 0;\n-\n//allocate memory for temporary buffers\ncompress_symbolic_block_buffers temp_buffers;\ntemp_buffers.ewb = new error_weight_block;\n@@ -375,40 +264,8 @@ void* encode_astc_image_threadfunc(void* vblk)\n}\n#endif\n- counters[thread_id]++;\n- ctr = threadcount - 1;\n-\n+ ctr = thread_count - 1;\npctr++;\n-\n- // routine to print the progress counter.\n- if (suppress_progress_counter == 0 && (pctr % progress_counter_divider) == 0 && print_tile_errors == 0 && print_statistics == 0)\n- {\n- int do_print = 1;\n- // the current thread has the responsibility for printing the progress counter\n- // if every previous thread has completed. Also, if we have ever received the\n- // responsibility to print the progress counter, we are going to keep it\n- // until the thread is completed.\n- if (!owns_progress_counter)\n- {\n- for (i = thread_id - 1; i >= 0; i--)\n- {\n- if (threads_completed[i] == 0)\n- {\n- do_print = 0;\n- break;\n- }\n- }\n- }\n- if (do_print)\n- {\n- owns_progress_counter = 1;\n- int summa = 0;\n- for (i = 0; i < threadcount; i++)\n- summa += counters[i];\n- printf(\"\\r%d\", summa);\n- fflush(stdout);\n- }\n- }\n}\nelse\nctr--;\n@@ -429,9 +286,6 @@ void* encode_astc_image_threadfunc(void* vblk)\ndelete temp_buffers.temp;\ndelete temp_buffers.ewbo;\ndelete temp_buffers.ewb;\n-\n- threads_completed[thread_id] = 1;\n- return NULL;\n}\nvoid encode_astc_image(\n@@ -448,52 +302,24 @@ void encode_astc_image(\nint pack_and_unpack,\nint threadcount\n) {\n- int i;\n- int* counters = new int[threadcount];\n- int* threads_completed = new int[threadcount];\n-\n// before entering into the multi-threaded routine, ensure that the block size descriptors\n// and the partition table descriptors needed actually exist.\nblock_size_descriptor bsd;\ninit_block_size_descriptor(xdim, ydim, zdim, &bsd);\nget_partition_table(&bsd, 0);\n- encode_astc_image_info* ai = new encode_astc_image_info[threadcount];\n- for (i = 0; i < threadcount; i++)\n- {\n- ai[i].bsd = &bsd;\n- ai[i].buffer = buffer;\n- ai[i].ewp = ewp;\n- ai[i].counters = counters;\n- ai[i].pack_and_unpack = pack_and_unpack;\n- ai[i].thread_id = i;\n- ai[i].threadcount = threadcount;\n- ai[i].decode_mode = decode_mode;\n- ai[i].swz_encode = swz_encode;\n- ai[i].swz_decode = swz_decode;\n- ai[i].threads_completed = threads_completed;\n- ai[i].input_image = input_image;\n- ai[i].output_image = output_image;\n- counters[i] = 0;\n- threads_completed[i] = 0;\n- }\n-\n- if (threadcount == 1)\n- encode_astc_image_threadfunc(&ai[0]);\n- else\n- {\n- pthread_t *threads = new pthread_t[threadcount];\n- for (i = 0; i < threadcount; i++)\n- pthread_create(&(threads[i]), NULL, encode_astc_image_threadfunc, (void *)(&(ai[i])));\n-\n- for (i = 0; i < threadcount; i++)\n- pthread_join(threads[i], NULL);\n- delete[] threads;\n- }\n+ encode_astc_image_info ai;\n+ ai.bsd = &bsd;\n+ ai.buffer = buffer;\n+ ai.ewp = ewp;\n+ ai.pack_and_unpack = pack_and_unpack;\n+ ai.decode_mode = decode_mode;\n+ ai.swz_encode = swz_encode;\n+ ai.swz_decode = swz_decode;\n+ ai.input_image = input_image;\n+ ai.output_image = output_image;\n- delete[] ai;\n- delete[] counters;\n- delete[] threads_completed;\n+ launch_threads(threadcount, encode_astc_image_threadfunc, &ai);\n}\nvoid store_astc_file(\n@@ -2208,7 +2034,7 @@ int astc_main(\nif (thread_count < 1)\n{\n- thread_count = get_number_of_cpus();\n+ thread_count = get_cpu_count();\nthread_count_autodetected = 1;\n}\n@@ -2432,7 +2258,8 @@ int astc_main(\newp.mean_stdev_radius,\newp.alpha_radius,\nperform_srgb_transform,\n- swz_encode);\n+ swz_encode,\n+ thread_count);\nif (!silentmode)\n{\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Clean up platform-specific code Platform specific code migrated to a separate file, and added a new helper utility to spawn N threads executing a partitioned workload.
61,745
09.01.2020 21:34:28
0
b6d0c58182ac41bb0dd4cd74699eb351b3ef6ed2
Add unrolled decimation tables
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -43,7 +43,7 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -std=c++17 -O3 -msse2 -mfpmath=sse \\\n+CPPFLAGS = -std=c++14 -O3 -msse2 -mfpmath=sse \\\n-Wall -Wextra -Wpedantic -Werror -Werror=shadow -Wdouble-promotion\nastcenc: $(OBJECTS)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_block_sizes2.cpp", "new_path": "Source/astc_block_sizes2.cpp", "diff": "@@ -392,9 +392,9 @@ static void initialize_decimation_table_2d(\nfor (j = 0; j < weightcount_of_texel[i]; j++)\n{\n- dt->texel_weights_int[i][j] = weights_of_texel[i][j];\n- dt->texel_weights_float[i][j] = static_cast < float >(weights_of_texel[i][j]) * (1.0f / TEXEL_WEIGHT_SUM);\n- dt->texel_weights[i][j] = grid_weights_of_texel[i][j];\n+ dt->texel_weights_int[i][j] = (uint8_t)weights_of_texel[i][j];\n+ dt->texel_weights_float[i][j] = ((float)weights_of_texel[i][j]) * (1.0f / TEXEL_WEIGHT_SUM);\n+ dt->texel_weights[i][j] = (uint8_t)grid_weights_of_texel[i][j];\n}\n}\n@@ -402,12 +402,36 @@ static void initialize_decimation_table_2d(\n{\ndt->weight_num_texels[i] = texelcount_of_weight[i];\n-\nfor (j = 0; j < texelcount_of_weight[i]; j++)\n{\n- dt->weight_texel[i][j] = texels_of_weight[i][j];\n- dt->weights_int[i][j] = texelweights_of_weight[i][j];\n- dt->weights_flt[i][j] = static_cast < float >(texelweights_of_weight[i][j]);\n+ int texel = texels_of_weight[i][j];\n+ dt->weight_texel[i][j] = (uint8_t)texel;\n+ dt->weights_int[i][j] = (uint8_t)texelweights_of_weight[i][j];\n+ dt->weights_flt[i][j] = (float)texelweights_of_weight[i][j];\n+\n+ // perform a layer of array unrolling. An aspect of this unrolling is that\n+ // one of the texel-weight indexes is an identity-mapped index; we will use this\n+ // fact to reorder the indexes so that the first one is the identity index.\n+ int swap_idx = -1;\n+ for (int k = 0; k < 4; k++)\n+ {\n+ int dttw = dt->texel_weights[texel][k];\n+ float dttwf = dt->texel_weights_float[texel][k];\n+ if (dttw == i && dttwf != 0.0f)\n+ swap_idx = k;\n+ dt->texel_weights_texel[i][j][k] = (uint8_t)dttw;\n+ dt->texel_weights_float_texel[i][j][k] = dttwf;\n+ }\n+\n+ if (swap_idx != 0)\n+ {\n+ int vi = dt->texel_weights_texel[i][j][0];\n+ float vf = dt->texel_weights_float_texel[i][j][0];\n+ dt->texel_weights_texel[i][j][0] = dt->texel_weights_texel[i][j][swap_idx];\n+ dt->texel_weights_float_texel[i][j][0] = dt->texel_weights_float_texel[i][j][swap_idx];\n+ dt->texel_weights_texel[i][j][swap_idx] = (uint8_t)vi;\n+ dt->texel_weights_float_texel[i][j][swap_idx] = vf;\n+ }\n}\n}\n@@ -575,9 +599,9 @@ static void initialize_decimation_table_3d(\nfor (j = 0; j < weightcount_of_texel[i]; j++)\n{\n- dt->texel_weights_int[i][j] = weights_of_texel[i][j];\n- dt->texel_weights_float[i][j] = static_cast < float >(weights_of_texel[i][j]) * (1.0f / TEXEL_WEIGHT_SUM);\n- dt->texel_weights[i][j] = grid_weights_of_texel[i][j];\n+ dt->texel_weights_int[i][j] = (uint8_t)weights_of_texel[i][j];\n+ dt->texel_weights_float[i][j] = ((float)weights_of_texel[i][j]) * (1.0f / TEXEL_WEIGHT_SUM);\n+ dt->texel_weights[i][j] = (uint8_t)grid_weights_of_texel[i][j];\n}\n}\n@@ -586,9 +610,34 @@ static void initialize_decimation_table_3d(\ndt->weight_num_texels[i] = texelcount_of_weight[i];\nfor (j = 0; j < texelcount_of_weight[i]; j++)\n{\n- dt->weight_texel[i][j] = texels_of_weight[i][j];\n- dt->weights_int[i][j] = texelweights_of_weight[i][j];\n- dt->weights_flt[i][j] = static_cast < float >(texelweights_of_weight[i][j]);\n+ int texel = texels_of_weight[i][j];\n+ dt->weight_texel[i][j] = (uint8_t)texel;\n+ dt->weights_int[i][j] = (uint8_t)texelweights_of_weight[i][j];\n+ dt->weights_flt[i][j] = (float)texelweights_of_weight[i][j];\n+\n+ // perform a layer of array unrolling. An aspect of this unrolling is that\n+ // one of the texel-weight indexes is an identity-mapped index; we will use this\n+ // fact to reorder the indexes so that the first one is the identity index.\n+ int swap_idx = -1;\n+ for (int k = 0; k < 4; k++)\n+ {\n+ int dttw = dt->texel_weights[texel][k];\n+ float dttwf = dt->texel_weights_float[texel][k];\n+ if (dttw == i && dttwf != 0.0f)\n+ swap_idx = k;\n+ dt->texel_weights_texel[i][j][k] = (uint8_t)dttw;\n+ dt->texel_weights_float_texel[i][j][k] = dttwf;\n+ }\n+\n+ if (swap_idx != 0)\n+ {\n+ int vi = dt->texel_weights_texel[i][j][0];\n+ float vf = dt->texel_weights_float_texel[i][j][0];\n+ dt->texel_weights_texel[i][j][0] = dt->texel_weights_texel[i][j][swap_idx];\n+ dt->texel_weights_float_texel[i][j][0] = dt->texel_weights_float_texel[i][j][swap_idx];\n+ dt->texel_weights_texel[i][j][swap_idx] = (uint8_t)vi;\n+ dt->texel_weights_float_texel[i][j][swap_idx] = vf;\n+ }\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -113,6 +113,12 @@ struct decimation_table\nuint8_t weight_texel[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; // the texels that the weight contributes to\nuint8_t weights_int[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; // the weights that the weight contributes to a texel.\nfloat weights_flt[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; // the weights that the weight contributes to a texel.\n+\n+ // folded data structures:\n+ // * texel_weights_texel[i][j] = texel_weights[weight_texel[i][j]];\n+ // * texel_weights_float_texel[i][j] = texel_weights_float[weight_texel[i][j]\n+ uint8_t texel_weights_texel[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK][4];\n+ float texel_weights_float_texel[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK][4];\n};\n/*\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add unrolled decimation tables
61,745
09.01.2020 22:58:03
0
fca3e88b26a6844791e4e86babbff87b8f413d00
Change HDR tests to use mPSNR
[ { "change_type": "MODIFY", "old_path": "Test/astc_run.py", "new_path": "Test/astc_run.py", "diff": "@@ -115,7 +115,7 @@ class TestImage():\nelse:\nassert False, \"Unsupported LDR color format %s\" % self.format\nelse:\n- patternPSNR = \"PSNR \\\\(RGB normalized to peak\\\\): ([0-9.]*) dB\"\n+ patternPSNR = r\"mPSNR \\(RGB\\) .*: ([0-9.]*) dB\"\npatternPSNR = re.compile(patternPSNR)\npatternTime = re.compile(\".*: ([0-9.]*) .*: ([0-9.]*)\")\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_reference.csv", "new_path": "Test/astc_test_reference.csv", "diff": "Name,Block Size,PSNR (dB),Time (s)\n-hdr-rgb-00,4x4,21.400,1.084\n-ldr-rgb-00,4x4,39.193,1.054\n-ldr-rgb-01,4x4,40.370,0.958\n-ldr-rgb-02,4x4,35.458,0.844\n-ldr-rgb-03,4x4,47.483,1.087\n-ldr-rgb-04,4x4,42.300,0.829\n-ldr-rgb-05,4x4,38.003,0.925\n-ldr-rgb-06,4x4,35.452,0.782\n-ldr-rgb-07,4x4,39.762,1.201\n-ldr-rgb-08,4x4,45.781,1.104\n-ldr-rgb-09,4x4,42.162,0.922\n-ldr-rgba-00,4x4,37.065,1.150\n-ldr-rgba-01,4x4,39.032,1.035\n-ldr-rgba-02,4x4,35.025,1.361\n-ldr-xy-00,4x4,34.063,0.966\n-ldr-xy-01,4x4,34.733,1.101\n-ldr-xy-02,4x4,54.330,1.337\n-hdr-rgb-00,5x5,20.206,1.205\n-ldr-rgb-00,5x5,35.387,1.291\n-ldr-rgb-01,5x5,36.544,1.167\n-ldr-rgb-02,5x5,31.189,1.055\n-ldr-rgb-03,5x5,44.547,1.241\n-ldr-rgb-04,5x5,37.947,0.995\n-ldr-rgb-05,5x5,33.761,1.167\n-ldr-rgb-06,5x5,31.156,0.999\n-ldr-rgb-07,5x5,36.717,1.421\n-ldr-rgb-08,5x5,42.299,1.278\n-ldr-rgb-09,5x5,37.709,1.062\n-ldr-rgba-00,5x5,33.490,1.407\n-ldr-rgba-01,5x5,35.381,1.228\n-ldr-rgba-02,5x5,31.184,1.767\n-ldr-xy-00,5x5,33.898,0.828\n-ldr-xy-01,5x5,34.370,1.418\n-ldr-xy-02,5x5,51.346,1.539\n-hdr-rgb-00,6x6,23.292,1.217\n-ldr-rgb-00,6x6,32.739,1.660\n-ldr-rgb-01,6x6,33.246,1.622\n-ldr-rgb-02,6x6,27.569,1.719\n-ldr-rgb-03,6x6,42.525,0.863\n-ldr-rgb-04,6x6,34.496,1.630\n-ldr-rgb-05,6x6,30.444,1.721\n-ldr-rgb-06,6x6,27.572,1.714\n-ldr-rgb-07,6x6,34.549,1.658\n-ldr-rgb-08,6x6,39.939,0.933\n-ldr-rgb-09,6x6,33.861,1.580\n-ldr-rgba-00,6x6,30.959,1.662\n-ldr-rgba-01,6x6,32.344,1.321\n-ldr-rgba-02,6x6,27.900,1.975\n-ldr-xy-00,6x6,33.531,0.668\n-ldr-xy-01,6x6,33.740,1.256\n-ldr-xy-02,6x6,48.673,1.490\n-hdr-rgb-00,8x8,20.331,1.169\n-ldr-rgb-00,8x8,29.096,1.628\n-ldr-rgb-01,8x8,29.135,1.587\n-ldr-rgb-02,8x8,23.223,1.739\n-ldr-rgb-03,8x8,39.343,0.304\n-ldr-rgb-04,8x8,29.875,1.587\n-ldr-rgb-05,8x8,26.150,1.721\n-ldr-rgb-06,8x8,23.326,1.731\n-ldr-rgb-07,8x8,31.297,1.635\n-ldr-rgb-08,8x8,36.574,0.635\n-ldr-rgb-09,8x8,29.177,1.304\n-ldr-rgba-00,8x8,26.892,1.671\n-ldr-rgba-01,8x8,28.519,1.318\n-ldr-rgba-02,8x8,23.988,1.845\n+hdr-rgb-00,4x4,32.586,1.060\n+ldr-rgb-00,4x4,28.901,0.010\n+ldr-rgb-00,4x4,33.702,0.010\n+ldr-rgb-00,4x4,39.193,1.210\n+ldr-rgb-01,4x4,40.370,0.920\n+ldr-rgb-02,4x4,35.458,1.050\n+ldr-rgb-03,4x4,47.483,1.070\n+ldr-rgb-04,4x4,42.300,0.980\n+ldr-rgb-05,4x4,38.003,0.910\n+ldr-rgb-06,4x4,35.452,0.760\n+ldr-rgb-07,4x4,39.762,1.290\n+ldr-rgb-08,4x4,45.781,1.080\n+ldr-rgb-09,4x4,42.162,1.020\n+ldr-rgba-00,4x4,37.064,1.120\n+ldr-rgba-01,4x4,39.032,1.130\n+ldr-rgba-02,4x4,35.024,1.390\n+ldr-xy-00,4x4,34.063,0.930\n+ldr-xy-01,4x4,34.733,1.050\n+ldr-xy-02,4x4,54.330,1.460\n+hdr-rgb-00,5x5,27.739,1.350\n+ldr-rgb-00,5x5,27.991,0.010\n+ldr-rgb-00,5x5,30.497,0.010\n+ldr-rgb-00,5x5,35.387,1.270\n+ldr-rgb-01,5x5,36.544,1.300\n+ldr-rgb-02,5x5,31.189,1.040\n+ldr-rgb-03,5x5,44.547,1.320\n+ldr-rgb-04,5x5,37.947,1.030\n+ldr-rgb-05,5x5,33.761,1.180\n+ldr-rgb-06,5x5,31.156,1.000\n+ldr-rgb-07,5x5,36.717,1.460\n+ldr-rgb-08,5x5,42.299,1.390\n+ldr-rgb-09,5x5,37.709,1.030\n+ldr-rgba-00,5x5,33.490,1.540\n+ldr-rgba-01,5x5,35.381,1.190\n+ldr-rgba-02,5x5,31.184,1.890\n+ldr-xy-00,5x5,33.898,0.930\n+ldr-xy-01,5x5,34.370,1.390\n+ldr-xy-02,5x5,51.346,1.650\n+hdr-rgb-00,6x6,25.086,1.300\n+ldr-rgb-00,6x6,25.778,0.020\n+ldr-rgb-00,6x6,27.507,0.020\n+ldr-rgb-00,6x6,32.739,1.640\n+ldr-rgb-01,6x6,33.245,1.690\n+ldr-rgb-02,6x6,27.569,1.900\n+ldr-rgb-03,6x6,42.527,0.920\n+ldr-rgb-04,6x6,34.496,1.660\n+ldr-rgb-05,6x6,30.444,1.880\n+ldr-rgb-06,6x6,27.572,2.260\n+ldr-rgb-07,6x6,34.548,1.820\n+ldr-rgb-08,6x6,39.939,0.940\n+ldr-rgb-09,6x6,33.861,1.710\n+ldr-rgba-00,6x6,30.959,1.800\n+ldr-rgba-01,6x6,32.344,1.310\n+ldr-rgba-02,6x6,27.900,2.070\n+ldr-xy-00,6x6,33.530,0.850\n+ldr-xy-01,6x6,33.740,1.230\n+ldr-xy-02,6x6,48.674,1.660\n+hdr-rgb-00,8x8,21.838,1.250\n+ldr-rgb-00,8x8,24.697,0.020\n+ldr-rgb-00,8x8,23.989,0.020\n+ldr-rgb-00,8x8,29.097,1.720\n+ldr-rgb-01,8x8,29.136,1.570\n+ldr-rgb-02,8x8,23.224,1.920\n+ldr-rgb-03,8x8,39.344,0.320\n+ldr-rgb-04,8x8,29.876,1.780\n+ldr-rgb-05,8x8,26.151,1.900\n+ldr-rgb-06,8x8,23.326,1.890\n+ldr-rgb-07,8x8,31.297,1.640\n+ldr-rgb-08,8x8,36.574,0.760\n+ldr-rgb-09,8x8,29.174,1.330\n+ldr-rgba-00,8x8,26.892,1.780\n+ldr-rgba-01,8x8,28.520,1.430\n+ldr-rgba-02,8x8,23.989,1.940\nldr-xy-00,8x8,32.378,0.670\n-ldr-xy-01,8x8,32.549,0.669\n-ldr-xy-02,8x8,44.943,0.635\n+ldr-xy-01,8x8,32.551,0.670\n+ldr-xy-02,8x8,44.944,0.670\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_run.py", "new_path": "Test/astc_test_run.py", "diff": "@@ -159,7 +159,7 @@ class TestImage():\nelse:\nassert False, \"Unsupported LDR color format %s\" % self.format\nelse:\n- patternPSNR = \"PSNR \\\\(RGB normalized to peak\\\\): ([0-9.]*) dB\"\n+ patternPSNR = r\"mPSNR \\(RGB\\) .*: ([0-9.]*) dB\"\npatternPSNR = re.compile(patternPSNR)\npatternTime = re.compile(\".* coding time: ([0-9.]*) seconds\")\n@@ -411,8 +411,8 @@ def run_reference_rebuild():\n\"\"\"\nRun the reference test generator rebuild process.\n\"\"\"\n- TestImage.testRuns = 10\n- TestImage.warmupRuns = 1\n+ TestImage.testRuns = 1\n+ TestImage.warmupRuns = 0\n# Delete and recreate test output location\nif os.path.exists(\"TestOutput\"):\n@@ -456,8 +456,8 @@ def run_reference_update():\n\"\"\"\nRun the reference test generator update process.\n\"\"\"\n- TestImage.testRuns = 3\n- TestImage.warmupRuns = 1\n+ TestImage.testRuns = 1\n+ TestImage.warmupRuns = 0\n# Delete and recreate test output location\nif os.path.exists(\"TestOutput\"):\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Change HDR tests to use mPSNR
61,745
09.01.2020 23:18:18
0
137e498625e0292f7e7a3643f36d0d96b8eb3fab
Add sRGB tests to the test suite
[ { "change_type": "RENAME", "old_path": "Test/Images/LDR-RGB/ldr-rgb-00-micro.png", "new_path": "Test/Images/LDR-RGB/ldr-rgb-00-xmicro.png", "diff": "" }, { "change_type": "RENAME", "old_path": "Test/Images/LDR-RGB/ldr-rgb-00-mini.png", "new_path": "Test/Images/LDR-RGB/ldr-rgb-00-xmini.png", "diff": "" }, { "change_type": "ADD", "old_path": "Test/Images/LDR-SRGBA/ldr-srgba-00-s.png", "new_path": "Test/Images/LDR-SRGBA/ldr-srgba-00-s.png", "diff": "Binary files /dev/null and b/Test/Images/LDR-SRGBA/ldr-srgba-00-s.png differ\n" }, { "change_type": "ADD", "old_path": "Test/Images/LDR-SRGBA/ldr-srgba-01-s.png", "new_path": "Test/Images/LDR-SRGBA/ldr-srgba-01-s.png", "diff": "Binary files /dev/null and b/Test/Images/LDR-SRGBA/ldr-srgba-01-s.png differ\n" }, { "change_type": "ADD", "old_path": "Test/Images/LDR-SRGBA/ldr-srgba-02-s.png", "new_path": "Test/Images/LDR-SRGBA/ldr-srgba-02-s.png", "diff": "Binary files /dev/null and b/Test/Images/LDR-SRGBA/ldr-srgba-02-s.png differ\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_run.py", "new_path": "Test/astc_run.py", "diff": "@@ -65,6 +65,10 @@ class TestImage():\nif self.format == \"xy\":\nargs.append(\"-normal_psnr\")\n+ # Switch sRGB images into sRGB mode\n+ if self.format == \"srgba\":\n+ args.append(\"-srgb\")\n+\n# Switch HDR data formats into HDR compression mode; note that this\n# mode assumes that the alpha channel is non-correlated\nif self.dynamicRange == \"hdr\":\n@@ -110,7 +114,7 @@ class TestImage():\nif self.dynamicRange == \"ldr\":\nif self.format in (\"rgb\", \"xy\"):\npatternPSNR = \"PSNR \\\\(LDR-RGB\\\\): ([0-9.]*) dB\"\n- elif self.format == \"rgba\":\n+ elif self.format in (\"srgba\", \"rgba\"):\npatternPSNR = \"PSNR \\\\(LDR-RGBA\\\\): ([0-9.]*) dB\"\nelse:\nassert False, \"Unsupported LDR color format %s\" % self.format\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_reference.csv", "new_path": "Test/astc_test_reference.csv", "diff": "Name,Block Size,PSNR (dB),Time (s)\n-hdr-rgb-00,4x4,32.586,1.060\n-ldr-rgb-00,4x4,28.901,0.010\n-ldr-rgb-00,4x4,33.702,0.010\n-ldr-rgb-00,4x4,39.193,1.210\n-ldr-rgb-01,4x4,40.370,0.920\n-ldr-rgb-02,4x4,35.458,1.050\n-ldr-rgb-03,4x4,47.483,1.070\n-ldr-rgb-04,4x4,42.300,0.980\n+hdr-rgb-00,4x4,32.586,1.050\n+ldr-rgb-00,4x4,39.193,1.010\n+ldr-rgb-01,4x4,40.370,0.910\n+ldr-rgb-02,4x4,35.458,0.820\n+ldr-rgb-03,4x4,47.483,1.060\n+ldr-rgb-04,4x4,42.300,0.800\nldr-rgb-05,4x4,38.003,0.910\n-ldr-rgb-06,4x4,35.452,0.760\n-ldr-rgb-07,4x4,39.762,1.290\n-ldr-rgb-08,4x4,45.781,1.080\n-ldr-rgb-09,4x4,42.162,1.020\n-ldr-rgba-00,4x4,37.064,1.120\n-ldr-rgba-01,4x4,39.032,1.130\n-ldr-rgba-02,4x4,35.024,1.390\n-ldr-xy-00,4x4,34.063,0.930\n+ldr-rgb-06,4x4,35.452,0.810\n+ldr-rgb-07,4x4,39.762,1.200\n+ldr-rgb-08,4x4,45.781,1.070\n+ldr-rgb-09,4x4,42.162,0.950\n+ldr-rgba-00,4x4,37.064,1.200\n+ldr-rgba-01,4x4,39.032,1.010\n+ldr-rgba-02,4x4,35.024,1.290\n+ldr-srgba-00,4x4,33.296,1.170\n+ldr-srgba-01,4x4,37.532,1.010\n+ldr-srgba-02,4x4,31.055,1.400\n+ldr-xy-00,4x4,34.063,0.880\nldr-xy-01,4x4,34.733,1.050\n-ldr-xy-02,4x4,54.330,1.460\n-hdr-rgb-00,5x5,27.739,1.350\n-ldr-rgb-00,5x5,27.991,0.010\n-ldr-rgb-00,5x5,30.497,0.010\n-ldr-rgb-00,5x5,35.387,1.270\n-ldr-rgb-01,5x5,36.544,1.300\n+ldr-xy-02,4x4,54.330,1.260\n+hdr-rgb-00,5x5,27.739,1.190\n+ldr-rgb-00,5x5,35.387,1.250\n+ldr-rgb-01,5x5,36.544,1.110\nldr-rgb-02,5x5,31.189,1.040\n-ldr-rgb-03,5x5,44.547,1.320\n-ldr-rgb-04,5x5,37.947,1.030\n-ldr-rgb-05,5x5,33.761,1.180\n-ldr-rgb-06,5x5,31.156,1.000\n-ldr-rgb-07,5x5,36.717,1.460\n-ldr-rgb-08,5x5,42.299,1.390\n+ldr-rgb-03,5x5,44.547,1.210\n+ldr-rgb-04,5x5,37.947,0.960\n+ldr-rgb-05,5x5,33.761,1.130\n+ldr-rgb-06,5x5,31.156,0.980\n+ldr-rgb-07,5x5,36.717,1.410\n+ldr-rgb-08,5x5,42.299,1.340\nldr-rgb-09,5x5,37.709,1.030\n-ldr-rgba-00,5x5,33.490,1.540\n-ldr-rgba-01,5x5,35.381,1.190\n-ldr-rgba-02,5x5,31.184,1.890\n-ldr-xy-00,5x5,33.898,0.930\n-ldr-xy-01,5x5,34.370,1.390\n-ldr-xy-02,5x5,51.346,1.650\n-hdr-rgb-00,6x6,25.086,1.300\n-ldr-rgb-00,6x6,25.778,0.020\n-ldr-rgb-00,6x6,27.507,0.020\n-ldr-rgb-00,6x6,32.739,1.640\n-ldr-rgb-01,6x6,33.245,1.690\n-ldr-rgb-02,6x6,27.569,1.900\n-ldr-rgb-03,6x6,42.527,0.920\n-ldr-rgb-04,6x6,34.496,1.660\n-ldr-rgb-05,6x6,30.444,1.880\n-ldr-rgb-06,6x6,27.572,2.260\n-ldr-rgb-07,6x6,34.548,1.820\n-ldr-rgb-08,6x6,39.939,0.940\n-ldr-rgb-09,6x6,33.861,1.710\n-ldr-rgba-00,6x6,30.959,1.800\n-ldr-rgba-01,6x6,32.344,1.310\n-ldr-rgba-02,6x6,27.900,2.070\n-ldr-xy-00,6x6,33.530,0.850\n+ldr-rgba-00,5x5,33.490,1.370\n+ldr-rgba-01,5x5,35.381,1.200\n+ldr-rgba-02,5x5,31.184,1.760\n+ldr-srgba-00,5x5,30.281,1.450\n+ldr-srgba-01,5x5,34.163,1.240\n+ldr-srgba-02,5x5,27.373,1.780\n+ldr-xy-00,5x5,33.898,0.820\n+ldr-xy-01,5x5,34.370,1.380\n+ldr-xy-02,5x5,51.346,1.630\n+hdr-rgb-00,6x6,25.086,1.190\n+ldr-rgb-00,6x6,32.739,1.590\n+ldr-rgb-01,6x6,33.245,1.600\n+ldr-rgb-02,6x6,27.569,1.700\n+ldr-rgb-03,6x6,42.527,0.870\n+ldr-rgb-04,6x6,34.496,1.580\n+ldr-rgb-05,6x6,30.444,1.680\n+ldr-rgb-06,6x6,27.572,1.710\n+ldr-rgb-07,6x6,34.548,1.620\n+ldr-rgb-08,6x6,39.939,0.910\n+ldr-rgb-09,6x6,33.861,1.520\n+ldr-rgba-00,6x6,30.959,1.620\n+ldr-rgba-01,6x6,32.344,1.340\n+ldr-rgba-02,6x6,27.900,1.960\n+ldr-srgba-00,6x6,28.263,1.680\n+ldr-srgba-01,6x6,31.434,1.520\n+ldr-srgba-02,6x6,24.612,1.910\n+ldr-xy-00,6x6,33.530,0.660\nldr-xy-01,6x6,33.740,1.230\n-ldr-xy-02,6x6,48.674,1.660\n-hdr-rgb-00,8x8,21.838,1.250\n-ldr-rgb-00,8x8,24.697,0.020\n-ldr-rgb-00,8x8,23.989,0.020\n-ldr-rgb-00,8x8,29.097,1.720\n-ldr-rgb-01,8x8,29.136,1.570\n-ldr-rgb-02,8x8,23.224,1.920\n-ldr-rgb-03,8x8,39.344,0.320\n-ldr-rgb-04,8x8,29.876,1.780\n-ldr-rgb-05,8x8,26.151,1.900\n-ldr-rgb-06,8x8,23.326,1.890\n-ldr-rgb-07,8x8,31.297,1.640\n-ldr-rgb-08,8x8,36.574,0.760\n-ldr-rgb-09,8x8,29.174,1.330\n-ldr-rgba-00,8x8,26.892,1.780\n-ldr-rgba-01,8x8,28.520,1.430\n-ldr-rgba-02,8x8,23.989,1.940\n-ldr-xy-00,8x8,32.378,0.670\n+ldr-xy-02,6x6,48.674,1.480\n+hdr-rgb-00,8x8,21.838,1.190\n+ldr-rgb-00,8x8,29.097,1.630\n+ldr-rgb-01,8x8,29.136,1.510\n+ldr-rgb-02,8x8,23.224,1.700\n+ldr-rgb-03,8x8,39.344,0.350\n+ldr-rgb-04,8x8,29.876,1.580\n+ldr-rgb-05,8x8,26.151,1.750\n+ldr-rgb-06,8x8,23.326,1.740\n+ldr-rgb-07,8x8,31.297,1.920\n+ldr-rgb-08,8x8,36.574,0.810\n+ldr-rgb-09,8x8,29.174,2.450\n+ldr-rgba-00,8x8,26.892,2.040\n+ldr-rgba-01,8x8,28.520,1.380\n+ldr-rgba-02,8x8,23.989,1.830\n+ldr-srgba-00,8x8,24.409,1.680\n+ldr-srgba-01,8x8,27.814,1.480\n+ldr-srgba-02,8x8,21.547,1.820\n+ldr-xy-00,8x8,32.378,0.650\nldr-xy-01,8x8,32.551,0.670\n-ldr-xy-02,8x8,44.944,0.670\n+ldr-xy-02,8x8,44.944,0.640\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_run.py", "new_path": "Test/astc_test_run.py", "diff": "@@ -68,6 +68,8 @@ class TestImage():\nassert len(nameParts) == 4\nif \"s\" in nameParts[3]:\nself.useLevel.append(\"smoke\")\n+ if \"x\" in nameParts[3]:\n+ self.useLevel = []\n# Name of the test excludes flags from the file name\nself.name = \"-\".join(nameParts[0:3])\n@@ -127,6 +129,10 @@ class TestImage():\nif self.format == \"xy\":\nargs.append(\"-normal_psnr\")\n+ # Switch sRGB images into sRGB mode\n+ if self.format == \"srgba\":\n+ args.append(\"-srgb\")\n+\n# Switch HDR data formats into HDR compression mode; note that this\n# mode assumes that the alpha channel is non-correlated\nif self.dynamicRange == \"hdr\":\n@@ -154,7 +160,7 @@ class TestImage():\nif self.dynamicRange == \"ldr\":\nif self.format in (\"rgb\", \"xy\"):\npatternPSNR = \"PSNR \\\\(LDR-RGB\\\\): ([0-9.]*) dB\"\n- elif self.format == \"rgba\":\n+ elif self.format in (\"srgba\", \"rgba\"):\npatternPSNR = \"PSNR \\\\(LDR-RGBA\\\\): ([0-9.]*) dB\"\nelse:\nassert False, \"Unsupported LDR color format %s\" % self.format\n@@ -292,6 +298,9 @@ def get_test_listing(testReference, patchRun=False):\ntestFilePath = os.path.join(root, testFile)\nimage = TestImage(testFilePath, testReference, patchRun)\n+\n+ # If this image has any test use level then add it to the list\n+ if image.useLevel:\ntests.append(image)\nreturn tests\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add sRGB tests to the test suite
61,745
10.01.2020 00:14:10
0
4d6edfe748bed8bd7f2f434267a72a83df0f638d
[IQ change]: Only do single iteration in realign_weights
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -299,22 +299,40 @@ enum quantization_method\nQUANT_256 = 20\n};\n-/*\n- In ASTC, we support relatively many combinations of weight precisions and weight transfer functions.\n- As such, for each combination we support, we have a hardwired data structure.\n-\n- This structure provides the following information: A table, used to estimate the closest quantized\n+/**\n+ * @brief Weight quantization transfer table.\n+ *\n+ * ASTC can store texel weights at many quantization levels, so for performance\n+ * we store essential information about each level as a precomputed data\n+ * structure.\n+ *\n+ * Unquantized weights are integers in the range [0, 64], or floats [0, 1].\n+ *\n+ * This structure provides the following information:\n+ * A table, used to estimate the closest quantized\nweight for a given floating-point weight. For each quantized weight, the corresponding unquantized\nand floating-point values. For each quantized weight, a previous-value and a next-value.\n*/\nstruct quantization_and_transfer_table\n{\nquantization_method method;\n+ /* TODO: Now that we've introduced the packed prev_next data below, some\n+ * of these can be replaced by that in and then removed. */\nuint8_t unquantized_value[32]; // 0..64\nfloat unquantized_value_flt[32]; // 0..1\nuint8_t prev_quantized_value[32];\nuint8_t next_quantized_value[32];\nuint8_t closest_quantized_weight[1025];\n+\n+ /**\n+ * An encoded table of previous-and-next weight values, indexed by the\n+ * current unquantized value.\n+ * * bits 7:0 = previous-index, unquantized\n+ * * bits 15:8 = next-index, unquantized\n+ * * bits 23:16 = previous-index, quantized\n+ * * bits 31:24 = next-index, quantized\n+ */\n+ uint32_t prev_next_values[65];\n};\nextern const quantization_and_transfer_table quant_and_xfer_tables[12];\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "#include <fenv.h>\n#endif\n+/**\n+ * @brief Attempt to improve weights given a chosen configuration.\n+ *\n+ * Given a fixed weight grid decimation and weight value quantization, iterate\n+ * over all weights (per partition and per plane) and attempt to improve image\n+ * quality by moving each weight up by one or down by one quantization step.\n+ */\nstatic int realign_weights(\nastc_decode_mode decode_mode,\nconst block_size_descriptor* bsd,\nconst imageblock* blk,\nconst error_weight_block* ewb,\nsymbolic_compressed_block* scb,\n- uint8_t* weight_set8,\n+ uint8_t* plane1_weight_set8,\nuint8_t* plane2_weight_set8\n) {\n- int i, j;\n-\n- // get the appropriate partition descriptor.\n+ // Get the partition descriptor\nint partition_count = scb->partition_count;\nconst partition_info *pt = get_partition_table(bsd, partition_count);\npt += scb->partition_index;\n- // get the appropriate block descriptor\n- const decimation_table *const *ixtab2 = bsd->decimation_tables;\n-\n- const decimation_table *it = ixtab2[bsd->block_modes[scb->block_mode].decimation_mode];\n-\n- int is_dual_plane = bsd->block_modes[scb->block_mode].is_dual_plane;\n-\n- // get quantization-parameters\n+ // Get the quantization table\nint weight_quantization_level = bsd->block_modes[scb->block_mode].quantization_mode;\n+ const quantization_and_transfer_table *qat = &(quant_and_xfer_tables[weight_quantization_level]);\n- // decode the color endpoints\n- uint4 color_endpoint0[4];\n- uint4 color_endpoint1[4];\n- int rgb_hdr[4];\n- int alpha_hdr[4];\n- int nan_endpoint[4];\n-\n- for (i = 0; i < partition_count; i++)\n- unpack_color_endpoints(decode_mode,\n- scb->color_formats[i], scb->color_quantization_level, scb->color_values[i], &rgb_hdr[i], &alpha_hdr[i], &nan_endpoint[i], &(color_endpoint0[i]), &(color_endpoint1[i]));\n-\n- float uq_plane1_weights[MAX_WEIGHTS_PER_BLOCK];\n- float uq_plane2_weights[MAX_WEIGHTS_PER_BLOCK];\n+ // Get the decimation table\n+ const decimation_table *const *ixtab2 = bsd->decimation_tables;\n+ const decimation_table *it = ixtab2[bsd->block_modes[scb->block_mode].decimation_mode];\nint weight_count = it->num_weights;\n- // read and unquantize the weights.\n+ int max_plane = bsd->block_modes[scb->block_mode].is_dual_plane;\n+ int plane2_component = max_plane ? scb->plane2_color_component : 0;\n+ int plane_mask = max_plane ? 1 << plane2_component : 0;\n- const quantization_and_transfer_table *qat = &(quant_and_xfer_tables[weight_quantization_level]);\n+ // Decode the color endpoints\n+ int rgb_hdr;\n+ int alpha_hdr;\n+ int nan_endpoint;\n+ int4 endpnt0[4];\n+ int4 endpnt1[4];\n+ float4 endpnt0f[4];\n+ float4 offset[4];\n- for (i = 0; i < weight_count; i++)\n- {\n- uq_plane1_weights[i] = qat->unquantized_value_flt[weight_set8[i]];\n- }\n- if (is_dual_plane)\n- {\n- for (i = 0; i < weight_count; i++)\n- uq_plane2_weights[i] = qat->unquantized_value_flt[plane2_weight_set8[i]];\n- }\n-\n- int plane2_color_component = is_dual_plane ? scb->plane2_color_component : -1;\n-\n- // for each weight, unquantize the weight, use it to compute a color and a color error.\n- // then, increment the weight until the color error stops decreasing\n- // then, decrement the weight until the color error stops increasing\n-\n- #define COMPUTE_ERROR( errorvar ) \\\n- errorvar = 0.0f; \\\n- for(j=0;j<texels_to_evaluate;j++) \\\n- { \\\n- int texel = it->weight_texel[i][j]; \\\n- int partition = pt->partition_of_texel[texel]; \\\n- float plane1_weight = compute_value_of_texel_flt( texel, it, uq_plane1_weights ); \\\n- float plane2_weight = 0.0f; \\\n- if( is_dual_plane ) \\\n- plane2_weight = compute_value_of_texel_flt( texel, it, uq_plane2_weights ); \\\n- int int_plane1_weight = static_cast<int>(floor( plane1_weight*64.0f + 0.5f ) ); \\\n- int int_plane2_weight = static_cast<int>(floor( plane2_weight*64.0f + 0.5f ) ); \\\n- uint4 lrp_color = lerp_color_int( \\\n- decode_mode, \\\n- color_endpoint0[partition], \\\n- color_endpoint1[partition], \\\n- int_plane1_weight, \\\n- int_plane2_weight, \\\n- plane2_color_component ); \\\n- float4 color = float4( lrp_color.x, lrp_color.y, lrp_color.z, lrp_color.w ); \\\n- float4 origcolor = float4( \\\n- blk->work_data[4*texel], \\\n- blk->work_data[4*texel+1], \\\n- blk->work_data[4*texel+2], \\\n- blk->work_data[4*texel+3] ); \\\n- float4 error_weight = ewb->error_weights[texel]; \\\n- float4 colordiff = color - origcolor; \\\n- errorvar += dot( colordiff*colordiff, error_weight ); \\\n+ for (int pa_idx = 0; pa_idx < partition_count; pa_idx++)\n+ {\n+ unpack_color_endpoints(decode_mode,\n+ scb->color_formats[pa_idx],\n+ scb->color_quantization_level,\n+ scb->color_values[pa_idx],\n+ &rgb_hdr, &alpha_hdr, &nan_endpoint,\n+ // TODO: Fix these casts ...\n+ reinterpret_cast<uint4*>(&endpnt0[pa_idx]),\n+ reinterpret_cast<uint4*>(&endpnt1[pa_idx]));\n}\n+ uint8_t uq_pl_weights[MAX_WEIGHTS_PER_BLOCK];\n+ uint8_t* weight_set8 = plane1_weight_set8;\nint adjustments = 0;\n- for (i = 0; i < weight_count; i++)\n+ // For each plane and partition ...\n+ for (int pl_idx = 0; pl_idx <= max_plane; pl_idx++)\n{\n- int current_wt = weight_set8[i];\n- int texels_to_evaluate = it->weight_num_texels[i];\n-\n- float current_error;\n+ for (int pa_idx = 0; pa_idx < partition_count; pa_idx++)\n+ {\n+ // Compute the endpoint delta for all channels in current plane\n+ int4 epd = endpnt1[pa_idx] - endpnt0[pa_idx];\n- COMPUTE_ERROR(current_error);\n+ if (plane_mask & 1 ) epd.x = 0;\n+ if (plane_mask & 2 ) epd.y = 0;\n+ if (plane_mask & 4 ) epd.z = 0;\n+ if (plane_mask & 8 ) epd.w = 0;\n- // increment until error starts increasing.\n- while (1)\n- {\n- int next_wt = qat->next_quantized_value[current_wt];\n- if (next_wt == current_wt)\n- break;\n- uq_plane1_weights[i] = qat->unquantized_value_flt[next_wt];\n- float next_error;\n- COMPUTE_ERROR(next_error);\n- if (next_error < current_error)\n- {\n- // succeeded, increment the weight\n- current_wt = next_wt;\n- current_error = next_error;\n- adjustments++;\n- }\n- else\n- {\n- // failed, back out the attempted increment\n- uq_plane1_weights[i] = qat->unquantized_value_flt[current_wt];\n- break;\n- }\n+ endpnt0f[pa_idx] = float4((float)endpnt0[pa_idx].x, (float)endpnt0[pa_idx].y,\n+ (float)endpnt0[pa_idx].z, (float)endpnt0[pa_idx].w );\n+ offset[pa_idx] = float4((float)epd.x, (float)epd.y, (float)epd.z, (float)epd.w );\n+ offset[pa_idx] = offset[pa_idx] * (1.0f / 64.0f);\n}\n- // decrement until error starts increasing\n- while (1)\n+ // Create an unquantized weight grid for this decimation level\n+ for (int we_idx = 0; we_idx < weight_count; we_idx++)\n{\n- int prev_wt = qat->prev_quantized_value[current_wt];\n- if (prev_wt == current_wt)\n- break;\n- uq_plane1_weights[i] = qat->unquantized_value_flt[prev_wt];\n- float prev_error;\n- COMPUTE_ERROR(prev_error);\n- if (prev_error < current_error)\n- {\n- // succeeded, decrement the weight\n- current_wt = prev_wt;\n- current_error = prev_error;\n- adjustments++;\n+ uq_pl_weights[we_idx] = qat->unquantized_value[weight_set8[we_idx]];\n}\n- else\n+\n+ // For each weight compute previous, current, and next errors\n+ for (int we_idx = 0; we_idx < weight_count; we_idx++)\n{\n- // failed, back out the attempted decrement\n- uq_plane1_weights[i] = qat->unquantized_value_flt[current_wt];\n- break;\n- }\n- }\n+ int uqw = uq_pl_weights[we_idx];\n- weight_set8[i] = current_wt;\n- }\n+ uint32_t prev_and_next = qat->prev_next_values[uqw];\n+ int prev_wt_uq = prev_and_next & 0xFF;\n+ int next_wt_uq = (prev_and_next >> 8) & 0xFF;\n- if (!is_dual_plane)\n- return adjustments;\n+ int uqw_next_dif = next_wt_uq - uqw;\n+ int uqw_prev_dif = prev_wt_uq - uqw;\n+\n+ float current_error = 0.0f;\n+ float up_error = 0.0f;\n+ float down_error = 0.0f;\n- // processing of the second plane of weights\n- for (i = 0; i < weight_count; i++)\n+ // Interpolate the colors to create the diffs\n+ int texels_to_evaluate = it->weight_num_texels[we_idx];\n+ for (int te_idx = 0; te_idx < texels_to_evaluate; te_idx++)\n{\n- int current_wt = plane2_weight_set8[i];\n- int texels_to_evaluate = it->weight_num_texels[i];\n+ int texel = it->weight_texel[we_idx][te_idx];\n+ const uint8_t *texel_weights = it->texel_weights_texel[we_idx][te_idx];\n+ const float *texel_weights_float = it->texel_weights_float_texel[we_idx][te_idx];\n+ float twf0 = texel_weights_float[0];\n+ float weight_base =\n+ ((uqw * twf0\n+ + uq_pl_weights[texel_weights[1]] * texel_weights_float[1])\n+ + (uq_pl_weights[texel_weights[2]] * texel_weights_float[2]\n+ + uq_pl_weights[texel_weights[3]] * texel_weights_float[3]));\n- float current_error;\n+ int partition = pt->partition_of_texel[texel];\n- COMPUTE_ERROR(current_error);\n+ weight_base = weight_base + 0.5f;\n+ float plane_weight = floorf(weight_base );\n+ float plane_up_weight = floorf(weight_base + uqw_next_dif * twf0) - plane_weight;\n+ float plane_down_weight = floorf(weight_base + uqw_prev_dif * twf0) - plane_weight;\n- // increment until error starts increasing.\n- while (1)\n- {\n- int next_wt = qat->next_quantized_value[current_wt];\n- if (next_wt == current_wt)\n- break;\n- uq_plane2_weights[i] = qat->unquantized_value_flt[next_wt];\n- float next_error;\n- COMPUTE_ERROR(next_error);\n- if (next_error < current_error)\n- {\n- // succeeded, increment the weight\n- current_wt = next_wt;\n- current_error = next_error;\n- adjustments++;\n- }\n- else\n- {\n- // failed, back out the attempted increment\n- uq_plane2_weights[i] = qat->unquantized_value_flt[current_wt];\n- break;\n- }\n+ float4 color_offset = offset[partition];\n+ float4 color_base = endpnt0f[partition];\n+\n+ float4 color = color_base + color_offset * plane_weight;\n+\n+ float4 origcolor = float4(blk->work_data[4 * texel] , blk->work_data[4 * texel + 1],\n+ blk->work_data[4 * texel + 2], blk->work_data[4 * texel + 3]);\n+ float4 error_weight = float4(ewb->texel_weight_r[texel], ewb->texel_weight_g[texel],\n+ ewb->texel_weight_b[texel], ewb->texel_weight_a[texel]);\n+\n+ float4 colordiff = color - origcolor;\n+ float4 color_up_diff = colordiff + color_offset * plane_up_weight;\n+ float4 color_down_diff = colordiff + color_offset * plane_down_weight;\n+ current_error += dot(colordiff * colordiff, error_weight);\n+ up_error += dot(color_up_diff * color_up_diff, error_weight);\n+ down_error += dot(color_down_diff * color_down_diff, error_weight);\n}\n- // decrement until error starts increasing\n- while (1)\n+ // Check if the prev or next error is better, and if so use it\n+ if ((up_error < current_error) && (up_error < down_error))\n{\n- int prev_wt = qat->prev_quantized_value[current_wt];\n- if (prev_wt == current_wt)\n- break;\n- uq_plane2_weights[i] = qat->unquantized_value_flt[prev_wt];\n- float prev_error;\n- COMPUTE_ERROR(prev_error);\n- if (prev_error < current_error)\n- {\n- // succeeded, decrement the weight\n- current_wt = prev_wt;\n- current_error = prev_error;\n+ uq_pl_weights[we_idx] = next_wt_uq;\n+ weight_set8[we_idx] = (uint8_t)((prev_and_next >> 24) & 0xFF);\nadjustments++;\n}\n- else\n+ else if(down_error < current_error )\n{\n- // failed, back out the attempted decrement\n- uq_plane2_weights[i] = qat->unquantized_value_flt[current_wt];\n- break;\n+ uq_pl_weights[we_idx] = prev_wt_uq;\n+ weight_set8[we_idx] = (uint8_t)((prev_and_next >> 16) & 0xFF);\n+ adjustments++;\n}\n+\n+ // IQ loss: The v1 compressor iterated here multiple times, trying\n+ // multiple increments or decrements until the error stopped\n+ // improving. This was very expensive (~15% of the v1 compressor\n+ // coding time) for very small improvements in quality (typically\n+ // less than 0.005 dB PSNR), so we now only check one step in\n+ // either direction\n}\n- plane2_weight_set8[i] = current_wt;\n+ // Prepare iteration for plane 2\n+ weight_set8 = plane2_weight_set8;\n+ plane_mask ^= 0xF;\n}\nreturn adjustments;\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_quant_xfer_tables.cpp", "new_path": "Source/astc_weight_quant_xfer_tables.cpp", "diff": "#include \"astc_codec_internals.h\"\n+#define _ 0 // using _ to indicate an entry that will not be used.\n+\nconst quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 0, range 0..1\n{\nQUANT_2,\n{0, 64,},\n- {\n- 0.000000, 1.000000,},\n+ {0.000000, 1.000000,},\n{0, 0,},\n{1, 1,},\n{\n@@ -89,11 +90,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n1,\n},\n+ {0x01004000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x01004000}\n},\n-\n-\n-\n-\n// quantization method 1, range 0..2\n{\nQUANT_3,\n@@ -169,11 +167,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\n2,\n},\n+ {0x01002000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x02004000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x02014020}\n},\n-\n-\n-\n-\n// quantization method 2, range 0..3\n{\nQUANT_4,\n@@ -249,11 +244,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\n3,\n},\n+ {0x01001500,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x02002b00,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x03014015,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x0302402b}\n},\n-\n-\n-\n-\n// quantization method 3, range 0..4\n{\nQUANT_5,\n@@ -330,11 +322,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,\n4,\n},\n+ {0x01001000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x02002000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x03013010,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x04024020,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x04034030}\n},\n-\n-\n-\n-\n// quantization method 4, range 0..5\n{\nQUANT_6,\n@@ -411,11 +400,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n1,\n},\n+ {0x02000c00,_,_,_,_,_,_,_,_,_,_,_,0x04001900,_,_,_,_,_,_,_,_,_,_,_,_,0x0502270c,_,_,_,_,_,_,_,_,_,_,_,_,_,0x03043419,_,_,_,_,_,_,_,_,_,_,_,_,0x01054027,_,_,_,_,_,_,_,_,_,_,_,0x01034034}\n},\n-\n-\n-\n-\n// quantization method 5, range 0..7\n{\nQUANT_8,\n@@ -492,11 +478,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,\n7,\n},\n+ {0x01000900,_,_,_,_,_,_,_,_,0x02001200,_,_,_,_,_,_,_,_,0x03011b09,_,_,_,_,_,_,_,_,0x04022512,_,_,_,_,_,_,_,_,_,0x05032e1b,_,_,_,_,_,_,_,_,0x06043725,_,_,_,_,_,_,_,_,0x0705402e,_,_,_,_,_,_,_,_,0x07064037}\n},\n-\n-\n-\n-\n// quantization method 6, range 0..9\n{\nQUANT_10,\n@@ -574,11 +557,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n1,\n},\n+ {0x02000700,_,_,_,_,_,_,0x04000e00,_,_,_,_,_,_,0x06021507,_,_,_,_,_,_,0x08041c0e,_,_,_,_,_,_,0x09062415,_,_,_,_,_,_,_,0x07082b1c,_,_,_,_,_,_,0x05093224,_,_,_,_,_,_,0x0307392b,_,_,_,_,_,_,0x01054032,_,_,_,_,_,_,0x01034039}\n},\n-\n-\n-\n-\n// quantization method 7, range 0..11\n{\nQUANT_12,\n@@ -656,11 +636,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n1,\n},\n+ {0x04000500,_,_,_,_,0x08000b00,_,_,_,_,_,0x02041105,_,_,_,_,_,0x0608170b,_,_,_,_,_,0x0a021c11,_,_,_,_,0x0b062417,_,_,_,_,_,_,_,0x070a291c,_,_,_,_,0x030b2f24,_,_,_,_,_,0x09073529,_,_,_,_,_,0x05033b2f,_,_,_,_,_,0x01094035,_,_,_,_,0x0105403b}\n},\n-\n-\n-\n-\n// quantization method 8, range 0..15\n{\nQUANT_16,\n@@ -739,11 +716,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,\n15,\n},\n+ {0x01000400,_,_,_,0x02000800,_,_,_,0x03010c04,_,_,_,0x04021108,_,_,_,_,0x0503150c,_,_,_,0x06041911,_,_,_,0x07051d15,_,_,_,0x08062319,_,_,_,_,_,0x0907271d,_,_,_,0x0a082b23,_,_,_,0x0b092f27,_,_,_,0x0c0a342b,_,_,_,_,0x0d0b382f,_,_,_,0x0e0c3c34,_,_,_,0x0f0d4038,_,_,_,0x0f0e403c}\n},\n-\n-\n-\n-\n// quantization method 9, range 0..19\n{\nQUANT_20,\n@@ -823,11 +797,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n1,\n},\n+ {0x04000300,_,_,0x08000600,_,_,0x0c040903,_,_,0x10080d06,_,_,_,0x020c1009,_,_,0x0610130d,_,_,0x0a021710,_,_,_,0x0e061a13,_,_,0x120a1d17,_,_,0x130e231a,_,_,_,_,_,0x0f12261d,_,_,0x0b132923,_,_,0x070f2d26,_,_,_,0x030b3029,_,_,0x1107332d,_,_,0x0d033730,_,_,_,0x09113a33,_,_,0x050d3d37,_,_,0x0109403a,_,_,0x0105403d}\n},\n-\n-\n-\n-\n// quantization method 10, range 0..23\n{\nQUANT_24,\n@@ -908,11 +879,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n1,\n},\n+ {0x08000200,_,0x10000500,_,_,0x02080802,_,_,0x0a100b05,_,_,0x12020d08,_,0x040a100b,_,_,0x0c12130d,_,_,0x14041610,_,_,0x060c1813,_,0x0e141b16,_,_,0x16061e18,_,_,0x170e221b,_,_,_,0x0f16251e,_,_,0x07172822,_,_,0x150f2a25,_,0x0d072d28,_,_,0x0515302a,_,_,0x130d332d,_,_,0x0b053530,_,0x03133833,_,_,0x110b3b35,_,_,0x09033e38,_,_,0x0111403b,_,0x0109403e}\n},\n-\n-\n-\n-\n// quantization method 11, range 0..31\n{\nQUANT_32,\n@@ -995,5 +963,6 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,\n31,\n},\n- },\n+ {0x01000200,_,0x02000400,_,0x03010602,_,0x04020804,_,0x05030a06,_,0x06040c08,_,0x07050e0a,_,0x0806100c,_,0x0907120e,_,0x0a081410,_,0x0b091612,_,0x0c0a1814,_,0x0d0b1a16,_,0x0e0c1c18,_,0x0f0d1e1a,_,0x100e221c,_,_,_,0x110f241e,_,0x12102622,_,0x13112824,_,0x14122a26,_,0x15132c28,_,0x16142e2a,_,0x1715302c,_,0x1816322e,_,0x19173430,_,0x1a183632,_,0x1b193834,_,0x1c1a3a36,_,0x1d1b3c38,_,0x1e1c3e3a,_,0x1f1d403c,_,0x1f1e403e}\n+ }\n};\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
[IQ change]: Only do single iteration in realign_weights
61,745
10.01.2020 00:29:20
0
896b1f5ae94828d983881cb3b799631329df1b37
[IQ change] Halve angular_steppings density This change reduces the number of angular steppings used for testing weight quantization levels, which is one of the most significant processing costs in the codec. This reduces image quality by ~0.01 dB, and improves performance by ~10%.
[ { "change_type": "MODIFY", "old_path": "Source/astc_weight_align.cpp", "new_path": "Source/astc_weight_align.cpp", "diff": "#include <stdio.h>\n-static const float angular_steppings[] = {\n- 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875,\n-\n- 2.0, 2.25, 2.5, 2.75,\n- 3.0, 3.25, 3.5, 3.75,\n- 4.0, 4.25, 4.5, 4.75,\n- 5.0, 5.25, 5.5, 5.75,\n- 6.0, 6.25, 6.5, 6.75,\n- 7.0, 7.25, 7.5, 7.75,\n-\n- 8.0, 8.5,\n- 9.0, 9.5,\n- 10.0, 10.5,\n- 11.0, 11.5,\n- 12.0, 12.5,\n- 13.0, 13.5,\n- 14.0, 14.5,\n- 15.0, 15.5,\n- 16.0, 16.5,\n- 17.0, 17.5,\n- 18.0, 18.5,\n- 19.0, 19.5,\n- 20.0, 20.5,\n- 21.0, 21.5,\n- 22.0, 22.5,\n- 23.0, 23.5,\n- 24.0, 24.5,\n- 25.0, 25.5,\n- 26.0, 26.5,\n- 27.0, 27.5,\n- 28.0, 28.5,\n- 29.0, 29.5,\n- 30.0, 30.5,\n- 31.0, 31.5,\n- 32.0, 32.5,\n- 33.0, 33.5,\n- 34.0, 34.5,\n- 35.0, 35.5\n+static const float angular_steppings[44] = {\n+ 1.0f, 1.25f, 1.5f, 1.75f,\n+\n+ 2.0f, 2.5f, 3.0f, 3.5f,\n+ 4.0f, 4.5f, 5.0f, 5.5f,\n+ 6.0f, 6.5f, 7.0f, 7.5f,\n+\n+ 8.0f, 9.0f, 10.0f, 11.0f,\n+ 12.0f, 13.0f, 14.0f, 15.0f,\n+ 16.0f, 17.0f, 18.0f, 19.0f,\n+ 20.0f, 21.0f, 22.0f, 23.0f,\n+ 24.0f, 25.0f, 26.0f, 27.0f,\n+ 28.0f, 29.0f, 30.0f, 31.0f,\n+ 32.0f, 33.0f, 34.0f, 35.0f\n};\n#define ANGULAR_STEPS ((int)(sizeof(angular_steppings)/sizeof(angular_steppings[0])))\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
[IQ change] Halve angular_steppings density This change reduces the number of angular steppings used for testing weight quantization levels, which is one of the most significant processing costs in the codec. This reduces image quality by ~0.01 dB, and improves performance by ~10%.
61,745
11.01.2020 20:16:31
0
1fec277ba517d1b1372211121ee6938274de138b
Update VS2017 project, fix VS build warnings
[ { "change_type": "MODIFY", "old_path": "Source/VS2017/astcenc.vcxproj", "new_path": "Source/VS2017/astcenc.vcxproj", "diff": "<ClCompile Include=\"..\\astc_compute_variance.cpp\" />\n<ClCompile Include=\"..\\astc_decompress_symbolic.cpp\" />\n<ClCompile Include=\"..\\astc_encoding_choice_error.cpp\" />\n+ <ClCompile Include=\"..\\astc_error_metrics.cpp\" />\n<ClCompile Include=\"..\\astc_find_best_partitioning.cpp\" />\n<ClCompile Include=\"..\\astc_ideal_endpoints_and_weights.cpp\" />\n<ClCompile Include=\"..\\astc_image_load_store.cpp\" />\n<ClCompile Include=\"..\\astc_kmeans_partitioning.cpp\" />\n<ClCompile Include=\"..\\astc_ktx_dds.cpp\" />\n<ClCompile Include=\"..\\astc_main.cpp\" />\n+ <ClCompile Include=\"..\\astc_mathlib.cpp\" />\n<ClCompile Include=\"..\\astc_partition_tables.cpp\" />\n<ClCompile Include=\"..\\astc_percentile_tables.cpp\" />\n<ClCompile Include=\"..\\astc_pick_best_endpoint_format.cpp\" />\n+ <ClCompile Include=\"..\\astc_platform_dependents.cpp\" />\n<ClCompile Include=\"..\\astc_quantization.cpp\" />\n<ClCompile Include=\"..\\astc_stb_tga.cpp\" />\n<ClCompile Include=\"..\\astc_symbolic_physical.cpp\" />\n<ClCompile Include=\"..\\astc_toplevel.cpp\" />\n<ClCompile Include=\"..\\astc_weight_align.cpp\" />\n<ClCompile Include=\"..\\astc_weight_quant_xfer_tables.cpp\" />\n- <ClCompile Include=\"..\\mathlib.cpp\" />\n- <ClCompile Include=\"..\\softfloat.cpp\" />\n</ItemGroup>\n<ItemGroup>\n<ClInclude Include=\"..\\astc_codec_internals.h\" />\n- <ClInclude Include=\"..\\mathlib.h\" />\n- <ClInclude Include=\"..\\softfloat.h\" />\n+ <ClInclude Include=\"..\\astc_mathlib.h\" />\n<ClInclude Include=\"..\\stb_image.h\" />\n- <ClInclude Include=\"..\\vectypes.h\" />\n</ItemGroup>\n<PropertyGroup Label=\"Globals\">\n<ProjectGuid>{D6D60D86-0502-446A-8498-888F78B869C2}</ProjectGuid>\n<RootNamespace>astcenc</RootNamespace>\n<Keyword>Win32Proj</Keyword>\n- <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>\n+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\n</PropertyGroup>\n<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\n<ConfigurationType>Application</ConfigurationType>\n<CharacterSet>Unicode</CharacterSet>\n<WholeProgramOptimization>true</WholeProgramOptimization>\n- <PlatformToolset>v141</PlatformToolset>\n+ <PlatformToolset>v142</PlatformToolset>\n</PropertyGroup>\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n<ConfigurationType>Application</ConfigurationType>\n<CharacterSet>Unicode</CharacterSet>\n- <PlatformToolset>v141</PlatformToolset>\n+ <PlatformToolset>v142</PlatformToolset>\n</PropertyGroup>\n<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n<ImportGroup Label=\"ExtensionSettings\">\n" }, { "change_type": "MODIFY", "old_path": "Source/VS2017/astcenc.vcxproj.filters", "new_path": "Source/VS2017/astcenc.vcxproj.filters", "diff": "<ClCompile Include=\"..\\astc_weight_quant_xfer_tables.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\mathlib.cpp\">\n+ <ClCompile Include=\"..\\astc_mathlib.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\softfloat.cpp\">\n+ <ClCompile Include=\"..\\astc_platform_dependents.cpp\">\n+ <Filter>Source Files</Filter>\n+ </ClCompile>\n+ <ClCompile Include=\"..\\astc_error_metrics.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n</ItemGroup>\n<ClInclude Include=\"..\\astc_codec_internals.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\mathlib.h\">\n- <Filter>Header Files</Filter>\n- </ClInclude>\n- <ClInclude Include=\"..\\softfloat.h\">\n- <Filter>Header Files</Filter>\n- </ClInclude>\n<ClInclude Include=\"..\\stb_image.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\vectypes.h\">\n+ <ClInclude Include=\"..\\astc_mathlib.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n</ItemGroup>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_decompress_symbolic.cpp", "new_path": "Source/astc_decompress_symbolic.cpp", "diff": "@@ -272,10 +272,10 @@ void decompress_symbolic_block(\nblk->alpha_lns[i] = alpha_hdr_endpoint[partition];\nblk->nan_texel[i] = nan_endpoint[partition];\n- blk->work_data[4 * i] = color.x;\n- blk->work_data[4 * i + 1] = color.y;\n- blk->work_data[4 * i + 2] = color.z;\n- blk->work_data[4 * i + 3] = color.w;\n+ blk->work_data[4 * i ] = (float)color.x;\n+ blk->work_data[4 * i + 1] = (float)color.y;\n+ blk->work_data[4 * i + 2] = (float)color.z;\n+ blk->work_data[4 * i + 3] = (float)color.w;\n}\nimageblock_initialize_orig_from_work(blk, bsd->texel_count);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_mathlib.h", "new_path": "Source/astc_mathlib.h", "diff": "#include <cstdint>\n#include <cmath>\n+#ifndef M_PI\n+ #define M_PI 3.14159265358979323846\n+#endif\n+\n// **********************************************************************\n// vector data types and basic add/subtract/multiply functions on them\n// **********************************************************************\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update VS2017 project, fix VS build warnings
61,745
11.01.2020 21:38:51
0
6b867709dea222cfbf60773f58e483152266d819
Move bsd off the stack to fit into 1MB stack limit on VS
[ { "change_type": "MODIFY", "old_path": "Source/astc_compute_variance.cpp", "new_path": "Source/astc_compute_variance.cpp", "diff": "@@ -102,7 +102,7 @@ static void brent_kung_prefix_sum(\nsize_t iters = items >> log2_stride;\nfloat4 *da = d + (start * stride);\n- size_t ofs = -(step * stride);\n+ ptrdiff_t ofs = -(step * stride);\nsize_t ofs_stride = stride << log2_stride;\nwhile (iters)\n@@ -126,7 +126,7 @@ static void brent_kung_prefix_sum(\nsize_t iters = (items - step) >> log2_stride;\nfloat4 *da = d + (start * stride);\n- size_t ofs = -(step * stride);\n+ ptrdiff_t ofs = -(step * stride);\nsize_t ofs_stride = stride << log2_stride;\nwhile (iters)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -304,12 +304,12 @@ void encode_astc_image(\n) {\n// before entering into the multi-threaded routine, ensure that the block size descriptors\n// and the partition table descriptors needed actually exist.\n- block_size_descriptor bsd;\n- init_block_size_descriptor(xdim, ydim, zdim, &bsd);\n- get_partition_table(&bsd, 0);\n+ block_size_descriptor* bsd = new block_size_descriptor;\n+ init_block_size_descriptor(xdim, ydim, zdim, bsd);\n+ get_partition_table(bsd, 0);\nencode_astc_image_info ai;\n- ai.bsd = &bsd;\n+ ai.bsd = bsd;\nai.buffer = buffer;\nai.ewp = ewp;\nai.pack_and_unpack = pack_and_unpack;\n@@ -320,6 +320,7 @@ void encode_astc_image(\nai.output_image = output_image;\nlaunch_threads(threadcount, encode_astc_image_threadfunc, &ai);\n+ delete bsd;\n}\nvoid store_astc_file(\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Move bsd off the stack to fit into 1MB stack limit on VS
61,745
11.01.2020 23:23:35
0
f9f95dc9c4813d1747044d191195ead390aa0393
Refactor compute_lowest_and_highest_weight Algorithm is unchanged, but keeps a running tracker rather than scatter array writes, which will make it easier to vectorize in future. Some computation from the calling function is also merged into this, as it's easy to compute and mostly stateless.
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "#ifndef ASTC_CODEC_INTERNALS_INCLUDED\n#define ASTC_CODEC_INTERNALS_INCLUDED\n+#include <cstddef>\n#include <cstdint>\n#include <cstdio>\n#include <cstdlib>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compute_variance.cpp", "new_path": "Source/astc_compute_variance.cpp", "diff": "@@ -102,7 +102,7 @@ static void brent_kung_prefix_sum(\nsize_t iters = items >> log2_stride;\nfloat4 *da = d + (start * stride);\n- ptrdiff_t ofs = -(step * stride);\n+ ptrdiff_t ofs = -(ptrdiff_t)(step * stride);\nsize_t ofs_stride = stride << log2_stride;\nwhile (iters)\n@@ -126,7 +126,7 @@ static void brent_kung_prefix_sum(\nsize_t iters = (items - step) >> log2_stride;\nfloat4 *da = d + (start * stride);\n- ptrdiff_t ofs = -(step * stride);\n+ ptrdiff_t ofs = -(ptrdiff_t)(step * stride);\nsize_t ofs_stride = stride << log2_stride;\nwhile (iters)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_align.cpp", "new_path": "Source/astc_weight_align.cpp", "diff": "@@ -152,26 +152,19 @@ void compute_angular_offsets(\n// lowest and highest weight that results from quantizing using the stepsize & offset.\n// also, compute the resulting error.\n-void compute_lowest_and_highest_weight(\n+static void compute_lowest_and_highest_weight(\nint samplecount,\nconst float *samples,\nconst float *sample_weights,\nint max_angular_steps,\n+ int max_quantization_steps,\nconst float *offsets,\nint8_t * lowest_weight,\n- int8_t * highest_weight,\n+ int8_t * weight_span,\nfloat *error,\nfloat *cut_low_weight_error,\nfloat *cut_high_weight_error\n) {\n- float error_from_forcing_weight_down[60];\n- float error_from_forcing_weight_either_way[60];\n- for (int i = 0; i < 60; i++)\n- {\n- error_from_forcing_weight_down[i] = 0;\n- error_from_forcing_weight_either_way[i] = 0;\n- }\n-\n// weight + 12\nstatic const unsigned int idxtab[128] = {\n12, 13, 14, 15, 16, 17, 18, 19,\n@@ -198,95 +191,65 @@ void compute_lowest_and_highest_weight(\nunsigned int maxidx_bias12 = 0;\nfloat errval = 0.0f;\n+ float cut_low_weight_err = 0.0f;\n+ float cut_high_weight_err = 0.0f;\nfloat rcp_stepsize = angular_steppings[sp];\nfloat offset = offsets[sp];\nfloat scaled_offset = rcp_stepsize * offset;\n- for (int i = 0; i < samplecount - 1; i += 2)\n+ for (int j = 0; j < samplecount; j++)\n{\n- float wt1 = sample_weights[i];\n- float wt2 = sample_weights[i + 1];\n- if32 p1, p2;\n- float sval1 = (samples[i] * rcp_stepsize) - scaled_offset;\n- float sval2 = (samples[i + 1] * rcp_stepsize) - scaled_offset;\n- p1.f = sval1 + 12582912.0f; // FP representation abuse to avoid floor() and float->int conversion\n- p2.f = sval2 + 12582912.0f; // FP representation abuse to avoid floor() and float->int conversion\n- float isval1 = p1.f - 12582912.0f;\n- float isval2 = p2.f - 12582912.0f;\n- float dif1 = sval1 - isval1;\n- float dif2 = sval2 - isval2;\n-\n- errval += (dif1 * wt1) * dif1;\n- errval += (dif2 * wt2) * dif2;\n-\n- // table lookups that really perform a minmax function.\n- unsigned int idx1_bias12 = idxtab[p1.u & 0x7F];\n- unsigned int idx2_bias12 = idxtab[p2.u & 0x7F];\n-\n- if (idx1_bias12 < minidx_bias12)\n- minidx_bias12 = idx1_bias12;\n- if (idx1_bias12 > maxidx_bias12)\n- maxidx_bias12 = idx1_bias12;\n- if (idx2_bias12 < minidx_bias12)\n- minidx_bias12 = idx2_bias12;\n- if (idx2_bias12 > maxidx_bias12)\n- maxidx_bias12 = idx2_bias12;\n-\n- error_from_forcing_weight_either_way[idx1_bias12] += wt1;\n- error_from_forcing_weight_down[idx1_bias12] += (dif1 * wt1);\n-\n- error_from_forcing_weight_either_way[idx2_bias12] += wt2;\n- error_from_forcing_weight_down[idx2_bias12] += (dif2 * wt2);\n- }\n-\n- if (samplecount & 1)\n- {\n- int i = samplecount - 1;\n- float wt = sample_weights[i];\n+ float wt = sample_weights[j];\nif32 p;\n- float sval = (samples[i] * rcp_stepsize) - scaled_offset;\n+ float sval = (samples[j] * rcp_stepsize) - scaled_offset;\np.f = sval + 12582912.0f; // FP representation abuse to avoid floor() and float->int conversion\nfloat isval = p.f - 12582912.0f;\n- float dif = sval - isval;\n- errval += (dif * wt) * dif;\n+ float dif = sval - isval;\n+ float dwt = dif * wt;\n+ errval += dwt * dif;\nunsigned int idx_bias12 = idxtab[p.u & 0x7F];\nif (idx_bias12 < minidx_bias12)\n+ {\nminidx_bias12 = idx_bias12;\n+ cut_low_weight_err = wt - 2.0f * dwt;\n+ }\n+ else if (idx_bias12 == minidx_bias12)\n+ {\n+ cut_low_weight_err += wt - 2.0f * dwt;\n+ }\n+\nif (idx_bias12 > maxidx_bias12)\n+ {\nmaxidx_bias12 = idx_bias12;\n-\n- error_from_forcing_weight_either_way[idx_bias12] += wt;\n- error_from_forcing_weight_down[idx_bias12] += dif * wt;\n+ cut_high_weight_err = wt + 2.0f * dwt;\n+ }\n+ else if (idx_bias12 == maxidx_bias12)\n+ {\n+ cut_high_weight_err += wt + 2.0f * dwt;\n}\n+ }\n+\n+ int minIndex = minidx_bias12 - 12;\n+ int maxIndex = maxidx_bias12 - 12;\n+ int span = maxIndex - minIndex + 1;\n+ // Clamp the span to a usable range\n+ span = MIN(span, max_quantization_steps + 3);\n+ span = MAX(span, 2);\nlowest_weight[sp] = (int)minidx_bias12 - 12;\n- highest_weight[sp] = (int)maxidx_bias12 - 12;\n+ weight_span[sp] = span;\nerror[sp] = errval;\n// the cut_(lowest/highest)_weight_error indicate the error that results from\n// forcing samples that should have had the (lowest/highest) weight value\n// one step (up/down).\n- cut_low_weight_error[sp] = error_from_forcing_weight_either_way[minidx_bias12] - 2.0f * error_from_forcing_weight_down[minidx_bias12];\n- cut_high_weight_error[sp] = error_from_forcing_weight_either_way[maxidx_bias12] + 2.0f * error_from_forcing_weight_down[maxidx_bias12];\n-\n- // clear out the error-from-forcing values we actually used in this pass\n- // so that these are clean for the next pass.\n- for (unsigned int ui = minidx_bias12 & ~0x3; ui <= maxidx_bias12; ui += 4)\n- {\n- error_from_forcing_weight_either_way[ui] = 0;\n- error_from_forcing_weight_down[ui] = 0;\n- error_from_forcing_weight_either_way[ui + 1] = 0;\n- error_from_forcing_weight_down[ui + 1] = 0;\n- error_from_forcing_weight_either_way[ui + 2] = 0;\n- error_from_forcing_weight_down[ui + 2] = 0;\n- error_from_forcing_weight_either_way[ui + 3] = 0;\n- error_from_forcing_weight_down[ui + 3] = 0;\n- }\n+ cut_low_weight_error[sp] = cut_low_weight_err;\n+ cut_high_weight_error[sp] = cut_high_weight_err;\n}\nfor (int sp = 0; sp < max_angular_steps; sp++)\n@@ -309,50 +272,31 @@ void compute_angular_endpoints_for_quantization_levels(\n) {\nint i;\n- max_quantization_level++; // Temporarily increase level - needs refinement\n-\nstatic const int quantization_steps_for_level[13] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 33, 36 };\n- int max_quantization_steps = quantization_steps_for_level[max_quantization_level];\n- float offsets[ANGULAR_STEPS];\n+ int max_quantization_steps = quantization_steps_for_level[max_quantization_level + 1];\n+ float angular_offsets[ANGULAR_STEPS];\nint max_angular_steps = max_angular_steps_needed_for_quant_level[max_quantization_level];\n-\n- compute_angular_offsets(samplecount, samples, sample_weights, max_angular_steps, offsets);\n+ compute_angular_offsets(samplecount, samples, sample_weights, max_angular_steps, angular_offsets);\n// the +4 offsets are to allow for vectorization within compute_lowest_and_highest_weight().\nint8_t lowest_weight[ANGULAR_STEPS + 4];\n- int8_t highest_weight[ANGULAR_STEPS + 4];\n+ int8_t weight_span[ANGULAR_STEPS + 4];\nfloat error[ANGULAR_STEPS + 4];\nfloat cut_low_weight_error[ANGULAR_STEPS + 4];\nfloat cut_high_weight_error[ANGULAR_STEPS + 4];\n- compute_lowest_and_highest_weight(samplecount, samples, sample_weights, max_angular_steps,\n- offsets, lowest_weight, highest_weight, error,\n+ compute_lowest_and_highest_weight(samplecount, samples, sample_weights,\n+ max_angular_steps, max_quantization_steps,\n+ angular_offsets, lowest_weight, weight_span, error,\ncut_low_weight_error, cut_high_weight_error);\n- #ifdef DEBUG_PRINT_DIAGNOSTICS\n- if (print_diagnostics)\n- {\n- printf(\"%s : max-angular-steps=%d \\n\", __func__, max_angular_steps);\n- printf(\"Samplecount=%d, max_quantization_level=%d\\n\", samplecount, max_quantization_level);\n- for (i = 0; i < samplecount; i++)\n- printf(\"Sample %d : %f (weight %f)\\n\", i, samples[i], sample_weights[i]);\n-\n- for (i = 0; i < max_angular_steps; i++)\n- {\n- printf(\"%d: offset=%f error=%f lowest=%d highest=%d cl=%f ch=%f\\n\", i, offsets[i], error[i], lowest_weight[i], highest_weight[i], cut_low_weight_error[i], cut_high_weight_error[i]);\n- }\n- printf(\"\\n\");\n- }\n- #endif\n-\n// for each quantization level, find the best error terms.\nfloat best_errors[40];\nint best_scale[40];\nuint8_t cut_low_weight[40];\n-\nfor (i = 0; i < (max_quantization_steps + 4); i++)\n{\nbest_errors[i] = 1e30f;\n@@ -362,47 +306,38 @@ void compute_angular_endpoints_for_quantization_levels(\nfor (i = 0; i < max_angular_steps; i++)\n{\n- int samplecount_weight = highest_weight[i] - lowest_weight[i] + 1;\n- if (samplecount_weight >= (max_quantization_steps + 4))\n- {\n- continue;\n- }\n+ int idx_span = weight_span[i];\n- if (samplecount_weight < 2)\n+ if (best_errors[idx_span] > error[i])\n{\n- samplecount_weight = 2;\n- }\n-\n- if (best_errors[samplecount_weight] > error[i])\n- {\n- best_errors[samplecount_weight] = error[i];\n- best_scale[samplecount_weight] = i;\n- cut_low_weight[samplecount_weight] = 0;\n+ best_errors[idx_span] = error[i];\n+ best_scale[idx_span] = i;\n+ cut_low_weight[idx_span] = 0;\n}\nfloat error_cut_low = error[i] + cut_low_weight_error[i];\nfloat error_cut_high = error[i] + cut_high_weight_error[i];\nfloat error_cut_low_high = error[i] + cut_low_weight_error[i] + cut_high_weight_error[i];\n- if (best_errors[samplecount_weight - 1] > error_cut_low)\n+ if (best_errors[idx_span - 1] > error_cut_low)\n{\n- best_errors[samplecount_weight - 1] = error_cut_low;\n- best_scale[samplecount_weight - 1] = i;\n- cut_low_weight[samplecount_weight - 1] = 1;\n+ best_errors[idx_span - 1] = error_cut_low;\n+ best_scale[idx_span - 1] = i;\n+ cut_low_weight[idx_span - 1] = 1;\n}\n- if (best_errors[samplecount_weight - 1] > error_cut_high)\n+ if (best_errors[idx_span - 1] > error_cut_high)\n{\n- best_errors[samplecount_weight - 1] = error_cut_high;\n- best_scale[samplecount_weight - 1] = i;\n- cut_low_weight[samplecount_weight - 1] = 0;\n+ best_errors[idx_span - 1] = error_cut_high;\n+ best_scale[idx_span - 1] = i;\n+ cut_low_weight[idx_span - 1] = 0;\n}\n- if (best_errors[samplecount_weight - 2] > error_cut_low_high)\n+ if (best_errors[idx_span - 2] > error_cut_low_high)\n{\n- best_errors[samplecount_weight - 2] = error_cut_low_high;\n- best_scale[samplecount_weight - 2] = i;\n- cut_low_weight[samplecount_weight - 2] = 1;\n+ best_errors[idx_span - 2] = error_cut_low_high;\n+ best_scale[idx_span - 2] = i;\n+ cut_low_weight[idx_span - 2] = 1;\n}\n}\n@@ -419,30 +354,26 @@ void compute_angular_endpoints_for_quantization_levels(\n}\n}\n- max_quantization_level--; // Decrease level again (see corresponding ++, above)\n-\n- static const int ql_weights[12] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 33 };\nfor (i = 0; i <= max_quantization_level; i++)\n{\n- int q = ql_weights[i];\n+ int q = quantization_steps_for_level[i];\nint bsi = best_scale[q];\n// Did we find anything?\nif (bsi < 0)\n{\n- printf(\"ERROR: Unable to find an encoding within the specified error limits. Please revise the error limit values and try again.\\n\");\n+ printf(\"ERROR: Unable to find an encoding within the specified error limits.\\n\");\nexit(1);\n}\nfloat stepsize = stepsizes[bsi];\nint lwi = lowest_weight[bsi] + cut_low_weight[q];\nint hwi = lwi + q - 1;\n- float offset = offsets[bsi];\n+ float offset = angular_offsets[bsi];\nlow_value[i] = offset + lwi * stepsize;\nhigh_value[i] = offset + hwi * stepsize;\n}\n-\n}\n// helper functions that will compute ideal angular-endpoints\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Refactor compute_lowest_and_highest_weight Algorithm is unchanged, but keeps a running tracker rather than scatter array writes, which will make it easier to vectorize in future. Some computation from the calling function is also merged into this, as it's easy to compute and mostly stateless.
61,745
12.01.2020 01:00:14
0
fa9f97ff3a5a3e9ba6a9f498cc357938b6dfda80
[IQ change] Remove decimated weight grid refinement Removing this pass costs around 0.01dB, but saves about 15% of runtime.
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -317,6 +317,9 @@ enum quantization_method\nstruct quantization_and_transfer_table\n{\nquantization_method method;\n+ uint8_t unquantized_value_unsc[33]; // unquantized values, unscrambled.\n+ uint8_t scramble_map[32]; // scrambling order, forward\n+\n/* TODO: Now that we've introduced the packed prev_next data below, some\n* of these can be replaced by that in and then removed. */\nuint8_t unquantized_value[32]; // 0..64\n@@ -760,7 +763,6 @@ void compute_ideal_weights_for_decimation_table(\nfloat* weights);\nvoid compute_ideal_quantized_weights_for_decimation_table(\n- const endpoints_and_weights* eai,\nconst decimation_table* it,\nfloat low_bound,\nfloat high_bound,\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -310,8 +310,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\nqwt_bitcounts[i] = bitcount;\n// then, generate the optimized set of weights for the weight mode.\n- compute_ideal_quantized_weights_for_decimation_table(&(eix[decimation_mode]),\n- ixtab2[decimation_mode],\n+ compute_ideal_quantized_weights_for_decimation_table(ixtab2[decimation_mode],\nweight_low_value[i], weight_high_value[i],\ndecimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * decimation_mode,\nflt_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * i,\n@@ -607,16 +606,14 @@ static void compress_symbolic_block_fixed_partition_2_planes(\nqwt_bitcounts[i] = bitcount;\n// then, generate the optimized set of weights for the mode.\n- compute_ideal_quantized_weights_for_decimation_table(&(eix1[decimation_mode]),\n- ixtab2[decimation_mode],\n+ compute_ideal_quantized_weights_for_decimation_table(ixtab2[decimation_mode],\nweight_low_value1[i],\nweight_high_value1[i],\ndecimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * decimation_mode),\nflt_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * i),\nu8_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * i), bsd->block_modes[i].quantization_mode);\n- compute_ideal_quantized_weights_for_decimation_table(&(eix2[decimation_mode]),\n- ixtab2[decimation_mode],\n+ compute_ideal_quantized_weights_for_decimation_table(ixtab2[decimation_mode],\nweight_low_value2[i],\nweight_high_value2[i],\ndecimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * decimation_mode + 1),\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1266,7 +1266,6 @@ void compute_ideal_weights_for_decimation_table(\ntriggering any perturbations *OR* we have run 4 full passes.\n*/\nvoid compute_ideal_quantized_weights_for_decimation_table(\n- const endpoints_and_weights* eai,\nconst decimation_table* it,\nfloat low_bound,\nfloat high_bound,\n@@ -1275,10 +1274,7 @@ void compute_ideal_quantized_weights_for_decimation_table(\nuint8_t* quantized_weight_set,\nint quantization_level\n) {\n- int i;\nint weight_count = it->num_weights;\n- int texels_per_block = it->num_texels;\n-\nconst quantization_and_transfer_table *qat = &(quant_and_xfer_tables[quantization_level]);\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -1294,8 +1290,11 @@ void compute_ideal_quantized_weights_for_decimation_table(\n}\n#endif\n- // quantize the weight set using both the specified low/high bounds and the\n- // standard 0..1 weight bounds.\n+ static const int quant_levels[12] = { 2,3,4,5,6,8,10,12,16,20,24,32 };\n+ float quant_level_m1 = (float)(quant_levels[quantization_level] - 1);\n+\n+ // Quantize the weight set using both the specified low/high bounds\n+ // and the standard 0..1 weight bounds.\n/*\nTODO: WTF issue that we need to examine some time\n@@ -1309,218 +1308,36 @@ void compute_ideal_quantized_weights_for_decimation_table(\nfloat rscale = high_bound - low_bound;\nfloat scale = 1.0f / rscale;\n- // rescale the weights so that\n- // low_bound -> 0\n- // high_bound -> 1\n- // OK: first, subtract low_bound, then divide by (high_bound - low_bound)\n- for (i = 0; i < weight_count; i++)\n- weight_set_out[i] = (weight_set_in[i] - low_bound) * scale;\n-\n- static const float quantization_step_table[12] = {\n- 1.0f / 1.0f,\n- 1.0f / 2.0f,\n- 1.0f / 3.0f,\n- 1.0f / 4.0f,\n- 1.0f / 5.0f,\n- 1.0f / 7.0f,\n- 1.0f / 9.0f,\n- 1.0f / 11.0f,\n- 1.0f / 15.0f,\n- 1.0f / 19.0f,\n- 1.0f / 23.0f,\n- 1.0f / 31.0f,\n- };\n-\n- float quantization_cutoff = quantization_step_table[quantization_level] * 0.333f;\n-\n- int is_perturbable[MAX_WEIGHTS_PER_BLOCK];\n- int perturbable_count = 0;\n-\n- // quantize the weight set\n- for (i = 0; i < weight_count; i++)\n- {\n- float ix0 = weight_set_out[i];\n- if (ix0 < 0.0f)\n- ix0 = 0.0f;\n- if (ix0 > 1.0f)\n- ix0 = 1.0f;\n- float ix = ix0;\n-\n- ix *= 1024.0f;\n- int ix2 = (int)floor(ix + 0.5f);\n- int weight = qat->closest_quantized_weight[ix2];\n+ float scaled_low_bound = low_bound * scale;\n+ rscale *= 1.0f / 64.0f;\n- ix = qat->unquantized_value_flt[weight];\n- weight_set_out[i] = ix;\n- quantized_weight_set[i] = weight;\n-\n- // test whether the error of the weight is greater than 1/3 of the weight spacing;\n- // if it is not, then it is flagged as \"not perturbable\". This causes a\n- // quality loss of about 0.002 dB, which is totally worth the speedup we're getting.\n- is_perturbable[i] = 0;\n- if (fabsf(ix - ix0) > quantization_cutoff)\n+ // Rescale the weights so that\n+ // low_bound -> 0, high_bound -> 1\n+ // and quantize the weight set\n+ for (int i = 0; i < weight_count; i++)\n{\n- is_perturbable[i] = 1;\n- perturbable_count++;\n- }\n- }\n+ float ix = (weight_set_in[i] * scale ) - scaled_low_bound;\n+ if (ix < 0.0f)\n+ ix = 0.0f;\n+ if (ix > 1.0f) // upper bound must be smaller than 1 to avoid an array overflow below.\n+ ix = 1.0f;\n- #ifdef DEBUG_PRINT_DIAGNOSTICS\n- if (print_diagnostics)\n- {\n- printf(\"Weight values after initial quantization:\\n\");\n- for (i = 0; i < weight_count; i++)\n- printf(\"%3d : %g <%d>\\n\", i, weight_set_out[i], quantized_weight_set[i]);\n- }\n- #endif\n+ // look up the two closest indexes and return the one that was closest.\n+ float ix1 = ix * quant_level_m1;\n+ int weight = (int)ix1;\n+ float ixl = qat->unquantized_value_unsc[weight];\n+ float ixh = qat->unquantized_value_unsc[weight + 1];\n- // if the decimation table is complete, the quantization above was all we needed to do,\n- // so we can early-out.\n- if (it->num_weights == it->num_texels)\n+ if (ixl + ixh < 128.0f * ix)\n{\n- // invert the weight-scaling that was done initially\n- // 0 -> low_bound\n- // 1 -> high_bound\n-\n- rscale = high_bound - low_bound;\n- for (i = 0; i < weight_count; i++)\n- weight_set_out[i] = (weight_set_out[i] * rscale) + low_bound;\n-\n- #ifdef DEBUG_PRINT_DIAGNOSTICS\n- if (print_diagnostics)\n- {\n- printf(\"Weight values after adjustment:\\n\");\n- for (i = 0; i < weight_count; i++)\n- printf(\"%3d : %g <%d> <error=%g>\\n\", i, weight_set_out[i], quantized_weight_set[i], weight_set_out[i] - weight_set_in[i]);\n- printf(\"\\n\");\n- printf(\"%s: Early-out\\n\\n\", __func__);\n-\n+ weight++;\n+ ixl = ixh;\n}\n- #endif\n-\n- return;\n- }\n-\n- int weights_tested = 0;\n-\n- #ifdef DEBUG_PRINT_DIAGNOSTICS\n- int perturbation_count = 0;\n- #endif\n- // if no weights are flagged as perturbable, don't try to perturb them.\n- // if only one weight is flagged as perturbable, perturbation is also pointless.\n- if (perturbable_count > 1)\n- {\n- endpoints_and_weights eaix;\n- for (i = 0; i < texels_per_block; i++)\n- {\n- eaix.weights[i] = (eai->weights[i] - low_bound) * scale;\n- eaix.weight_error_scale[i] = eai->weight_error_scale[i];\n+ // Invert the weight-scaling that was done initially\n+ weight_set_out[i] = (ixl * rscale) + low_bound;\n+ quantized_weight_set[i] = qat->scramble_map[weight];\n}\n-\n- float infilled_weights[MAX_TEXELS_PER_BLOCK];\n- for (i = 0; i < texels_per_block; i++)\n- infilled_weights[i] = compute_value_of_texel_flt(i, it, weight_set_out);\n-\n- int weight_to_perturb = 0;\n- int weights_since_last_perturbation = 0;\n- int num_weights = it->num_weights;\n-\n- while (weights_since_last_perturbation < num_weights && weights_tested < num_weights * 4)\n- {\n- int do_quant_mod = 0;\n- if (is_perturbable[weight_to_perturb])\n- {\n-\n- int weight_val = quantized_weight_set[weight_to_perturb];\n- int weight_next_up = qat->next_quantized_value[weight_val];\n- int weight_next_down = qat->prev_quantized_value[weight_val];\n- float flt_weight_val = qat->unquantized_value_flt[weight_val];\n- float flt_weight_next_up = qat->unquantized_value_flt[weight_next_up];\n- float flt_weight_next_down = qat->unquantized_value_flt[weight_next_down];\n- float error_change_up, error_change_down;\n-\n- // compute the error change from perturbing the weight either up or down.\n- compute_two_error_changes_from_perturbing_weight_infill(&eaix,\n- it,\n- infilled_weights,\n- weight_to_perturb,\n- (flt_weight_next_up - flt_weight_val), (flt_weight_next_down - flt_weight_val), &error_change_up, &error_change_down);\n-\n- int new_weight_val;\n- float flt_new_weight_val;\n- if (weight_val != weight_next_up && error_change_up < 0.0f)\n- {\n- do_quant_mod = 1;\n- new_weight_val = weight_next_up;\n- flt_new_weight_val = flt_weight_next_up;\n- }\n- else if (weight_val != weight_next_down && error_change_down < 0.0f)\n- {\n- do_quant_mod = 1;\n- new_weight_val = weight_next_down;\n- flt_new_weight_val = flt_weight_next_down;\n- }\n-\n- if (do_quant_mod)\n- {\n-\n- // update the weight.\n- weight_set_out[weight_to_perturb] = flt_new_weight_val;\n- quantized_weight_set[weight_to_perturb] = new_weight_val;\n-\n- // update the infilled-weights\n- int num_weights_infill = it->weight_num_texels[weight_to_perturb];\n- float perturbation = (flt_new_weight_val - flt_weight_val) * (1.0f / TEXEL_WEIGHT_SUM);\n- const uint8_t *weight_texel_ptr = it->weight_texel[weight_to_perturb];\n- const float *weights_ptr = it->weights_flt[weight_to_perturb];\n- for (i = num_weights_infill - 1; i >= 0; i--)\n- {\n- uint8_t weight_texel = weight_texel_ptr[i];\n- float weights = weights_ptr[i];\n- infilled_weights[weight_texel] += perturbation * weights;\n- }\n-\n- #ifdef DEBUG_PRINT_DIAGNOSTICS\n- if (print_diagnostics)\n- {\n- printf(\"Perturbation of weight %d : %g\\n\", weight_to_perturb, perturbation * (float)TEXEL_WEIGHT_SUM);\n- perturbation_count++;\n- }\n- #endif\n- }\n- }\n-\n- if (do_quant_mod)\n- weights_since_last_perturbation = 0;\n- else\n- weights_since_last_perturbation++;\n-\n- weight_to_perturb++;\n- if (weight_to_perturb >= num_weights)\n- weight_to_perturb -= num_weights;\n-\n- weights_tested++;\n- }\n- }\n-\n- // invert the weight-scaling that was done initially\n- // 0 -> low_bound\n- // 1 -> high_bound\n-\n- for (i = 0; i < weight_count; i++)\n- weight_set_out[i] = (weight_set_out[i] * rscale) + low_bound;\n-\n- #ifdef DEBUG_PRINT_DIAGNOSTICS\n- if (print_diagnostics)\n- {\n- printf(\"%d weights, %d weight tests, %d perturbations\\n\", weight_count, weights_tested, perturbation_count);\n- printf(\"Weight values after adjustment:\\n\");\n- for (i = 0; i < weight_count; i++)\n- printf(\"%3d : %g <%d>\\n\", i, weight_set_out[i], quantized_weight_set[i]);\n- printf(\"\\n\");\n- }\n- #endif\n}\nstatic inline float mat_square_sum(mat2 p)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_align.cpp", "new_path": "Source/astc_weight_align.cpp", "diff": "@@ -392,6 +392,7 @@ void compute_angular_endpoints_1plane(\nfor (i = 0; i < MAX_DECIMATION_MODES; i++)\n{\n+ // TODO: Do this at build time and cache the result\nint samplecount = bsd->decimation_mode_samples[i];\nint quant_mode = bsd->decimation_mode_maxprec_1plane[i];\nfloat percentile = bsd->decimation_mode_percentile[i];\n@@ -399,7 +400,6 @@ void compute_angular_endpoints_1plane(\nif (permit_encode == 0 || samplecount < 1 || quant_mode < 0 || percentile > mode_cutoff)\ncontinue;\n-\ncompute_angular_endpoints_for_quantization_levels(samplecount,\ndecimated_quantized_weights + i * MAX_WEIGHTS_PER_BLOCK,\ndecimated_weights + i * MAX_WEIGHTS_PER_BLOCK, quant_mode, low_values[i], high_values[i]);\n@@ -435,6 +435,7 @@ void compute_angular_endpoints_2planes(\nfor (i = 0; i < MAX_DECIMATION_MODES; i++)\n{\n+ // TODO: Do this at build time and cache the result\nint samplecount = bsd->decimation_mode_samples[i];\nint quant_mode = bsd->decimation_mode_maxprec_2planes[i];\nfloat percentile = bsd->decimation_mode_percentile[i];\n@@ -449,7 +450,6 @@ void compute_angular_endpoints_2planes(\ncompute_angular_endpoints_for_quantization_levels(samplecount,\ndecimated_quantized_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK,\ndecimated_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK, quant_mode, low_values2[i], high_values2[i]);\n-\n}\nfor (i = 0; i < MAX_WEIGHT_MODES; i++)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_quant_xfer_tables.cpp", "new_path": "Source/astc_weight_quant_xfer_tables.cpp", "diff": "@@ -19,10 +19,12 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 0, range 0..1\n{\nQUANT_2,\n- {0, 64,},\n- {0.000000, 1.000000,},\n- {0, 0,},\n- {1, 1,},\n+ {0, 64, 255},\n+ {0, 1},\n+ {0, 64},\n+ {0.000000f, 1.000000f},\n+ {0, 0},\n+ {1, 1},\n{\n0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n@@ -95,6 +97,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 1, range 0..2\n{\nQUANT_3,\n+ {0, 32, 64, 255},\n+ {0, 1, 2},\n{0, 32, 64,},\n{\n0.000000, 0.500000, 1.000000,},\n@@ -172,6 +176,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 2, range 0..3\n{\nQUANT_4,\n+ {0, 21, 43, 64, 255},\n+ {0, 1, 2, 3},\n{0, 21, 43, 64,},\n{\n0.000000, 0.328125, 0.671875, 1.000000,},\n@@ -249,6 +255,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 3, range 0..4\n{\nQUANT_5,\n+ {0,16,32,48,64,255},\n+ {0,1,2,3,4},\n{0, 16, 32, 48, 64,},\n{\n0.000000, 0.250000, 0.500000, 0.750000,\n@@ -327,6 +335,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 4, range 0..5\n{\nQUANT_6,\n+ {0,12,25,39,52,64,255},\n+ {0,2,4,5,3,1},\n{0, 64, 12, 52, 25, 39,},\n{\n0.000000, 1.000000, 0.187500, 0.812500,\n@@ -405,6 +415,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 5, range 0..7\n{\nQUANT_8,\n+ {0,9,18,27,37,46,55,64,255},\n+ {0,1,2,3,4,5,6,7},\n{0, 9, 18, 27, 37, 46, 55, 64,},\n{\n0.000000, 0.140625, 0.281250, 0.421875,\n@@ -483,6 +495,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 6, range 0..9\n{\nQUANT_10,\n+ {0,7,14,21,28,36,43,50,57,64,255},\n+ {0,2,4,6,8,9,7,5,3,1},\n{0, 64, 7, 57, 14, 50, 21, 43, 28, 36,},\n{\n0.000000, 1.000000, 0.109375, 0.890625,\n@@ -562,6 +576,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 7, range 0..11\n{\nQUANT_12,\n+ {0,5,11,17,23,28,36,41,47,53,59,64,255},\n+ {0,4,8,2,6,10,11,7,3,9,5,1},\n{0, 64, 17, 47, 5, 59, 23, 41, 11, 53, 28, 36,},\n{\n0.000000, 1.000000, 0.265625, 0.734375,\n@@ -641,6 +657,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 8, range 0..15\n{\nQUANT_16,\n+ {0,4,8,12,17,21,25,29,35,39,43,47,52,56,60,64,255},\n+ {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},\n{0, 4, 8, 12, 17, 21, 25, 29, 35, 39, 43, 47, 52, 56, 60, 64,},\n{\n0.000000, 0.062500, 0.125000, 0.187500,\n@@ -721,6 +739,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 9, range 0..19\n{\nQUANT_20,\n+ {0,3,6,9,13,16,19,23,26,29,35,38,41,45,48,51,55,58,61,64,255},\n+ {0,4,8,12,16,2,6,10,14,18,19,15,11,7,3,17,13,9,5,1},\n{0, 64, 16, 48, 3, 61, 19, 45, 6, 58, 23, 41, 9, 55, 26, 38, 13, 51, 29, 35,},\n{\n0.000000, 1.000000, 0.250000, 0.750000,\n@@ -802,6 +822,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 10, range 0..23\n{\nQUANT_24,\n+ {0,2,5,8,11,13,16,19,22,24,27,30,34,37,40,42,45,48,51,53,56,59,62,64,255},\n+ {0,8,16,2,10,18,4,12,20,6,14,22,23,15,7,21,13,5,19,11,3,17,9,1},\n{0, 64, 8, 56, 16, 48, 24, 40, 2, 62, 11, 53, 19, 45, 27, 37, 5, 59, 13, 51, 22, 42, 30, 34,},\n{\n0.000000, 1.000000, 0.125000, 0.875000,\n@@ -884,6 +906,8 @@ const quantization_and_transfer_table quant_and_xfer_tables[12] = {\n// quantization method 11, range 0..31\n{\nQUANT_32,\n+ {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,255},\n+ {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31},\n{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64,},\n{\n0.000000, 0.031250, 0.062500, 0.093750,\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
[IQ change] Remove decimated weight grid refinement Removing this pass costs around 0.01dB, but saves about 15% of runtime.
61,745
12.01.2020 17:26:56
0
1311aa8ea9b5c4a6c8b79fa70218f590c85e6a73
Add support for native popcnt if available Builds default to SSE2 support; users must specify VEC=sse4.2 to enable SSE4.2 and popcnt instrinsics
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "# from Arm Limited.\n# ----------------------------------------------------------------------------\n+# Configure the vectorization intrinsics support; valid values are:\n+#\n+# * nointrin - allow use of sse2 by the compiler, but no manual instrinsics\n+# * see2 - allow use of sse2 by the compiler and instrinsics\n+# * see4.2 - allow use of sse4.2 and popcnt by the compiler and instrinsics\n+#\n+# Note that we always enable at least sse2 support for compiler generated code,\n+# as it is guaranteed to be present in x86-64, but we allow disabling of\n+# our manually written instrinsic functions.\n+#\n+# Also note that we currently assume that sse4.2 implies support for popcnt,\n+# which is the default GCC behavior and true on currently shipping hardware.\n+VEC?=sse2\n+\nSOURCES = \\\nastc_averages_and_directions.cpp \\\nastc_block_sizes2.cpp \\\n@@ -43,12 +57,26 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -std=c++14 -O3 -msse2 -mfpmath=sse \\\n+CPPFLAGS = -std=c++14 -O3 \\\n-Wall -Wextra -Wpedantic -Werror -Werror=shadow -Wdouble-promotion\n+ifeq ($(VEC),nointrin)\n+CPPFLAGS += -mfpmath=sse -msse2 -DASTC_SSE=00\n+else\n+ifeq ($(VEC),sse2)\n+CPPFLAGS += -mfpmath=sse -msse2 -DASTC_SSE=20\n+else\n+ifeq ($(VEC),sse4.2)\n+CPPFLAGS += -mfpmath=sse -msse4.2 -mpopcnt -DASTC_SSE=42\n+else\n+$(error Unsupported VEC target, use VEC=nointrin/sse2/sse4.2)\n+endif\n+endif\n+endif\n+\nastcenc: $(OBJECTS)\n@g++ -o $@ $^ $(CPPFLAGS) -lpthread\n- @echo \"[Link] $@\"\n+ @echo \"[Link] $@ (using $(VEC))\"\n$(OBJECTS): %.o: %.cpp $(HEADERS)\n@g++ -c -o $@ $< $(CPPFLAGS)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_kmeans_partitioning.cpp", "new_path": "Source/astc_kmeans_partitioning.cpp", "diff": "@@ -247,51 +247,6 @@ void basic_kmeans_update(\n}\n}\n-// after a few rounds of k-means-clustering, we should have a set of 2, 3 or 4 partitions;\n-// we then turn this set into 2, 3 or 4 bitmaps. Then, for each of the 1024 partitions,\n-// we try to match the bitmaps as well as possible.\n-static inline int bitcount(uint64_t p)\n-{\n- if (sizeof(void *) > 4)\n- {\n- uint64_t mask1 = 0x5555555555555555ULL;\n- uint64_t mask2 = 0x3333333333333333ULL;\n- uint64_t mask3 = 0x0F0F0F0F0F0F0F0FULL;\n- // best-known algorithm for 64-bit bitcount, assuming 64-bit processor\n- // should probably be adapted for use with 32-bit processors and/or processors\n- // with a POPCNT instruction, but leave that for later.\n- p -= (p >> 1) & mask1;\n- p = (p & mask2) + ((p >> 2) & mask2);\n- p += p >> 4;\n- p &= mask3;\n- p *= 0x0101010101010101ULL;\n- p >>= 56;\n- return (int)p;\n- }\n- else\n- {\n- // on 32-bit processor, split the 64-bit input argument in two,\n- // and bitcount each half separately.\n- uint32_t p1 = (uint32_t) p;\n- uint32_t p2 = (uint32_t) (p >> 32);\n- uint32_t mask1 = 0x55555555U;\n- uint32_t mask2 = 0x33333333U;\n- uint32_t mask3 = 0x0F0F0F0FU;\n- p1 = p1 - ((p1 >> 1) & mask1);\n- p2 = p2 - ((p2 >> 1) & mask1);\n- p1 = (p1 & mask2) + ((p1 >> 2) & mask2);\n- p2 = (p2 & mask2) + ((p2 >> 2) & mask2);\n- p1 += p1 >> 4;\n- p2 += p2 >> 4;\n- p1 &= mask3;\n- p2 &= mask3;\n- p1 += p2;\n- p1 *= 0x01010101U;\n- p1 >>= 24;\n- return (int)p1;\n- }\n-}\n-\n// compute the bit-mismatch for a partitioning in 2-partition mode\nstatic inline int partition_mismatch2(\nuint64_t a0,\n@@ -299,8 +254,8 @@ static inline int partition_mismatch2(\nuint64_t b0,\nuint64_t b1\n) {\n- int v1 = bitcount(a0 ^ b0) + bitcount(a1 ^ b1);\n- int v2 = bitcount(a0 ^ b1) + bitcount(a1 ^ b0);\n+ int v1 = popcount(a0 ^ b0) + popcount(a1 ^ b1);\n+ int v2 = popcount(a0 ^ b1) + popcount(a1 ^ b0);\nreturn MIN(v1, v2);\n}\n@@ -313,17 +268,17 @@ static inline int partition_mismatch3(\nuint64_t b1,\nuint64_t b2\n) {\n- int p00 = bitcount(a0 ^ b0);\n- int p01 = bitcount(a0 ^ b1);\n- int p02 = bitcount(a0 ^ b2);\n+ int p00 = popcount(a0 ^ b0);\n+ int p01 = popcount(a0 ^ b1);\n+ int p02 = popcount(a0 ^ b2);\n- int p10 = bitcount(a1 ^ b0);\n- int p11 = bitcount(a1 ^ b1);\n- int p12 = bitcount(a1 ^ b2);\n+ int p10 = popcount(a1 ^ b0);\n+ int p11 = popcount(a1 ^ b1);\n+ int p12 = popcount(a1 ^ b2);\n- int p20 = bitcount(a2 ^ b0);\n- int p21 = bitcount(a2 ^ b1);\n- int p22 = bitcount(a2 ^ b2);\n+ int p20 = popcount(a2 ^ b0);\n+ int p21 = popcount(a2 ^ b1);\n+ int p22 = popcount(a2 ^ b2);\nint s0 = p11 + p22;\nint s1 = p12 + p21;\n@@ -365,25 +320,25 @@ static inline int partition_mismatch4(\nuint64_t b2,\nuint64_t b3\n) {\n- int p00 = bitcount(a0 ^ b0);\n- int p01 = bitcount(a0 ^ b1);\n- int p02 = bitcount(a0 ^ b2);\n- int p03 = bitcount(a0 ^ b3);\n-\n- int p10 = bitcount(a1 ^ b0);\n- int p11 = bitcount(a1 ^ b1);\n- int p12 = bitcount(a1 ^ b2);\n- int p13 = bitcount(a1 ^ b3);\n-\n- int p20 = bitcount(a2 ^ b0);\n- int p21 = bitcount(a2 ^ b1);\n- int p22 = bitcount(a2 ^ b2);\n- int p23 = bitcount(a2 ^ b3);\n-\n- int p30 = bitcount(a3 ^ b0);\n- int p31 = bitcount(a3 ^ b1);\n- int p32 = bitcount(a3 ^ b2);\n- int p33 = bitcount(a3 ^ b3);\n+ int p00 = popcount(a0 ^ b0);\n+ int p01 = popcount(a0 ^ b1);\n+ int p02 = popcount(a0 ^ b2);\n+ int p03 = popcount(a0 ^ b3);\n+\n+ int p10 = popcount(a1 ^ b0);\n+ int p11 = popcount(a1 ^ b1);\n+ int p12 = popcount(a1 ^ b2);\n+ int p13 = popcount(a1 ^ b3);\n+\n+ int p20 = popcount(a2 ^ b0);\n+ int p21 = popcount(a2 ^ b1);\n+ int p22 = popcount(a2 ^ b2);\n+ int p23 = popcount(a2 ^ b3);\n+\n+ int p30 = popcount(a3 ^ b0);\n+ int p31 = popcount(a3 ^ b1);\n+ int p32 = popcount(a3 ^ b2);\n+ int p33 = popcount(a3 ^ b3);\nint mx23 = MIN(p22 + p33, p23 + p32);\nint mx13 = MIN(p21 + p33, p23 + p31);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_mathlib.h", "new_path": "Source/astc_mathlib.h", "diff": "#include <cstdint>\n#include <cmath>\n+#include <immintrin.h>\n+\n#ifndef M_PI\n#define M_PI 3.14159265358979323846\n#endif\n@@ -238,4 +240,56 @@ float4 transform(mat4 p, float4 q);\nmat2 invert(mat2 p);\nmat4 invert(mat4 p);\n+/* ============================================================================\n+ Fast math library; note that many of the higher-order functions in this set\n+ use approximations which are less accurate, but faster, than <cmath> standard\n+ library equivalents.\n+============================================================================ */\n+\n+/**\n+ * @brief Fast floating-point round-to-nearest integer.\n+ */\n+static inline float ae_rint( float p )\n+{\n+// round to integer, round-to-nearest\n+#if ASTC_SSE >= 42\n+ const int flag = _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC;\n+ __m128 tmp = _mm_set_ss(p);\n+ tmp = _mm_round_ss(tmp, tmp, flag);\n+ return _mm_cvtss_f32(tmp);\n+#else\n+ return floorf(p + 0.5f);\n+#endif\n+}\n+\n+static inline int ae_convert_int_rte( float p )\n+{ // convert to integer, round-to-nearest\n+#if ASTC_SSE >= 20\n+ return _mm_cvt_ss2si(_mm_set_ss(p));\n+#else\n+ return (int)(floorf(p + 0.5f));\n+#endif\n+}\n+\n+static inline int popcount(uint64_t p)\n+{\n+#if ASTC_SSE >= 42\n+ return (int)_mm_popcnt_u64(p);\n+#else\n+ uint64_t mask1 = 0x5555555555555555ULL;\n+ uint64_t mask2 = 0x3333333333333333ULL;\n+ uint64_t mask3 = 0x0F0F0F0F0F0F0F0FULL;\n+ // best-known algorithm for 64-bit bitcount, assuming 64-bit processor\n+ // should probably be adapted for use with 32-bit processors and/or processors\n+ // with a POPCNT instruction, but leave that for later.\n+ p -= (p >> 1) & mask1;\n+ p = (p & mask2) + ((p >> 2) & mask2);\n+ p += p >> 4;\n+ p &= mask3;\n+ p *= 0x0101010101010101ULL;\n+ p >>= 56;\n+ return (int)p;\n+#endif\n+}\n+\n#endif\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add support for native popcnt if available Builds default to SSE2 support; users must specify VEC=sse4.2 to enable SSE4.2 and popcnt instrinsics