diff --git a/3rdparty/astc-codec/.gitignore b/3rdparty/astc-codec/.gitignore
deleted file mode 100644
index 9e28100..0000000
--- a/3rdparty/astc-codec/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bazel-*
-.bazelrc
-build
-.vs
-.vscode
diff --git a/3rdparty/astc-codec/BUILD.bazel b/3rdparty/astc-codec/BUILD.bazel
deleted file mode 100644
index ea5a2c4..0000000
--- a/3rdparty/astc-codec/BUILD.bazel
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2018 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-licenses(["notice"])
-
-cc_library(
- name = "api",
- hdrs = ["include/astc-codec/astc-codec.h"],
- visibility = ["//src/decoder:__pkg__"],
-)
-
-cc_library(
- name = "astc_codec",
- hdrs = ["include/astc-codec/astc-codec.h"],
- includes = ["include"],
- visibility = ["//visibility:public"],
- deps = ["//src/decoder:codec"],
-)
diff --git a/3rdparty/astc-codec/CMakeLists.txt b/3rdparty/astc-codec/CMakeLists.txt
deleted file mode 100644
index 4ecb921..0000000
--- a/3rdparty/astc-codec/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 2018 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-cmake_minimum_required(VERSION 3.1.0)
-project(astc-codec)
-
-option(OPTION_ASTC_TESTS "Build all the unit tests." ON)
-
-# TODO add support for the fuzzer, it has some additional dependencies we are not
-# yet bringing in.
-option(OPTION_BUILD_FUZZER "Build the fuzzer tests." OFF)
-
-set (CMAKE_CXX_STANDARD 11)
-if(OPTION_ASTC_TESTS)
- enable_testing()
-
- # No need to build gmock if an external project defines it.
- if(NOT TARGET gmock_main)
- # We use the approach suggested by https://crascit.com/2015/07/25/cmake-gtest/ to download gtest.
- include(ExternalProject)
- # Download and unpack googletest at configure time
- configure_file(GoogleTest-CMakeLists.txt.in googletest-download/CMakeLists.txt)
- execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
- execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
-
- # Prevent GoogleTest from overriding our compiler/linker options when building with Visual Studio
- set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
-
- # Add googletest directly to our build. This adds the following targets: gtest, gtest_main, gmock and gmock_main
- add_subdirectory("${CMAKE_BINARY_DIR}/googletest-src" "${CMAKE_BINARY_DIR}/googletest-build")
- endif()
-endif()
-
-add_subdirectory(src/base)
-add_subdirectory(src/decoder)
diff --git a/3rdparty/astc-codec/CONTRIBUTING.md b/3rdparty/astc-codec/CONTRIBUTING.md
deleted file mode 100644
index 939e534..0000000
--- a/3rdparty/astc-codec/CONTRIBUTING.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# How to Contribute
-
-We'd love to accept your patches and contributions to this project. There are
-just a few small guidelines you need to follow.
-
-## Contributor License Agreement
-
-Contributions to this project must be accompanied by a Contributor License
-Agreement. You (or your employer) retain the copyright to your contribution;
-this simply gives us permission to use and redistribute your contributions as
-part of the project. Head over to to see
-your current agreements on file or to sign a new one.
-
-You generally only need to submit a CLA once, so if you've already submitted one
-(even if it was for a different project), you probably don't need to do it
-again.
-
-## Code reviews
-
-All submissions, including submissions by project members, require review. We
-use GitHub pull requests for this purpose. Consult
-[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
-information on using pull requests.
-
-## Community Guidelines
-
-This project follows [Google's Open Source Community
-Guidelines](https://opensource.google.com/conduct/).
diff --git a/3rdparty/astc-codec/GoogleTest-CMakeLists.txt.in b/3rdparty/astc-codec/GoogleTest-CMakeLists.txt.in
deleted file mode 100644
index 569f4df..0000000
--- a/3rdparty/astc-codec/GoogleTest-CMakeLists.txt.in
+++ /dev/null
@@ -1,15 +0,0 @@
-cmake_minimum_required(VERSION 2.8.2)
-
-project(googletest-download NONE)
-
-include(ExternalProject)
-ExternalProject_Add(googletest
- GIT_REPOSITORY https://github.com/google/googletest.git
- GIT_TAG "release-1.8.1"
- SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
- BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- TEST_COMMAND ""
-)
\ No newline at end of file
diff --git a/3rdparty/astc-codec/README.md b/3rdparty/astc-codec/README.md
deleted file mode 100644
index 398de14..0000000
--- a/3rdparty/astc-codec/README.md
+++ /dev/null
@@ -1,71 +0,0 @@
-# astc-codec
-
-astc-codec is a software ASTC decoder implementation, which supports the ASTC
-LDR profile.
-
-Example usage:
-
-```
-#include
-
-// ...
-
-std::vector astc = LoadMyASTCData();
-const size_t width = 640;
-const size_t height = 480;
-
-std::vector result;
-result.resize(width * height * 4);
-
-bool success = astc_codec::ASTCDecompressToRGBA(
- astc.data(), astc.size(), width, height, astc_codec::FootprintType::k4x4,
- result.data(), result.size(), /* stride */ width * 4);
-```
-
-## Building
-
-### With bazel
-
-Install [Bazel](https://bazel.build/), and then run:
-
-```
-bazel build :astc_codec -c opt
-```
-
-astc-codec has been tested on Mac and Linux.
-
-### Run Tests
-
-```
-bazel test //...
-```
-
-### With CMake
-
-Install [CMake](https://cmake.org/), and the run:
-
-```
-mkdir build && cd build && cmake .. && make
-```
-
-Or open the project in your favorite IDE and import CMakeLists.txt.
-
-### Run Tests
-
-In the build directory, execute:
-
-```
-ctest
-```
-
-
-## Contributing
-
-See [CONTRIBUTING.md](CONTRIBUTING.md) for important contributing requirements.
-
-## License
-
-astc-codec project is licensed under the Apache License Version 2.0. You can
-find a copy of it in [LICENSE](LICENSE).
-
-This is not an officially supported Google product.
diff --git a/3rdparty/astc-codec/WORKSPACE b/3rdparty/astc-codec/WORKSPACE
deleted file mode 100644
index 83fd282..0000000
--- a/3rdparty/astc-codec/WORKSPACE
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2018 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-git_repository(
- name = "gtest",
- remote = "https://github.com/google/googletest.git",
- commit = "ba96d0b1161f540656efdaed035b3c062b60e006",
-)
-
-http_archive(
- name = "honggfuzz",
- url = "https://github.com/google/honggfuzz/archive/1.7.zip",
- sha256 = "9d420326979fed4a065fa6176d5e09bd513cd2820fe216ae8b684aa6780d72b2",
- build_file = "//third_party:honggfuzz.BUILD",
- strip_prefix = "honggfuzz-1.7",
-)
-
-http_archive(
- name = "benchmark",
- url = "https://github.com/google/benchmark/archive/v1.4.1.zip",
- sha256 = "61ae07eb5d4a0b02753419eb17a82b7d322786bb36ab62bd3df331a4d47c00a7",
- strip_prefix = "benchmark-1.4.1",
-)
diff --git a/3rdparty/astc-codec/cmake-format.json b/3rdparty/astc-codec/cmake-format.json
deleted file mode 100644
index de38ed2..0000000
--- a/3rdparty/astc-codec/cmake-format.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "line_width": 120,
- "dangle_parens": false,
- "first_comment_is_literal": true,
- "algorithm_order": [
- 0,
- 1,
- 2,
- 3
- ],
- "command_case": "lower",
- "additional_commands": {
- "foo": {
- "flags": [
- "BAR",
- "BAZ"
- ],
- "kwargs": {
- "HEADERS": "*",
- "DEPENDS": "*",
- "SOURCES": "*"
- }
- }
- },
- "separate_fn_name_with_space": false,
- "always_wrap": [],
- "separate_ctrl_name_with_space": false,
- "max_subargs_per_line": 5,
- "fence_pattern": "^\\s*([`~]{3}[`~]*)(.*)$",
- "enable_markup": true,
- "ruler_pattern": "^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$",
- "tab_size": 2,
- "keyword_case": "unchanged",
- "enum_char": ".",
- "literal_comment_pattern": null,
- "bullet_char": "*",
- "line_ending": "unix"
-}
diff --git a/3rdparty/astc-codec/src/.clang-format b/3rdparty/astc-codec/src/.clang-format
deleted file mode 100644
index 9a00ee2..0000000
--- a/3rdparty/astc-codec/src/.clang-format
+++ /dev/null
@@ -1,4 +0,0 @@
-BasedOnStyle: Google
-AllowShortCaseLabelsOnASingleLine: true
-AllowShortFunctionsOnASingleLine: Inline
-SpaceAfterTemplateKeyword: false
diff --git a/3rdparty/astc-codec/src/base/BUILD.bazel b/3rdparty/astc-codec/src/base/BUILD.bazel
deleted file mode 100644
index 84d2131..0000000
--- a/3rdparty/astc-codec/src/base/BUILD.bazel
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 2018 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-licenses(["notice"])
-
-cc_library(
- name = "base",
- hdrs = [
- "bit_stream.h",
- "bottom_n.h",
- "math_utils.h",
- "optional.h",
- "string_utils.h",
- "type_traits.h",
- "uint128.h",
- "utils.h",
- ],
- features = ["-parse_headers"],
- visibility = ["//src/decoder:__pkg__"],
-)
-
-cc_test(
- name = "base_test",
- srcs = [
- "test/bit_stream_test.cpp",
- "test/bottom_n_test.cpp",
- "test/math_utils_test.cpp",
- "test/optional_test.cpp",
- "test/string_utils_test.cpp",
- "test/type_traits_test.cpp",
- "test/uint128_test.cpp",
- ],
- deps = [
- "@gtest//:gtest_main",
- ":base",
- ],
-)
-
diff --git a/3rdparty/astc-codec/src/base/CMakeLists.txt b/3rdparty/astc-codec/src/base/CMakeLists.txt
deleted file mode 100644
index 5a45f85..0000000
--- a/3rdparty/astc-codec/src/base/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2018 Google LLC
-#
-# Licensed under the Apache License Version 2.0 (the License); you may not use
-# this file except in compliance with the License. You may obtain a copy of the
-# License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing software distributed
-# under the License is distributed on an AS IS BASIS WITHOUT WARRANTIES OR
-# CONDITIONS OF ANY KIND either express or implied. See the License for the
-# specific language governing permissions and limitations under the License.
-add_library(base INTERFACE)
-target_include_directories(base INTERFACE ../..)
-
-if(OPTION_ASTC_TESTS)
- add_executable(base_test
- test/bit_stream_test.cpp
- test/bottom_n_test.cpp
- test/math_utils_test.cpp
- test/optional_test.cpp
- test/string_utils_test.cpp
- test/type_traits_test.cpp
- test/uint128_test.cpp)
- target_link_libraries(base_test base gmock_main)
- add_test(NAME base_test COMMAND base_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
-endif()
diff --git a/3rdparty/astc-codec/src/base/test/bit_stream_test.cpp b/3rdparty/astc-codec/src/base/test/bit_stream_test.cpp
deleted file mode 100644
index 0c4b3c9..0000000
--- a/3rdparty/astc-codec/src/base/test/bit_stream_test.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2018 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "src/base/bit_stream.h"
-
-#include
-
-namespace astc_codec {
-namespace base {
-
-namespace {
- static constexpr uint64_t kAllBits = 0xFFFFFFFFFFFFFFFF;
- static constexpr uint64_t k40Bits = 0x000000FFFFFFFFFF;
-}
-
-TEST(BitStream, Decode) {
- {
- BitStream stream(0, 1);
-
- uint64_t bits = kAllBits;
- EXPECT_TRUE(stream.GetBits(1, &bits));
- EXPECT_EQ(bits, 0);
- EXPECT_FALSE(stream.GetBits(1, &bits));
- }
-
- {
- BitStream stream(0b1010101010101010, 32);
- EXPECT_EQ(stream.Bits(), 32);
-
- uint64_t bits = 0;
- EXPECT_TRUE(stream.GetBits(1, &bits));
- EXPECT_EQ(bits, 0);
-
- EXPECT_TRUE(stream.GetBits(3, &bits));
- EXPECT_EQ(bits, 0b101);
-
- EXPECT_TRUE(stream.GetBits(8, &bits));
- EXPECT_EQ(bits, 0b10101010);
-
- EXPECT_EQ(stream.Bits(), 20);
-
- EXPECT_TRUE(stream.GetBits(20, &bits));
- EXPECT_EQ(bits, 0b1010);
- EXPECT_EQ(stream.Bits(), 0);
- }
-
- {
- BitStream stream(kAllBits, 64);
- EXPECT_EQ(stream.Bits(), 64);
-
- uint64_t bits = 0;
- EXPECT_TRUE(stream.GetBits(64, &bits));
- EXPECT_EQ(bits, kAllBits);
- EXPECT_EQ(stream.Bits(), 0);
- }
-
- {
- BitStream stream(kAllBits, 64);
- EXPECT_EQ(stream.Bits(), 64);
-
- uint64_t bits = 0;
- EXPECT_TRUE(stream.GetBits(40, &bits));
- EXPECT_EQ(bits, k40Bits);
- EXPECT_EQ(stream.Bits(), 24);
- }
-
- {
- BitStream stream(kAllBits, 32);
-
- uint64_t bits = 0;
- EXPECT_TRUE(stream.GetBits(0, &bits));
- EXPECT_EQ(bits, 0);
- EXPECT_TRUE(stream.GetBits(32, &bits));
- EXPECT_EQ(bits, k40Bits & 0xFFFFFFFF);
- EXPECT_TRUE(stream.GetBits(0, &bits));
- EXPECT_EQ(bits, 0);
- EXPECT_EQ(stream.Bits(), 0);
- }
-}
-
-TEST(BitStream, Encode) {
- {
- BitStream stream;
-
- stream.PutBits(0, 1);
- stream.PutBits(0b11, 2);
- EXPECT_EQ(stream.Bits(), 3);
-
- uint64_t bits = 0;
- EXPECT_TRUE(stream.GetBits(3, &bits));
- EXPECT_EQ(bits, 0b110);
- }
-
- {
- BitStream stream;
-
- uint64_t bits = 0;
- stream.PutBits(kAllBits, 64);
- EXPECT_EQ(stream.Bits(), 64);
-
- EXPECT_TRUE(stream.GetBits(64, &bits));
- EXPECT_EQ(bits, kAllBits);
- EXPECT_EQ(stream.Bits(), 0);
- }
-
- {
- BitStream stream;
- stream.PutBits(kAllBits, 40);
-
- uint64_t bits = 0;
- EXPECT_TRUE(stream.GetBits(40, &bits));
- EXPECT_EQ(bits, k40Bits);
- EXPECT_EQ(stream.Bits(), 0);
- }
-
- {
- BitStream stream;
- stream.PutBits(0, 0);
- stream.PutBits(kAllBits, 32);
- stream.PutBits(0, 0);
-
- uint64_t bits = 0;
- EXPECT_TRUE(stream.GetBits(32, &bits));
- EXPECT_EQ(bits, k40Bits & 0xFFFFFFFF);
- EXPECT_EQ(stream.Bits(), 0);
- }
-}
-
-} // namespace base
-} // namespace astc_codec
diff --git a/3rdparty/astc-codec/src/base/test/bottom_n_test.cpp b/3rdparty/astc-codec/src/base/test/bottom_n_test.cpp
deleted file mode 100644
index 71265d7..0000000
--- a/3rdparty/astc-codec/src/base/test/bottom_n_test.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2018 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "src/base/bottom_n.h"
-
-#include
-#include
-
-namespace astc_codec {
-namespace base {
-
-using ::testing::ElementsAre;
-
-template
-static void pushAll(BottomN& heap, const T (&arr)[N]) {
- for (auto i : arr) {
- heap.Push(i);
- }
-}
-
-TEST(BottomN, Sort) {
- {
- BottomN heap(10);
- EXPECT_TRUE(heap.Empty());
- int list[] = { 1,2 };
- pushAll(heap, list);
-
- EXPECT_EQ(heap.Size(), 2);
- EXPECT_FALSE(heap.Empty());
- EXPECT_THAT(heap.Pop(), ElementsAre(1, 2));
- }
-
- {
- BottomN heap(6);
- int list[] = {1, 4, 3, 2, 2, 1};
- pushAll(heap, list);
-
- EXPECT_EQ(heap.Size(), 6);
- EXPECT_THAT(heap.Pop(), ElementsAre(1, 1, 2, 2, 3, 4));
- }
-}
-
-TEST(BottomN, Bounds) {
- {
- BottomN heap(4);
- int list[] = { 1, 2, 3, 4 };
- pushAll(heap, list);
- EXPECT_EQ(heap.Size(), 4);
-
- heap.Push(0);
- EXPECT_EQ(heap.Size(), 4);
-
- EXPECT_THAT(heap.Pop(), ElementsAre(0, 1, 2, 3));
- }
-
- {
- BottomN heap(4);
- int list[] = { 4, 3, 2,1 };
- pushAll(heap, list);
- EXPECT_EQ(heap.Size(), 4);
-
- int list2[] = { 4,4,4,4 };
- pushAll(heap, list2);
- EXPECT_EQ(heap.Size(), 4);
-
- EXPECT_THAT(heap.Pop(), ElementsAre(1, 2, 3, 4));
- }
-
- {
- BottomN heap(4);
- int list[] = { 4, 3, 2, 1 };
- pushAll(heap, list);
- EXPECT_EQ(heap.Size(), 4);
-
- int list2[] = { 5, 5, 5, 5 };
- pushAll(heap, list2);
- EXPECT_EQ(heap.Size(), 4);
-
- EXPECT_THAT(heap.Pop(), ElementsAre(1, 2, 3, 4));
- }
-
- {
- BottomN heap(4);
- int list[] = { 4, 3, 2, 1 };
- pushAll(heap, list);
- EXPECT_EQ(heap.Size(), 4);
-
- int list2[] = { 0, 0, 0, 0 };
- pushAll(heap, list2);
- EXPECT_EQ(heap.Size(), 4);
-
- EXPECT_THAT(heap.Pop(), ElementsAre(0, 0, 0, 0));
- }
-}
-
-} // namespace base
-} // namespace astc_codec
diff --git a/3rdparty/astc-codec/src/base/test/math_utils_test.cpp b/3rdparty/astc-codec/src/base/test/math_utils_test.cpp
deleted file mode 100644
index 0371e11..0000000
--- a/3rdparty/astc-codec/src/base/test/math_utils_test.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2018 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "src/base/math_utils.h"
-
-#include
-
-namespace astc_codec {
-namespace base {
-
-TEST(MathUtils, Log2Floor) {
- EXPECT_EQ(-1, Log2Floor(0));
-
- for (int i = 0; i < 32; i++) {
- uint32_t n = 1U << i;
- EXPECT_EQ(i, Log2Floor(n));
- if (n > 2) {
- EXPECT_EQ(i - 1, Log2Floor(n - 1));
- EXPECT_EQ(i, Log2Floor(n + 1));
- }
- }
-}
-
-TEST(MathUtils, CountOnes) {
- EXPECT_EQ(0, CountOnes(0));
- EXPECT_EQ(1, CountOnes(1));
- EXPECT_EQ(32, CountOnes(static_cast(~0U)));
- EXPECT_EQ(1, CountOnes(0x8000000));
-
- for (int i = 0; i < 32; i++) {
- EXPECT_EQ(1, CountOnes(1U << i));
- EXPECT_EQ(31, CountOnes(static_cast(~0U) ^ (1U << i)));
- }
-}
-
-TEST(MathUtils, ReverseBits) {
- EXPECT_EQ(ReverseBits(0u), 0u);
- EXPECT_EQ(ReverseBits(1u), 1u << 31);
- EXPECT_EQ(ReverseBits(0xffffffff), 0xffffffff);
- EXPECT_EQ(ReverseBits(0x00000001), 0x80000000);
- EXPECT_EQ(ReverseBits(0x80000000), 0x00000001);
- EXPECT_EQ(ReverseBits(0xaaaaaaaa), 0x55555555);
- EXPECT_EQ(ReverseBits(0x55555555), 0xaaaaaaaa);
- EXPECT_EQ(ReverseBits(0x7d5d7f53), 0xcafebabe);
- EXPECT_EQ(ReverseBits(0xcafebabe), 0x7d5d7f53);
-}
-
-TEST(MathUtils, GetBits) {
- EXPECT_EQ(GetBits(0u, 0, 1), 0u);
- EXPECT_EQ(GetBits(0u, 0, 32), 0u);
- EXPECT_EQ(GetBits(0x00000001u, 0, 1), 0x00000001);
- EXPECT_EQ(GetBits(0x00000001u, 0, 32), 0x00000001);
- EXPECT_EQ(GetBits(0x00000001u, 1, 31), 0x00000000);
- EXPECT_EQ(GetBits(0x00000001u, 31, 1), 0x00000000);
-
- EXPECT_DEBUG_DEATH(GetBits(0x00000000u, 1, 32), "");
- EXPECT_DEBUG_DEATH(GetBits(0x00000000u, 32, 0), "");
- EXPECT_DEBUG_DEATH(GetBits(0x00000000u, 32, 1), "");
-
- EXPECT_EQ(GetBits(0XFFFFFFFFu, 0, 4), 0x0000000F);
- EXPECT_EQ(GetBits(0XFFFFFFFFu, 16, 16), 0xFFFF);
- EXPECT_EQ(GetBits(0x80000000u, 31, 1), 1);
- EXPECT_EQ(GetBits(0xCAFEBABEu, 24, 8), 0xCA);
-}
-
-} // namespace base
-} // namespace astc_codec
diff --git a/3rdparty/astc-codec/src/base/test/optional_test.cpp b/3rdparty/astc-codec/src/base/test/optional_test.cpp
deleted file mode 100644
index 1eeefbd..0000000
--- a/3rdparty/astc-codec/src/base/test/optional_test.cpp
+++ /dev/null
@@ -1,481 +0,0 @@
-// Copyright 2018 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "src/base/optional.h"
-
-#include
-
-#include
-#include
-
-namespace astc_codec {
-namespace base {
-
-TEST(Optional, TypeProperties) {
- // Making sure optional has the correct alignment and doesn't waste too much
- // space
-
- static_assert(sizeof(Optional) == 2, "bad Optional size");
- static_assert(std::alignment_of>::value ==
- std::alignment_of::value,
- "bad Optional alignment");
-
- static_assert(sizeof(Optional) == 2, "bad Optional size");
- static_assert(std::alignment_of>::value ==
- std::alignment_of::value,
- "bad Optional alignment");
-
- static_assert(sizeof(Optional) == 4, "bad Optional size");
- static_assert(std::alignment_of>::value ==
- std::alignment_of::value,
- "bad Optional alignment");
-
- static_assert(sizeof(Optional) == 8, "bad Optional size");
- static_assert(std::alignment_of>::value ==
- std::alignment_of::value,
- "bad Optional alignment");
-
- static_assert(sizeof(Optional) == 16, "bad Optional size");
- static_assert(std::alignment_of>::value ==
- std::alignment_of::value,
- "bad Optional alignment");
-
- struct S128 {
- int64_t data[2];
- };
-
- static_assert(sizeof(Optional) == 3 * sizeof(int64_t),
- "bad Optional size");
- static_assert(std::alignment_of>::value ==
- std::alignment_of::value,
- "bad Optional alignment");
-}
-
-TEST(Optional, ConstructFromValue) {
- {
- Optional o;
- EXPECT_FALSE(o);
- }
- {
- Optional o = {};
- EXPECT_FALSE(o);
- }
- {
- Optional o = kNullopt;
- EXPECT_FALSE(o);
- }
- {
- Optional o(1);
- EXPECT_TRUE(o);
- EXPECT_EQ(1, *o);
- }
- {
- // check the std::decay<> constructor
- Optional o = static_cast(1);
- EXPECT_TRUE(o);
- EXPECT_EQ(1, *o);
- }
- {
- Optional o = 1;
- EXPECT_TRUE(o);
- EXPECT_EQ(1, *o);
- }
- {
- Optional o{1};
- EXPECT_TRUE(o);
- EXPECT_EQ(1, *o);
- }
- {
- short val = 10;
- Optional o = val;
- EXPECT_TRUE(o);
- EXPECT_EQ(10, *o);
- }
- {
- Optional> o(kInplace, 10);
- EXPECT_TRUE(o);
- EXPECT_EQ((std::vector(10)), *o);
- }
- {
- Optional> o(kInplace, {1, 2, 3, 4});
- EXPECT_TRUE(o);
- EXPECT_EQ((std::vector{1, 2, 3, 4}), *o);
- }
-}
-
-TEST(Optional, ConstructFromOptional) {
- {
- Optional o = Optional();
- EXPECT_FALSE(o);
- }
- {
- Optional o2;
- Optional o(o2);
- EXPECT_FALSE(o);
- }
- {
- Optional o2 = 42;
- Optional o(o2);
- EXPECT_TRUE(o);
- EXPECT_EQ(42, *o);
- }
- {
- Optional o(Optional(1));
- EXPECT_TRUE(o);
- EXPECT_EQ(1, *o);
- }
- {
- Optional o2 = 2;
- Optional o = o2;
- EXPECT_TRUE(o);
- EXPECT_EQ(2, *o);
- }
- {
- Optional> o2 = std::vector{20, 30, 40};
- Optional> o = o2;
- EXPECT_TRUE(o);
- EXPECT_EQ((std::vector{20, 30, 40}), *o);
- }
-}
-
-TEST(Optional, Assign) {
- {
- Optional o;
- o = 1;
- EXPECT_TRUE(o);
- EXPECT_EQ(1, *o);
-
- o = 2;
- EXPECT_TRUE(o);
- EXPECT_EQ(2, *o);
-
- o = kNullopt;
- EXPECT_FALSE(o);
-
- o = Optional(10);
- EXPECT_TRUE(o);
- EXPECT_EQ(10, *o);
-
- Optional o2;
- o = o2;
- EXPECT_FALSE(o);
-
- o = 2u;
- EXPECT_TRUE(o);
- EXPECT_EQ(2, *o);
-
- o = Optional();
- EXPECT_FALSE(o);
-
- o = Optional(20);
- EXPECT_TRUE(o);
- EXPECT_EQ(20, *o);
-
- Optional o3(200);
- o = o3;
- EXPECT_TRUE(o);
- EXPECT_EQ(200, *o);
-
- o = {};
- EXPECT_FALSE(o);
-
- // check the std::decay<> assignment
- o = static_cast(1);
- EXPECT_TRUE(o);
- EXPECT_EQ(1, *o);
- }
-}
-
-TEST(Optional, MakeOptional) {
- {
- auto o = makeOptional(1);
- static_assert(std::is_same>::value,
- "Bad type deduction in makeOptional()");
- EXPECT_TRUE(o);
- EXPECT_EQ(1, *o);
- }
- {
- auto o = makeOptional(std::vector{'1', '2'});
- static_assert(std::is_same>>::value,
- "Bad type deduction in makeOptional()");
- EXPECT_TRUE(o);
- EXPECT_EQ((std::vector{'1', '2'}), *o);
- }
- {
- // check std::decay<> in the factory function
- auto o = makeOptional("String");
- static_assert(std::is_same>::value,
- "Bad type deduction in makeOptional()");
- EXPECT_TRUE(o);
- EXPECT_STREQ("String", *o);
- }
- {
- auto o = makeOptional("String");
- static_assert(std::is_same>::value,
- "Bad type deduction in makeOptional()");
- EXPECT_TRUE(o);
- EXPECT_STREQ("String", o->c_str());
- }
- {
- auto o = makeOptional(5, 'b');
- static_assert(std::is_same>::value,
- "Bad type deduction in makeOptional()");
- EXPECT_TRUE(o);
- EXPECT_STREQ("bbbbb", o->c_str());
- }
- {
- auto o = makeOptional();
- static_assert(std::is_same>::value,
- "Bad type deduction in makeOptional()");
- EXPECT_TRUE(o);
- EXPECT_STREQ("", o->c_str());
- }
-}
-
-TEST(Optional, Move) {
- auto o = makeOptional(std::unique_ptr(new int(10)));
- {
- decltype(o) o2 = std::move(o);
- EXPECT_TRUE(o);
- EXPECT_TRUE(o2);
- EXPECT_FALSE(bool(*o));
- EXPECT_TRUE(bool(*o2));
- EXPECT_EQ(10, **o2);
-
- decltype(o) o3;
- o3 = std::move(o2);
- EXPECT_TRUE(o2);
- EXPECT_TRUE(o3);
- EXPECT_FALSE(bool(*o2));
- EXPECT_TRUE(bool(*o3));
- EXPECT_EQ(10, **o3);
-
- o3 = std::move(o2);
- EXPECT_TRUE(o2);
- EXPECT_TRUE(o3);
- EXPECT_FALSE(bool(*o2));
- EXPECT_FALSE(bool(*o3));
- }
-
- {
- decltype(o) o1;
- decltype(o) o2 = std::move(o1);
- EXPECT_FALSE(o1);
- EXPECT_FALSE(o2);
-
- o2 = std::move(o1);
- EXPECT_FALSE(o1);
- EXPECT_FALSE(o2);
-
- decltype(o) o3{kInplace, new int(20)};
- o3 = std::move(o1);
- EXPECT_FALSE(o1);
- EXPECT_FALSE(o3);
- }
-}
-
-TEST(Optional, Value) {
- auto o = makeOptional(1);
- EXPECT_EQ(1, o.value());
- EXPECT_EQ(1, o.valueOr(2));
-
- o = kNullopt;
- EXPECT_EQ(2, o.valueOr(2));
-}
-
-TEST(Optional, Clear) {
- auto o = makeOptional(1);
- o.clear();
- EXPECT_FALSE(o);
-
- o.clear();
- EXPECT_FALSE(o);
-}
-
-TEST(Optional, Emplace) {
- auto o = makeOptional(std::vector{1, 2, 3, 4});
- o.emplace(3, 1);
- EXPECT_TRUE(o);
- EXPECT_EQ((std::vector{1, 1, 1}), *o);
- EXPECT_EQ(3U, o->capacity());
-
- o.clear();
- o.emplace({1, 2});
- EXPECT_TRUE(o);
- EXPECT_EQ((std::vector{1, 2}), *o);
- EXPECT_EQ(2U, o->capacity());
-}
-
-TEST(Optional, Reset) {
- auto o = makeOptional(std::vector{1, 2, 3, 4});
- o.reset(std::vector{4, 3});
- EXPECT_TRUE(o);
- EXPECT_EQ((std::vector{4, 3}), *o);
- EXPECT_EQ(2U, o->capacity());
-
- o.clear();
- o.reset(std::vector{1});
- EXPECT_EQ((std::vector{1}), *o);
- EXPECT_EQ(1U, o->capacity());
-}
-
-TEST(Optional, CompareEqual) {
- EXPECT_TRUE(makeOptional(1) == makeOptional(1));
- EXPECT_TRUE(makeOptional(1) == 1);
- EXPECT_TRUE(1 == makeOptional(1));
- EXPECT_FALSE(makeOptional(1) == makeOptional(2));
- EXPECT_FALSE(makeOptional(2) == 1);
- EXPECT_FALSE(2 == makeOptional(1));
- EXPECT_TRUE(makeOptional(1) != makeOptional(2));
- EXPECT_TRUE(makeOptional(1) != 2);
- EXPECT_TRUE(1 != makeOptional(2));
-
- EXPECT_FALSE(makeOptional(1) == kNullopt);
- EXPECT_FALSE(makeOptional(1) == Optional());
- EXPECT_FALSE(kNullopt == makeOptional(1));
- EXPECT_FALSE(Optional() == makeOptional(1));
- EXPECT_TRUE(makeOptional(1) != kNullopt);
- EXPECT_TRUE(makeOptional(1) != Optional());
- EXPECT_TRUE(kNullopt != makeOptional(1));
- EXPECT_TRUE(Optional() != makeOptional(1));
-
- EXPECT_TRUE(kNullopt == Optional());
- EXPECT_TRUE(kNullopt == Optional());
- EXPECT_FALSE(kNullopt != Optional());
- EXPECT_FALSE(kNullopt != Optional());
- EXPECT_TRUE(Optional() == Optional());
- EXPECT_FALSE(Optional() != Optional());
-}
-
-TEST(Optional, CompareLess) {
- EXPECT_TRUE(makeOptional(1) < makeOptional(2));
- EXPECT_TRUE(1 < makeOptional(2));
- EXPECT_TRUE(makeOptional(1) < 2);
-
- EXPECT_FALSE(makeOptional(1) < makeOptional(1));
- EXPECT_FALSE(1 < makeOptional(1));
- EXPECT_FALSE(makeOptional(1) < 1);
- EXPECT_FALSE(makeOptional(2) < makeOptional(1));
- EXPECT_FALSE(2 < makeOptional(1));
- EXPECT_FALSE(makeOptional(2) < 1);
-
- EXPECT_TRUE(kNullopt < makeOptional(2));
- EXPECT_TRUE(Optional() < makeOptional(2));
- EXPECT_TRUE(Optional() < 2);
- EXPECT_FALSE(makeOptional(2) < kNullopt);
- EXPECT_FALSE(makeOptional(2) < Optional());
- EXPECT_FALSE(2 < Optional());
-
- EXPECT_FALSE(kNullopt < Optional());
- EXPECT_FALSE(Optional() < kNullopt);
-}
-
-TEST(Optional, Destruction) {
- // create a reference counting class to check if we delete everything
- // we've created
- struct Track {
- Track(int& val) : mVal(val) { ++mVal.get(); }
- Track(std::initializer_list vals) : mVal(**vals.begin()) {
- ++mVal.get();
- }
- Track(const Track& other) : mVal(other.mVal) { ++mVal.get(); }
- Track(Track&& other) : mVal(other.mVal) { ++mVal.get(); }
- Track& operator=(const Track& other) {
- --mVal.get();
- mVal = other.mVal;
- ++mVal.get();
- return *this;
- }
- Track& operator=(Track&& other) {
- --mVal.get();
- mVal = other.mVal;
- ++mVal.get();
- return *this;
- }
-
- ~Track() { --mVal.get(); }
-
- std::reference_wrapper mVal;
- };
-
- int counter = 0;
- {
- auto o = makeOptional(Track(counter));
- EXPECT_EQ(1, counter);
- }
- EXPECT_EQ(0, counter);
-
- {
- auto o = makeOptional(Track(counter));
- EXPECT_EQ(1, counter);
- o.clear();
- EXPECT_EQ(0, counter);
- }
- EXPECT_EQ(0, counter);
-
- {
- auto o = makeOptional(Track(counter));
- EXPECT_EQ(1, counter);
- int counter2 = 0;
- o.emplace(counter2);
- EXPECT_EQ(0, counter);
- EXPECT_EQ(1, counter2);
- o = Track(counter);
- EXPECT_EQ(1, counter);
- EXPECT_EQ(0, counter2);
-
- auto o2 = o;
- EXPECT_EQ(2, counter);
- EXPECT_EQ(0, counter2);
- }
- EXPECT_EQ(0, counter);
-
- {
- auto o = makeOptional(Track(counter));
- auto o2 = std::move(o);
- EXPECT_EQ(2, counter);
- o = o2;
- EXPECT_EQ(2, counter);
- }
- EXPECT_EQ(0, counter);
-
- int counter2 = 0;
- {
- Optional