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
61,745
13.07.2021 23:31:20
-3,600
b6c571b028106c5afc13acd5791a62cceace17a6
Workaround stb_image_write warnings (issue
[ { "change_type": "MODIFY", "old_path": "Source/stb_image_write.h", "new_path": "Source/stb_image_write.h", "diff": "@@ -511,7 +511,7 @@ static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, c\nSTBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)\n{\n- stbi__write_context s = { 0 };\n+ stbi__write_context s {};\nstbi__start_write_callbacks(&s, func, context);\nreturn stbi_write_bmp_core(&s, x, y, comp, data);\n}\n@@ -519,7 +519,7 @@ STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x,\n#ifndef STBI_WRITE_NO_STDIO\nSTBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)\n{\n- stbi__write_context s = { 0 };\n+ stbi__write_context s {};\nif (stbi__start_write_file(&s,filename)) {\nint r = stbi_write_bmp_core(&s, x, y, comp, data);\nstbi__end_write_file(&s);\n@@ -610,7 +610,7 @@ static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, v\nSTBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)\n{\n- stbi__write_context s = { 0 };\n+ stbi__write_context s {};\nstbi__start_write_callbacks(&s, func, context);\nreturn stbi_write_tga_core(&s, x, y, comp, (void *) data);\n}\n@@ -618,7 +618,7 @@ STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x,\n#ifndef STBI_WRITE_NO_STDIO\nSTBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)\n{\n- stbi__write_context s = { 0 };\n+ stbi__write_context s {};\nif (stbi__start_write_file(&s,filename)) {\nint r = stbi_write_tga_core(&s, x, y, comp, (void *) data);\nstbi__end_write_file(&s);\n@@ -786,14 +786,14 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f\nSTBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data)\n{\n- stbi__write_context s = { 0 };\n+ stbi__write_context s {};\nstbi__start_write_callbacks(&s, func, context);\nreturn stbi_write_hdr_core(&s, x, y, comp, (float *) data);\n}\nSTBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data)\n{\n- stbi__write_context s = { 0 };\n+ stbi__write_context s {};\nif (stbi__start_write_file(&s,filename)) {\nint r = stbi_write_hdr_core(&s, x, y, comp, (float *) data);\nstbi__end_write_file(&s);\n@@ -1606,7 +1606,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in\nSTBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality)\n{\n- stbi__write_context s = { 0 };\n+ stbi__write_context s {};\nstbi__start_write_callbacks(&s, func, context);\nreturn stbi_write_jpg_core(&s, x, y, comp, (void *) data, quality);\n}\n@@ -1615,7 +1615,7 @@ STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x,\n#ifndef STBI_WRITE_NO_STDIO\nSTBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality)\n{\n- stbi__write_context s = { 0 };\n+ stbi__write_context s {};\nif (stbi__start_write_file(&s,filename)) {\nint r = stbi_write_jpg_core(&s, x, y, comp, data, quality);\nstbi__end_write_file(&s);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Workaround stb_image_write warnings (issue #1099)
61,745
14.07.2021 22:27:09
-3,600
43f9b6cee15bb2189cbb7277f725ee86e4c41752
Fix arm64 invariance in NONE builds
[ { "change_type": "MODIFY", "old_path": "Source/UnitTest/test_simd.cpp", "new_path": "Source/UnitTest/test_simd.cpp", "diff": "@@ -1082,11 +1082,11 @@ TEST(vfloat4, normalize_safe)\n/** @brief Test vfloat4 float_to_int. */\nTEST(vfloat4, float_to_int)\n{\n- vfloat4 a(1.1f, 1.5f, 1.6f, 4.0f);\n+ vfloat4 a(1.1f, 1.5f, -1.6f, 4.0f);\nvint4 r = float_to_int(a);\nEXPECT_EQ(r.lane<0>(), 1);\nEXPECT_EQ(r.lane<1>(), 1);\n- EXPECT_EQ(r.lane<2>(), 1);\n+ EXPECT_EQ(r.lane<2>(), -1);\nEXPECT_EQ(r.lane<3>(), 4);\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_vecmathlib_none_4.h", "new_path": "Source/astcenc_vecmathlib_none_4.h", "diff": "@@ -936,12 +936,10 @@ ASTCENC_SIMD_INLINE void storea(vfloat4 a, float* ptr)\n*/\nASTCENC_SIMD_INLINE vint4 float_to_int(vfloat4 a)\n{\n- // Casting to unsigned buys us an extra bit of precision in cases where\n- // we can use the integer as nasty bit hacks.\n- return vint4((unsigned int)a.m[0],\n- (unsigned int)a.m[1],\n- (unsigned int)a.m[2],\n- (unsigned int)a.m[3]);\n+ return vint4((int)a.m[0],\n+ (int)a.m[1],\n+ (int)a.m[2],\n+ (int)a.m[3]);\n}\n/**f\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix arm64 invariance in NONE builds
61,745
15.07.2021 14:12:30
-3,600
3c6ba048bf7aa5d7ffe428834bd4dd14c1e5c828
Add color support for -perceptual
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_entry.cpp", "new_path": "Source/astcenc_entry.cpp", "diff": "@@ -672,8 +672,7 @@ astcenc_error astcenc_config_init(\nconfig.v_a_stdev = 50.0f;\n}\n}\n-\n- if (flags & ASTCENC_FLG_MAP_MASK)\n+ else if (flags & ASTCENC_FLG_MAP_MASK)\n{\nconfig.v_rgba_radius = 3;\nconfig.v_rgba_mean_stdev_mix = 0.03f;\n@@ -682,13 +681,30 @@ astcenc_error astcenc_config_init(\nconfig.v_a_mean = 0.0f;\nconfig.v_a_stdev = 25.0f;\n}\n-\n- if (flags & ASTCENC_FLG_MAP_RGBM)\n+ else if (flags & ASTCENC_FLG_MAP_RGBM)\n{\nconfig.rgbm_m_scale = 5.0f;\nconfig.cw_a_weight = 2.0f * config.rgbm_m_scale;\n}\n-\n+ else // (This is color data)\n+ {\n+ // This is a very basic perceptual metric for RGB color data, which weights error\n+ // significance by the perceptual luminance contribution of each color channel. For\n+ // luminance the usual weights to compute luminance from a linear RGB value are as\n+ // follows:\n+ //\n+ // l = r * 0.3 + g * 0.59 + b * 0.11\n+ //\n+ // ... but we scale these up to keep a better balance between color and alpha. Note\n+ // that if the content is using alpha we'd recommend using the -a option to weight\n+ // the color conribution by the alpha transparency.\n+ if (flags & ASTCENC_FLG_USE_PERCEPTUAL)\n+ {\n+ config.cw_r_weight = 0.30f * 2.25f;\n+ config.cw_g_weight = 0.59f * 2.25f;\n+ config.cw_b_weight = 0.11f * 2.25f;\n+ }\n+ }\nconfig.flags = flags;\nreturn ASTCENC_SUCCESS;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel_help.cpp", "new_path": "Source/astcenccli_toplevel_help.cpp", "diff": "@@ -192,7 +192,7 @@ COMPRESSION\nThe codec should optimize perceptual error, instead of direct\nRMS error. This aims to improves perceived image quality, but\ntypically lowers the measured PSNR score. Perceptual methods are\n- currently only available for normal maps.\n+ currently only available for normal maps and RGB color data.\n-array <size>\nLoads an array of <size> 2D image slices to use as a 3D image.\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add color support for -perceptual
61,745
15.07.2021 17:57:15
-3,600
0021070ca9fe6845652b135bb155868ab43a9de9
Add 3.1 change log
[ { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-3x.md", "new_path": "Docs/ChangeLog-3x.md", "diff": "@@ -6,6 +6,69 @@ release of the 3.x series.\nAll performance data on this page is measured on an Intel Core i5-9600K\nclocked at 4.2 GHz, running astcenc using AVX2 and 6 threads.\n+<!-- ---------------------------------------------------------------------- -->\n+## 3.1\n+\n+**Status:** July 2021 (in development)\n+\n+The 3.1 release is the second release in the 3.x series. This release gives\n+another performance boost, typically between 5 and 20% faster than the 3.0\n+release, as well as further incremental improvements to image quality. A number\n+of build system improvements make astcenc easier and faster to integrate into\n+other projects as a library, including support for building unversal binaries\n+on macOS. Full change list is shown below.\n+\n+Reminder for users of the library interface - the API is not designed to be\n+binary compatible across versions, and this release is not compatible with\n+earlier releases. Please update and rebuild your client-side code using the\n+updated `astcenc.h` header.\n+\n+* **General:**\n+ * **Feature:** RGB color data now supports `-perceptual` operation. The\n+ current implementation is simple, weighting color channel errors by their\n+ contribution to perceived luminance. This mimics the behavior of the human\n+ visual system, which is most sensitive to green, then red, then blue.\n+ * **Feature:** Codec supports a new low weight search mode, which is a\n+ simpler weight assignment for encodings with a low number of weights in the\n+ weight grid. The weight threshold can be overriden using the new\n+ `-lowweightmodelimit` commadn line option.\n+ * **Feature:** All platform builds now support building a native binary.\n+ Native binaries automatically select the SIMD level based on the default\n+ configuration of the compiler in use. Native binaries built on one machine\n+ may use different SIMD options than native binaries build on another.\n+ * **Feature:** macOS platform builds now support building universal binaries\n+ containing both `x86_64` and `arm64` target support.\n+ * **Feature:** Building the command line can be disabled when using as a\n+ library in another project. Set `-DCLI=OFF` during the CMake configure\n+ step.\n+ * **Feature:** A standalone minimal example of the core codec API usage has\n+ been added in the `./Utils/Example/` directory.\n+* **Core API:**\n+ * **Feature:** Config flag `ASTCENC_FLG_USE_PERCEPTUAL` works for color data.\n+ * **Feature:** Config option `tune_low_weight_count_limit` added.\n+ * **Feature:** New heuristic added which prunes dual weight plane searches if\n+ they are unlikely to help. This heuristic is not user controllable.\n+ * **Feature:** Image quality has been improved. In general we see significant\n+ improvements (up to 0.2dB) for high bitrate encodings (4x4, 5x4), and a\n+ smaller improvement (up to 0.1dB) for lower bitrate encodings.\n+ * **Bug fix:** Arm \"none\" SIMD builds could be invariant with other builds.\n+ This fix has also been back-ported to the 2.x LTS branch.\n+\n+### Performance:\n+\n+Key for charts:\n+\n+* Color = block size (see legend).\n+* Letter = image format (N = normal map, G = greyscale, L = LDR, H = HDR).\n+\n+**Absolute performance vs 3.0 release:**\n+\n+TBD\n+\n+**Relative performance vs 3.0 release:**\n+\n+TBD\n+\n<!-- ---------------------------------------------------------------------- -->\n## 3.0\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add 3.1 change log
61,745
15.07.2021 21:45:03
-3,600
bb9253eed4bb1ae5a508b280efd833aad63fe7d6
Bump CMake project version to 3.1.0
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -24,7 +24,7 @@ if(MSVC)\nadd_compile_options(\"/wd4324\") # Disable structure was padded due to alignment specifier\nendif()\n-project(astcencoder VERSION 3.0.0)\n+project(astcencoder VERSION 3.1.0)\nset(CMAKE_CXX_STANDARD 14)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Bump CMake project version to 3.1.0
61,745
15.07.2021 21:54:31
-3,600
bb1436af3a1e7dec5f06aa4e4571e451d3579f3c
Add f16c to the version string
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel_help.cpp", "new_path": "Source/astcenccli_toplevel_help.cpp", "diff": "/** @brief The version header. */\nstatic const char *astcenc_copyright_string =\n-R\"(astcenc v%s, %u-bit %s%s\n+R\"(astcenc v%s, %u-bit %s%s%s\nCopyright 2011-%s Arm Limited, all rights reserved\n)\";\n@@ -595,9 +595,15 @@ void astcenc_print_header()\nconst char* pcnttype = \"\";\n#endif\n+#if (ASTCENC_F16C == 1)\n+ const char* f16ctype = \"+f16c\";\n+#else\n+ const char* f16ctype = \"\";\n+#endif\n+\nunsigned int bits = (int)(sizeof(void*) * 8);\nprintf(astcenc_copyright_string,\n- VERSION_STRING, bits, simdtype, pcnttype, YEAR_STRING);\n+ VERSION_STRING, bits, simdtype, pcnttype, f16ctype, YEAR_STRING);\n}\n/* See header for documentation. */\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add f16c to the version string
61,745
21.07.2021 14:05:58
-3,600
380194367f3c697927efe810bf97afb795691581
Remove obsolete blockify script.
[ { "change_type": "DELETE", "old_path": "Utils/astc_rgbm_blockify.cpp", "new_path": null, "diff": "-// SPDX-License-Identifier: Apache-2.0\n-// ----------------------------------------------------------------------------\n-// Copyright 2019-2020 Arm Limited\n-//\n-// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n-// use this file except in compliance with the License. You may obtain a copy\n-// of the License at:\n-//\n-// http://www.apache.org/licenses/LICENSE-2.0\n-//\n-// Unless required by applicable law or agreed to in writing, software\n-// distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n-// License for the specific language governing permissions and limitations\n-// under the License.\n-// ----------------------------------------------------------------------------\n-\n-// This is a utility tool to blockify the M component 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
Remove obsolete blockify script.
61,745
01.08.2021 19:43:27
-3,600
8013b1732977d39626ea41c27a59de2c806a3100
Cleanup - remove some ;; instances
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_find_best_partitioning.cpp", "new_path": "Source/astcenc_find_best_partitioning.cpp", "diff": "@@ -229,7 +229,7 @@ static void kmeans_update(\nfor (unsigned int i = 0; i < texel_count; i++)\n{\nuint8_t partition = partition_of_texel[i];\n- color_sum[partition] += blk.texel(i);;\n+ color_sum[partition] += blk.texel(i);\npartition_texel_count[partition]++;\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_image.cpp", "new_path": "Source/astcenc_image.cpp", "diff": "@@ -255,7 +255,7 @@ void fetch_image_block(\ndata_enc_lns = float16_to_float(lns_to_sf16(float_to_int(data_enc)));\n}\n- blk.origin_texel = select(data_enc_unorm, data_enc_lns, lns_mask);;\n+ blk.origin_texel = select(data_enc_unorm, data_enc_lns, lns_mask);\n// Store block metadata\nblk.data_min = data_min;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenccli_image_load_store.cpp", "new_path": "Source/astcenccli_image_load_store.cpp", "diff": "@@ -1706,7 +1706,7 @@ static astcenc_image* load_dds_uncompressed_image(\n// The bytes per component in the DDS file itself\nint bytes_per_component = 0;\nint components = 0;\n- scanline_transfer copy_method = R8_TO_RGBA8;;\n+ scanline_transfer copy_method = R8_TO_RGBA8;\n// figure out the format actually used in the DDS file.\nif (use_dx10_header)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Cleanup - remove some ;; instances
61,745
20.08.2021 07:37:01
-3,600
a463566e906016c195a5a1d8e1b9c14be3491f79
Use a ROM quant_mode_table to avoid parallel init
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_entry.cpp", "new_path": "Source/astcenc_entry.cpp", "diff": "@@ -819,7 +819,6 @@ astcenc_error astcenc_context_alloc(\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\nprepare_angular_tables();\n#endif\n- init_quant_mode_table();\nreturn ASTCENC_SUCCESS;\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -1485,15 +1485,7 @@ extern const uint8_t color_unquant_tables[21][256];\n* number of compressed storage bits. Returns -1 for cases where the requested integer count cannot\n* ever fit in the supplied storage size.\n*/\n-extern int8_t quant_mode_table[17][128];\n-\n-/**\n- * @brief Initialize the quant mode table.\n- *\n- * This is stored in global memory so this only needs to be done once, but is typically done\n- * whenever a new context is created.\n- */\n-void init_quant_mode_table();\n+extern const int8_t quant_mode_table[17][128];\n/**\n* @brief Encode a packed string using BISE.\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_quantization.cpp", "new_path": "Source/astcenc_quantization.cpp", "diff": "@@ -535,44 +535,175 @@ const uint8_t color_unquant_tables[21][256] {\n// The quant_mode_table[integercount/2][bits] gives us the quantization level for a given integer\n// count and number of bits that the integer may fit into.\n-int8_t quant_mode_table[17][128];\n-\n-/* See header for documentation. */\n-void init_quant_mode_table()\n-{\n- for (unsigned int i = 0; i <= 16; i++)\n- {\n- for (unsigned int j = 0; j < 128; j++)\n- {\n- quant_mode_table[i][j] = -1;\n- }\n- }\n-\n- for (unsigned int i = 0; i < 21; i++)\n- {\n- for (unsigned int j = 1; j <= 16; j++)\n- {\n- unsigned int p = get_ise_sequence_bitcount(2 * j, (quant_method)i);\n- if (p < 128)\n- {\n- quant_mode_table[j][p] = static_cast<int8_t>(i);\n- }\n- }\n- }\n-\n- for (int i = 0; i <= 16; i++)\n- {\n- int8_t largest_value_so_far = -1;\n- for (unsigned int j = 0; j < 128; j++)\n- {\n- if (quant_mode_table[i][j] > largest_value_so_far)\n- {\n- largest_value_so_far = quant_mode_table[i][j];\n- }\n- else\n+const int8_t quant_mode_table[17][128] {\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1\n+ },\n+ {\n+ -1, -1, 0, 0, 2, 3, 5, 6, 8, 9, 11, 12, 14, 15, 17, 18,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20\n+ },\n+ {\n+ -1, -1, -1, -1, 0, 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7,\n+ 8, 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 17, 17, 18, 19,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3,\n+ 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,\n+ 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1,\n+ 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7,\n+ 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13,\n+ 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 19, 19, 19,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0,\n+ 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5,\n+ 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10,\n+ 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14,\n+ 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 19, 19, 19, 19,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0,\n+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,\n+ 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,\n+ 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11,\n+ 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15,\n+ 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0,\n+ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2,\n+ 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6,\n+ 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9,\n+ 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13,\n+ 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16,\n+ 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19,\n+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,\n+ 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,\n+ 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,\n+ 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10,\n+ 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13,\n+ 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16,\n+ 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,\n+ 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4,\n+ 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6,\n+ 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9,\n+ 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,\n+ 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14,\n+ 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3,\n+ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5,\n+ 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7,\n+ 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10,\n+ 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12,\n+ 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 15\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,\n+ 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,\n+ 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,\n+ 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8,\n+ 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,\n+ 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0,\n+ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n+ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,\n+ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,\n+ 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7,\n+ 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10,\n+ 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0,\n+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,\n+ 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3,\n+ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5,\n+ 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7,\n+ 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8,\n+ 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0,\n+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,\n+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2,\n+ 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,\n+ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6,\n+ 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,\n+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9\n+ },\n+ {\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0,\n+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,\n+ 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4,\n+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5,\n+ 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7,\n+ 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8\n+ },\n{\n- quant_mode_table[i][j] = largest_value_so_far;\n- }\n- }\n- }\n-}\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,\n+ 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,\n+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,\n+ 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7\n+ },\n+};\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Use a ROM quant_mode_table to avoid parallel init (#284)
61,745
21.08.2021 16:23:40
-3,600
04c5e7764c0bc0f0362d2e8f0f911aa1e325af1d
Ensure fuzz builds starts with clean archive state
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "*.log\n*.diff\n*.user\n+*.o\n+*.a\n__pycache__\nScratch\nProto\n@@ -36,3 +38,4 @@ TestOutput\n/*.astc\nastc_reference-main*\nDocs/Profiling.md\n+Source/astcenccli_version.h\n" }, { "change_type": "MODIFY", "old_path": "Source/Fuzzers/build.sh", "new_path": "Source/Fuzzers/build.sh", "diff": "# This script is invoked by oss-fuzz from <root>/Source/\n-# Generate a dummy verison header (normally built by CMake variable expansion)\n+# Generate a dummy version header (normally built by CMake variable expansion)\necho \"#pragma once\" > astcenccli_version.h\necho \"#define VERSION_STRING \\\"0.0.0\\\"\" >> astcenccli_version.h\necho \"#define YEAR_STRING \\\"2021\\\"\" >> astcenccli_version.h\n@@ -52,3 +52,7 @@ for fuzzer in ./Fuzzers/fuzz_*.cpp; do\n-I. -std=c++14 $fuzzer $LIB_FUZZING_ENGINE ./libastcenc.a \\\n-o $OUT/$(basename -s .cpp $fuzzer)\ndone\n+\n+# Cleanup temporary build files\n+rm *.o\n+rm *.a\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Ensure fuzz builds starts with clean archive state
61,745
21.08.2021 16:25:56
-3,600
5c5dee52401189c27e481e8a7ec30f54fcdcdb5f
Reject invalid encodings during decode
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_symbolic_physical.cpp", "new_path": "Source/astcenc_symbolic_physical.cpp", "diff": "@@ -301,6 +301,7 @@ void physical_to_symbolic(\nif (rsvbits != 3)\n{\nscb.block_type = SYM_BTYPE_ERROR;\n+ return;\n}\nint vx_low_s = read_bits(8, 12, pcb.data) | (read_bits(5, 12 + 8, pcb.data) << 8);\n@@ -313,6 +314,7 @@ void physical_to_symbolic(\nif ((vx_low_s >= vx_high_s || vx_low_t >= vx_high_t) && !all_ones)\n{\nscb.block_type = SYM_BTYPE_ERROR;\n+ return;\n}\n}\nelse\n@@ -330,6 +332,7 @@ void physical_to_symbolic(\nif ((vx_low_s >= vx_high_s || vx_low_t >= vx_high_t || vx_low_p >= vx_high_p) && !all_ones)\n{\nscb.block_type = SYM_BTYPE_ERROR;\n+ return;\n}\n}\n@@ -384,6 +387,7 @@ void physical_to_symbolic(\nif (is_dual_plane && partition_count == 4)\n{\nscb.block_type = SYM_BTYPE_ERROR;\n+ return;\n}\nscb.color_formats_matched = 0;\n@@ -449,6 +453,7 @@ void physical_to_symbolic(\nif (color_integer_count > 18)\n{\nscb.block_type = SYM_BTYPE_ERROR;\n+ return;\n}\n// Determine the color endpoint format to use\n@@ -465,13 +470,14 @@ void physical_to_symbolic(\n}\nint color_quant_level = quant_mode_table[color_integer_count >> 1][color_bits];\n- scb.quant_mode = (quant_method)color_quant_level;\nif (color_quant_level < QUANT_6)\n{\nscb.block_type = SYM_BTYPE_ERROR;\n+ return;\n}\n// Unpack the integer color values and assign to endpoints\n+ scb.quant_mode = (quant_method)color_quant_level;\nuint8_t values_to_decode[32];\ndecode_ise((quant_method)color_quant_level, color_integer_count, pcb.data, values_to_decode, (partition_count == 1 ? 17 : 19 + PARTITION_INDEX_BITS));\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Reject invalid encodings during decode
61,745
16.09.2021 09:55:31
-3,600
14b20f33f2980efc3e25dbd69a04d44498da1d2c
Add documentation of .astc files Fixes
[ { "change_type": "ADD", "old_path": null, "new_path": "Docs/FileFormat.md", "diff": "+# The .astc File Format\n+\n+The default file format for compressed textures generated by `astcenc`, as well\n+as from many other ASTC compressors, is the `.astc` format. This is a very\n+simple format consisting of a small header followed immediately by the binary\n+payload for a single image surface.\n+\n+Header\n+======\n+\n+The header is a fixed 16 byte structure, defined as storing only bytes to avoid\n+any endianness issues or incur any padding overhead.\n+\n+```\n+struct astc_header\n+{\n+ uint8_t magic[4];\n+ uint8_t block_x;\n+ uint8_t block_y;\n+ uint8_t block_z;\n+ uint8_t dim_x[3];\n+ uint8_t dim_y[3];\n+ uint8_t dim_z[3];\n+};\n+```\n+\n+Magic number\n+------------\n+\n+The 4 byte magic number at the start of the file acts as a format identifier.\n+\n+```\n+ magic[0] = 0x13;\n+ magic[1] = 0xAB;\n+ magic[2] = 0xA1;\n+ magic[3] = 0x5C;\n+```\n+\n+Block size\n+----------\n+\n+The `block_*` fields store the ASTC block dimensions in texels. For 2D images\n+the Z dimension must be set to 1.\n+\n+Image dimensions\n+----------------\n+\n+The `dim_*` fields store the image dimensions in texels. For 2D images the\n+Z dimension must be set to 1.\n+\n+Note that the image is not required to be an exact multiple of the compressed\n+block size; the compressed data may include padding that is discarded during\n+decompression.\n+\n+Each dimension is a 24 bit unsigned value that is reconstructed from the stored\n+byte values as:\n+\n+```\n+decoded_dim = dim[0] + (dim[1] << 8) + (dim[2] << 16);\n+```\n+\n+Binary payload\n+==============\n+\n+The binary payload is a byte stream that immediately follows the header. It\n+contains 16 bytes per compressed block. The number of compressed blocks is\n+determined programmatically based on the header information.\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -195,9 +195,9 @@ help message for more details.\n# Documentation\n-The [ASTC Format Overview](./Docs/FormatOverview.md) provides a high level\n-introduction to the ASTC data format, how it encodes data, and why it is both\n-flexible and efficient.\n+The [ASTC Format Overview](./Docs/FormatOverview.md) page provides a high level\n+introduction to the ASTC texture format, how it encodes data, and why it is\n+both flexible and efficient.\nThe [Effective ASTC Encoding](./Docs/Encoding.md) page looks at some of the\nguidelines that should be followed when compressing data using `astcenc`.\n@@ -207,6 +207,9 @@ It covers:\n* How to efficiently encode normal maps, sRGB data, and HDR data.\n* Coding equivalents to other compression formats.\n+The [.astc File Format](./Docs/FileFormat.md) page provides a light-weight\n+specification for the `.astc` file format and how to read or write it.\n+\nThe [Building ASTC Encoder](./Docs/Building.md) page provides instructions on\nhow to build `astcenc` from the sources in this repository.\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add documentation of .astc files Fixes #285
61,745
16.09.2021 23:14:52
-3,600
36469f9fc322cde5affe86d5ed5bf6167ee48906
Avoid left shift of negative value in soft-fp16
[ { "change_type": "MODIFY", "old_path": "Source/UnitTest/cmake_core.cmake", "new_path": "Source/UnitTest/cmake_core.cmake", "diff": "# ----------------------------------------------------------------------------\nif(${UNIVERSAL_BUILD})\n- set(ASTC_TEST test-simd)\n+ set(ASTC_TEST test-unit)\nelse()\n- set(ASTC_TEST test-simd-${ISA_SIMD})\n+ set(ASTC_TEST test-unit-${ISA_SIMD})\nendif()\nadd_executable(${ASTC_TEST})\n@@ -26,6 +26,7 @@ add_executable(${ASTC_TEST})\ntarget_sources(${ASTC_TEST}\nPRIVATE\ntest_simd.cpp\n+ test_softfloat.cpp\n../astcenc_mathlib_softfloat.cpp)\ntarget_include_directories(${ASTC_TEST}\n@@ -119,6 +120,14 @@ elseif(${ISA_SIMD} MATCHES \"avx2\")\nendif()\n+target_compile_options(${ASTC_TEST}\n+ PRIVATE\n+ $<$<CXX_COMPILER_ID:${CLANG_LIKE}>:-fsanitize=undefined>)\n+\n+target_link_options(${ASTC_TEST}\n+ PRIVATE\n+ $<$<CXX_COMPILER_ID:${CLANG_LIKE}>:-fsanitize=undefined>)\n+\ntarget_link_libraries(${ASTC_TEST}\nPRIVATE\ngtest_main)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Source/UnitTest/test_softfloat.cpp", "diff": "+// SPDX-License-Identifier: Apache-2.0\n+// ----------------------------------------------------------------------------\n+// Copyright 2020-2021 Arm Limited\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n+// use this file except in compliance with the License. You may obtain a copy\n+// of the License at:\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+// License for the specific language governing permissions and limitations\n+// under the License.\n+// ----------------------------------------------------------------------------\n+\n+/**\n+ * @brief Unit tests for the vectorized SIMD functionality.\n+ *\n+ * This test suite is a partial implementation, focussing on 4-wide vectors.\n+ * We're adding things as we touch related parts of the code, but there is some\n+ * technical debt to catch up on to get full coverage.\n+ */\n+\n+#include <limits>\n+\n+#include \"gtest/gtest.h\"\n+\n+#include \"../astcenc_internal.h\"\n+#include \"../astcenc_vecmathlib.h\"\n+\n+namespace astcenc\n+{\n+\n+#if (ASTCENC_F16C == 0) && (ASTCENC_NEON == 0)\n+\n+/** @brief Test normal numbers. */\n+TEST(softfloat, FP16NormalNumbers)\n+{\n+ float result = sf16_to_float((15 << 10) + 1);\n+ EXPECT_NEAR(result, 1.00098f, 0.00005f);\n+}\n+\n+/** @brief Test VLA loop limit round down. */\n+TEST(softfloat, FP16DenormalNumbers)\n+{\n+ float result = sf16_to_float((0 << 10) + 1);\n+ EXPECT_NEAR(result, 5.96046e-08f, 0.00005f);\n+}\n+\n+/** @brief Test zero. */\n+TEST(softfloat, FP16Zero)\n+{\n+ float result = sf16_to_float(0x0000);\n+ EXPECT_EQ(result, 0.0f);\n+}\n+\n+/** @brief Test NaN. */\n+TEST(softfloat, FP16NaN)\n+{\n+ float result = sf16_to_float(0xFFFF);\n+ EXPECT_FALSE(result == result);\n+}\n+\n+#endif\n+\n+}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_mathlib_softfloat.cpp", "new_path": "Source/astcenc_mathlib_softfloat.cpp", "diff": "@@ -147,43 +147,48 @@ static sf32 sf16_to_sf32(sf16 inp)\nwith just 1 table lookup, 2 shifts and 1 add.\n*/\n- #define WITH_MB(a) INT32_C((a) | (1 << 31))\n- static const int32_t tbl[64] =\n+ #define WITH_MSB(a) (UINT32_C(a) | (1u << 31))\n+ static const uint32_t tbl[64] =\n{\n- WITH_MB(0x00000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000),\n- INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000),\n- INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000),\n- INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), WITH_MB(0x38000),\n- WITH_MB(0x38000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000),\n- INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000),\n- INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000),\n- INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), WITH_MB(0x70000)\n+ WITH_MSB(0x00000), 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000,\n+ 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000,\n+ 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000,\n+ 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, 0x1C000, WITH_MSB(0x38000),\n+ WITH_MSB(0x38000), 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000,\n+ 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000,\n+ 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000,\n+ 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, 0x54000, WITH_MSB(0x70000)\n};\n- int32_t res = tbl[inpx >> 10];\n+ uint32_t res = tbl[inpx >> 10];\nres += inpx;\n- /* the normal cases: the MSB of 'res' is not set. */\n- if (res >= 0) /* signed compare */\n+ /* Normal cases: MSB of 'res' not set. */\n+ if ((res & WITH_MSB(0)) == 0)\n+ {\nreturn res << 13;\n+ }\n- /* Infinity and Zero: the bottom 10 bits of 'res' are clear. */\n- if ((res & UINT32_C(0x3FF)) == 0)\n+ /* Infinity and Zero: 10 LSB of 'res' not set. */\n+ if ((res & 0x3FF) == 0)\n+ {\nreturn res << 13;\n+ }\n- /* NaN: the exponent field of 'inp' is not zero; NaNs must be quietened. */\n+ /* NaN: the exponent field of 'inp' is non-zero. */\nif ((inpx & 0x7C00) != 0)\n- return (res << 13) | UINT32_C(0x400000);\n-\n- /* the remaining cases are Denormals. */\n{\n- uint32_t sign = (inpx & UINT32_C(0x8000)) << 16;\n- uint32_t mskval = inpx & UINT32_C(0x7FFF);\n+ /* All NaNs are quietened. */\n+ return (res << 13) | 0x400000;\n+ }\n+\n+ /* Denormal cases */\n+ uint32_t sign = (inpx & 0x8000) << 16;\n+ uint32_t mskval = inpx & 0x7FFF;\nuint32_t leadingzeroes = clz32(mskval);\nmskval <<= leadingzeroes;\nreturn (mskval >> 8) + ((0x85 - leadingzeroes) << 23) + sign;\n}\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. */\nstatic sf16 sf32_to_sf16(sf32 inp, roundmode rmode)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Avoid left shift of negative value in soft-fp16
61,745
16.09.2021 23:42:11
-3,600
03b70120f97c88bb894ee9de9dc0a463282ba3b1
Improve comments in unit test header
[ { "change_type": "MODIFY", "old_path": "Source/UnitTest/test_simd.cpp", "new_path": "Source/UnitTest/test_simd.cpp", "diff": "/**\n* @brief Unit tests for the vectorized SIMD functionality.\n- *\n- * This test suite is a partial implementation, focussing on 4-wide vectors.\n- * We're adding things as we touch related parts of the code, but there is some\n- * technical debt to catch up on to get full coverage.\n*/\n#include <limits>\n" }, { "change_type": "MODIFY", "old_path": "Source/UnitTest/test_softfloat.cpp", "new_path": "Source/UnitTest/test_softfloat.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2020-2021 Arm Limited\n+// Copyright 2021 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n// ----------------------------------------------------------------------------\n/**\n- * @brief Unit tests for the vectorized SIMD functionality.\n- *\n- * This test suite is a partial implementation, focussing on 4-wide vectors.\n- * We're adding things as we touch related parts of the code, but there is some\n- * technical debt to catch up on to get full coverage.\n+ * @brief Unit tests for the software half-float library.\n*/\n-#include <limits>\n-\n#include \"gtest/gtest.h\"\n#include \"../astcenc_internal.h\"\n-#include \"../astcenc_vecmathlib.h\"\nnamespace astcenc\n{\n@@ -42,7 +35,7 @@ TEST(softfloat, FP16NormalNumbers)\nEXPECT_NEAR(result, 1.00098f, 0.00005f);\n}\n-/** @brief Test VLA loop limit round down. */\n+/** @brief Test denormal numbers. */\nTEST(softfloat, FP16DenormalNumbers)\n{\nfloat result = sf16_to_float((0 << 10) + 1);\n@@ -56,11 +49,18 @@ TEST(softfloat, FP16Zero)\nEXPECT_EQ(result, 0.0f);\n}\n+/** @brief Test infinity. */\n+TEST(softfloat, FP16Infinity)\n+{\n+ float result = sf16_to_float((31 << 10) + 0);\n+ EXPECT_TRUE(std::isinf(result));\n+}\n+\n/** @brief Test NaN. */\nTEST(softfloat, FP16NaN)\n{\nfloat result = sf16_to_float(0xFFFF);\n- EXPECT_FALSE(result == result);\n+ EXPECT_TRUE(std::isnan(result));\n}\n#endif\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Improve comments in unit test header
61,745
24.09.2021 21:27:04
-3,600
8a640dd4a6d27fb0e6713ea61caa5a2526898e16
Fix verbose codec config log
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel.cpp", "new_path": "Source/astcenccli_toplevel.cpp", "diff": "@@ -1130,14 +1130,14 @@ static void print_astcenc_config(\nprintf(\" RGB power: %g\\n\", (double)config.v_rgb_power );\nprintf(\" RGB base weight: %g\\n\", (double)config.v_rgb_base);\nprintf(\" RGB mean weight: %g\\n\", (double)config.v_rgb_mean);\n- printf(\" RGB stdev weight: %g\\n\", (double)config.v_rgba_mean_stdev_mix);\n+ printf(\" RGB stdev weight: %g\\n\", (double)config.v_rgb_stdev);\nprintf(\" RGB mean/stdev mixing: %g\\n\", (double)config.v_rgba_mean_stdev_mix);\nprintf(\" Alpha power: %g\\n\", (double)config.v_a_power);\nprintf(\" Alpha base weight: %g\\n\", (double)config.v_a_base);\nprintf(\" Alpha mean weight: %g\\n\", (double)config.v_a_mean);\nprintf(\" Alpha stdev weight: %g\\n\", (double)config.v_a_stdev);\n- printf(\" RGB alpha scale weight: %d\\n\", (config.flags & ASTCENC_FLG_MAP_NORMAL));\n- if ((config.flags & ASTCENC_FLG_MAP_NORMAL))\n+ printf(\" RGB alpha scale weight: %d\\n\", (config.flags & ASTCENC_FLG_USE_ALPHA_WEIGHT));\n+ if ((config.flags & ASTCENC_FLG_USE_ALPHA_WEIGHT))\n{\nprintf(\" Radius RGB alpha scale: %u texels\\n\", config.a_scale_radius);\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix verbose codec config log
61,745
24.09.2021 21:30:23
-3,600
8a44ad2e4388984f1537ac62f3d6d3c1a8df39b9
Typo in scb Doxygen
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -1190,7 +1190,7 @@ struct symbolic_compressed_block\n/** @brief The endpoint color formats for each partition; valid for @c NONCONST blocks. */\nuint8_t color_formats[BLOCK_MAX_PARTITIONS];\n- /** @brief The endpoint color formats for each partition; valid for @c NONCONST blocks. */\n+ /** @brief The endpoint color quant mode; valid for @c NONCONST blocks. */\nquant_method quant_mode;\n/** @brief The error of the current encoding; valid for @c NONCONST blocks. */\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Typo in scb Doxygen
61,745
24.09.2021 22:53:48
-3,600
c945cda397bfa96086f0cf10af8a3e5c7edc9b6a
Add f postfix to float literals
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -499,8 +499,8 @@ static void compute_ideal_colors_and_weights_4_comp(\npromise(texel_count > 0);\npromise(partition_count > 0);\n- float lowparam[BLOCK_MAX_PARTITIONS] { 1e10, 1e10, 1e10, 1e10 };\n- float highparam[BLOCK_MAX_PARTITIONS] { -1e10, -1e10, -1e10, -1e10 };\n+ float lowparam[BLOCK_MAX_PARTITIONS] { 1e10f, 1e10f, 1e10f, 1e10f };\n+ float highparam[BLOCK_MAX_PARTITIONS] { -1e10f, -1e10f, -1e10f, -1e10f };\nline4 lines[BLOCK_MAX_PARTITIONS];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add f postfix to float literals
61,745
28.09.2021 00:18:47
-3,600
d81f1f68c1896625c46b6fb64e73a51ec085fb1f
Skip list scan for trial 0
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_pick_best_endpoint_format.cpp", "new_path": "Source/astcenc_pick_best_endpoint_format.cpp", "diff": "@@ -1150,6 +1150,10 @@ unsigned int compute_ideal_endpoint_formats(\nbest_quant_levels_mod[i] = QUANT_2;\n}\n+ // Track a scalar best to avoid expensive search at least once ...\n+ float error_of_best_combination = ERROR_CALC_DEFAULT;\n+ int index_of_best_combination = -1;\n+\n// The block contains 1 partition\nif (partition_count == 1)\n{\n@@ -1165,8 +1169,15 @@ unsigned int compute_ideal_endpoint_formats(\nbest_error[0], format_of_choice[0], qwt_bitcounts[i],\nbest_quant_levels[i], best_ep_formats[i][0]);\n- errors_of_best_combination[i] = error_of_best + qwt_errors[i];\n+ float total_error = error_of_best + qwt_errors[i];\n+ errors_of_best_combination[i] = total_error;\nbest_quant_levels_mod[i] = best_quant_levels[i];\n+\n+ if (total_error < error_of_best_combination)\n+ {\n+ error_of_best_combination = total_error;\n+ index_of_best_combination = i;\n+ }\n}\n}\n// The block contains 2 partitions\n@@ -1191,7 +1202,14 @@ unsigned int compute_ideal_endpoint_formats(\nbest_quant_levels[i], best_quant_levels_mod[i],\nbest_ep_formats[i]);\n- errors_of_best_combination[i] = error_of_best + qwt_errors[i];\n+ float total_error = error_of_best + qwt_errors[i];\n+ errors_of_best_combination[i] = total_error;\n+\n+ if (total_error < error_of_best_combination)\n+ {\n+ error_of_best_combination = total_error;\n+ index_of_best_combination = i;\n+ }\n}\n}\n// The block contains 3 partitions\n@@ -1216,7 +1234,14 @@ unsigned int compute_ideal_endpoint_formats(\nbest_quant_levels[i], best_quant_levels_mod[i],\nbest_ep_formats[i]);\n- errors_of_best_combination[i] = error_of_best + qwt_errors[i];\n+ float total_error = error_of_best + qwt_errors[i];\n+ errors_of_best_combination[i] = total_error;\n+\n+ if (total_error < error_of_best_combination)\n+ {\n+ error_of_best_combination = total_error;\n+ index_of_best_combination = i;\n+ }\n}\n}\n// The block contains 4 partitions\n@@ -1242,13 +1267,28 @@ unsigned int compute_ideal_endpoint_formats(\nbest_quant_levels[i], best_quant_levels_mod[i],\nbest_ep_formats[i]);\n- errors_of_best_combination[i] = error_of_best + qwt_errors[i];\n+ float total_error = error_of_best + qwt_errors[i];\n+ errors_of_best_combination[i] = total_error;\n+\n+ if (total_error < error_of_best_combination)\n+ {\n+ error_of_best_combination = total_error;\n+ index_of_best_combination = i;\n+ }\n}\n}\n- // Go through the results and pick the best candidate modes\nint best_error_weights[TUNE_MAX_TRIAL_CANDIDATES];\n- for (unsigned int i = 0; i < tune_candidate_limit; i++)\n+\n+ // Fast path the first result and avoid the list search for trial 0\n+ best_error_weights[0] = index_of_best_combination;\n+ if (index_of_best_combination >= 0)\n+ {\n+ errors_of_best_combination[index_of_best_combination] = ERROR_CALC_DEFAULT;\n+ }\n+\n+ // Search the remaining results and pick the best candidate modes for trial 1+\n+ for (unsigned int i = 1; i < tune_candidate_limit; i++)\n{\nvint vbest_error_index(-1);\nvfloat vbest_ep_error(ERROR_CALC_DEFAULT);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Skip list scan for trial 0
61,745
28.09.2021 00:37:34
-3,600
9ca55411e4abe255516f8a65daced4c5b50fcc45
Use the mode0 fast-pash less for -fastest quality For 6x6 this improves IQ by around 0.3dB for ~8% performance. For 8x8 this improves IQ by around 0.5dB for ~15% performance. Both are still substantially faster than -fast (2-3x).
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_entry.cpp", "new_path": "Source/astcenc_entry.cpp", "diff": "@@ -62,7 +62,7 @@ struct astcenc_preset_config\nstatic const std::array<astcenc_preset_config, 5> preset_configs_high {{\n{\nASTCENC_PRE_FASTEST,\n- 3, 4, 30, 1, 2, 79.0f, 57.0f, 2.0f, 2.0f, 1.0f, 1.0f, 0.5f, 25\n+ 3, 4, 30, 1, 2, 79.0f, 57.0f, 2.5f, 2.5f, 1.0f, 1.0f, 0.5f, 25\n}, {\nASTCENC_PRE_FAST,\n3, 12, 55, 3, 3, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.1f, 0.65f, 20\n@@ -86,7 +86,7 @@ static const std::array<astcenc_preset_config, 5> preset_configs_high {{\nstatic const std::array<astcenc_preset_config, 5> preset_configs_mid {{\n{\nASTCENC_PRE_FASTEST,\n- 3, 4, 30, 1, 2, 79.0f, 57.0f, 2.0f, 2.0f, 1.0f, 1.0f, 0.5f, 20\n+ 3, 4, 30, 1, 2, 79.0f, 57.0f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f, 20\n}, {\nASTCENC_PRE_FAST,\n3, 12, 55, 3, 3, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.1f, 0.5f, 16\n@@ -110,7 +110,7 @@ static const std::array<astcenc_preset_config, 5> preset_configs_mid {{\nstatic const std::array<astcenc_preset_config, 5> preset_configs_low {{\n{\nASTCENC_PRE_FASTEST,\n- 3, 4, 30, 1, 2, 79.0f, 57.0f, 2.0f, 2.0f, 1.0f, 1.0f, 0.5f, 20\n+ 3, 4, 30, 1, 2, 79.0f, 57.0f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f, 20\n}, {\nASTCENC_PRE_FAST,\n3, 10, 53, 3, 3, 85.0f, 63.0f, 3.5f, 3.5f, 1.0f, 1.1f, 0.5f, 16\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Use the mode0 fast-pash less for -fastest quality - For 6x6 this improves IQ by around 0.3dB for ~8% performance. - For 8x8 this improves IQ by around 0.5dB for ~15% performance. Both are still substantially faster than -fast (2-3x).
61,745
30.09.2021 20:06:52
-3,600
4c8ba12a15962461623cc633c83688107a5277af
Increase test runner info log precision
[ { "change_type": "MODIFY", "old_path": "Test/testlib/resultset.py", "new_path": "Test/testlib/resultset.py", "diff": "@@ -132,19 +132,19 @@ class ResultSummary():\nif (self.tTimesRel):\n# Performance summaries\ndat = (np.mean(self.tTimesRel), np.std(self.tTimesRel))\n- result.append(\"\\nTotal speed: Mean: %+0.2f x Std: %0.2f x\" % dat)\n+ result.append(\"\\nTotal speed: Mean: %+0.3f x Std: %0.2f x\" % dat)\ndat = (np.mean(self.cTimesRel), np.std(self.cTimesRel))\n- result.append(\"Coding speed: Mean: %+0.2f x Std: %0.2f x\" % dat)\n+ result.append(\"Coding speed: Mean: %+0.3f x Std: %0.2f x\" % dat)\ndat = (np.mean(self.psnrRel), np.std(self.psnrRel))\n- result.append(\"Quality diff: Mean: %+0.2f dB Std: %0.2f dB\" % dat)\n+ result.append(\"Quality diff: Mean: %+0.3f dB Std: %0.2f dB\" % dat)\ndat = (np.mean(self.cTime), np.std(self.cTime))\n- result.append(\"Coding time: Mean: %+0.2f s Std: %0.2f s\" % dat)\n+ result.append(\"Coding time: Mean: %+0.3f s Std: %0.2f s\" % dat)\ndat = (np.mean(self.psnr), np.std(self.psnr))\n- result.append(\"Quality abs: Mean: %+0.2f dB Std: %0.2f dB\" % dat)\n+ result.append(\"Quality: Mean: %+0.3f dB Std: %0.2f dB\" % dat)\nreturn \"\\n\".join(result)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Increase test runner info log precision
61,762
07.10.2021 14:44:30
-10,800
4febf62cc1e9e76c24ac580ff0858488ed0632e6
Fixed image size validation in load_cimage
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_image_load_store.cpp", "new_path": "Source/astcenccli_image_load_store.cpp", "diff": "@@ -2367,7 +2367,7 @@ int load_cimage(\nunsigned int dim_y = unpack_bytes(hdr.dim_y[0], hdr.dim_y[1], hdr.dim_y[2], 0);\nunsigned int dim_z = unpack_bytes(hdr.dim_z[0], hdr.dim_z[1], hdr.dim_z[2], 0);\n- if (dim_x == 0 || dim_z == 0 || dim_z == 0)\n+ if (dim_x == 0 || dim_y == 0 || dim_z == 0)\n{\nprintf(\"ERROR: File corrupt '%s'\\n\", filename);\nreturn 1;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fixed image size validation in load_cimage (#289)
61,762
18.10.2021 11:36:25
-10,800
a1abaae60e75b3a69a089a8d7d708d8d78fc3e8e
Fixed an invalid assert when ASTCENC_DECOMPRESS_ONLY is used
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_block_sizes.cpp", "new_path": "Source/astcenc_block_sizes.cpp", "diff": "@@ -950,10 +950,10 @@ static void construct_block_size_descriptor_2d(\nbsd.always_block_mode_count = always_block_mode_count;\nbsd.always_decimation_mode_count = always_decimation_mode_count;\n+#if !defined(ASTCENC_DECOMPRESS_ONLY)\nassert(bsd.always_block_mode_count > 0);\nassert(bsd.always_decimation_mode_count > 0);\n-#if !defined(ASTCENC_DECOMPRESS_ONLY)\ndelete[] percentiles;\n#endif\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fixed an invalid assert when ASTCENC_DECOMPRESS_ONLY is used (#291)
61,745
03.10.2021 21:57:46
-3,600
aa1cd33c6e718c4f17c4996038d6c2c15e2b66ed
Remove partition loop in merge_endpoints
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -41,15 +41,13 @@ static void merge_endpoints(\nendpoints& result\n) {\nunsigned int partition_count = ep_plane1.partition_count;\n+ assert(partition_count == 1);\n+\nvmask4 sep_mask = vint4::lane_id() == vint4(component_plane2);\nresult.partition_count = partition_count;\n- promise(partition_count > 0);\n- for (unsigned int i = 0; i < partition_count; i++)\n- {\n- result.endpt0[i] = select(ep_plane1.endpt0[i], ep_plane2.endpt0[i], sep_mask);\n- result.endpt1[i] = select(ep_plane1.endpt1[i], ep_plane2.endpt1[i], sep_mask);\n- }\n+ result.endpt0[0] = select(ep_plane1.endpt0[0], ep_plane2.endpt0[0], sep_mask);\n+ result.endpt1[0] = select(ep_plane1.endpt1[0], ep_plane2.endpt1[0], sep_mask);\n}\n/**\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove partition loop in merge_endpoints
61,745
20.10.2021 20:49:59
-3,600
9619be4adf1bc42e980502896251e7b5ea70c503
Use more default constructors
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_vecmathlib_neon_4.h", "new_path": "Source/astcenc_vecmathlib_neon_4.h", "diff": "@@ -51,7 +51,7 @@ struct vfloat4\n/**\n* @brief Construct from zero-initialized value.\n*/\n- ASTCENC_SIMD_INLINE vfloat4() {}\n+ ASTCENC_SIMD_INLINE vfloat4() = default;\n/**\n* @brief Construct from 4 values loaded from an unaligned address.\n@@ -184,7 +184,7 @@ struct vint4\n/**\n* @brief Construct from zero-initialized value.\n*/\n- ASTCENC_SIMD_INLINE vint4() {}\n+ ASTCENC_SIMD_INLINE vint4() = default;\n/**\n* @brief Construct from 4 values loaded from an unaligned address.\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_vecmathlib_none_4.h", "new_path": "Source/astcenc_vecmathlib_none_4.h", "diff": "@@ -57,7 +57,7 @@ struct vfloat4\n/**\n* @brief Construct from zero-initialized value.\n*/\n- ASTCENC_SIMD_INLINE vfloat4() {}\n+ ASTCENC_SIMD_INLINE vfloat4() = default;\n/**\n* @brief Construct from 4 values loaded from an unaligned address.\n@@ -189,7 +189,7 @@ struct vint4\n/**\n* @brief Construct from zero-initialized value.\n*/\n- ASTCENC_SIMD_INLINE vint4() {}\n+ ASTCENC_SIMD_INLINE vint4() = default;\n/**\n* @brief Construct from 4 values loaded from an unaligned address.\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Use more default constructors
61,745
21.10.2021 21:35:49
-3,600
54c414166bfa5a2b1f56e76f1dd3bf08552d167b
Add metrics for angular error to -tl -normal modes
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_error_metrics.cpp", "new_path": "Source/astcenccli_error_metrics.cpp", "diff": "@@ -113,7 +113,8 @@ static float mpsnr_sumdiff(\n/* See header for documentation */\nvoid compute_error_metrics(\n- int compute_hdr_metrics,\n+ bool compute_hdr_metrics,\n+ bool compute_normal_metrics,\nint input_components,\nconst astcenc_image* img1,\nconst astcenc_image* img2,\n@@ -127,6 +128,8 @@ void compute_error_metrics(\nkahan_accum4 alpha_scaled_errorsum;\nkahan_accum4 log_errorsum;\nkahan_accum4 mpsnr_errorsum;\n+ double mean_angular_errorsum = 0.0;\n+ float worst_angular_errorsum = 0.0;\nunsigned int dim_x = astc::min(img1->dim_x, img2->dim_x);\nunsigned int dim_y = astc::min(img1->dim_y, img2->dim_y);\n@@ -266,6 +269,24 @@ void compute_error_metrics(\nmpsnr_errorsum += mpsnr_error;\n}\n+\n+ if (compute_normal_metrics)\n+ {\n+ // Decode the normal vector\n+ vfloat4 normal1 = (color1 - 0.5f) * 2.0f;\n+ normal1 = normalize_safe(normal1.swz<0, 1, 2>(), unit3());\n+\n+ vfloat4 normal2 = (color2 - 0.5f) * 2.0f;\n+ normal2 = normalize_safe(normal2.swz<0, 1, 2>(), unit3());\n+\n+ // Float error can push this outside of valid range for acos, so clamp to avoid NaN issues\n+ float normal_cos = clamp(-1.0f, 1.0f, dot3(normal1, normal2)).lane<0>();\n+ float rad_to_degrees = 180.0f / astc::PI;\n+ float error_degrees = std::acos(static_cast<double>(normal_cos)) * static_cast<double>(rad_to_degrees);\n+\n+ mean_angular_errorsum += static_cast<double>(error_degrees) / (dim_x * dim_y * dim_z);\n+ worst_angular_errorsum = astc::max(worst_angular_errorsum, error_degrees);\n+ }\n}\n}\n}\n@@ -372,5 +393,11 @@ void compute_error_metrics(\nprintf(\" LogRMSE (RGB): %9.4f\\n\", (double)logrmse);\n}\n+ if (compute_normal_metrics)\n+ {\n+ printf(\" Mean Angular Error: %9.4f degrees\\n\", mean_angular_errorsum);\n+ printf(\" Worst Angular Error: %9.4f degrees\\n\", (double)worst_angular_errorsum);\n+ }\n+\nprintf(\"\\n\");\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenccli_internal.h", "new_path": "Source/astcenccli_internal.h", "diff": "@@ -304,7 +304,8 @@ void astcenc_print_longhelp();\n/**\n* @brief Compute error metrics comparing two images.\n*\n- * @param compute_hdr_metrics Non-zero if HDR metrics should be computed.\n+ * @param compute_hdr_metrics True if HDR metrics should be computed.\n+ * @param compute_normal_metrics True if normal map metrics should be computed.\n* @param input_components The number of input color components.\n* @param img1 The original image.\n* @param img2 The compressed image.\n@@ -312,7 +313,8 @@ void astcenc_print_longhelp();\n* @param fstop_hi The high exposure fstop (HDR only).\n*/\nvoid compute_error_metrics(\n- int compute_hdr_metrics,\n+ bool compute_hdr_metrics,\n+ bool compute_normal_metrics,\nint input_components,\nconst astcenc_image* img1,\nconst astcenc_image* img2,\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel.cpp", "new_path": "Source/astcenccli_toplevel.cpp", "diff": "@@ -1713,9 +1713,11 @@ int main(\n// Print metrics in comparison mode\nif (operation & ASTCENC_STAGE_COMPARE)\n{\n+ bool is_normal_map = config.flags & ASTCENC_FLG_MAP_NORMAL;\n+\ncompute_error_metrics(\n- image_uncomp_in_is_hdr, image_uncomp_in_component_count, image_uncomp_in,\n- image_decomp_out, cli_config.low_fstop, cli_config.high_fstop);\n+ image_uncomp_in_is_hdr, is_normal_map, image_uncomp_in_component_count,\n+ image_uncomp_in, image_decomp_out, cli_config.low_fstop, cli_config.high_fstop);\n}\n// Store compressed image\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add metrics for angular error to -tl -normal modes
61,745
22.10.2021 08:52:04
-3,600
fbf59948fc69be36f889ab459ccc4fbfc199cc5d
Add ENABLE_ASAN option to CMake
[ { "change_type": "MODIFY", "old_path": "Source/cmake_core.cmake", "new_path": "Source/cmake_core.cmake", "diff": "@@ -135,6 +135,16 @@ macro(astcenc_set_properties NAME)\n# Use pthreads on Linux/macOS\n$<$<PLATFORM_ID:Linux,Darwin>:-pthread>)\n+ if(${ENABLE_ASAN})\n+ target_compile_options(${NAME}\n+ PRIVATE\n+ $<$<CXX_COMPILER_ID:${CLANG_LIKE}>:-fsanitize=address>)\n+\n+ target_link_options(${NAME}\n+ PRIVATE\n+ $<$<CXX_COMPILER_ID:${CLANG_LIKE}>:-fsanitize=address>)\n+ endif()\n+\nif(${CLI})\n# Enable LTO on release builds\nset_property(TARGET ${NAME}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add ENABLE_ASAN option to CMake
61,745
22.10.2021 16:50:49
-3,600
6ffb3058bfbcc836108c25274e955e399481e2b4
Provide a fallback for blocks which find no valid encoding
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -1550,6 +1550,27 @@ void compress_block(\ntrace_add_data(\"exit\", \"quality not hit\");\nEND_OF_TESTS:\n+ // If we still have an error block then convert to something we can encode\n+ // TODO: Do something more sensible here, such as average color block\n+ if (scb.block_type == SYM_BTYPE_ERROR)\n+ {\n+#if !defined(NDEBUG)\n+ static bool printed_once = false;\n+ if (!printed_once)\n+ {\n+ printed_once = true;\n+ printf(\"WARN: At least one block failed to find a valid encoding.\\n\"\n+ \" Try increasing compression quality settings.\\n\\n\");\n+ }\n+#endif\n+\n+ scb.block_type = SYM_BTYPE_CONST_U16;\n+ scb.block_mode = -2;\n+ vfloat4 color_f32 = clamp(0.0f, 1.0f, blk.origin_texel) * 65535.0f;\n+ vint4 color_u16 = float_to_int_rtn(color_f32);\n+ store(color_u16, scb.constant_color);\n+ }\n+\n// Compress to a physical block\nsymbolic_to_physical(*bsd, scb, pcb);\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_symbolic_physical.cpp", "new_path": "Source/astcenc_symbolic_physical.cpp", "diff": "@@ -101,6 +101,8 @@ void symbolic_to_physical(\nconst symbolic_compressed_block& scb,\nphysical_compressed_block& pcb\n) {\n+ assert(scb.block_type != SYM_BTYPE_ERROR);\n+\n// Constant color block using UNORM16 colors\nif (scb.block_type == SYM_BTYPE_CONST_U16)\n{\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_weight_align.cpp", "new_path": "Source/astcenc_weight_align.cpp", "diff": "@@ -333,7 +333,7 @@ static void compute_angular_endpoints_for_quant_levels(\nif ((bsi < 0) && print_once)\n{\nprint_once = false;\n- printf(\"INFO: Unable to find full encoding within search error limit\\n\\n\");\n+ printf(\"INFO: Unable to find full encoding within search error limit.\\n\\n\");\n}\n#endif\n@@ -497,7 +497,7 @@ static void compute_angular_endpoints_for_quant_levels_lwc(\nif ((bsi < 0) && print_once)\n{\nprint_once = false;\n- printf(\"INFO: Unable to find low weight encoding within search error limit\\n\\n\");\n+ printf(\"INFO: Unable to find low weight encoding within search error limit.\\n\\n\");\n}\n#endif\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Provide a fallback for blocks which find no valid encoding
61,745
22.10.2021 17:35:00
-3,600
bdd385fe19bf2737bead4b5664acdfdeca7aab15
Only load based on texel index if undecimated
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1129,13 +1129,13 @@ void recompute_ideal_colors_1plane(\nvfloat4 rgba_sum(1e-17f);\nvfloat4 rgba_weight_sum(1e-17f);\n- int texel_count = pi.partition_texel_count[i];\n+ unsigned int texel_count = pi.partition_texel_count[i];\nconst uint8_t *texel_indexes = pi.texels_of_partition[i];\npromise(texel_count > 0);\n- for (int j = 0; j < texel_count; j++)\n+ for (unsigned int j = 0; j < texel_count; j++)\n{\n- int tix = texel_indexes[j];\n+ unsigned int tix = texel_indexes[j];\nvfloat4 rgba = blk.texel(tix);\nvfloat4 error_weight = ewb.error_weights[tix];\n@@ -1165,9 +1165,9 @@ void recompute_ideal_colors_1plane(\nvfloat4 weight_weight_sum = vfloat4(1e-17f);\nfloat psum = 1e-17f;\n- for (int j = 0; j < texel_count; j++)\n+ for (unsigned int j = 0; j < texel_count; j++)\n{\n- int tix = texel_indexes[j];\n+ unsigned int tix = texel_indexes[j];\nvfloat4 rgba = blk.texel(tix);\nvfloat4 color_weight = ewb.error_weights[tix];\n@@ -1175,8 +1175,13 @@ void recompute_ideal_colors_1plane(\n// TODO: Move this calculation out to the color block?\nfloat ls_weight = hadd_rgb_s(color_weight);\n- float idx0 = dec_weight_quant_uvalue[tix];\n- if (is_decimated)\n+ float idx0;\n+ if (!is_decimated)\n+ {\n+ assert(tix < BLOCK_MAX_WEIGHTS);\n+ idx0 = dec_weight_quant_uvalue[tix];\n+ }\n+ else\n{\nidx0 = bilinear_infill(di, dec_weight_quant_uvalue, tix);\n}\n@@ -1318,7 +1323,7 @@ void recompute_ideal_colors_2planes(\nvfloat4& rgbo_vector,\nint plane2_component\n) {\n- int weight_count = di.weight_count;\n+ unsigned int weight_count = di.weight_count;\nbool is_decimated = di.weight_count != di.texel_count;\npromise(weight_count > 0);\n@@ -1328,7 +1333,8 @@ void recompute_ideal_colors_2planes(\nfloat dec_weights_quant_uvalue_plane1[BLOCK_MAX_WEIGHTS_2PLANE];\nfloat dec_weights_quant_uvalue_plane2[BLOCK_MAX_WEIGHTS_2PLANE];\n- for (int i = 0; i < weight_count; i++)\n+ assert(weight_count <= BLOCK_MAX_WEIGHTS_2PLANE);\n+ for (unsigned int i = 0; i < weight_count; i++)\n{\ndec_weights_quant_uvalue_plane1[i] = qat->unquantized_value[dec_weights_quant_pvalue_plane1[i]] * (1.0f / 64.0f);\ndec_weights_quant_uvalue_plane2[i] = qat->unquantized_value[dec_weights_quant_pvalue_plane2[i]] * (1.0f / 64.0f);\n@@ -1337,7 +1343,7 @@ void recompute_ideal_colors_2planes(\nvfloat4 rgba_sum = ewb.block_error_weighted_rgba_sum;\nvfloat4 rgba_weight_sum = ewb.block_error_weight_sum;\n- int texel_count = bsd.texel_count;\n+ unsigned int texel_count = bsd.texel_count;\nvfloat4 scale_direction = normalize((rgba_sum * (1.0f / rgba_weight_sum)).swz<0, 1, 2>());\nfloat scale_max = 0.0f;\n@@ -1365,7 +1371,7 @@ void recompute_ideal_colors_2planes(\nvfloat4 weight_weight_sum = vfloat4(1e-17f);\nfloat psum = 1e-17f;\n- for (int j = 0; j < texel_count; j++)\n+ for (unsigned int j = 0; j < texel_count; j++)\n{\nvfloat4 rgba = blk.texel(j);\nvfloat4 color_weight = ewb.error_weights[j];\n@@ -1373,8 +1379,13 @@ void recompute_ideal_colors_2planes(\n// TODO: Move this calculation out to the color block?\nfloat ls_weight = hadd_rgb_s(color_weight);\n- float idx0 = dec_weights_quant_uvalue_plane1[j];\n- if (is_decimated)\n+ float idx0;\n+ if (!is_decimated)\n+ {\n+ assert(j < BLOCK_MAX_WEIGHTS_2PLANE);\n+ idx0 = dec_weights_quant_uvalue_plane1[j];\n+ }\n+ else\n{\nidx0 = bilinear_infill(di, dec_weights_quant_uvalue_plane1, j);\n}\n@@ -1400,8 +1411,13 @@ void recompute_ideal_colors_2planes(\nright_sum += right;\nlmrs_sum += lmrs;\n- float idx1 = dec_weights_quant_uvalue_plane2[j];\n- if (is_decimated)\n+ float idx1;\n+ if (!is_decimated)\n+ {\n+ assert(j < BLOCK_MAX_WEIGHTS_2PLANE);\n+ idx1 = dec_weights_quant_uvalue_plane2[j];\n+ }\n+ else\n{\nidx1 = bilinear_infill(di, dec_weights_quant_uvalue_plane2, j);\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Only load based on texel index if undecimated
61,745
26.10.2021 21:54:53
-3,600
d26e7dea93dd65d00efb674703bb91c4cae1a5b9
Update -help to match latest presets
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel_help.cpp", "new_path": "Source/astcenccli_toplevel_help.cpp", "diff": "@@ -314,7 +314,7 @@ ADVANCED COMPRESSION\nHigher numbers give better quality, as more complex blocks can\nbe encoded, but will increase search time. Preset defaults are:\n- -fastest : 3\n+ -fastest : 2\n-fast : 3\n-medium : 4\n-thorough : 4\n@@ -326,10 +326,10 @@ ADVANCED COMPRESSION\ndiminishing returns especially for smaller block sizes. Preset\ndefaults are:\n- -fastest : 2\n+ -fastest : 8\n-fast : 12\n- -medium : 25\n- -thorough : 75\n+ -medium : 26\n+ -thorough : 76\n-exhaustive : 1024\n-blockmodelimit <number>\n@@ -337,28 +337,28 @@ ADVANCED COMPRESSION\ndetermined distribution of block mode frequency. This option is\nineffective for 3D textures. Preset defaults are:\n- -fastest : 30\n+ -fastest : 40\n-fast : 55\n- -medium : 75\n- -thorough : 92\n+ -medium : 76\n+ -thorough : 93\n-exhaustive : 100\n-refinementlimit <value>\nIterate only <value> refinement iterations on colors and\nweights. Minimum value is 1. Preset defaults are:\n- -fastest : 1\n+ -fastest : 2\n-fast : 3\n- -medium : 2\n+ -medium : 3\n-thorough : 4\n-exhaustive : 4\n-candidatelimit <value>\nTrial only <value> candidate encodings for each block mode:\n- -fastest : 1\n- -fast : 2\n- -medium : 2\n+ -fastest : 2\n+ -fast : 3\n+ -medium : 3\n-thorough : 4\n-exhaustive : 4\n@@ -368,7 +368,7 @@ ADVANCED COMPRESSION\nineffective for HDR textures. Preset defaults, where N is the\nnumber of texels in a block, are:\n- -fastest : MAX(57-19*log10(N), 79-35*log10(N))\n+ -fastest : MAX(63-19*log10(N), 85-35*log10(N))\n-fast : MAX(63-19*log10(N), 85-35*log10(N))\n-medium : MAX(70-19*log10(N), 95-35*log10(N))\n-thorough : MAX(77-19*log10(N), 105-35*log10(N))\n@@ -381,11 +381,11 @@ ADVANCED COMPRESSION\nwith one partition by more than the specified factor. Preset\ndefaults are:\n- -fastest : 1.00\n- -fast : 1.00\n- -medium : 1.20\n- -thorough : 2.50\n- -exhaustive : 10.00\n+ -fastest : 1.0\n+ -fast : 1.0\n+ -medium : 1.2\n+ -thorough : 2.5\n+ -exhaustive : 10.0\n-3partitionlimitfactor <factor>\nStop compression work on a block after only testing blocks with\n@@ -407,8 +407,8 @@ ADVANCED COMPRESSION\nnormal maps. Preset defaults are:\n-fastest : 0.50\n- -fast : 0.50\n- -medium : 0.75\n+ -fast : 0.65\n+ -medium : 0.85\n-thorough : 0.95\n-exhaustive : 0.99\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update -help to match latest presets
61,745
26.10.2021 22:43:50
-3,600
838b8d1297bc051d0bcc1045e2b6678028c94bd4
Add deblocking to all -normal modes
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_entry.cpp", "new_path": "Source/astcenc_entry.cpp", "diff": "@@ -661,9 +661,12 @@ astcenc_error astcenc_config_init(\nconfig.tune_3_partition_early_out_limit_factor *= 1.5f;\nconfig.tune_2_plane_early_out_limit_correlation = 0.99f;\n+ // Normals are prone to blocking artifacts on smooth curves\n+ // so force compressor to try harder here ...\n+ config.b_deblock_weight = 1.8f;\n+\nif (flags & ASTCENC_FLG_USE_PERCEPTUAL)\n{\n- config.b_deblock_weight = 1.8f;\nconfig.v_rgba_radius = 3;\nconfig.v_rgba_mean_stdev_mix = 0.0f;\nconfig.v_rgb_mean = 0.0f;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add deblocking to all -normal modes
61,745
26.10.2021 23:53:53
-3,600
a574ae927336859fd58b1064922210a69b906c30
Remove -normal mode error weighting heuristic In principle this was an estimator of angular error significance, but in practice it causes block artifacts and doesn't seem to help much
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -1093,19 +1093,6 @@ static float prepare_error_weight_block(\nerror_weight = 1.0f / error_weight;\n}\n- if (ctx.config.flags & ASTCENC_FLG_MAP_NORMAL)\n- {\n- // Convert from 0 to 1 to -1 to +1 range.\n- float xN = ((blk.data_r[idx] * (1.0f / 65535.0f)) - 0.5f) * 2.0f;\n- float yN = ((blk.data_a[idx] * (1.0f / 65535.0f)) - 0.5f) * 2.0f;\n-\n- float denom = 1.0f - xN * xN - yN * yN;\n- denom = astc::max(denom, 0.1f);\n- denom = 1.0f / denom;\n- error_weight.set_lane<0>(error_weight.lane<0>() * (1.0f + xN * xN * denom));\n- error_weight.set_lane<3>(error_weight.lane<3>() * (1.0f + yN * yN * denom));\n- }\n-\nif (ctx.config.flags & ASTCENC_FLG_USE_ALPHA_WEIGHT)\n{\nfloat alpha_scale;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove -normal mode error weighting heuristic In principle this was an estimator of angular error significance, but in practice it causes block artifacts and doesn't seem to help much
61,745
26.10.2021 23:55:40
-3,600
e7cb1e453968b0e16e48ef6d68fc9d1227d8a378
Give normals a slightly higher search quality threshold
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_entry.cpp", "new_path": "Source/astcenc_entry.cpp", "diff": "@@ -664,6 +664,7 @@ astcenc_error astcenc_config_init(\n// Normals are prone to blocking artifacts on smooth curves\n// so force compressor to try harder here ...\nconfig.b_deblock_weight = 1.8f;\n+ config.tune_db_limit *= 1.03f;\nif (flags & ASTCENC_FLG_USE_PERCEPTUAL)\n{\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Give normals a slightly higher search quality threshold
61,750
08.11.2021 09:35:08
0
b36b9af07467e62f815dc39d5e6cfba69d43230d
Update Coverity client and licence
[ { "change_type": "MODIFY", "old_path": "jenkins/build-image.sh", "new_path": "jenkins/build-image.sh", "diff": "#!/usr/bin/env bash\n-DOCKER_REGISTRY=mobile-studio--docker.eu-west-1.artifactory.aws.arm.com\n+ARTIFACTORY_URL=eu-west-1.artifactory.aws.arm.com\n+DOCKER_REGISTRY=mobile-studio--docker.${ARTIFACTORY_URL}\nIMAGE_NAME=astcenc\n-IMAGE_VERSION=3.0.0\n+IMAGE_VERSION=3.1.0\n# Check Artifactory credentials are set\nif [[ -z \"${ARTIFACTORY_CREDENTIALS}\" ]]\n@@ -17,11 +18,8 @@ rm -fr tmp\nmkdir -p tmp\necho \"Get static analysis tools\"\n-curl --user ${ARTIFACTORY_CREDENTIALS} https://eu-west-1.artifactory.aws.arm.com/artifactory/mobile-studio.tools/coverity201909.tar.xz --output tmp/coverity.tar.xz\n-pushd tmp\n- tar xf coverity.tar.xz\n- rm coverity.tar.xz\n-popd\n+curl --user ${ARTIFACTORY_CREDENTIALS} https://${ARTIFACTORY_URL}/artifactory/mobile-studio.tools/coverity/cov-analysis-linux64-2020.12.sh --output tmp/coverity_install.sh\n+curl --user ${ARTIFACTORY_CREDENTIALS} https://${ARTIFACTORY_URL}/artifactory/mobile-studio.tools/coverity/license.dat --output tmp/coverity_license.dat\necho \"Building image\"\ndocker build -f jenkins/build.Dockerfile \\\n" }, { "change_type": "MODIFY", "old_path": "jenkins/build.Dockerfile", "new_path": "jenkins/build.Dockerfile", "diff": "@@ -2,7 +2,8 @@ FROM ubuntu:18.04\nRUN useradd -u 1000 -U -m -c Jenkins jenkins\n-RUN apt update && apt-get install -y \\\n+RUN apt update && apt -y upgrade \\\n+ && apt install -y \\\nsoftware-properties-common \\\nclang \\\nclang++-9 \\\n@@ -18,15 +19,18 @@ RUN apt update && apt-get install -y \\\npython3-pil \\\nca-certificates \\\ngnupg \\\n- wget\n+ wget \\\n+ && rm -rf /var/lib/apt/lists/*\n# Install python modules\nRUN pip3 install requests\n# Install Coverity static analysis tools\n-COPY cov-analysis-linux64-2019.09 /coverity/\n-RUN chmod -R a+rw /coverity\n-ENV PATH=\"/coverity/bin:$PATH\"\n+COPY coverity_* /tmp/\n+RUN chmod 555 /tmp/coverity_install.sh && \\\n+ /tmp/coverity_install.sh -q --license.region=6 --license.agreement=agree --license.cov.path=/tmp/coverity_license.dat -dir /usr/local/cov-analysis && \\\n+ rm /tmp/coverity_*\n+ENV PATH=\"/usr/local/cov-analysis/bin:$PATH\"\n# Install up-to-date CMake, as standard Ubuntu 18.04 package is too old\nRUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \\\n" }, { "change_type": "MODIFY", "old_path": "jenkins/nightly.Jenkinsfile", "new_path": "jenkins/nightly.Jenkinsfile", "diff": "@@ -41,7 +41,7 @@ pipeline {\n- name: artifactory-ms-docker\ncontainers:\n- name: astcenc\n- image: mobile-studio--docker.eu-west-1.artifactory.aws.arm.com/astcenc:3.0.0\n+ image: mobile-studio--docker.eu-west-1.artifactory.aws.arm.com/astcenc:3.1.0\ncommand:\n- sleep\nargs:\n" }, { "change_type": "MODIFY", "old_path": "jenkins/release.Jenkinsfile", "new_path": "jenkins/release.Jenkinsfile", "diff": "@@ -43,7 +43,7 @@ spec:\n- name: artifactory-ms-docker\ncontainers:\n- name: astcenc\n- image: mobile-studio--docker.eu-west-1.artifactory.aws.arm.com/astcenc:3.0.0\n+ image: mobile-studio--docker.eu-west-1.artifactory.aws.arm.com/astcenc:3.1.0\ncommand:\n- sleep\nargs:\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
QE-2641: Update Coverity client and licence (#298)
61,745
08.11.2021 09:51:25
0
99d23d833efdc0f09c83cf85a63f1ea43b0318e7
Define Coverity config file
[ { "change_type": "MODIFY", "old_path": "jenkins/release.Jenkinsfile", "new_path": "jenkins/release.Jenkinsfile", "diff": "@@ -75,9 +75,9 @@ spec:\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON ..\n- cov-configure --template --compiler cc --comptype gcc\n- cov-configure --template --compiler c++ --comptype g++\n- cov-build --dir ${WORKSPACE}/intermediate make install\n+ cov-configure --config ${WORKSPACE}/coverity.conf --template --compiler cc --comptype gcc\n+ cov-configure --config ${WORKSPACE}/coverity.conf --template --compiler c++ --comptype g++\n+ cov-build --config ${WORKSPACE}/coverity.conf --dir ${WORKSPACE}/intermediate make install\ncov-analyze --dir ${WORKSPACE}/intermediate\ncov-commit-defects --dir ${WORKSPACE}/intermediate \\\\\n--stream astcenc-master \\\\\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
QE-2641: Define Coverity config file (#299)
61,745
08.11.2021 13:42:29
0
1eeeb2da46ddeec2ee722d45f4c941ba04c853a2
Add missing separator to package builds
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -215,7 +215,7 @@ if(PACKAGE)\nset(PKG_VER ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR})\n- set(CPACK_PACKAGE_FILE_NAME \"astcenc-${PKG_VER}-${PKG_OS}${PACKAGE}\")\n+ set(CPACK_PACKAGE_FILE_NAME \"astcenc-${PKG_VER}-${PKG_OS}-${PACKAGE}\")\nset(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)\nset(CPACK_PACKAGE_CHECKSUM SHA256)\nset(CPACK_GENERATOR ZIP)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add missing separator to package builds
61,745
08.11.2021 14:32:30
0
954af82d2832aa2707d936c5aa5522c76ecd4426
Update change log for 3.3 release
[ { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-3x.md", "new_path": "Docs/ChangeLog-3x.md", "diff": "@@ -4,7 +4,42 @@ This page summarizes the major functional and performance changes in each\nrelease of the 3.x series.\nAll performance data on this page is measured on an Intel Core i5-9600K\n-clocked at 4.2 GHz, running astcenc using AVX2 and 6 threads.\n+clocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.\n+\n+\n+<!-- ---------------------------------------------------------------------- -->\n+## 3.3\n+\n+**Status:** November 2021\n+\n+The 3.3 release improves image quality for normal maps, and two component\n+textures. Normal maps are expected to compress 25% slower than the 3.2\n+release, although it should be noted that they are still faster to compress\n+in 3.3 than when using the 2.5 series. This release also fixes one reported\n+stability issue.\n+\n+* **General:**\n+ * **Feature:** Normal map image quality has been improved.\n+ * **Feature:** Two component image quality has been improved, provided\n+ that unused components are correctly zero-weighted using e.g. `-cw` on the\n+ command line.\n+ * **Bug-fix:** Improved stability when trying to compress complex blocks that\n+ could not beat even the starting quality threshold. These will now always\n+ compress in to a constant color blocks.\n+\n+<!-- ---------------------------------------------------------------------- -->\n+## 3.2\n+\n+**Status:** August 2021\n+\n+The 3.2 release is a bugfix release; no significant image quality or\n+performance differences are expected.\n+\n+* **General:**\n+ * **Bug-fix:** Improved stability when new contexts were created while other\n+ contexts were compressing or decompressing an image.\n+ * **Bug-fix:** Improved stability when decompressing blocks with invalid\n+ block encodings.\n<!-- ---------------------------------------------------------------------- -->\n## 3.1\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update change log for 3.3 release
61,745
02.12.2021 13:12:56
0
a287627df60809a2a32fe959757d7b3112716a6f
Delete Test/Images/KodakLite directory
[ { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-avx2_fast_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,41.5438,0.0722,0.0511,7.6876\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.4252,0.0656,0.0443,8.8718\n-KodakLite,4x4,ldr-rgb-kodak15.png,44.5130,0.0586,0.0369,10.6485\n-KodakLite,4x4,ldr-rgb-kodak17.png,45.7496,0.0421,0.0188,20.9335\n-KodakLite,4x4,ldr-rgb-kodak18.png,41.5761,0.0757,0.0501,7.8439\n-KodakLite,4x4,ldr-rgb-kodak23.png,45.5477,0.0465,0.0262,15.0254\n-KodakLite,5x5,ldr-rgb-kodak05.png,37.3822,0.0667,0.0447,8.7995\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.8071,0.0623,0.0402,9.7898\n-KodakLite,5x5,ldr-rgb-kodak15.png,41.1327,0.0474,0.0249,15.7823\n-KodakLite,5x5,ldr-rgb-kodak17.png,42.0162,0.0403,0.0162,24.2055\n-KodakLite,5x5,ldr-rgb-kodak18.png,38.0826,0.0605,0.0355,11.0778\n-KodakLite,5x5,ldr-rgb-kodak23.png,42.4022,0.0404,0.0193,20.3971\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.3540,0.0814,0.0585,6.7212\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.7856,0.0866,0.0635,6.1910\n-KodakLite,6x6,ldr-rgb-kodak15.png,38.5381,0.0508,0.0273,14.4178\n-KodakLite,6x6,ldr-rgb-kodak17.png,38.9311,0.0445,0.0194,20.2899\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.1082,0.0689,0.0428,9.1839\n-KodakLite,6x6,ldr-rgb-kodak23.png,40.0639,0.0411,0.0195,20.1782\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.2365,0.0954,0.0681,5.7761\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.2153,0.1105,0.0832,4.7281\n-KodakLite,8x8,ldr-rgb-kodak15.png,34.9106,0.0547,0.0269,14.6155\n-KodakLite,8x8,ldr-rgb-kodak17.png,34.8485,0.0520,0.0226,17.3836\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.2442,0.0778,0.0474,8.2937\n-KodakLite,8x8,ldr-rgb-kodak23.png,36.5047,0.0443,0.0179,21.9782\n-KodakLite,12x12,ldr-rgb-kodak05.png,25.8228,0.0798,0.0446,8.8208\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.3252,0.1005,0.0650,6.0474\n-KodakLite,12x12,ldr-rgb-kodak15.png,31.3081,0.0539,0.0186,21.1817\n-KodakLite,12x12,ldr-rgb-kodak17.png,30.8806,0.0531,0.0161,24.4249\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.4237,0.0690,0.0311,12.6533\n-KodakLite,12x12,ldr-rgb-kodak23.png,32.5624,0.0474,0.0134,29.4523\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-avx2_fastest_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,40.7590,0.0520,0.0312,12.6044\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.0931,0.0527,0.0314,12.5216\n-KodakLite,4x4,ldr-rgb-kodak15.png,43.7258,0.0445,0.0229,17.1958\n-KodakLite,4x4,ldr-rgb-kodak17.png,45.4482,0.0380,0.0146,26.8939\n-KodakLite,4x4,ldr-rgb-kodak18.png,41.0795,0.0559,0.0311,12.6351\n-KodakLite,4x4,ldr-rgb-kodak23.png,44.9926,0.0386,0.0183,21.4788\n-KodakLite,5x5,ldr-rgb-kodak05.png,36.9662,0.0528,0.0309,12.7160\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.6885,0.0532,0.0313,12.5648\n-KodakLite,5x5,ldr-rgb-kodak15.png,40.8415,0.0410,0.0186,21.1634\n-KodakLite,5x5,ldr-rgb-kodak17.png,41.8593,0.0377,0.0136,28.8409\n-KodakLite,5x5,ldr-rgb-kodak18.png,37.9188,0.0513,0.0262,15.0353\n-KodakLite,5x5,ldr-rgb-kodak23.png,42.0743,0.0368,0.0157,24.9980\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.1002,0.0577,0.0354,11.1081\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.7197,0.0638,0.0412,9.5390\n-KodakLite,6x6,ldr-rgb-kodak15.png,38.3754,0.0420,0.0190,20.7054\n-KodakLite,6x6,ldr-rgb-kodak17.png,38.8470,0.0392,0.0147,26.6643\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.0120,0.0544,0.0285,13.8193\n-KodakLite,6x6,ldr-rgb-kodak23.png,39.8521,0.0363,0.0147,26.7586\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.0266,0.0743,0.0473,8.3124\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.1418,0.0853,0.0585,6.7266\n-KodakLite,8x8,ldr-rgb-kodak15.png,34.7635,0.0477,0.0206,19.1206\n-KodakLite,8x8,ldr-rgb-kodak17.png,34.7176,0.0467,0.0179,21.9478\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.1628,0.0646,0.0352,11.1823\n-KodakLite,8x8,ldr-rgb-kodak23.png,36.3979,0.0404,0.0147,26.6842\n-KodakLite,12x12,ldr-rgb-kodak05.png,25.6987,0.0645,0.0330,11.9247\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.2380,0.0778,0.0463,8.4985\n-KodakLite,12x12,ldr-rgb-kodak15.png,31.2355,0.0483,0.0155,25.3266\n-KodakLite,12x12,ldr-rgb-kodak17.png,30.8266,0.0473,0.0130,30.2080\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.3668,0.0583,0.0227,17.3468\n-KodakLite,12x12,ldr-rgb-kodak23.png,32.5063,0.0423,0.0111,35.4216\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-avx2_medium_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,42.0787,0.2029,0.1817,2.1645\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.6078,0.1699,0.1483,2.6522\n-KodakLite,4x4,ldr-rgb-kodak15.png,45.3860,0.1585,0.1364,2.8834\n-KodakLite,4x4,ldr-rgb-kodak17.png,46.2753,0.1513,0.1279,3.0754\n-KodakLite,4x4,ldr-rgb-kodak18.png,41.9463,0.2304,0.2054,1.9147\n-KodakLite,4x4,ldr-rgb-kodak23.png,46.7393,0.1813,0.1607,2.4463\n-KodakLite,5x5,ldr-rgb-kodak05.png,37.9653,0.2085,0.1859,2.1152\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.9119,0.1835,0.1608,2.4460\n-KodakLite,5x5,ldr-rgb-kodak15.png,41.8807,0.1443,0.1212,3.2445\n-KodakLite,5x5,ldr-rgb-kodak17.png,42.5304,0.1086,0.0840,4.6806\n-KodakLite,5x5,ldr-rgb-kodak18.png,38.3628,0.2020,0.1755,2.2406\n-KodakLite,5x5,ldr-rgb-kodak23.png,43.4940,0.1262,0.1046,3.7577\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.8070,0.2271,0.2033,1.9344\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.8889,0.2367,0.2128,1.8479\n-KodakLite,6x6,ldr-rgb-kodak15.png,39.2095,0.1428,0.1185,3.3180\n-KodakLite,6x6,ldr-rgb-kodak17.png,39.5028,0.1000,0.0740,5.3157\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.3646,0.2029,0.1757,2.2385\n-KodakLite,6x6,ldr-rgb-kodak23.png,41.0051,0.0974,0.0747,5.2668\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.7508,0.2780,0.2495,1.5761\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.3988,0.3169,0.2884,1.3636\n-KodakLite,8x8,ldr-rgb-kodak15.png,35.8410,0.1611,0.1317,2.9848\n-KodakLite,8x8,ldr-rgb-kodak17.png,35.6791,0.1313,0.1002,3.9229\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.5602,0.2536,0.2212,1.7774\n-KodakLite,8x8,ldr-rgb-kodak23.png,37.6748,0.0972,0.0695,5.6610\n-KodakLite,12x12,ldr-rgb-kodak05.png,26.3963,0.3009,0.2630,1.4950\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.5329,0.3438,0.3059,1.2854\n-KodakLite,12x12,ldr-rgb-kodak15.png,32.2202,0.1254,0.0873,4.5065\n-KodakLite,12x12,ldr-rgb-kodak17.png,31.7754,0.1060,0.0661,5.9512\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.7836,0.2115,0.1700,2.3131\n-KodakLite,12x12,ldr-rgb-kodak23.png,33.5539,0.0842,0.0472,8.3326\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-avx2_thorough_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,42.4039,0.4663,0.4447,0.8843\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.7183,0.4251,0.4031,0.9754\n-KodakLite,4x4,ldr-rgb-kodak15.png,45.7807,0.4576,0.4356,0.9026\n-KodakLite,4x4,ldr-rgb-kodak17.png,46.4627,0.4618,0.4378,0.8981\n-KodakLite,4x4,ldr-rgb-kodak18.png,42.1531,0.5038,0.4788,0.8212\n-KodakLite,4x4,ldr-rgb-kodak23.png,47.1411,0.5023,0.4817,0.8163\n-KodakLite,5x5,ldr-rgb-kodak05.png,38.1870,0.5281,0.5054,0.7780\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.9564,0.4769,0.4502,0.8735\n-KodakLite,5x5,ldr-rgb-kodak15.png,42.1361,0.4967,0.4736,0.8303\n-KodakLite,5x5,ldr-rgb-kodak17.png,42.6114,0.5012,0.4729,0.8315\n-KodakLite,5x5,ldr-rgb-kodak18.png,38.4757,0.5589,0.5330,0.7378\n-KodakLite,5x5,ldr-rgb-kodak23.png,43.8954,0.5607,0.5391,0.7294\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.9888,0.6272,0.6035,0.6516\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.9330,0.5873,0.5633,0.6981\n-KodakLite,6x6,ldr-rgb-kodak15.png,39.4662,0.4883,0.4640,0.8475\n-KodakLite,6x6,ldr-rgb-kodak17.png,39.6618,0.5605,0.5339,0.7366\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.4461,0.6607,0.6301,0.6241\n-KodakLite,6x6,ldr-rgb-kodak23.png,41.4207,0.5665,0.5436,0.7234\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.9155,0.6757,0.6463,0.6084\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.4569,0.7453,0.7164,0.5489\n-KodakLite,8x8,ldr-rgb-kodak15.png,36.0757,0.4584,0.4290,0.9165\n-KodakLite,8x8,ldr-rgb-kodak17.png,35.8814,0.4334,0.4024,0.9772\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.6561,0.6998,0.6673,0.5893\n-KodakLite,8x8,ldr-rgb-kodak23.png,38.1952,0.3464,0.3184,1.2351\n-KodakLite,12x12,ldr-rgb-kodak05.png,26.5893,0.7829,0.7441,0.5284\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.5825,0.9093,0.8708,0.4515\n-KodakLite,12x12,ldr-rgb-kodak15.png,32.7169,0.4260,0.3875,1.0149\n-KodakLite,12x12,ldr-rgb-kodak17.png,32.1339,0.3862,0.3454,1.1385\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.9265,0.6759,0.6344,0.6198\n-KodakLite,12x12,ldr-rgb-kodak23.png,34.3689,0.2835,0.2452,1.6039\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-sse2_fast_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,41.5438,0.0877,0.0663,5.9332\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.4252,0.0797,0.0581,6.7684\n-KodakLite,4x4,ldr-rgb-kodak15.png,44.5130,0.0699,0.0480,8.2004\n-KodakLite,4x4,ldr-rgb-kodak17.png,45.7496,0.0477,0.0238,16.4899\n-KodakLite,4x4,ldr-rgb-kodak18.png,41.5761,0.0908,0.0654,6.0142\n-KodakLite,4x4,ldr-rgb-kodak23.png,45.5477,0.0542,0.0334,11.7652\n-KodakLite,5x5,ldr-rgb-kodak05.png,37.3822,0.0844,0.0620,6.3419\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.8071,0.0789,0.0567,6.9358\n-KodakLite,5x5,ldr-rgb-kodak15.png,41.1327,0.0559,0.0330,11.9153\n-KodakLite,5x5,ldr-rgb-kodak17.png,42.0162,0.0445,0.0204,19.2971\n-KodakLite,5x5,ldr-rgb-kodak18.png,38.0826,0.0747,0.0486,8.0864\n-KodakLite,5x5,ldr-rgb-kodak23.png,42.4022,0.0460,0.0245,16.0535\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.3540,0.1075,0.0843,4.6669\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.7856,0.1169,0.0933,4.2124\n-KodakLite,6x6,ldr-rgb-kodak15.png,38.5381,0.0615,0.0376,10.4693\n-KodakLite,6x6,ldr-rgb-kodak17.png,38.9311,0.0518,0.0261,15.0687\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.1082,0.0877,0.0606,6.4914\n-KodakLite,6x6,ldr-rgb-kodak23.png,40.0639,0.0482,0.0257,15.2752\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.2365,0.1278,0.1002,3.9225\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.2153,0.1512,0.1234,3.1867\n-KodakLite,8x8,ldr-rgb-kodak15.png,34.9106,0.0652,0.0369,10.6493\n-KodakLite,8x8,ldr-rgb-kodak17.png,34.8485,0.0612,0.0311,12.6262\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.2442,0.0994,0.0679,5.7911\n-KodakLite,8x8,ldr-rgb-kodak23.png,36.5047,0.0506,0.0242,16.2573\n-KodakLite,12x12,ldr-rgb-kodak05.png,25.8228,0.1009,0.0657,5.9886\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.3252,0.1312,0.0956,4.1147\n-KodakLite,12x12,ldr-rgb-kodak15.png,31.3081,0.0609,0.0255,15.4009\n-KodakLite,12x12,ldr-rgb-kodak17.png,30.8806,0.0592,0.0223,17.6568\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.4237,0.0824,0.0441,8.9100\n-KodakLite,12x12,ldr-rgb-kodak23.png,32.5624,0.0519,0.0181,21.7682\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-sse2_fastest_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,40.7590,0.0619,0.0406,9.6790\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.0931,0.0628,0.0414,9.5065\n-KodakLite,4x4,ldr-rgb-kodak15.png,43.7258,0.0518,0.0298,13.2080\n-KodakLite,4x4,ldr-rgb-kodak17.png,45.4482,0.0425,0.0190,20.6564\n-KodakLite,4x4,ldr-rgb-kodak18.png,41.0795,0.0665,0.0413,9.5230\n-KodakLite,4x4,ldr-rgb-kodak23.png,44.9926,0.0440,0.0234,16.8056\n-KodakLite,5x5,ldr-rgb-kodak05.png,36.9662,0.0653,0.0431,9.1204\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.6885,0.0663,0.0441,8.9248\n-KodakLite,5x5,ldr-rgb-kodak15.png,40.8415,0.0471,0.0242,16.2360\n-KodakLite,5x5,ldr-rgb-kodak17.png,41.8593,0.0416,0.0173,22.7187\n-KodakLite,5x5,ldr-rgb-kodak18.png,37.9188,0.0614,0.0357,11.0021\n-KodakLite,5x5,ldr-rgb-kodak23.png,42.0743,0.0412,0.0198,19.8334\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.1002,0.0725,0.0498,7.8992\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.7197,0.0814,0.0585,6.7171\n-KodakLite,6x6,ldr-rgb-kodak15.png,38.3754,0.0487,0.0253,15.5170\n-KodakLite,6x6,ldr-rgb-kodak17.png,38.8470,0.0446,0.0195,20.2106\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.0120,0.0657,0.0393,9.9969\n-KodakLite,6x6,ldr-rgb-kodak23.png,39.8521,0.0410,0.0193,20.3696\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.0266,0.0960,0.0689,5.7035\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.1418,0.1133,0.0861,4.5692\n-KodakLite,8x8,ldr-rgb-kodak15.png,34.7635,0.0557,0.0280,14.0430\n-KodakLite,8x8,ldr-rgb-kodak17.png,34.7176,0.0538,0.0245,16.0655\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.1628,0.0802,0.0494,7.9606\n-KodakLite,8x8,ldr-rgb-kodak23.png,36.3979,0.0458,0.0198,19.8363\n-KodakLite,12x12,ldr-rgb-kodak05.png,25.6987,0.0793,0.0466,8.4432\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.2380,0.0995,0.0667,5.8921\n-KodakLite,12x12,ldr-rgb-kodak15.png,31.2355,0.0539,0.0214,18.3961\n-KodakLite,12x12,ldr-rgb-kodak17.png,30.8266,0.0517,0.0170,23.1197\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.3668,0.0675,0.0314,12.5096\n-KodakLite,12x12,ldr-rgb-kodak23.png,32.5063,0.0459,0.0148,26.5724\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-sse2_medium_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,42.0787,0.2707,0.2492,1.5779\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.6078,0.2284,0.2067,1.9021\n-KodakLite,4x4,ldr-rgb-kodak15.png,45.3860,0.2366,0.2141,1.8363\n-KodakLite,4x4,ldr-rgb-kodak17.png,46.2753,0.2315,0.2073,1.8969\n-KodakLite,4x4,ldr-rgb-kodak18.png,41.9463,0.3068,0.2812,1.3984\n-KodakLite,4x4,ldr-rgb-kodak23.png,46.7393,0.2410,0.2202,1.7860\n-KodakLite,5x5,ldr-rgb-kodak05.png,37.9653,0.2980,0.2751,1.4296\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.9119,0.2669,0.2437,1.6132\n-KodakLite,5x5,ldr-rgb-kodak15.png,41.8807,0.2000,0.1765,2.2274\n-KodakLite,5x5,ldr-rgb-kodak17.png,42.5304,0.1483,0.1231,3.1950\n-KodakLite,5x5,ldr-rgb-kodak18.png,38.3628,0.2846,0.2582,1.5230\n-KodakLite,5x5,ldr-rgb-kodak23.png,43.4940,0.1786,0.1561,2.5197\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.8070,0.3362,0.3123,1.2592\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.8889,0.3492,0.3252,1.2090\n-KodakLite,6x6,ldr-rgb-kodak15.png,39.2095,0.2005,0.1753,2.2427\n-KodakLite,6x6,ldr-rgb-kodak17.png,39.5028,0.1376,0.1111,3.5382\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.3646,0.2934,0.2656,1.4806\n-KodakLite,6x6,ldr-rgb-kodak23.png,41.0051,0.1341,0.1107,3.5532\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.7508,0.4196,0.3907,1.0063\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.3988,0.4756,0.4458,0.8821\n-KodakLite,8x8,ldr-rgb-kodak15.png,35.8410,0.2006,0.1709,2.3012\n-KodakLite,8x8,ldr-rgb-kodak17.png,35.6791,0.1645,0.1331,2.9542\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.5602,0.3367,0.3044,1.2918\n-KodakLite,8x8,ldr-rgb-kodak23.png,37.6748,0.1329,0.1046,3.7581\n-KodakLite,12x12,ldr-rgb-kodak05.png,26.3963,0.4432,0.4051,0.9707\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.5329,0.5106,0.4725,0.8321\n-KodakLite,12x12,ldr-rgb-kodak15.png,32.2202,0.1701,0.1318,2.9837\n-KodakLite,12x12,ldr-rgb-kodak17.png,31.7754,0.1419,0.1014,3.8775\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.7836,0.3043,0.2619,1.5013\n-KodakLite,12x12,ldr-rgb-kodak23.png,33.5539,0.1082,0.0706,5.5661\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-sse2_thorough_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,42.4039,0.6148,0.5933,0.6628\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.7183,0.5484,0.5264,0.7469\n-KodakLite,4x4,ldr-rgb-kodak15.png,45.7807,0.6046,0.5822,0.6753\n-KodakLite,4x4,ldr-rgb-kodak17.png,46.4627,0.6033,0.5793,0.6788\n-KodakLite,4x4,ldr-rgb-kodak18.png,42.1531,0.6592,0.6337,0.6205\n-KodakLite,4x4,ldr-rgb-kodak23.png,47.1411,0.6640,0.6431,0.6114\n-KodakLite,5x5,ldr-rgb-kodak05.png,38.1870,0.7438,0.7186,0.5472\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.9564,0.6585,0.6353,0.6189\n-KodakLite,5x5,ldr-rgb-kodak15.png,42.1361,0.6963,0.6724,0.5848\n-KodakLite,5x5,ldr-rgb-kodak17.png,42.6114,0.7000,0.6745,0.5830\n-KodakLite,5x5,ldr-rgb-kodak18.png,38.4757,0.7851,0.7585,0.5184\n-KodakLite,5x5,ldr-rgb-kodak23.png,43.8954,0.7893,0.7670,0.5127\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.9888,0.9091,0.8850,0.4443\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.9330,0.8517,0.8273,0.4753\n-KodakLite,6x6,ldr-rgb-kodak15.png,39.4662,0.7056,0.6810,0.5774\n-KodakLite,6x6,ldr-rgb-kodak17.png,39.6618,0.8107,0.7843,0.5014\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.4461,0.9556,0.9262,0.4246\n-KodakLite,6x6,ldr-rgb-kodak23.png,41.4207,0.8235,0.8001,0.4914\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.9155,1.0177,0.9870,0.3984\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.4569,1.1246,1.0951,0.3591\n-KodakLite,8x8,ldr-rgb-kodak15.png,36.0757,0.6845,0.6546,0.6007\n-KodakLite,8x8,ldr-rgb-kodak17.png,35.8814,0.6537,0.6218,0.6324\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.6561,1.0508,1.0177,0.3864\n-KodakLite,8x8,ldr-rgb-kodak23.png,38.1952,0.5180,0.4881,0.8056\n-KodakLite,12x12,ldr-rgb-kodak05.png,26.5893,1.1844,1.1460,0.3431\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.5825,1.3816,1.3424,0.2929\n-KodakLite,12x12,ldr-rgb-kodak15.png,32.7169,0.6342,0.5935,0.6626\n-KodakLite,12x12,ldr-rgb-kodak17.png,32.1339,0.5737,0.5319,0.7393\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.9265,1.0196,0.9751,0.4033\n-KodakLite,12x12,ldr-rgb-kodak23.png,34.3689,0.4144,0.3763,1.0450\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-sse4.1_fast_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,41.5438,0.0763,0.0552,7.1285\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.4252,0.0699,0.0486,8.0905\n-KodakLite,4x4,ldr-rgb-kodak15.png,44.5130,0.0621,0.0402,9.7725\n-KodakLite,4x4,ldr-rgb-kodak17.png,45.7496,0.0447,0.0211,18.6394\n-KodakLite,4x4,ldr-rgb-kodak18.png,41.5761,0.0794,0.0546,7.2069\n-KodakLite,4x4,ldr-rgb-kodak23.png,45.5477,0.0493,0.0288,13.6330\n-KodakLite,5x5,ldr-rgb-kodak05.png,37.3822,0.0739,0.0518,7.5877\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.8071,0.0694,0.0473,8.3176\n-KodakLite,5x5,ldr-rgb-kodak15.png,41.1327,0.0507,0.0281,13.9930\n-KodakLite,5x5,ldr-rgb-kodak17.png,42.0162,0.0421,0.0178,22.0723\n-KodakLite,5x5,ldr-rgb-kodak18.png,38.0826,0.0664,0.0414,9.4973\n-KodakLite,5x5,ldr-rgb-kodak23.png,42.4022,0.0422,0.0215,18.3044\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.3540,0.0951,0.0720,5.4616\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.7856,0.1029,0.0794,4.9515\n-KodakLite,6x6,ldr-rgb-kodak15.png,38.5381,0.0561,0.0325,12.0986\n-KodakLite,6x6,ldr-rgb-kodak17.png,38.9311,0.0482,0.0228,17.2380\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.1082,0.0787,0.0519,7.5818\n-KodakLite,6x6,ldr-rgb-kodak23.png,40.0639,0.0446,0.0224,17.5684\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.2365,0.1134,0.0860,4.5707\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.2153,0.1336,0.1059,3.7127\n-KodakLite,8x8,ldr-rgb-kodak15.png,34.9106,0.0600,0.0320,12.2930\n-KodakLite,8x8,ldr-rgb-kodak17.png,34.8485,0.0570,0.0271,14.5050\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.2442,0.0892,0.0583,6.7475\n-KodakLite,8x8,ldr-rgb-kodak23.png,36.5047,0.0475,0.0211,18.6244\n-KodakLite,12x12,ldr-rgb-kodak05.png,25.8228,0.0915,0.0569,6.9162\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.3252,0.1187,0.0834,4.7121\n-KodakLite,12x12,ldr-rgb-kodak15.png,31.3081,0.0582,0.0224,17.5708\n-KodakLite,12x12,ldr-rgb-kodak17.png,30.8806,0.0563,0.0188,20.8969\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.4237,0.0764,0.0383,10.2715\n-KodakLite,12x12,ldr-rgb-kodak23.png,32.5624,0.0497,0.0157,25.0056\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-sse4.1_fastest_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,40.7590,0.0552,0.0340,11.5696\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.0931,0.0559,0.0346,11.3785\n-KodakLite,4x4,ldr-rgb-kodak15.png,43.7258,0.0470,0.0252,15.6025\n-KodakLite,4x4,ldr-rgb-kodak17.png,45.4482,0.0400,0.0169,23.2353\n-KodakLite,4x4,ldr-rgb-kodak18.png,41.0795,0.0594,0.0345,11.3890\n-KodakLite,4x4,ldr-rgb-kodak23.png,44.9926,0.0406,0.0203,19.4066\n-KodakLite,5x5,ldr-rgb-kodak05.png,36.9662,0.0581,0.0362,10.8723\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.6885,0.0588,0.0367,10.7088\n-KodakLite,5x5,ldr-rgb-kodak15.png,40.8415,0.0434,0.0210,18.7406\n-KodakLite,5x5,ldr-rgb-kodak17.png,41.8593,0.0392,0.0151,26.0614\n-KodakLite,5x5,ldr-rgb-kodak18.png,37.9188,0.0557,0.0307,12.8205\n-KodakLite,5x5,ldr-rgb-kodak23.png,42.0743,0.0382,0.0175,22.4283\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.1002,0.0648,0.0423,9.2869\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.7197,0.0726,0.0499,7.8799\n-KodakLite,6x6,ldr-rgb-kodak15.png,38.3754,0.0453,0.0222,17.7131\n-KodakLite,6x6,ldr-rgb-kodak17.png,38.8470,0.0419,0.0176,22.3751\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.0120,0.0601,0.0338,11.6209\n-KodakLite,6x6,ldr-rgb-kodak23.png,39.8521,0.0385,0.0169,23.2399\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.0266,0.0861,0.0592,6.6448\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.1418,0.1011,0.0740,5.3110\n-KodakLite,8x8,ldr-rgb-kodak15.png,34.7635,0.0518,0.0246,16.0168\n-KodakLite,8x8,ldr-rgb-kodak17.png,34.7176,0.0504,0.0219,17.9953\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.1628,0.0729,0.0431,9.1286\n-KodakLite,8x8,ldr-rgb-kodak23.png,36.3979,0.0431,0.0172,22.8190\n-KodakLite,12x12,ldr-rgb-kodak05.png,25.6987,0.0729,0.0408,9.6301\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.2380,0.0906,0.0582,6.7601\n-KodakLite,12x12,ldr-rgb-kodak15.png,31.2355,0.0510,0.0184,21.3172\n-KodakLite,12x12,ldr-rgb-kodak17.png,30.8266,0.0498,0.0158,24.8653\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.3668,0.0632,0.0279,14.1049\n-KodakLite,12x12,ldr-rgb-kodak23.png,32.5063,0.0445,0.0132,29.7530\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-sse4.1_medium_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,42.0787,0.2289,0.2075,1.8955\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.6078,0.1904,0.1684,2.3353\n-KodakLite,4x4,ldr-rgb-kodak15.png,45.3860,0.1782,0.1562,2.5169\n-KodakLite,4x4,ldr-rgb-kodak17.png,46.2753,0.1714,0.1477,2.6619\n-KodakLite,4x4,ldr-rgb-kodak18.png,41.9463,0.2617,0.2367,1.6614\n-KodakLite,4x4,ldr-rgb-kodak23.png,46.7393,0.2045,0.1839,2.1384\n-KodakLite,5x5,ldr-rgb-kodak05.png,37.9653,0.2502,0.2275,1.7285\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.9119,0.2225,0.1996,1.9698\n-KodakLite,5x5,ldr-rgb-kodak15.png,41.8807,0.1718,0.1486,2.6468\n-KodakLite,5x5,ldr-rgb-kodak17.png,42.5304,0.1281,0.1032,3.8098\n-KodakLite,5x5,ldr-rgb-kodak18.png,38.3628,0.2392,0.2130,1.8465\n-KodakLite,5x5,ldr-rgb-kodak23.png,43.4940,0.1497,0.1281,3.0704\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.8070,0.2884,0.2648,1.4848\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.8889,0.3030,0.2776,1.4164\n-KodakLite,6x6,ldr-rgb-kodak15.png,39.2095,0.1753,0.1511,2.6021\n-KodakLite,6x6,ldr-rgb-kodak17.png,39.5028,0.1209,0.0947,4.1506\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.3646,0.2565,0.2293,1.7148\n-KodakLite,6x6,ldr-rgb-kodak23.png,41.0051,0.1186,0.0953,4.1253\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.7508,0.3635,0.3349,1.1742\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.3988,0.4160,0.3872,1.0155\n-KodakLite,8x8,ldr-rgb-kodak15.png,35.8410,0.1774,0.1474,2.6679\n-KodakLite,8x8,ldr-rgb-kodak17.png,35.6791,0.1458,0.1148,3.4265\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.5602,0.2951,0.2627,1.4966\n-KodakLite,8x8,ldr-rgb-kodak23.png,37.6748,0.1177,0.0901,4.3651\n-KodakLite,12x12,ldr-rgb-kodak05.png,26.3963,0.3944,0.3567,1.1025\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.5329,0.4552,0.4171,0.9427\n-KodakLite,12x12,ldr-rgb-kodak15.png,32.2202,0.1542,0.1159,3.3919\n-KodakLite,12x12,ldr-rgb-kodak17.png,31.7754,0.1297,0.0895,4.3956\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.7836,0.2724,0.2311,1.7017\n-KodakLite,12x12,ldr-rgb-kodak23.png,33.5539,0.0992,0.0621,6.3330\n" }, { "change_type": "DELETE", "old_path": "Test/Images/KodakLite/astc_reference-3.3-sse4.1_thorough_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-KodakLite,4x4,ldr-rgb-kodak05.png,42.4039,0.5279,0.5054,0.7780\n-KodakLite,4x4,ldr-rgb-kodak13.png,41.7183,0.4749,0.4534,0.8673\n-KodakLite,4x4,ldr-rgb-kodak15.png,45.7807,0.5203,0.4957,0.7932\n-KodakLite,4x4,ldr-rgb-kodak17.png,46.4627,0.5184,0.4943,0.7955\n-KodakLite,4x4,ldr-rgb-kodak18.png,42.1531,0.5694,0.5441,0.7226\n-KodakLite,4x4,ldr-rgb-kodak23.png,47.1411,0.5697,0.5487,0.7166\n-KodakLite,5x5,ldr-rgb-kodak05.png,38.1870,0.6357,0.6134,0.6410\n-KodakLite,5x5,ldr-rgb-kodak13.png,36.9564,0.5697,0.5449,0.7216\n-KodakLite,5x5,ldr-rgb-kodak15.png,42.1361,0.5997,0.5764,0.6822\n-KodakLite,5x5,ldr-rgb-kodak17.png,42.6114,0.6032,0.5770,0.6815\n-KodakLite,5x5,ldr-rgb-kodak18.png,38.4757,0.6724,0.6447,0.6099\n-KodakLite,5x5,ldr-rgb-kodak23.png,43.8954,0.6790,0.6572,0.5984\n-KodakLite,6x6,ldr-rgb-kodak05.png,34.9888,0.7966,0.7728,0.5088\n-KodakLite,6x6,ldr-rgb-kodak13.png,32.9330,0.7407,0.7164,0.5489\n-KodakLite,6x6,ldr-rgb-kodak15.png,39.4662,0.6166,0.5909,0.6654\n-KodakLite,6x6,ldr-rgb-kodak17.png,39.6618,0.7112,0.6816,0.5769\n-KodakLite,6x6,ldr-rgb-kodak18.png,35.4461,0.8332,0.8058,0.4880\n-KodakLite,6x6,ldr-rgb-kodak23.png,41.4207,0.7179,0.6938,0.5667\n-KodakLite,8x8,ldr-rgb-kodak05.png,30.9155,0.8916,0.8626,0.4559\n-KodakLite,8x8,ldr-rgb-kodak13.png,28.4569,0.9854,0.9542,0.4121\n-KodakLite,8x8,ldr-rgb-kodak15.png,36.0757,0.6008,0.5714,0.6882\n-KodakLite,8x8,ldr-rgb-kodak17.png,35.8814,0.5683,0.5370,0.7323\n-KodakLite,8x8,ldr-rgb-kodak18.png,31.6561,0.9231,0.8904,0.4416\n-KodakLite,8x8,ldr-rgb-kodak23.png,38.1952,0.4491,0.4207,0.9346\n-KodakLite,12x12,ldr-rgb-kodak05.png,26.5893,1.0516,1.0126,0.3883\n-KodakLite,12x12,ldr-rgb-kodak13.png,24.5825,1.2323,1.1935,0.3295\n-KodakLite,12x12,ldr-rgb-kodak15.png,32.7169,0.5660,0.5270,0.7462\n-KodakLite,12x12,ldr-rgb-kodak17.png,32.1339,0.5100,0.4688,0.8387\n-KodakLite,12x12,ldr-rgb-kodak18.png,27.9265,0.9061,0.8640,0.4551\n-KodakLite,12x12,ldr-rgb-kodak23.png,34.3689,0.3691,0.3309,1.1885\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Delete Test/Images/KodakLite directory
61,745
14.12.2021 23:21:49
0
6979e920f1e2b37ee2eb140d9937e4ab0070990f
Remove redundant ; in macro
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "#define promise(cond) if(!(cond)) { __builtin_unreachable(); }\n#endif\n#else\n- #define promise(cond) assert(cond);\n+ #define promise(cond) assert(cond)\n#endif\n/* ============================================================================\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove redundant ; in macro
61,745
14.12.2021 23:22:45
0
159df62cea33461f20bf1c8359fb88a7f8d1b1c8
Remove redundant default in switch
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -447,9 +447,10 @@ static inline unsigned int get_quant_level(quant_method method)\ncase QUANT_160: return 160;\ncase QUANT_192: return 192;\ncase QUANT_256: return 256;\n- // Unreachable - the enum is fully described\n- default: return 0;\n}\n+\n+ // Unreachable - the enum is fully described\n+ return 0;\n}\n/**\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove redundant default in switch
61,745
14.12.2021 23:23:10
0
5cb190482f92320f7ccc29f4978933c984bd7176
Consistently use doubles in angular sum metrics
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_error_metrics.cpp", "new_path": "Source/astcenccli_error_metrics.cpp", "diff": "@@ -129,7 +129,7 @@ void compute_error_metrics(\nkahan_accum4 log_errorsum;\nkahan_accum4 mpsnr_errorsum;\ndouble mean_angular_errorsum = 0.0;\n- float worst_angular_errorsum = 0.0;\n+ double worst_angular_errorsum = 0.0;\nunsigned int dim_x = astc::min(img1->dim_x, img2->dim_x);\nunsigned int dim_y = astc::min(img1->dim_y, img2->dim_y);\n@@ -282,9 +282,9 @@ void compute_error_metrics(\n// Float error can push this outside of valid range for acos, so clamp to avoid NaN issues\nfloat normal_cos = clamp(-1.0f, 1.0f, dot3(normal1, normal2)).lane<0>();\nfloat rad_to_degrees = 180.0f / astc::PI;\n- float error_degrees = std::acos(static_cast<double>(normal_cos)) * static_cast<double>(rad_to_degrees);\n+ double error_degrees = std::acos(static_cast<double>(normal_cos)) * static_cast<double>(rad_to_degrees);\n- mean_angular_errorsum += static_cast<double>(error_degrees) / (dim_x * dim_y * dim_z);\n+ mean_angular_errorsum += error_degrees / (dim_x * dim_y * dim_z);\nworst_angular_errorsum = astc::max(worst_angular_errorsum, error_degrees);\n}\n}\n@@ -396,7 +396,7 @@ void compute_error_metrics(\nif (compute_normal_metrics)\n{\nprintf(\" Mean Angular Error: %9.4f degrees\\n\", mean_angular_errorsum);\n- printf(\" Worst Angular Error: %9.4f degrees\\n\", (double)worst_angular_errorsum);\n+ printf(\" Worst Angular Error: %9.4f degrees\\n\", worst_angular_errorsum);\n}\nprintf(\"\\n\");\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Consistently use doubles in angular sum metrics
61,745
14.12.2021 23:23:36
0
cff6402f4d2b056776b6b854a7a6789978e76098
Suppress Clang12 -Watomic-implicit-seq-cst warning
[ { "change_type": "MODIFY", "old_path": "Source/cmake_core.cmake", "new_path": "Source/cmake_core.cmake", "diff": "@@ -118,6 +118,7 @@ macro(astcenc_set_properties NAME)\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-c++98-c++11-compat-pedantic>\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-float-equal>\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated-declarations>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-atomic-implicit-seq-cst>\n# Clang 10 also throws up warnings we need to investigate (ours)\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-old-style-cast>\n@@ -129,7 +130,6 @@ macro(astcenc_set_properties NAME)\n$<$<CXX_COMPILER_ID:Clang>:-Wdocumentation>)\n-\ntarget_link_options(${NAME}\nPRIVATE\n# Use pthreads on Linux/macOS\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Suppress Clang12 -Watomic-implicit-seq-cst warning
61,745
15.12.2021 07:24:35
0
b789e7b9775d210c945f1b238f70f656a768cd27
Adding Visual Studio ClangCL to build docs
[ { "change_type": "MODIFY", "old_path": "Docs/Building.md", "new_path": "Docs/Building.md", "diff": "@@ -25,19 +25,22 @@ cd build\n# Configure your build of choice, for example:\n# x86-64 using NMake\n-cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.\\ ^\n- -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+cmake -G \"NMake Makefiles\" -T ClangCL -DCMAKE_BUILD_TYPE=Release ^\n+ -DCMAKE_INSTALL_PREFIX=.\\ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n# x86-64 using Visual Studio solution\n-cmake -G \"Visual Studio 16 2019\" -DCMAKE_INSTALL_PREFIX=.\\ ^\n+cmake -G \"Visual Studio 16 2019\" -T ClangCL -DCMAKE_INSTALL_PREFIX=.\\ ^\n-DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n-\n```\nThis example shows all SIMD variants being enabled. It is possible to build a\nsubset of the supported variants by enabling only the ones you require. At\nleast one variant must be enabled.\n+Using the Visual Studio Clang-cl LLVM toolchain (`-T ClangCL`) is optional but\n+produces signficantly faster binaries than the default toolchain. The C++ LLVM\n+toolchain component must be installed via the Visual Studio installer.\n+\n### Building\nOnce you have configured the build you can use NMake to compile the project\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Adding Visual Studio ClangCL to build docs
61,745
23.12.2021 21:46:14
0
49f08b2f6ce6a820676f09a42cae23f244e37043
Use += accumulators in SIMD code
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_averages_and_directions.cpp", "new_path": "Source/astcenc_averages_and_directions.cpp", "diff": "@@ -619,7 +619,7 @@ void compute_error_squared_rgba(\nsamec_err = select(vfloat::zero(), samec_err, mask);\nhaccumulate(samec_errorsumv, samec_err);\n- lane_ids = lane_ids + vint(ASTCENC_SIMD_WIDTH);\n+ lane_ids += vint(ASTCENC_SIMD_WIDTH);\n}\nuncor_loparam = hmin_s(uncor_loparamv);\n@@ -765,7 +765,7 @@ void compute_error_squared_rgb(\nsamec_err = select(vfloat::zero(), samec_err, mask);\nhaccumulate(samec_errorsumv, samec_err);\n- lane_ids = lane_ids + vint(ASTCENC_SIMD_WIDTH);\n+ lane_ids += vint(ASTCENC_SIMD_WIDTH);\n}\nuncor_loparam = hmin_s(uncor_loparamv);\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_pick_best_endpoint_format.cpp", "new_path": "Source/astcenc_pick_best_endpoint_format.cpp", "diff": "@@ -213,8 +213,8 @@ static void compute_encoding_choice_errors(\nline3 rgb_luma_lines; // for HDR-RGB-scale\nprocessed_line3 uncor_rgb_plines;\n- processed_line3 samec_rgb_plines; // for LDR-RGB-scale\n- processed_line3 rgb_luma_plines; // for HDR-RGB-scale\n+ processed_line3 samec_rgb_plines;\n+ processed_line3 rgb_luma_plines;\nprocessed_line3 luminance_plines;\nfloat uncorr_rgb_error;\n@@ -1301,7 +1301,7 @@ unsigned int compute_ideal_endpoint_formats(\nvmask mask = mask1 & mask2;\nvbest_ep_error = select(vbest_ep_error, err, mask);\nvbest_error_index = select(vbest_error_index, lane_ids, mask);\n- lane_ids = lane_ids + vint(ASTCENC_SIMD_WIDTH);\n+ lane_ids += vint(ASTCENC_SIMD_WIDTH);\n}\n// Pick best mode from the SIMD result, using lowest matching index to ensure invariance\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenccli_image_load_store.cpp", "new_path": "Source/astcenccli_image_load_store.cpp", "diff": "@@ -781,7 +781,7 @@ struct ktx_header\nuint32_t endianness; // should be 0x04030201; if it is instead 0x01020304, then the endianness of everything must be switched.\nuint32_t gl_type; // 0 for compressed textures, otherwise value from table 3.2 (page 162) of OpenGL 4.0 spec\nuint32_t gl_type_size; // size of data elements to do endianness swap on (1=endian-neutral data)\n- uint32_t gl_format; // 0 for compressed textures, otherwise value from table 3.3 (page 163) of OpenGLl spec\n+ uint32_t gl_format; // 0 for compressed textures, otherwise value from table 3.3 (page 163) of OpenGL spec\nuint32_t gl_internal_format; // sized-internal-format, corresponding to table 3.12 to 3.14 (pages 182-185) of OpenGL spec\nuint32_t gl_base_internal_format; // unsized-internal-format: corresponding to table 3.11 (page 179) of OpenGL spec\nuint32_t pixel_width; // texture dimensions; not rounded up to block size for compressed.\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Use += accumulators in SIMD code
61,745
27.12.2021 18:47:10
0
56125862a0fd257b299a3fd21c526619faf58559
Fix example error message
[ { "change_type": "MODIFY", "old_path": "Utils/Example/astc_api_example.cpp", "new_path": "Utils/Example/astc_api_example.cpp", "diff": "@@ -68,7 +68,7 @@ int main(int argc, char **argv)\nuint8_t *image_data = (uint8_t*)stbi_load(argv[1], &image_x, &image_y, &image_c, 4);\nif (!image_data)\n{\n- printf(\"Failed to load image \\\"%s\\\"\\n\", image_data);\n+ printf(\"Failed to load image \\\"%s\\\"\\n\", argv[1]);\nreturn 1;\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix example error message
61,745
12.01.2022 11:08:30
0
f0a0f730622d82311f14cd7ad84bb1389b855eea
Expose -j option for test runner to allow scaling tests
[ { "change_type": "MODIFY", "old_path": "Test/astc_test_image.py", "new_path": "Test/astc_test_image.py", "diff": "#!/usr/bin/env python3\n# SPDX-License-Identifier: Apache-2.0\n# -----------------------------------------------------------------------------\n-# Copyright 2019-2021 Arm Limited\n+# Copyright 2019-2022 Arm Limited\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy\n@@ -164,7 +164,7 @@ def format_result(image, reference, result):\ndef run_test_set(encoder, testRef, testSet, quality, blockSizes, testRuns,\n- keepOutput):\n+ keepOutput, threads):\n\"\"\"\nExecute all tests in the test set.\n@@ -178,6 +178,7 @@ def run_test_set(encoder, testRef, testSet, quality, blockSizes, testRuns,\nkeepOutput (bool): Should the test preserve output images? This is\nonly a hint and discarding output may be ignored if the encoder\nversion used can't do it natively.\n+ threads (int or None): The thread count to use.\nReturns:\nResultSet: The test results.\n@@ -203,7 +204,7 @@ def run_test_set(encoder, testRef, testSet, quality, blockSizes, testRuns,\ndat = (curCount, maxCount, blkSz, image.testFile)\nprint(\"Running %u/%u %s %s ... \" % dat, end='', flush=True)\nres = encoder.run_test(image, blkSz, \"-%s\" % quality, testRuns,\n- keepOutput)\n+ keepOutput, threads)\nres = trs.Record(blkSz, image.testFile, res[0], res[1], res[2], res[3])\nresultSet.add_record(res)\n@@ -350,6 +351,10 @@ def parse_command_line():\nparser.add_argument(\"--keep-output\", dest=\"keepOutput\", default=False,\naction=\"store_true\", help=\"keep image output\")\n+ parser.add_argument(\"-j\", dest=\"threads\", default=None,\n+ type=int, help=\"thread count\")\n+\n+\nargs = parser.parse_args()\n# Turn things into canonical format lists\n@@ -421,7 +426,7 @@ def main():\nresultSet = run_test_set(encoder, testRef, testSet, quality,\nargs.blockSizes, testRepeats,\n- args.keepOutput)\n+ args.keepOutput, args.threads)\nresultSet.save_to_file(testRes)\n" }, { "change_type": "MODIFY", "old_path": "Test/testlib/encoder.py", "new_path": "Test/testlib/encoder.py", "diff": "# SPDX-License-Identifier: Apache-2.0\n# -----------------------------------------------------------------------------\n-# Copyright 2019-2021 Arm Limited\n+# Copyright 2019-2022 Arm Limited\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy\n@@ -61,7 +61,7 @@ class EncoderBase():\nself.binary = binary\ndef build_cli(self, image, blockSize=\"6x6\", preset=\"-thorough\",\n- keepOutput=True):\n+ keepOutput=True, threads=None):\n\"\"\"\nBuild the command line needed for the given test.\n@@ -72,6 +72,7 @@ class EncoderBase():\nkeepOutput (bool): Should the test preserve output images? This is\nonly a hint and discarding output may be ignored if the encoder\nversion used can't do it natively.\n+ threads (int or None): The thread count to use.\nReturns:\nlist(str): A list of command line arguments.\n@@ -186,7 +187,8 @@ class EncoderBase():\n# pylint: disable=unused-argument,no-self-use,redundant-returns-doc\nassert False, \"Missing subclass implementation\"\n- def run_test(self, image, blockSize, preset, testRuns, keepOutput=True):\n+ def run_test(self, image, blockSize, preset, testRuns, keepOutput=True,\n+ threads=None):\n\"\"\"\nRun the test N times.\n@@ -198,6 +200,7 @@ class EncoderBase():\nkeepOutput (bool): Should the test preserve output images? This is\nonly a hint and discarding output may be ignored if the encoder\nversion used can't do it natively.\n+ threads (int or None): The thread count to use.\nReturns:\ntuple(float, float, float, float): Returns the best results from\n@@ -205,7 +208,7 @@ class EncoderBase():\n(seconds), and coding rate (M pixels/s).\n\"\"\"\n# pylint: disable=assignment-from-no-return\n- command = self.build_cli(image, blockSize, preset, keepOutput)\n+ command = self.build_cli(image, blockSize, preset, keepOutput, threads)\n# Execute test runs\nbestPSNR = 0\n@@ -258,7 +261,7 @@ class Encoder2x(EncoderBase):\nsuper().__init__(name, variant, binary)\ndef build_cli(self, image, blockSize=\"6x6\", preset=\"-thorough\",\n- keepOutput=True):\n+ keepOutput=True, threads=None):\nopmode = self.SWITCHES[image.colorProfile]\nsrcPath = image.filePath\n@@ -290,10 +293,9 @@ class Encoder2x(EncoderBase):\ncommand.append(\"-a\")\ncommand.append(\"1\")\n- # Limit core count on NEON builds to avoid test device throttling\n- if self.variant == \"neon\":\n+ if threads is not None:\ncommand.append(\"-j\")\n- command.append(\"2\")\n+ command.append(\"%u\" % threads)\nreturn command\n@@ -361,7 +363,7 @@ class Encoder1_7(EncoderBase):\nsuper().__init__(name, None, binary)\ndef build_cli(self, image, blockSize=\"6x6\", preset=\"-thorough\",\n- keepOutput=True):\n+ keepOutput=True, threads=None):\nif preset == \"-fastest\":\npreset = \"-fast\"\n@@ -394,6 +396,10 @@ class Encoder1_7(EncoderBase):\nif image.isAlphaScaled:\ncommand.append(\"-alphablend\")\n+ if threads is not None:\n+ command.append(\"-j\")\n+ command.append(\"%u\" % threads)\n+\nreturn command\ndef get_psnr_pattern(self, image):\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Expose -j option for test runner to allow scaling tests
61,745
17.01.2022 22:19:35
0
69695e524e9b083aa50ce1424ae2579af6367d52
Move core logging to DIAGNOSTICS builds
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -1541,7 +1541,7 @@ END_OF_TESTS:\n// TODO: Do something more sensible here, such as average color block\nif (scb.block_type == SYM_BTYPE_ERROR)\n{\n-#if !defined(NDEBUG)\n+#if defined(ASTCENC_DIAGNOSTICS)\nstatic bool printed_once = false;\nif (!printed_once)\n{\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_weight_align.cpp", "new_path": "Source/astcenc_weight_align.cpp", "diff": "@@ -65,7 +65,7 @@ static const unsigned int quantization_steps_for_level[13] {\nalignas(ASTCENC_VECALIGN) static float sin_table[SINCOS_STEPS][ANGULAR_STEPS];\nalignas(ASTCENC_VECALIGN) static float cos_table[SINCOS_STEPS][ANGULAR_STEPS];\n-#if !defined(NDEBUG)\n+#if defined(ASTCENC_DIAGNOSTICS)\nstatic bool print_once { true };\n#endif\n@@ -329,7 +329,7 @@ static void compute_angular_endpoints_for_quant_levels(\nint bsi = (int)best_results[q].lane<1>();\n// Did we find anything?\n-#if !defined(NDEBUG)\n+#if defined(ASTCENC_DIAGNOSTICS)\nif ((bsi < 0) && print_once)\n{\nprint_once = false;\n@@ -493,7 +493,7 @@ static void compute_angular_endpoints_for_quant_levels_lwc(\nint bsi = best_index[q];\n// Did we find anything?\n-#if !defined(NDEBUG)\n+#if defined(ASTCENC_DIAGNOSTICS)\nif ((bsi < 0) && print_once)\n{\nprint_once = false;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Move core logging to DIAGNOSTICS builds
61,745
17.01.2022 23:14:10
0
f75966e6d044f8dccb8f9405a6eb1875b0ebb21f
Return best partition candidate first
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -1494,25 +1494,24 @@ void compress_block(\n// Find best blocks for 2, 3 and 4 partitions\nfor (int partition_count = 2; partition_count <= max_partitions; partition_count++)\n{\n- unsigned int partition_indices_1plane[2] { 0, 0 };\n+ unsigned int partition_indices[2] { 0 };\nfind_best_partition_candidates(*bsd, blk, ewb, partition_count,\nctx.config.tune_partition_index_limit,\n- partition_indices_1plane[0],\n- partition_indices_1plane[1]);\n+ partition_indices);\n- for (int i = 0; i < 2; i++)\n+ for (unsigned int i = 0; i < 2; i++)\n{\nTRACE_NODE(node1, \"pass\");\ntrace_add_data(\"partition_count\", partition_count);\n- trace_add_data(\"partition_index\", partition_indices_1plane[i]);\n+ trace_add_data(\"partition_index\", partition_indices[i]);\ntrace_add_data(\"plane_count\", 1);\ntrace_add_data(\"search_mode\", i);\nfloat errorval = compress_symbolic_block_for_partition_1plane(\nctx.config, *bsd, blk, ewb, false,\nerror_threshold * errorval_overshoot,\n- partition_count, partition_indices_1plane[i],\n+ partition_count, partition_indices[i],\nscb, tmpbuf);\nbest_errorvals_for_pcount[partition_count - 1] = astc::min(best_errorvals_for_pcount[partition_count - 1], errorval);\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_find_best_partitioning.cpp", "new_path": "Source/astcenc_find_best_partitioning.cpp", "diff": "@@ -485,8 +485,7 @@ void find_best_partition_candidates(\nconst error_weight_block& ewb,\nunsigned int partition_count,\nunsigned int partition_search_limit,\n- unsigned int& best_partition_uncor,\n- unsigned int& best_partition_samec\n+ unsigned int best_partitions[2]\n) {\n// Constant used to estimate quantization error for a given partitioning; the optimal value for\n// this depends on bitrate. These values have been determined empirically.\n@@ -736,10 +735,24 @@ void find_best_partition_candidates(\n}\n}\n- best_partition_uncor = uncor_best_partition;\n-\n- unsigned int index = samec_best_partitions[0] != uncor_best_partition ? 0 : 1;\n- best_partition_samec = samec_best_partitions[index];\n+ // Same parition is best for both, so use this first unconditionally\n+ if (uncor_best_partition == samec_best_partitions[0])\n+ {\n+ best_partitions[0] = samec_best_partitions[0];\n+ best_partitions[1] = samec_best_partitions[1];\n+ }\n+ // Uncor is best\n+ else if (uncor_best_error <= samec_best_errors[0])\n+ {\n+ best_partitions[0] = uncor_best_partition;\n+ best_partitions[1] = samec_best_partitions[0];\n+ }\n+ // Samec is best\n+ else\n+ {\n+ best_partitions[0] = samec_best_partitions[0];\n+ best_partitions[1] = uncor_best_partition;\n+ }\n}\n#endif\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -1677,16 +1677,16 @@ void compute_error_squared_rgba(\n/**\n* @brief Find the best set of partitions to trial for a given block.\n*\n- * On return @c best_partition_uncor contains the best partition assuming data has uncorrelated\n- * chroma, @c best_partition_samec contains the best partition assuming data has corelated chroma.\n+ * On return the @c best_partitions list will contain the two best partition\n+ * candidates; one assuming data has uncorrelated chroma and one assuming the\n+ * data has corelated chroma. The best candidate is returned first in the list.\n*\n* @param bsd The block size information.\n* @param blk The image block color data to compress.\n* @param ewb The image block weighted error data.\n* @param partition_count The number of partitions in the block.\n* @param partition_search_limit The number of candidate partition encodings to trial.\n- * @param[out] best_partition_uncor The best partition for uncorrelated chroma.\n- * @param[out] best_partition_samec The best partition for correlated chroma.\n+ * @param[out] best_partitions The best partition candidates.\n*/\nvoid find_best_partition_candidates(\nconst block_size_descriptor& bsd,\n@@ -1694,8 +1694,7 @@ void find_best_partition_candidates(\nconst error_weight_block& ewb,\nunsigned int partition_count,\nunsigned int partition_search_limit,\n- unsigned int& best_partition_uncor,\n- unsigned int& best_partition_samec);\n+ unsigned int best_partitions[2]);\n/* ============================================================================\nFunctionality for managing images and image related data.\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Return best partition candidate first
61,745
17.02.2022 22:14:32
0
29b50865153608b4cb87860e8afd5856f5b9e37e
Use <0 compares rather than ==-1 to reduce code size
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_block_sizes.cpp", "new_path": "Source/astcenc_block_sizes.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2021 Arm Limited\n+// Copyright 2011-2022 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -905,7 +905,7 @@ static void construct_block_size_descriptor_2d(\n// Allocate and initialize the decimation table entry if we've not used it yet\nint decimation_mode = decimation_mode_index[y_weights * 16 + x_weights];\n- if (decimation_mode == -1)\n+ if (decimation_mode < 0)\n{\ndecimation_mode = construct_dt_entry_2d(x_texels, y_texels, x_weights, y_weights, bsd);\ndecimation_mode_index[y_weights * 16 + x_weights] = decimation_mode;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_partition_tables.cpp", "new_path": "Source/astcenc_partition_tables.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2021 Arm Limited\n+// Copyright 2011-2022 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -58,7 +58,7 @@ static void generate_canonical_partitioning(\n{\nint index = partition_of_texel[i];\n- if (mapped_index[index] == -1)\n+ if (mapped_index[index] < 0)\n{\nmapped_index[index] = map_weight_count++;\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_pick_best_endpoint_format.cpp", "new_path": "Source/astcenc_pick_best_endpoint_format.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2021 Arm Limited\n+// Copyright 2011-2022 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -688,7 +688,7 @@ static float one_partition_find_best_combination_for_bitcount(\nint quant_level = quant_mode_table[integer_count][bits_available];\n// Don't have enough bits to represent a given endpoint format at all!\n- if (quant_level == -1)\n+ if (quant_level < 0)\n{\ncontinue;\n}\n@@ -791,7 +791,7 @@ static float two_partitions_find_best_combination_for_bitcount(\nint quant_level = quant_mode_table[integer_count][bits_available];\n// Don't have enough bits to represent a given endpoint format at all!\n- if (quant_level == -1)\n+ if (quant_level < 0)\n{\nbreak;\n}\n@@ -916,7 +916,7 @@ static float three_partitions_find_best_combination_for_bitcount(\nint quant_level = quant_mode_table[integer_count][bits_available];\n// Don't have enough bits to represent a given endpoint format at all!\n- if (quant_level == -1)\n+ if (quant_level < 0)\n{\nbreak;\n}\n@@ -1052,7 +1052,7 @@ static float four_partitions_find_best_combination_for_bitcount(\nint quant_level = quant_mode_table[integer_count][bits_available];\n// Don't have enough bits to represent a given endpoint format at all!\n- if (quant_level == -1)\n+ if (quant_level < 0)\n{\nbreak;\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel.cpp", "new_path": "Source/astcenccli_toplevel.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2021 Arm Limited\n+// Copyright 2011-2022 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -1512,7 +1512,7 @@ int main(\nif (operation & ASTCENC_STAGE_ST_NCOMP)\n{\nint bitness = get_output_filename_enforced_bitness(output_filename.c_str());\n- if (bitness == -1)\n+ if (bitness < 0)\n{\nreturn 1;\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Use <0 compares rather than ==-1 to reduce code size
61,745
20.02.2022 13:19:44
0
79d56b2fbba8b00b68f5d4b590e8deb0ed5b3af9
Cleanup compute_ideal_colors_and_weights
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2021 Arm Limited\n+// Copyright 2011-2022 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -54,8 +54,8 @@ static void compute_ideal_colors_and_weights_1_comp(\nfloat lowvalues[BLOCK_MAX_PARTITIONS] { 1e10f, 1e10f, 1e10f, 1e10f };\nfloat highvalues[BLOCK_MAX_PARTITIONS] { -1e10f, -1e10f, -1e10f, -1e10f };\n- float partition_error_scale[BLOCK_MAX_PARTITIONS];\n- float linelengths_rcp[BLOCK_MAX_PARTITIONS];\n+ float length_squared[BLOCK_MAX_PARTITIONS];\n+ float scale[BLOCK_MAX_PARTITIONS];\nconst float *error_weights = nullptr;\nconst float* data_vr = nullptr;\n@@ -96,36 +96,34 @@ static void compute_ideal_colors_and_weights_1_comp(\nvmask4 sep_mask = vint4::lane_id() == vint4(component);\nfor (int i = 0; i < partition_count; i++)\n{\n- float diff = highvalues[i] - lowvalues[i];\n-\n- if (diff < 0)\n+ float length = highvalues[i] - lowvalues[i];\n+ if (length < 0.0f)\n{\nlowvalues[i] = 0.0f;\nhighvalues[i] = 0.0f;\n}\n- diff = astc::max(diff, 1e-7f);\n-\n- partition_error_scale[i] = diff * diff;\n- linelengths_rcp[i] = 1.0f / diff;\n+ length = astc::max(length, 1e-7f);\n+ length_squared[i] = length * length;\n+ scale[i] = 1.0f / length;\nei.ep.endpt0[i] = select(blk.data_min, vfloat4(lowvalues[i]), sep_mask);\nei.ep.endpt1[i] = select(blk.data_max, vfloat4(highvalues[i]), sep_mask);\n}\nbool is_constant_wes = true;\n- float constant_wes = partition_error_scale[pi.partition_of_texel[0]] * error_weights[0];\n+ float constant_wes = length_squared[pi.partition_of_texel[0]] * error_weights[0];\nfor (int i = 0; i < texel_count; i++)\n{\nfloat value = data_vr[i];\nint partition = pi.partition_of_texel[i];\nvalue -= lowvalues[partition];\n- value *= linelengths_rcp[partition];\n+ value *= scale[partition];\nvalue = astc::clamp1f(value);\nei.weights[i] = value;\n- ei.weight_error_scale[i] = partition_error_scale[partition] * error_weights[i];\n+ ei.weight_error_scale[i] = length_squared[partition] * error_weights[i];\nassert(!astc::isnan(ei.weight_error_scale[i]));\nis_constant_wes = is_constant_wes && ei.weight_error_scale[i] == constant_wes;\n@@ -188,6 +186,7 @@ static void compute_ideal_colors_and_weights_2_comp(\n}\nelse // (component1 == 1 && component2 == 2)\n{\n+ assert(component1 == 1 && component2 == 2);\nerror_weights = ewb.texel_weight_gb;\ndata_vr = blk.data_g;\ndata_vg = blk.data_b;\n@@ -242,7 +241,7 @@ static void compute_ideal_colors_and_weights_2_comp(\nif (length < 0.0f) // Case for when none of the texels had any weight\n{\nlowparam[i] = 0.0f;\n- highparam[i] = 1e-7f;\n+ highparam[i] = 0.0f;\n}\n// It is possible for a uniform-color partition to produce length=0; this causes NaN issues\n@@ -403,7 +402,7 @@ static void compute_ideal_colors_and_weights_3_comp(\nfor (unsigned int i = 0; i < partition_count; i++)\n{\nfloat length = highparam[i] - lowparam[i];\n- if (length < 0) // Case for when none of the texels had any weight\n+ if (length < 0.0f) // Case for when none of the texels had any weight\n{\nlowparam[i] = 0.0f;\nhighparam[i] = 1e-7f;\n@@ -412,7 +411,6 @@ static void compute_ideal_colors_and_weights_3_comp(\n// It is possible for a uniform-color partition to produce length=0; this causes NaN issues\n// so set to a small value to avoid this problem.\nlength = astc::max(length, 1e-7f);\n-\nlength_squared[i] = length * length;\nscale[i] = 1.0f / length;\n@@ -548,16 +546,15 @@ static void compute_ideal_colors_and_weights_4_comp(\nfor (int i = 0; i < partition_count; i++)\n{\nfloat length = highparam[i] - lowparam[i];\n- if (length < 0)\n+ if (length < 0.0f) // Case for when none of the texels had any weight\n{\nlowparam[i] = 0.0f;\n- highparam[i] = 1e-7f;\n+ highparam[i] = 0.0f;\n}\n// It is possible for a uniform-color partition to produce length=0; this causes NaN issues\n// so set to a small value to avoid this problem.\nlength = astc::max(length, 1e-7f);\n-\nlength_squared[i] = length * length;\nscale[i] = 1.0f / length;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Cleanup compute_ideal_colors_and_weights
61,745
20.02.2022 16:02:50
0
f4f5024fb83444fddf0c181b5bb98a3b62318ce7
Standardize on "grayscale"
[ { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-2x.md", "new_path": "Docs/ChangeLog-2x.md", "diff": "@@ -226,7 +226,7 @@ speed. Our test sets show an average of 12% improvement in the codec for\nKey for performance charts:\n* Color = block size (see legend).\n-* Letter = image format (N = normal map, G = greyscale, L = LDR, H = HDR).\n+* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).\n**Absolute performance vs 2.1 release:**\n@@ -283,7 +283,7 @@ recompile your client-side code using the updated `astcenc.h` header.\nKey for performance charts:\n* Color = block size (see legend).\n-* Letter = image format (N = normal map, G = greyscale, L = LDR, H = HDR).\n+* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).\n**Absolute performance vs 2.0 release:**\n@@ -313,7 +313,7 @@ major changes over the earlier 1.7 series, and is not command-line compatible.\nKey for performance charts\n* Color = block size (see legend).\n-* Letter = image format (N = normal map, G = greyscale, L = LDR, H = HDR).\n+* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).\n**Absolute performance vs 1.7 release:**\n" }, { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-3x.md", "new_path": "Docs/ChangeLog-3x.md", "diff": "@@ -94,7 +94,7 @@ updated `astcenc.h` header.\nKey for charts:\n* Color = block size (see legend).\n-* Letter = image format (N = normal map, G = greyscale, L = LDR, H = HDR).\n+* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).\n**Relative performance vs 3.0 release:**\n@@ -145,7 +145,7 @@ updated `astcenc.h` header.\nKey for charts:\n* Color = block size (see legend).\n-* Letter = image format (N = normal map, G = greyscale, L = LDR, H = HDR).\n+* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).\n**Absolute performance vs 2.5 release:**\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2021 Arm Limited\n+// Copyright 2011-2022 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -822,7 +822,7 @@ struct image_block\n/** @brief The max component value of all texels in the block. */\nvfloat4 data_max;\n- /** @brief Is this greyscale block where R == G == B for all texels? */\n+ /** @brief Is this grayscale block where R == G == B for all texels? */\nbool grayscale;\n/** @brief Set to 1 if a texel is using HDR RGB endpoints (decompression only). */\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Standardize on "grayscale"
61,745
20.02.2022 16:12:05
0
a13b0ef3e4063cdbd77668c6f9d67a18b2a05efc
Remove ewb.block_error_weighted_rgba_sum
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -1132,13 +1132,11 @@ static float prepare_error_weight_block(\n}\n// Small bias to avoid divide by zeros and NaN propagation later\n- vfloat4 texel_weight_sum(1e-17f);\nvfloat4 error_weight_sum(1e-17f);\nint texels_per_block = bsd.texel_count;\nfor (int i = 0; i < texels_per_block; i++)\n{\n- texel_weight_sum += ewb.error_weights[i] * blk.texel(i);\nerror_weight_sum += ewb.error_weights[i];\nfloat wr = ewb.error_weights[i].lane<0>();\n@@ -1163,7 +1161,6 @@ static float prepare_error_weight_block(\newb.texel_weight[i] = (wr + wg + wb + wa) * 0.25f;\n}\n- ewb.block_error_weighted_rgba_sum = texel_weight_sum;\newb.block_error_weight_sum = error_weight_sum;\nreturn hadd_s(error_weight_sum);\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_decompress_symbolic.cpp", "new_path": "Source/astcenc_decompress_symbolic.cpp", "diff": "@@ -186,6 +186,7 @@ void decompress_symbolic_block(\nblk.zpos = zpos;\nblk.data_min = vfloat4::zero();\n+ blk.data_mean = vfloat4::zero();\nblk.data_max = vfloat4::zero();\nblk.grayscale = false;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_entry.cpp", "new_path": "Source/astcenc_entry.cpp", "diff": "@@ -951,8 +951,9 @@ static void compress_image(\n{\nblk.origin_texel = vfloat4::zero();\nblk.data_min = vfloat4::zero();\n- blk.data_max = blk.data_min;\n- blk.grayscale = false;\n+ blk.data_mean = vfloat4::zero();\n+ blk.data_max = vfloat4::zero();\n+ blk.grayscale = true;\n}\nint offset = ((z * yblocks + y) * xblocks + x) * 16;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1337,11 +1337,10 @@ void recompute_ideal_colors_2planes(\ndec_weights_quant_uvalue_plane2[i] = qat->unquantized_value[dec_weights_quant_pvalue_plane2[i]] * (1.0f / 64.0f);\n}\n- vfloat4 rgba_sum = ewb.block_error_weighted_rgba_sum;\nvfloat4 rgba_weight_sum = ewb.block_error_weight_sum;\nunsigned int texel_count = bsd.texel_count;\n- vfloat4 scale_direction = normalize((rgba_sum * (1.0f / rgba_weight_sum)).swz<0, 1, 2>());\n+ vfloat4 scale_direction = normalize(blk.data_mean.swz<0, 1, 2>());\nfloat scale_max = 0.0f;\nfloat scale_min = 1e10f;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_image.cpp", "new_path": "Source/astcenc_image.cpp", "diff": "@@ -173,6 +173,8 @@ void fetch_image_block(\nint idx = 0;\nvfloat4 data_min(1e38f);\n+ vfloat4 data_mean(0.0f);\n+ vfloat4 data_mean_scale(1.0f / static_cast<float>(bsd.texel_count));\nvfloat4 data_max(-1e38f);\nbool grayscale = true;\n@@ -225,6 +227,7 @@ void fetch_image_block(\n// Compute block metadata\ndata_min = min(data_min, datav);\n+ data_mean += datav * data_mean_scale;\ndata_max = max(data_max, datav);\nif (grayscale && (datav.lane<0>() != datav.lane<1>() || datav.lane<0>() != datav.lane<2>()))\n@@ -259,6 +262,7 @@ void fetch_image_block(\n// Store block metadata\nblk.data_min = data_min;\n+ blk.data_mean = data_mean;\nblk.data_max = data_max;\nblk.grayscale = grayscale;\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -819,6 +819,9 @@ struct image_block\n/** @brief The min component value of all texels in the block. */\nvfloat4 data_min;\n+ /** @brief The mean component value of all texels in the block. */\n+ vfloat4 data_mean;\n+\n/** @brief The max component value of all texels in the block. */\nvfloat4 data_max;\n@@ -953,20 +956,15 @@ struct image_block\n*/\nstruct error_weight_block\n{\n- /** @brief Block error weighted RGBA sum for whole block / 1 partition. */\n- vfloat4 block_error_weighted_rgba_sum;\n-\n/** @brief Block error sum for whole block / 1 partition. */\nvfloat4 block_error_weight_sum;\n/** @brief The full per texel per component error weights. */\nvfloat4 error_weights[BLOCK_MAX_TEXELS];\n-\n/** @brief The full per texel per component error weights. */\nfloat texel_weight[BLOCK_MAX_TEXELS];\n-\n/** @brief The average of the GBA error weights per texel. */\nfloat texel_weight_gba[BLOCK_MAX_TEXELS];\n@@ -979,7 +977,6 @@ struct error_weight_block\n/** @brief The average of the RGB error weights per texel. */\nfloat texel_weight_rgb[BLOCK_MAX_TEXELS];\n-\n/** @brief The average of the RG error weights per texel. */\nfloat texel_weight_rg[BLOCK_MAX_TEXELS];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove ewb.block_error_weighted_rgba_sum
61,745
20.02.2022 20:54:40
0
91f32e8bb291ef1ae516983dda5a7bc8c9793d2a
Remove remaining error_weight_block usage
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -586,7 +586,6 @@ static float compress_symbolic_block_for_partition_1plane(\n* @param config The compressor configuration.\n* @param bsd The block size information.\n* @param blk The image block color data to compress.\n- * @param ewb The image block weighted error data.\n* @param tune_errorval_threshold The error value threshold.\n* @param plane2_component The component index for the second plane of weights.\n* @param[out] scb The symbolic compressed block output.\n@@ -596,7 +595,6 @@ static float compress_symbolic_block_for_partition_2planes(\nconst astcenc_config& config,\nconst block_size_descriptor& bsd,\nconst image_block& blk,\n- const error_weight_block& ewb,\nfloat tune_errorval_threshold,\nunsigned int plane2_component,\nsymbolic_compressed_block& scb,\n@@ -808,8 +806,8 @@ static float compress_symbolic_block_for_partition_2planes(\nfor (unsigned int l = 0; l < config.tune_refinement_limit; l++)\n{\nrecompute_ideal_colors_2planes(\n- blk, ewb, bsd, di,\n- weight_quant_mode, workscb.weights, workscb.weights + WEIGHTS_PLANE2_OFFSET,\n+ blk, bsd, di, weight_quant_mode,\n+ workscb.weights, workscb.weights + WEIGHTS_PLANE2_OFFSET,\nepm, rgbs_color, rgbo_color, plane2_component);\n// Quantize the chosen color\n@@ -924,35 +922,6 @@ static float compress_symbolic_block_for_partition_2planes(\nreturn best_errorval_in_mode;\n}\n-/**\n- * @brief Create a per-texel and per-channel expansion of the error weights.\n- *\n- * This approach creates relatively large error block tables, but it allows a very flexible level of\n- * control over how specific texels and channels are prioritized by the compressor.\n- *\n- * @param ctx The compressor context and configuration.\n- * @param bsd The block size information.\n- * @param[out] blk The image block color data to compress.\n- * @param[out] ewb The image block weighted error data.\n- *\n- * @return Return the total error weight sum for all texels and channels.\n- */\n-static float prepare_error_weight_block(\n- const astcenc_context& ctx,\n- const block_size_descriptor& bsd,\n- image_block& blk,\n- error_weight_block& ewb\n-) {\n- // TODO: Find a better home for this later and drop EWB completely ...\n- blk.channel_weight = vfloat4(ctx.config.cw_r_weight,\n- ctx.config.cw_g_weight,\n- ctx.config.cw_b_weight,\n- ctx.config.cw_a_weight);\n-\n- ewb.block_error_weight_sum = blk.channel_weight * static_cast<float>(bsd.texel_count);\n- return hadd_s(ewb.block_error_weight_sum);\n-}\n-\n/**\n* @brief Determine the lowest cross-channel correlation factor.\n*\n@@ -1077,13 +1046,12 @@ static float prepare_block_statistics(\n/* See header for documentation. */\nvoid compress_block(\nconst astcenc_context& ctx,\n- image_block& blk,\n+ const image_block& blk,\nphysical_compressed_block& pcb,\ncompression_working_buffers& tmpbuf)\n{\nastcenc_profile decode_mode = ctx.config.profile;\nsymbolic_compressed_block scb;\n- error_weight_block& ewb = tmpbuf.ewb;\nconst block_size_descriptor* bsd = ctx.bsd;\nfloat lowest_correl;\n@@ -1113,7 +1081,7 @@ void compress_block(\n#if defined(ASTCENC_DIAGNOSTICS)\n// Do this early in diagnostic builds so we can dump uniform metrics\n// for every block. Do it later in release builds to avoid redundant work!\n- float error_weight_sum = prepare_error_weight_block(ctx, *bsd, blk, ewb);\n+ float error_weight_sum = hadd_s(blk.channel_weight) * bsd->texel_count;\nfloat error_threshold = ctx.config.tune_db_limit\n* error_weight_sum\n* block_is_l_scale\n@@ -1157,7 +1125,7 @@ void compress_block(\n}\n#if !defined(ASTCENC_DIAGNOSTICS)\n- float error_weight_sum = prepare_error_weight_block(ctx, *bsd, blk, ewb);\n+ float error_weight_sum = hadd_s(blk.channel_weight) * bsd->texel_count;\nfloat error_threshold = ctx.config.tune_db_limit\n* error_weight_sum\n* block_is_l_scale\n@@ -1254,8 +1222,7 @@ void compress_block(\n}\nfloat errorval = compress_symbolic_block_for_partition_2planes(\n- ctx.config, *bsd, blk, ewb,\n- error_threshold * errorval_overshoot,\n+ ctx.config, *bsd, blk, error_threshold * errorval_overshoot,\ni, scb, tmpbuf);\n// If attempting two planes is much worse than the best one plane result\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_entry.cpp", "new_path": "Source/astcenc_entry.cpp", "diff": "@@ -891,6 +891,12 @@ static void compress_image(\nblk.grayscale = true;\n}\n+ // Populate the block channel weights\n+ blk.channel_weight = vfloat4(ctx.config.cw_r_weight,\n+ ctx.config.cw_g_weight,\n+ ctx.config.cw_b_weight,\n+ ctx.config.cw_a_weight);\n+\nint offset = ((z * yblocks + y) * xblocks + x) * 16;\nuint8_t *bp = buffer + offset;\nphysical_compressed_block* pcb = reinterpret_cast<physical_compressed_block*>(bp);\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1275,7 +1275,6 @@ void recompute_ideal_colors_1plane(\n/* See header for documentation. */\nvoid recompute_ideal_colors_2planes(\nconst image_block& blk,\n- const error_weight_block& ewb,\nconst block_size_descriptor& bsd,\nconst decimation_info& di,\nint weight_quant_mode,\n@@ -1303,7 +1302,7 @@ void recompute_ideal_colors_2planes(\ndec_weights_quant_uvalue_plane2[i] = qat->unquantized_value[dec_weights_quant_pvalue_plane2[i]] * (1.0f / 64.0f);\n}\n- vfloat4 rgba_weight_sum = ewb.block_error_weight_sum;\n+ vfloat4 rgba_weight_sum = blk.channel_weight * bsd.texel_count;\nunsigned int texel_count = bsd.texel_count;\nvfloat4 scale_direction = normalize(blk.data_mean.swz<0, 1, 2>());\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -930,39 +930,6 @@ struct image_block\n}\n};\n-/**\n- * @brief Data structure representing per-texel and per-component error weights for a block.\n- *\n- * This structure stores a multiplier for the error weight to apply to each component when computing\n- * block errors. This can be used as a general purpose technique to to amplify or diminish the\n- * significance of texels and individual color components, based on what is being stored and the\n- * compressor heuristics. It can be applied in many different ways, some of which are outlined in\n- * the description below (this is not exhaustive).\n- *\n- * For blocks that span the edge of the texture, the weighting for texels outside of the texture\n- * bounds can zeroed to maximize the quality of the texels inside the texture.\n- *\n- * For textures storing fewer than 4 components the weighting for color components that are unused\n- * can be zeroed to maximize the quality of the components that are used. This is particularly\n- * important for two component textures, which must be imported in LLLA format to match the two\n- * component endpoint encoding. Without manual component weighting to correct significance the \"L\"\n- * would be treated as three times more important than A because of the replication.\n- *\n- * For HDR textures we can use perceptual weighting which os approximately inverse to the luminance\n- * of a texel.\n- *\n- * For normal maps we can use perceptual weighting which assigns higher weight to low-variability\n- * regions than to high-variability regions, ensuring smooth surfaces don't pick up artifacts.\n- *\n- * For transparent texels we can multiply the RGB weights by the alpha value, ensuring that\n- * the least transprent texels maintain the highest accuracy.\n- */\n-struct error_weight_block\n-{\n- /** @brief Block error sum for whole block / 1 partition. */\n- vfloat4 block_error_weight_sum;\n-};\n-\n/**\n* @brief Data structure storing the color endpoints for a block.\n*/\n@@ -1037,9 +1004,6 @@ struct alignas(ASTCENC_VECALIGN) compression_working_buffers\n/** @brief Ideal decimated endpoints and weights for plane 2. */\nendpoints_and_weights eix2[WEIGHTS_MAX_DECIMATION_MODES];\n- /** @brief The error weight block for the current thread. */\n- error_weight_block ewb;\n-\n/**\n* @brief Decimated ideal weight values.\n*\n@@ -2028,7 +1992,6 @@ void recompute_ideal_colors_1plane(\n* recompute the ideal colors for a specific weight set.\n*\n* @param blk The image block color data to compress.\n- * @param ewb The image block weighted error data.\n* @param bsd The block_size descriptor.\n* @param di The weight grid decimation table.\n* @param weight_quant_mode The weight grid quantization level.\n@@ -2041,7 +2004,6 @@ void recompute_ideal_colors_1plane(\n*/\nvoid recompute_ideal_colors_2planes(\nconst image_block& blk,\n- const error_weight_block& ewb,\nconst block_size_descriptor& bsd,\nconst decimation_info& di,\nint weight_quant_mode,\n@@ -2113,7 +2075,7 @@ void compute_angular_endpoints_2planes(\n*/\nvoid compress_block(\nconst astcenc_context& ctx,\n- image_block& blk,\n+ const image_block& blk,\nphysical_compressed_block& pcb,\ncompression_working_buffers& tmpbuf);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove remaining error_weight_block usage
61,745
20.02.2022 21:20:02
0
82df2fd7737952a13466b161b39e97c74a3f349d
Allow a threshold percentage for block modes
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_block_sizes.cpp", "new_path": "Source/astcenc_block_sizes.cpp", "diff": "@@ -854,6 +854,8 @@ static void construct_block_size_descriptor_2d(\nunsigned int always_block_mode_count = 0;\nunsigned int always_decimation_mode_count = 0;\n+ float always_threshold = 0.0f;\n+\n// Iterate twice; first time keep the \"always\" blocks, second time keep the \"non-always\" blocks.\n// This ensures that the always block modes and decimation modes are at the start of the list.\nfor (unsigned int j = 0; j < 2; j ++)\n@@ -869,12 +871,12 @@ static void construct_block_size_descriptor_2d(\nfloat percentile = percentiles[i];\nbool selected = (percentile <= mode_cutoff) || !can_omit_modes;\n- if (j == 0 && percentile != 0.0f)\n+ if (j == 0 && percentile > always_threshold)\n{\ncontinue;\n}\n- if (j == 1 && percentile == 0.0f)\n+ if (j == 1 && percentile <= always_threshold)\n{\ncontinue;\n}\n@@ -911,7 +913,7 @@ static void construct_block_size_descriptor_2d(\ndecimation_mode_index[y_weights * 16 + x_weights] = decimation_mode;\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\n- if (percentile == 0.0f)\n+ if (percentile <= always_threshold)\n{\nalways_decimation_mode_count++;\n}\n@@ -920,7 +922,7 @@ static void construct_block_size_descriptor_2d(\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\n// Flatten the block mode heuristic into some precomputed flags\n- if (percentile == 0.0f)\n+ if (percentile <= always_threshold)\n{\nalways_block_mode_count++;\nbsd.block_modes[packed_idx].percentile_hit = true;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Allow a threshold percentage for block modes
61,745
20.02.2022 21:35:36
0
291bce740d62408ed42209cb7a3efd68ffd80071
Refactor compute_avgs_and_dirs for constant texel weight
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_averages_and_directions.cpp", "new_path": "Source/astcenc_averages_and_directions.cpp", "diff": "@@ -30,33 +30,30 @@ void compute_avgs_and_dirs_4_comp(\nconst image_block& blk,\npartition_metrics pm[BLOCK_MAX_PARTITIONS]\n) {\n- int partition_count = pi.partition_count;\n- promise(partition_count > 0);\n-\nfloat texel_weight = hadd_s(blk.channel_weight) / 4.0f;\nvfloat4 channel_weight = blk.channel_weight;\n+ int partition_count = pi.partition_count;\n+ promise(partition_count > 0);\n+\nfor (int partition = 0; partition < partition_count; partition++)\n{\nconst uint8_t *texel_indexes = pi.texels_of_partition[partition];\n-\n- vfloat4 base_sum = vfloat4::zero();\n- float partition_weight = 0.0f;\n-\nunsigned int texel_count = pi.partition_texel_count[partition];\npromise(texel_count > 0);\n+ // TODO: Try gathers?\n+ vfloat4 base_sum = vfloat4::zero();\n+\nfor (unsigned int i = 0; i < texel_count; i++)\n{\nint iwt = texel_indexes[i];\n- vfloat4 texel_datum = blk.texel(iwt);\n- partition_weight += texel_weight;\n- base_sum += texel_datum * texel_weight;\n+ base_sum += blk.texel(iwt);\n}\nvfloat4 error_sum = channel_weight;\nvfloat4 csf = normalize(sqrt(error_sum)) * 2.0f;\n- vfloat4 average = base_sum / astc::max(partition_weight, 1e-7f);\n+ vfloat4 average = base_sum / static_cast<float>(texel_count);\npm[partition].error_weight = error_sum;\npm[partition].avg = average * csf;\n@@ -163,29 +160,20 @@ void compute_avgs_and_dirs_3_comp(\nfor (unsigned int partition = 0; partition < partition_count; partition++)\n{\nconst uint8_t *texel_indexes = pi.texels_of_partition[partition];\n-\n- vfloat4 base_sum = vfloat4::zero();\n- float partition_weight = 0.0f;\n-\nunsigned int texel_count = pi.partition_texel_count[partition];\npromise(texel_count > 0);\n+ vfloat4 base_sum = vfloat4::zero();\nfor (unsigned int i = 0; i < texel_count; i++)\n{\nunsigned int iwt = texel_indexes[i];\n-\n- vfloat4 texel_datum = vfloat3(data_vr[iwt],\n- data_vg[iwt],\n- data_vb[iwt]);\n-\n- partition_weight += texel_weight;\n- base_sum += texel_datum * texel_weight;\n+ base_sum += vfloat3(data_vr[iwt], data_vg[iwt], data_vb[iwt]);\n}\nvfloat4 error_sum = channel_weight;\nvfloat4 csf = normalize(sqrt(error_sum)) * 1.73205080f;\n- vfloat4 average = base_sum / astc::max(partition_weight, 1e-7f);\n+ vfloat4 average = base_sum / static_cast<float>(texel_count);\npm[partition].error_weight = error_sum;\npm[partition].avg = average * csf;\n@@ -255,27 +243,19 @@ void compute_avgs_and_dirs_3_comp_rgb(\nfor (unsigned int partition = 0; partition < partition_count; partition++)\n{\nconst uint8_t *texel_indexes = pi.texels_of_partition[partition];\n-\n- vfloat4 base_sum = vfloat4::zero();\n- float partition_weight = 0.0f;\n-\nunsigned int texel_count = pi.partition_texel_count[partition];\npromise(texel_count > 0);\n+ vfloat4 base_sum = vfloat4::zero();\nfor (unsigned int i = 0; i < texel_count; i++)\n{\nunsigned int iwt = texel_indexes[i];\n-\n- vfloat4 texel_datum = blk.texel3(iwt);\n-\n- partition_weight += texel_weight;\n- base_sum += texel_datum * texel_weight;\n+ base_sum += blk.texel3(iwt);\n}\nvfloat4 error_sum = channel_weight;\nvfloat4 csf = normalize(sqrt(error_sum)) * 1.73205080f;\n-\n- vfloat4 average = base_sum / astc::max(partition_weight, 1e-7f);\n+ vfloat4 average = base_sum / static_cast<float>(texel_count);\npm[partition].error_weight = error_sum;\npm[partition].avg = average * csf;\n@@ -375,26 +355,19 @@ void compute_avgs_and_dirs_2_comp(\nfor (unsigned int partition = 0; partition < partition_count; partition++)\n{\nconst uint8_t *texel_indexes = pt.texels_of_partition[partition];\n-\n- vfloat4 base_sum = vfloat4::zero();\n- float partition_weight = 0.0f;\n-\nunsigned int texel_count = pt.partition_texel_count[partition];\npromise(texel_count > 0);\n+ vfloat4 base_sum = vfloat4::zero();\nfor (unsigned int i = 0; i < texel_count; i++)\n{\nunsigned int iwt = texel_indexes[i];\n- vfloat4 texel_datum = vfloat2(data_vr[iwt], data_vg[iwt]) * texel_weight;\n-\n- partition_weight += texel_weight;\n- base_sum += texel_datum;\n+ base_sum += vfloat2(data_vr[iwt], data_vg[iwt]);\n}\nvfloat4 error_sum = channel_weight;\nvfloat4 csf = normalize(sqrt(error_sum)) * 1.41421356f;\n- vfloat4 average = base_sum / astc::max(partition_weight, 1e-7f);\n-\n+ vfloat4 average = base_sum / static_cast<float>(texel_count);\npm[partition].error_weight = error_sum;\npm[partition].avg = average * csf;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Refactor compute_avgs_and_dirs for constant texel weight
61,745
20.02.2022 22:11:41
0
dd16604bb43a438bcc5b0be7f0ad5546788d3a2d
Remove color_scale and icolor_scale
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_averages_and_directions.cpp", "new_path": "Source/astcenc_averages_and_directions.cpp", "diff": "@@ -31,7 +31,6 @@ void compute_avgs_and_dirs_4_comp(\npartition_metrics pm[BLOCK_MAX_PARTITIONS]\n) {\nfloat texel_weight = hadd_s(blk.channel_weight) / 4.0f;\n- vfloat4 channel_weight = blk.channel_weight;\nint partition_count = pi.partition_count;\npromise(partition_count > 0);\n@@ -51,14 +50,8 @@ void compute_avgs_and_dirs_4_comp(\nbase_sum += blk.texel(iwt);\n}\n- vfloat4 error_sum = channel_weight;\n- vfloat4 csf = normalize(sqrt(error_sum)) * 2.0f;\nvfloat4 average = base_sum / static_cast<float>(texel_count);\n-\n- pm[partition].error_weight = error_sum;\n- pm[partition].avg = average * csf;\n- pm[partition].color_scale = csf;\n- pm[partition].icolor_scale = 1.0f / max(csf, 1e-7f);\n+ pm[partition].avg = average;\nvfloat4 sum_xp = vfloat4::zero();\nvfloat4 sum_yp = vfloat4::zero();\n@@ -170,15 +163,8 @@ void compute_avgs_and_dirs_3_comp(\nbase_sum += vfloat3(data_vr[iwt], data_vg[iwt], data_vb[iwt]);\n}\n- vfloat4 error_sum = channel_weight;\n- vfloat4 csf = normalize(sqrt(error_sum)) * 1.73205080f;\n-\nvfloat4 average = base_sum / static_cast<float>(texel_count);\n-\n- pm[partition].error_weight = error_sum;\n- pm[partition].avg = average * csf;\n- pm[partition].color_scale = csf;\n- pm[partition].icolor_scale = 1.0f / max(csf, 1e-7f);\n+ pm[partition].avg = average;\nvfloat4 sum_xp = vfloat4::zero();\nvfloat4 sum_yp = vfloat4::zero();\n@@ -235,7 +221,6 @@ void compute_avgs_and_dirs_3_comp_rgb(\npartition_metrics pm[BLOCK_MAX_PARTITIONS]\n) {\nfloat texel_weight = hadd_s(blk.channel_weight.swz<0, 1, 2>()) / 3;\n- vfloat4 channel_weight = blk.channel_weight.swz<0, 1, 2>();\nunsigned int partition_count = pi.partition_count;\npromise(partition_count > 0);\n@@ -253,14 +238,8 @@ void compute_avgs_and_dirs_3_comp_rgb(\nbase_sum += blk.texel3(iwt);\n}\n- vfloat4 error_sum = channel_weight;\n- vfloat4 csf = normalize(sqrt(error_sum)) * 1.73205080f;\nvfloat4 average = base_sum / static_cast<float>(texel_count);\n-\n- pm[partition].error_weight = error_sum;\n- pm[partition].avg = average * csf;\n- pm[partition].color_scale = csf;\n- pm[partition].icolor_scale = 1.0f / max(csf, 1e-7f);\n+ pm[partition].avg = average;\nvfloat4 sum_xp = vfloat4::zero();\nvfloat4 sum_yp = vfloat4::zero();\n@@ -365,14 +344,8 @@ void compute_avgs_and_dirs_2_comp(\nbase_sum += vfloat2(data_vr[iwt], data_vg[iwt]);\n}\n- vfloat4 error_sum = channel_weight;\n- vfloat4 csf = normalize(sqrt(error_sum)) * 1.41421356f;\nvfloat4 average = base_sum / static_cast<float>(texel_count);\n-\n- pm[partition].error_weight = error_sum;\n- pm[partition].avg = average * csf;\n- pm[partition].color_scale = csf;\n- pm[partition].icolor_scale = 1.0f / max(csf, 1e-7f);\n+ pm[partition].avg = average;\nvfloat4 sum_xp = vfloat4::zero();\nvfloat4 sum_yp = vfloat4::zero();\n@@ -451,11 +424,6 @@ void compute_error_squared_rgba(\nvfloat l_uncor_amod2(l_uncor.amod.lane<2>());\nvfloat l_uncor_amod3(l_uncor.amod.lane<3>());\n- vfloat l_uncor_bis0(l_uncor.bis.lane<0>());\n- vfloat l_uncor_bis1(l_uncor.bis.lane<1>());\n- vfloat l_uncor_bis2(l_uncor.bis.lane<2>());\n- vfloat l_uncor_bis3(l_uncor.bis.lane<3>());\n-\nvfloat l_samec_bs0(l_samec.bs.lane<0>());\nvfloat l_samec_bs1(l_samec.bs.lane<1>());\nvfloat l_samec_bs2(l_samec.bs.lane<2>());\n@@ -463,11 +431,6 @@ void compute_error_squared_rgba(\nassert(all(l_samec.amod == vfloat4(0.0f)));\n- vfloat l_samec_bis0(l_samec.bis.lane<0>());\n- vfloat l_samec_bis1(l_samec.bis.lane<1>());\n- vfloat l_samec_bis2(l_samec.bis.lane<2>());\n- vfloat l_samec_bis3(l_samec.bis.lane<3>());\n-\nvfloat uncor_loparamv(1e10f);\nvfloat uncor_hiparamv(-1e10f);\nvfloat4 uncor_errorsumv = vfloat4::zero();\n@@ -504,13 +467,13 @@ void compute_error_squared_rgba(\nuncor_hiparamv = max(uncor_param, uncor_hiparamv);\nvfloat uncor_dist0 = (l_uncor_amod0 - data_r)\n- + (uncor_param * l_uncor_bis0);\n+ + (uncor_param * l_uncor_bs0);\nvfloat uncor_dist1 = (l_uncor_amod1 - data_g)\n- + (uncor_param * l_uncor_bis1);\n+ + (uncor_param * l_uncor_bs1);\nvfloat uncor_dist2 = (l_uncor_amod2 - data_b)\n- + (uncor_param * l_uncor_bis2);\n+ + (uncor_param * l_uncor_bs2);\nvfloat uncor_dist3 = (l_uncor_amod3 - data_a)\n- + (uncor_param * l_uncor_bis3);\n+ + (uncor_param * l_uncor_bs3);\nvfloat uncor_err = (ew_r * uncor_dist0 * uncor_dist0)\n+ (ew_g * uncor_dist1 * uncor_dist1)\n@@ -529,10 +492,10 @@ void compute_error_squared_rgba(\nsamec_loparamv = min(samec_param, samec_loparamv);\nsamec_hiparamv = max(samec_param, samec_hiparamv);\n- vfloat samec_dist0 = samec_param * l_samec_bis0 - data_r;\n- vfloat samec_dist1 = samec_param * l_samec_bis1 - data_g;\n- vfloat samec_dist2 = samec_param * l_samec_bis2 - data_b;\n- vfloat samec_dist3 = samec_param * l_samec_bis3 - data_a;\n+ vfloat samec_dist0 = samec_param * l_samec_bs0 - data_r;\n+ vfloat samec_dist1 = samec_param * l_samec_bs1 - data_g;\n+ vfloat samec_dist2 = samec_param * l_samec_bs2 - data_b;\n+ vfloat samec_dist3 = samec_param * l_samec_bs3 - data_a;\nvfloat samec_err = (ew_r * samec_dist0 * samec_dist0)\n+ (ew_g * samec_dist1 * samec_dist1)\n@@ -607,20 +570,12 @@ void compute_error_squared_rgb(\nvfloat l_uncor_amod1(l_uncor.amod.lane<1>());\nvfloat l_uncor_amod2(l_uncor.amod.lane<2>());\n- vfloat l_uncor_bis0(l_uncor.bis.lane<0>());\n- vfloat l_uncor_bis1(l_uncor.bis.lane<1>());\n- vfloat l_uncor_bis2(l_uncor.bis.lane<2>());\n-\nvfloat l_samec_bs0(l_samec.bs.lane<0>());\nvfloat l_samec_bs1(l_samec.bs.lane<1>());\nvfloat l_samec_bs2(l_samec.bs.lane<2>());\nassert(all(l_samec.amod == vfloat4(0.0f)));\n- vfloat l_samec_bis0(l_samec.bis.lane<0>());\n- vfloat l_samec_bis1(l_samec.bis.lane<1>());\n- vfloat l_samec_bis2(l_samec.bis.lane<2>());\n-\nvfloat uncor_loparamv(1e10f);\nvfloat uncor_hiparamv(-1e10f);\nvfloat4 uncor_errorsumv = vfloat4::zero();\n@@ -654,11 +609,11 @@ void compute_error_squared_rgb(\nuncor_hiparamv = max(uncor_param, uncor_hiparamv);\nvfloat uncor_dist0 = (l_uncor_amod0 - data_r)\n- + (uncor_param * l_uncor_bis0);\n+ + (uncor_param * l_uncor_bs0);\nvfloat uncor_dist1 = (l_uncor_amod1 - data_g)\n- + (uncor_param * l_uncor_bis1);\n+ + (uncor_param * l_uncor_bs1);\nvfloat uncor_dist2 = (l_uncor_amod2 - data_b)\n- + (uncor_param * l_uncor_bis2);\n+ + (uncor_param * l_uncor_bs2);\nvfloat uncor_err = (ew_r * uncor_dist0 * uncor_dist0)\n+ (ew_g * uncor_dist1 * uncor_dist1)\n@@ -676,9 +631,9 @@ void compute_error_squared_rgb(\nsamec_hiparamv = max(samec_param, samec_hiparamv);\n- vfloat samec_dist0 = samec_param * l_samec_bis0 - data_r;\n- vfloat samec_dist1 = samec_param * l_samec_bis1 - data_g;\n- vfloat samec_dist2 = samec_param * l_samec_bis2 - data_b;\n+ vfloat samec_dist0 = samec_param * l_samec_bs0 - data_r;\n+ vfloat samec_dist1 = samec_param * l_samec_bs1 - data_g;\n+ vfloat samec_dist2 = samec_param * l_samec_bs2 - data_b;\nvfloat samec_err = (ew_r * samec_dist0 * samec_dist0)\n+ (ew_g * samec_dist1 * samec_dist1)\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_find_best_partitioning.cpp", "new_path": "Source/astcenc_find_best_partitioning.cpp", "diff": "@@ -547,16 +547,14 @@ void find_best_partition_candidates(\nuncor_lines[j].a = pm.avg;\nuncor_lines[j].b = normalize_safe(pm.dir, unit4());\n- uncor_plines[j].amod = (uncor_lines[j].a - uncor_lines[j].b * dot(uncor_lines[j].a, uncor_lines[j].b)) * pm.icolor_scale;\n- uncor_plines[j].bs = uncor_lines[j].b * pm.color_scale;\n- uncor_plines[j].bis = uncor_lines[j].b * pm.icolor_scale;\n+ uncor_plines[j].amod = uncor_lines[j].a - uncor_lines[j].b * dot(uncor_lines[j].a, uncor_lines[j].b);\n+ uncor_plines[j].bs = uncor_lines[j].b;\nsamec_lines[j].a = vfloat4::zero();\nsamec_lines[j].b = normalize_safe(pm.avg, unit4());\nsamec_plines[j].amod = vfloat4::zero();\n- samec_plines[j].bs = samec_lines[j].b * pm.color_scale;\n- samec_plines[j].bis = samec_lines[j].b * pm.icolor_scale;\n+ samec_plines[j].bs = samec_lines[j].b;\n}\nfloat uncor_error = 0.0f;\n@@ -583,20 +581,14 @@ void find_best_partition_candidates(\nfor (unsigned int j = 0; j < partition_count; j++)\n{\n- partition_metrics& pm = pms[j];\n- float tpp = (float)(pi.partition_texel_count[j]);\n-\n- vfloat4 ics = pm.icolor_scale;\n- vfloat4 error_weights = pm.error_weight * (tpp * weight_imprecision_estim);\n+ float tpp = static_cast<float>(pi.partition_texel_count[j]);\n+ vfloat4 error_weights(tpp * weight_imprecision_estim);\n- vfloat4 uncor_vector = uncor_lines[j].b * uncor_line_lens[j] * ics;\n- vfloat4 samec_vector = samec_lines[j].b * samec_line_lens[j] * ics;\n+ vfloat4 uncor_vector = uncor_lines[j].b * uncor_line_lens[j];\n+ vfloat4 samec_vector = samec_lines[j].b * samec_line_lens[j];\n- uncor_vector = uncor_vector * uncor_vector;\n- samec_vector = samec_vector * samec_vector;\n-\n- uncor_error += dot_s(uncor_vector, error_weights);\n- samec_error += dot_s(samec_vector, error_weights);\n+ uncor_error += dot_s(uncor_vector * uncor_vector, error_weights);\n+ samec_error += dot_s(samec_vector * samec_vector, error_weights);\n}\nif (uncor_error < uncor_best_error)\n@@ -650,13 +642,11 @@ void find_best_partition_candidates(\npl.samec_line.a = vfloat4::zero();\npl.samec_line.b = normalize_safe(pm.avg.swz<0, 1, 2>(), unit3());\n- pl.uncor_pline.amod = (pl.uncor_line.a - pl.uncor_line.b * dot3(pl.uncor_line.a, pl.uncor_line.b)) * pm.icolor_scale.swz<0, 1, 2, 3>();\n- pl.uncor_pline.bs = (pl.uncor_line.b * pm.color_scale.swz<0, 1, 2, 3>());\n- pl.uncor_pline.bis = (pl.uncor_line.b * pm.icolor_scale.swz<0, 1, 2, 3>());\n+ pl.uncor_pline.amod = pl.uncor_line.a - pl.uncor_line.b * dot3(pl.uncor_line.a, pl.uncor_line.b);\n+ pl.uncor_pline.bs = pl.uncor_line.b;\npl.samec_pline.amod = vfloat4::zero();\n- pl.samec_pline.bs = (pl.samec_line.b * pm.color_scale.swz<0, 1, 2, 3>());\n- pl.samec_pline.bis = (pl.samec_line.b * pm.icolor_scale.swz<0, 1, 2, 3>());\n+ pl.samec_pline.bs = pl.samec_line.b;\n}\nfloat uncor_error = 0.0f;\n@@ -680,25 +670,16 @@ void find_best_partition_candidates(\nfor (unsigned int j = 0; j < partition_count; j++)\n{\n- partition_metrics& pm = pms[j];\npartition_lines3& pl = plines[j];\n- float tpp = (float)(pi.partition_texel_count[j]);\n-\n- vfloat4 ics = pm.icolor_scale;\n- ics.set_lane<3>(0.0f);\n-\n- vfloat4 error_weights = pm.error_weight * (tpp * weight_imprecision_estim);\n- error_weights.set_lane<3>(0.0f);\n-\n- vfloat4 uncor_vector = (pl.uncor_line.b * pl.uncor_line_len) * ics;\n- vfloat4 samec_vector = (pl.samec_line.b * pl.samec_line_len) * ics;\n+ float tpp = static_cast<float>(pi.partition_texel_count[j]);\n+ vfloat4 error_weights(tpp * weight_imprecision_estim);\n- uncor_vector = uncor_vector * uncor_vector;\n- samec_vector = samec_vector * samec_vector;\n+ vfloat4 uncor_vector = pl.uncor_line.b * pl.uncor_line_len;\n+ vfloat4 samec_vector = pl.samec_line.b * pl.samec_line_len;\n- uncor_error += dot3_s(uncor_vector, error_weights);\n- samec_error += dot3_s(samec_vector, error_weights);\n+ uncor_error += dot3_s(uncor_vector * uncor_vector, error_weights);\n+ samec_error += dot3_s(samec_vector * samec_vector, error_weights);\n}\nif (uncor_error < uncor_best_error)\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -213,7 +213,7 @@ static void compute_ideal_colors_and_weights_2_comp(\nfor (int i = 0; i < texel_count; i++)\n{\nint partition = pi.partition_of_texel[i];\n- vfloat4 point = vfloat2(data_vr[i], data_vg[i]) * pms[partition].color_scale.swz<0, 1>();\n+ vfloat4 point = vfloat2(data_vr[i], data_vg[i]);\nline2 l = lines[partition];\nfloat param = dot_s(point - l.a, l.b);\nei.weights[i] = param;\n@@ -240,16 +240,11 @@ static void compute_ideal_colors_and_weights_2_comp(\nlength_squared[i] = length * length;\nscale[i] = 1.0f / length;\n- vfloat4 ep0 = lines[i].a + lines[i].b * lowparam[i];\n- vfloat4 ep1 = lines[i].a + lines[i].b * highparam[i];\n-\n- ep0 = ep0.swz<0, 1>() / pms[i].color_scale;\n- ep1 = ep1.swz<0, 1>() / pms[i].color_scale;\n-\n- lowvalues[i] = ep0;\n- highvalues[i] = ep1;\n+ lowvalues[i] = lines[i].a + lines[i].b * lowparam[i];\n+ highvalues[i] = lines[i].a + lines[i].b * highparam[i];\n}\n+ // TODO: Merge this into loop above?\nvmask4 comp1_mask = vint4::lane_id() == vint4(component1);\nvmask4 comp2_mask = vint4::lane_id() == vint4(component2);\nfor (int i = 0; i < partition_count; i++)\n@@ -370,7 +365,7 @@ static void compute_ideal_colors_and_weights_3_comp(\nfor (unsigned int i = 0; i < texel_count; i++)\n{\nint partition = pi.partition_of_texel[i];\n- vfloat4 point = vfloat3(data_vr[i], data_vg[i], data_vb[i]) * pms[partition].color_scale;\n+ vfloat4 point = vfloat3(data_vr[i], data_vg[i], data_vb[i]);\nline3 l = lines[partition];\nfloat param = dot3_s(point - l.a, l.b);\nei.weights[i] = param;\n@@ -397,9 +392,6 @@ static void compute_ideal_colors_and_weights_3_comp(\nvfloat4 ep0 = lines[i].a + lines[i].b * lowparam[i];\nvfloat4 ep1 = lines[i].a + lines[i].b * highparam[i];\n- ep0 = ep0 * pms[i].icolor_scale;\n- ep1 = ep1 * pms[i].icolor_scale;\n-\nvfloat4 bmin = blk.data_min;\nvfloat4 bmax = blk.data_max;\n@@ -504,7 +496,7 @@ static void compute_ideal_colors_and_weights_4_comp(\n{\nint partition = pi.partition_of_texel[i];\n- vfloat4 point = blk.texel(i) * pms[partition].color_scale;\n+ vfloat4 point = blk.texel(i);\nline4 l = lines[partition];\nfloat param = dot_s(point - l.a, l.b);\n@@ -529,11 +521,8 @@ static void compute_ideal_colors_and_weights_4_comp(\nlength_squared[i] = length * length;\nscale[i] = 1.0f / length;\n- vfloat4 ep0 = lines[i].a + lines[i].b * lowparam[i];\n- vfloat4 ep1 = lines[i].a + lines[i].b * highparam[i];\n-\n- ei.ep.endpt0[i] = ep0 * pms[i].icolor_scale;\n- ei.ep.endpt1[i] = ep1 * pms[i].icolor_scale;\n+ ei.ep.endpt0[i] = lines[i].a + lines[i].b * lowparam[i];\n+ ei.ep.endpt1[i] = lines[i].a + lines[i].b * highparam[i];\n}\nbool is_constant_wes = true;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -458,15 +458,6 @@ static inline unsigned int get_quant_level(quant_method method)\n*/\nstruct partition_metrics\n{\n- /** @brief The sum of the error weights for texels in this partition. */\n- vfloat4 error_weight;\n-\n- /** @brief The color scale factor used to weight color channels. */\n- vfloat4 color_scale;\n-\n- /** @brief The 1 / color_scale used to avoid divisions. */\n- vfloat4 icolor_scale;\n-\n/** @brief The error-weighted average color in the partition. */\nvfloat4 avg;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_mathlib.h", "new_path": "Source/astcenc_mathlib.h", "diff": "@@ -458,21 +458,18 @@ struct processed_line2\n{\nvfloat4 amod;\nvfloat4 bs;\n- vfloat4 bis;\n};\nstruct processed_line3\n{\nvfloat4 amod;\nvfloat4 bs;\n- vfloat4 bis;\n};\nstruct processed_line4\n{\nvfloat4 amod;\nvfloat4 bs;\n- vfloat4 bis;\n};\n#endif\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_pick_best_endpoint_format.cpp", "new_path": "Source/astcenc_pick_best_endpoint_format.cpp", "diff": "@@ -110,24 +110,24 @@ static void compute_error_squared_rgb_single_partition(\na_drop_err += omalpha * omalpha * ews.lane<3>();\nfloat param1 = dot3_s(point, uncor_pline.bs);\n- vfloat4 rp1 = uncor_pline.amod + param1 * uncor_pline.bis;\n+ vfloat4 rp1 = uncor_pline.amod + param1 * uncor_pline.bs;\nvfloat4 dist1 = rp1 - point;\nuncor_err += dot3_s(ews, dist1 * dist1);\nfloat param2 = dot3_s(point, samec_pline.bs);\n// No samec amod - we know it's always zero\n- vfloat4 rp2 = /* samec_pline.amod + */ param2 * samec_pline.bis;\n+ vfloat4 rp2 = /* samec_pline.amod + */ param2 * samec_pline.bs;\nvfloat4 dist2 = rp2 - point;\nsamec_err += dot3_s(ews, dist2 * dist2);\nfloat param3 = dot3_s(point, rgbl_pline.bs);\n- vfloat4 rp3 = rgbl_pline.amod + param3 * rgbl_pline.bis;\n+ vfloat4 rp3 = rgbl_pline.amod + param3 * rgbl_pline.bs;\nvfloat4 dist3 = rp3 - point;\nrgbl_err += dot3_s(ews, dist3 * dist3);\nfloat param4 = dot3_s(point, l_pline.bs);\n// No luma amod - we know it's always zero\n- vfloat4 rp4 = /* l_pline.amod + */ param4 * l_pline.bis;\n+ vfloat4 rp4 = /* l_pline.amod + */ param4 * l_pline.bs;\nvfloat4 dist4 = rp4 - point;\nl_err += dot3_s(ews, dist4 * dist4);\n}\n@@ -182,38 +182,28 @@ static void compute_encoding_choice_errors(\nfloat luminance_rgb_error;\nfloat alpha_drop_error;\n- vfloat4 csf = pm.color_scale;\n- vfloat4 csfn = normalize(csf);\n-\n- vfloat4 icsf = pm.icolor_scale;\n- icsf.set_lane<3>(0.0f);\n-\nuncor_rgb_lines.a = pm.avg;\n- uncor_rgb_lines.b = normalize_safe(pm.dir, csfn);\n+ uncor_rgb_lines.b = normalize_safe(pm.dir, unit3());\nsamec_rgb_lines.a = vfloat4::zero();\n- samec_rgb_lines.b = normalize_safe(pm.avg, csfn);\n+ samec_rgb_lines.b = normalize_safe(pm.avg, unit3());\nrgb_luma_lines.a = pm.avg;\n- rgb_luma_lines.b = csfn;\n+ rgb_luma_lines.b = unit3();\n- uncor_rgb_plines.amod = (uncor_rgb_lines.a - uncor_rgb_lines.b * dot3(uncor_rgb_lines.a, uncor_rgb_lines.b)) * icsf;\n- uncor_rgb_plines.bs = uncor_rgb_lines.b * csf;\n- uncor_rgb_plines.bis = uncor_rgb_lines.b * icsf;\n+ uncor_rgb_plines.amod = uncor_rgb_lines.a - uncor_rgb_lines.b * dot3(uncor_rgb_lines.a, uncor_rgb_lines.b);\n+ uncor_rgb_plines.bs = uncor_rgb_lines.b;\n// Same chroma always goes though zero, so this is simpler than the others\nsamec_rgb_plines.amod = vfloat4::zero();\n- samec_rgb_plines.bs = samec_rgb_lines.b * csf;\n- samec_rgb_plines.bis = samec_rgb_lines.b * icsf;\n+ samec_rgb_plines.bs = samec_rgb_lines.b;\n- rgb_luma_plines.amod = (rgb_luma_lines.a - rgb_luma_lines.b * dot3(rgb_luma_lines.a, rgb_luma_lines.b)) * icsf;\n- rgb_luma_plines.bs = rgb_luma_lines.b * csf;\n- rgb_luma_plines.bis = rgb_luma_lines.b * icsf;\n+ rgb_luma_plines.amod = rgb_luma_lines.a - rgb_luma_lines.b * dot3(rgb_luma_lines.a, rgb_luma_lines.b);\n+ rgb_luma_plines.bs = rgb_luma_lines.b;\n// Luminance always goes though zero, so this is simpler than the others\nluminance_plines.amod = vfloat4::zero();\n- luminance_plines.bs = csfn * csf;\n- luminance_plines.bis = csfn * icsf;\n+ luminance_plines.bs = unit3();\ncompute_error_squared_rgb_single_partition(\npi, i, blk,\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove color_scale and icolor_scale
61,745
20.02.2022 22:16:48
0
570ef4640133124498dd84aeafaccf83d22824d4
Clarify some help message descriptions
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel_help.cpp", "new_path": "Source/astcenccli_toplevel_help.cpp", "diff": "@@ -161,14 +161,13 @@ COMPRESSION\n-mask\nThe input texture is a mask texture with unrelated data stored\nin the various color components, so enable error heuristics that\n- aim to improve perceptual quality by minimizing the effect of\n- error cross-talk across the color components.\n+ aim to improve quality by minimizing the effect of error\n+ cross-talk across the color components.\n-normal\nThe input texture is a three component linear LDR normal map\nstoring unit length normals as (R=X, G=Y, B=Z). The output will\n- be a two component X+Y normal map stored as (RGB=X, A=Y),\n- optimized for angular error instead of simple PSNR. The Z\n+ be a two component X+Y normal map stored as (RGB=X, A=Y). The Z\ncomponent can be recovered programmatically in shader code by\nusing the equation:\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Clarify some help message descriptions
61,745
21.02.2022 09:45:51
0
4003394660c865e3b4192671dab015bc84040538
Use more accurate unit2() and unit3() constants
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_vecmathlib.h", "new_path": "Source/astcenc_vecmathlib.h", "diff": "@@ -243,7 +243,8 @@ static ASTCENC_SIMD_INLINE vfloat4 unit4()\n*/\nstatic ASTCENC_SIMD_INLINE vfloat4 unit3()\n{\n- return vfloat4(0.57735f, 0.57735f, 0.57735f, 0.0f);\n+ float val = 0.577350258827209473f;\n+ return vfloat4(val, val, val, 0.0f);\n}\n/**\n@@ -251,7 +252,8 @@ static ASTCENC_SIMD_INLINE vfloat4 unit3()\n*/\nstatic ASTCENC_SIMD_INLINE vfloat4 unit2()\n{\n- return vfloat4(0.70711f, 0.70711f, 0.0f, 0.0f);\n+ float val = 0.707106769084930420f;\n+ return vfloat4(val, val, 0.0f, 0.0f);\n}\n/**\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Use more accurate unit2() and unit3() constants
61,745
21.02.2022 21:02:40
0
464efe68ace5dd18bad83d83f602619c2112434e
Remove unused channel_weight
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_averages_and_directions.cpp", "new_path": "Source/astcenc_averages_and_directions.cpp", "diff": "@@ -116,7 +116,6 @@ void compute_avgs_and_dirs_3_comp(\npartition_metrics pm[BLOCK_MAX_PARTITIONS]\n) {\nfloat texel_weight = hadd_s(blk.channel_weight.swz<0, 1, 2>()) / 3.0f;\n- vfloat4 channel_weight = blk.channel_weight.swz<0, 1, 2>();\nconst float* data_vr = blk.data_r;\nconst float* data_vg = blk.data_g;\n@@ -125,7 +124,6 @@ void compute_avgs_and_dirs_3_comp(\nif (omitted_component == 0)\n{\ntexel_weight = hadd_s(blk.channel_weight.swz<1, 2, 3>()) / 3.0f;\n- channel_weight = blk.channel_weight.swz<1, 2, 3>();\ndata_vr = blk.data_g;\ndata_vg = blk.data_b;\n@@ -134,7 +132,6 @@ void compute_avgs_and_dirs_3_comp(\nelse if (omitted_component == 1)\n{\ntexel_weight = hadd_s(blk.channel_weight.swz<0, 2, 3>()) / 3.0f;\n- channel_weight = blk.channel_weight.swz<0, 2, 3>();\ndata_vg = blk.data_b;\ndata_vb = blk.data_a;\n@@ -142,7 +139,6 @@ void compute_avgs_and_dirs_3_comp(\nelse if (omitted_component == 2)\n{\ntexel_weight = hadd_s(blk.channel_weight.swz<0, 1, 3>()) / 3.0f;\n- channel_weight = blk.channel_weight.swz<0, 1, 3>();\ndata_vb = blk.data_a;\n}\n@@ -296,7 +292,6 @@ void compute_avgs_and_dirs_2_comp(\npartition_metrics pm[BLOCK_MAX_PARTITIONS]\n) {\nfloat texel_weight;\n- vfloat4 channel_weight;\nconst float* data_vr = nullptr;\nconst float* data_vg = nullptr;\n@@ -304,7 +299,6 @@ void compute_avgs_and_dirs_2_comp(\nif (component1 == 0 && component2 == 1)\n{\ntexel_weight = hadd_s(blk.channel_weight.swz<0, 1>()) / 2.0f;\n- channel_weight = blk.channel_weight.swz<0, 1>();\ndata_vr = blk.data_r;\ndata_vg = blk.data_g;\n@@ -312,7 +306,6 @@ void compute_avgs_and_dirs_2_comp(\nelse if (component1 == 0 && component2 == 2)\n{\ntexel_weight = hadd_s(blk.channel_weight.swz<0, 2>()) / 2.0f;\n- channel_weight = blk.channel_weight.swz<0, 2>();\ndata_vr = blk.data_r;\ndata_vg = blk.data_b;\n@@ -322,7 +315,6 @@ void compute_avgs_and_dirs_2_comp(\nassert(component1 == 1 && component2 == 2);\ntexel_weight = hadd_s(blk.channel_weight.swz<1, 2>()) / 2.0f;\n- channel_weight = blk.channel_weight.swz<1, 2>();\ndata_vr = blk.data_g;\ndata_vg = blk.data_b;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove unused channel_weight
61,745
21.02.2022 21:34:02
0
9546e91e8d985b4db2f5f1b9d8fd0597d74cd1ea
Update valgrind wrapper script
[ { "change_type": "MODIFY", "old_path": "Test/astc_profile_valgrind.py", "new_path": "Test/astc_profile_valgrind.py", "diff": "#!/usr/bin/env python3\n# SPDX-License-Identifier: Apache-2.0\n# -----------------------------------------------------------------------------\n-# Copyright 2020-2021 Arm Limited\n+# Copyright 2020-2022 Arm Limited\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy\n@@ -116,7 +116,7 @@ def run_pass(image, noStartup, encoder, blocksize, quality):\nif noStartup:\nargs = [\"gprof2dot\", \"--format=callgrind\", \"--output=out.dot\", \"callgrind.txt\",\n- \"-s\", \"-z\", \"compress_block(astcenc_context const&, astcenc_image const&, image_block const&, physical_compressed_block&, compression_working_buffers&)\"]\n+ \"-s\", \"-z\", \"compress_block(astcenc_context const&, image_block const&, physical_compressed_block&, compression_working_buffers&)\"]\nelse:\nargs = [\"gprof2dot\", \"--format=callgrind\", \"--output=out.dot\", \"callgrind.txt\",\n\"-s\", \"-z\", \"main\"]\n@@ -143,14 +143,14 @@ def parse_command_line():\nparser.add_argument(\"img\", type=argparse.FileType(\"r\"),\nhelp=\"The image file to test\")\n- testencoders = [\"sse2\", \"sse4.1\", \"avx2\"]\n- encoders = testencoders + [\"all\"]\n- parser.add_argument(\"--encoder\", dest=\"encoders\", default=\"avx2\",\n+ encoders = [\"sse2\", \"sse4.1\", \"avx2\"]\n+ parser.add_argument(\"--encoder\", dest=\"encoder\", default=\"avx2\",\nchoices=encoders, help=\"select encoder variant\")\n- testqualities = [\"fastest\", \"fast\", \"medium\", \"thorough\", \"20\", \"30\", \"40\", \"50\"]\n- qualities = testqualities + [\"all\"]\n- parser.add_argument(\"--test-quality\", dest=\"qualities\", default=\"medium\",\n+ testquant = [str(x) for x in range (0, 101, 10)]\n+ testqual = [\"-fastest\", \"-fast\", \"-medium\", \"-thorough\", \"-exhaustive\"]\n+ qualities = testqual + testquant\n+ parser.add_argument(\"--test-quality\", dest=\"quality\", default=\"medium\",\nchoices=qualities, help=\"select compression quality\")\nparser.add_argument(\"--no-startup\", dest=\"noStartup\", default=False,\n@@ -158,18 +158,6 @@ def parse_command_line():\nargs = parser.parse_args()\n- if args.encoders == \"all\":\n- args.encoders = testencoders\n- else:\n- args.encoders = [args.encoders]\n-\n- if args.qualities == \"all\":\n- args.qualities = testqualities\n- elif args.qualities in [\"fastest\", \"fast\", \"medium\", \"thorough\"]:\n- args.qualities = [f\"-{args.qualities}\"]\n- else:\n- args.qualities = [args.qualities]\n-\nreturn args\n@@ -181,11 +169,7 @@ def main():\nint: The process return code.\n\"\"\"\nargs = parse_command_line()\n-\n- for quality in args.qualities:\n- for encoder in args.encoders:\n- run_pass(args.img.name, args.noStartup, encoder, \"6x6\", quality)\n-\n+ run_pass(args.img.name, args.noStartup, args.encoder, \"6x6\", args.quality)\nreturn 0\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update valgrind wrapper script
61,745
21.02.2022 21:48:39
0
e216a7b81a416896bbe9d2070d2aef2de654b2dd
Move error_weight sum out of loop
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1053,6 +1053,7 @@ static inline vfloat4 compute_rgbo_vector(\n}\n/* See header for documentation. */\n+// TODO: Specialize for 1 partition?\nvoid recompute_ideal_colors_1plane(\nconst image_block& blk,\nconst partition_info& pi,\n@@ -1081,24 +1082,21 @@ void recompute_ideal_colors_1plane(\nfor (int i = 0; i < partition_count; i++)\n{\nvfloat4 rgba_sum(1e-17f);\n- vfloat4 rgba_weight_sum(1e-17f);\nunsigned int texel_count = pi.partition_texel_count[i];\nconst uint8_t *texel_indexes = pi.texels_of_partition[i];\n+ // TODO: Use gathers?\npromise(texel_count > 0);\nfor (unsigned int j = 0; j < texel_count; j++)\n{\nunsigned int tix = texel_indexes[j];\n-\n- vfloat4 rgba = blk.texel(tix);\n- vfloat4 error_weight = blk.channel_weight;\n-\n- rgba_sum += rgba * error_weight;\n- rgba_weight_sum += error_weight;\n+ rgba_sum += blk.texel(tix);\n}\n- vfloat4 scale_direction = normalize((rgba_sum * (1.0f / rgba_weight_sum)).swz<0, 1, 2>());\n+ rgba_sum = rgba_sum * blk.channel_weight;\n+ vfloat4 rgba_weight_sum = max(blk.channel_weight * static_cast<float>(texel_count), 1e-17f);\n+ vfloat4 scale_direction = normalize((rgba_sum / rgba_weight_sum).swz<0, 1, 2>());\nfloat scale_max = 0.0f;\nfloat scale_min = 1e10f;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Move error_weight sum out of loop
61,745
21.02.2022 22:08:02
0
eed698028d5aae408f94f4f3a48b1357d7b7daa9
Sclarize left/mid/right sum calculation
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1096,7 +1096,7 @@ void recompute_ideal_colors_1plane(\nrgba_sum = rgba_sum * blk.channel_weight;\nvfloat4 rgba_weight_sum = max(blk.channel_weight * static_cast<float>(texel_count), 1e-17f);\n- vfloat4 scale_direction = normalize((rgba_sum / rgba_weight_sum).swz<0, 1, 2>());\n+ vfloat4 scale_dir = normalize((rgba_sum / rgba_weight_sum).swz<0, 1, 2>());\nfloat scale_max = 0.0f;\nfloat scale_min = 1e10f;\n@@ -1104,10 +1104,9 @@ void recompute_ideal_colors_1plane(\nfloat wmin1 = 1.0f;\nfloat wmax1 = 0.0f;\n- vfloat4 left_sum = vfloat4::zero();\n- vfloat4 middle_sum = vfloat4::zero();\n- vfloat4 right_sum = vfloat4::zero();\n- vfloat4 lmrs_sum = vfloat4::zero();\n+ float left_sum_s = 0.0f;\n+ float middle_sum_s = 0.0f;\n+ float right_sum_s = 0.0f;\nvfloat4 color_vec_x = vfloat4::zero();\nvfloat4 color_vec_y = vfloat4::zero();\n@@ -1117,13 +1116,14 @@ void recompute_ideal_colors_1plane(\nvfloat4 weight_weight_sum = vfloat4(1e-17f);\nfloat psum = 1e-17f;\n+ vfloat4 color_weight = blk.channel_weight;\n+ float ls_weight = hadd_rgb_s(color_weight);\n+\nfor (unsigned int j = 0; j < texel_count; j++)\n{\nunsigned int tix = texel_indexes[j];\nvfloat4 rgba = blk.texel(tix);\n- vfloat4 color_weight = blk.channel_weight;\n- float ls_weight = hadd_rgb_s(color_weight);\nfloat idx0;\nif (!is_decimated)\n@@ -1140,22 +1140,13 @@ void recompute_ideal_colors_1plane(\nwmin1 = astc::min(idx0, wmin1);\nwmax1 = astc::max(idx0, wmax1);\n- float scale = dot3_s(scale_direction, rgba);\n+ float scale = dot3_s(scale_dir, rgba);\nscale_min = astc::min(scale, scale_min);\nscale_max = astc::max(scale, scale_max);\n- vfloat4 left = color_weight * (om_idx0 * om_idx0);\n- vfloat4 middle = color_weight * (om_idx0 * idx0);\n- vfloat4 right = color_weight * (idx0 * idx0);\n-\n- vfloat4 lmrs = vfloat3(om_idx0 * om_idx0,\n- om_idx0 * idx0,\n- idx0 * idx0) * ls_weight;\n-\n- left_sum += left;\n- middle_sum += middle;\n- right_sum += right;\n- lmrs_sum += lmrs;\n+ left_sum_s += om_idx0 * om_idx0;\n+ middle_sum_s += om_idx0 * idx0;\n+ right_sum_s += idx0 * idx0;\nvfloat4 color_idx(idx0);\nvfloat4 cwprod = color_weight * rgba;\n@@ -1169,6 +1160,11 @@ void recompute_ideal_colors_1plane(\npsum += dot3_s(color_weight * color_idx, color_idx);\n}\n+ vfloat4 left_sum = vfloat4(left_sum_s) * color_weight;\n+ vfloat4 middle_sum = vfloat4(middle_sum_s) * color_weight;\n+ vfloat4 right_sum = vfloat4(right_sum_s) * color_weight;\n+ vfloat4 lmrs_sum = vfloat3(left_sum_s, middle_sum_s, right_sum_s) * ls_weight;\n+\n// Calculations specific to mode #7, the HDR RGB-scale mode\nvfloat4 rgbq_sum = color_vec_x + color_vec_y;\nrgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));\n@@ -1187,7 +1183,7 @@ void recompute_ideal_colors_1plane(\nfloat scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\nscalediv = astc::clamp1f(scalediv);\n- vfloat4 sds = scale_direction * scale_max;\n+ vfloat4 sds = scale_dir * scale_max;\nrgbs_vectors[i] = vfloat4(sds.lane<0>(), sds.lane<1>(), sds.lane<2>(), scalediv);\n@@ -1195,7 +1191,7 @@ void recompute_ideal_colors_1plane(\n{\n// If all weights in the partition were equal, then just take average of all colors in\n// the partition and use that as both endpoint colors\n- vfloat4 avg = (color_vec_x + color_vec_y) * (1.0f / rgba_weight_sum);\n+ vfloat4 avg = (color_vec_x + color_vec_y) / rgba_weight_sum;\nvmask4 notnan_mask = avg == avg;\nep.endpt0[i] = select(ep.endpt0[i], avg, notnan_mask);\n@@ -1237,7 +1233,7 @@ void recompute_ideal_colors_1plane(\nif (fabsf(ls_det1) > (ls_mss1 * 1e-4f) && scale_ep0 == scale_ep0 && scale_ep1 == scale_ep1 && scale_ep0 < scale_ep1)\n{\nfloat scalediv2 = scale_ep0 * (1.0f / scale_ep1);\n- vfloat4 sdsm = scale_direction * scale_ep1;\n+ vfloat4 sdsm = scale_dir * scale_ep1;\nrgbs_vectors[i] = vfloat4(sdsm.lane<0>(), sdsm.lane<1>(), sdsm.lane<2>(), scalediv2);\n}\n}\n@@ -1292,24 +1288,24 @@ void recompute_ideal_colors_2planes(\nvfloat4 rgba_weight_sum = blk.channel_weight * bsd.texel_count;\nunsigned int texel_count = bsd.texel_count;\n- vfloat4 scale_direction = normalize(blk.data_mean.swz<0, 1, 2>());\n+ vfloat4 scale_dir = normalize(blk.data_mean.swz<0, 1, 2>());\nfloat scale_max = 0.0f;\nfloat scale_min = 1e10f;\nfloat wmin1 = 1.0f;\nfloat wmax1 = 0.0f;\n+\nfloat wmin2 = 1.0f;\nfloat wmax2 = 0.0f;\n- vfloat4 left_sum = vfloat4::zero();\n- vfloat4 middle_sum = vfloat4::zero();\n- vfloat4 right_sum = vfloat4::zero();\n+ float left1_sum_s = 0.0f;\n+ float middle1_sum_s = 0.0f;\n+ float right1_sum_s = 0.0f;\n- vfloat4 left2_sum = vfloat4::zero();\n- vfloat4 middle2_sum = vfloat4::zero();\n- vfloat4 right2_sum = vfloat4::zero();\n- vfloat4 lmrs_sum = vfloat4::zero();\n+ float left2_sum_s = 0.0f;\n+ float middle2_sum_s = 0.0f;\n+ float right2_sum_s = 0.0f;\nvfloat4 color_vec_x = vfloat4::zero();\nvfloat4 color_vec_y = vfloat4::zero();\n@@ -1319,11 +1315,12 @@ void recompute_ideal_colors_2planes(\nvfloat4 weight_weight_sum = vfloat4(1e-17f);\nfloat psum = 1e-17f;\n+ vfloat4 color_weight = blk.channel_weight;\n+ float ls_weight = hadd_rgb_s(color_weight);\n+\nfor (unsigned int j = 0; j < texel_count; j++)\n{\nvfloat4 rgba = blk.texel(j);\n- vfloat4 color_weight = blk.channel_weight;\n- float ls_weight = hadd_rgb_s(color_weight);\nfloat idx0;\nif (!is_decimated)\n@@ -1340,22 +1337,13 @@ void recompute_ideal_colors_2planes(\nwmin1 = astc::min(idx0, wmin1);\nwmax1 = astc::max(idx0, wmax1);\n- float scale = dot3_s(scale_direction, rgba);\n+ float scale = dot3_s(scale_dir, rgba);\nscale_min = astc::min(scale, scale_min);\nscale_max = astc::max(scale, scale_max);\n- vfloat4 left = color_weight * (om_idx0 * om_idx0);\n- vfloat4 middle = color_weight * (om_idx0 * idx0);\n- vfloat4 right = color_weight * (idx0 * idx0);\n-\n- vfloat4 lmrs = vfloat3(om_idx0 * om_idx0,\n- om_idx0 * idx0,\n- idx0 * idx0) * ls_weight;\n-\n- left_sum += left;\n- middle_sum += middle;\n- right_sum += right;\n- lmrs_sum += lmrs;\n+ left1_sum_s += om_idx0 * om_idx0;\n+ middle1_sum_s += om_idx0 * idx0;\n+ right1_sum_s += idx0 * idx0;\nfloat idx1;\nif (!is_decimated)\n@@ -1372,13 +1360,9 @@ void recompute_ideal_colors_2planes(\nwmin2 = astc::min(idx1, wmin2);\nwmax2 = astc::max(idx1, wmax2);\n- vfloat4 left2 = color_weight * (om_idx1 * om_idx1);\n- vfloat4 middle2 = color_weight * (om_idx1 * idx1);\n- vfloat4 right2 = color_weight * (idx1 * idx1);\n-\n- left2_sum += left2;\n- middle2_sum += middle2;\n- right2_sum += right2;\n+ left2_sum_s += om_idx1 * om_idx1;\n+ middle2_sum_s += om_idx1 * idx1;\n+ right2_sum_s += idx1 * idx1;\nvmask4 p2_mask = vint4::lane_id() == vint4(plane2_component);\nvfloat4 color_idx = select(vfloat4(idx0), vfloat4(idx1), p2_mask);\n@@ -1394,6 +1378,15 @@ void recompute_ideal_colors_2planes(\npsum += dot3_s(color_weight * color_idx, color_idx);\n}\n+ vfloat4 left1_sum = vfloat4(left1_sum_s) * color_weight;\n+ vfloat4 middle1_sum = vfloat4(middle1_sum_s) * color_weight;\n+ vfloat4 right1_sum = vfloat4(right1_sum_s) * color_weight;\n+ vfloat4 lmrs_sum = vfloat3(left1_sum_s, middle1_sum_s, right1_sum_s) * ls_weight;\n+\n+ vfloat4 left2_sum = vfloat4(left2_sum_s) * color_weight;\n+ vfloat4 middle2_sum = vfloat4(middle2_sum_s) * color_weight;\n+ vfloat4 right2_sum = vfloat4(right2_sum_s) * color_weight;\n+\n// Calculations specific to mode #7, the HDR RGB-scale mode\nvfloat4 rgbq_sum = color_vec_x + color_vec_y;\nrgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));\n@@ -1410,7 +1403,7 @@ void recompute_ideal_colors_2planes(\nfloat scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\nscalediv = astc::clamp1f(scalediv);\n- vfloat4 sds = scale_direction * scale_max;\n+ vfloat4 sds = scale_dir * scale_max;\nrgbs_vector = vfloat4(sds.lane<0>(), sds.lane<1>(), sds.lane<2>(), scalediv);\n@@ -1433,22 +1426,22 @@ void recompute_ideal_colors_2planes(\n{\n// Otherwise, complete the analytic calculation of ideal-endpoint-values for the given\n// set of texel weights and pixel colors\n- vfloat4 color_det1 = (left_sum * right_sum) - (middle_sum * middle_sum);\n+ vfloat4 color_det1 = (left1_sum * right1_sum) - (middle1_sum * middle1_sum);\nvfloat4 color_rdet1 = 1.0f / color_det1;\nfloat ls_det1 = (lmrs_sum.lane<0>() * lmrs_sum.lane<2>()) - (lmrs_sum.lane<1>() * lmrs_sum.lane<1>());\nfloat ls_rdet1 = 1.0f / ls_det1;\n- vfloat4 color_mss1 = (left_sum * left_sum)\n- + (2.0f * middle_sum * middle_sum)\n- + (right_sum * right_sum);\n+ vfloat4 color_mss1 = (left1_sum * left1_sum)\n+ + (2.0f * middle1_sum * middle1_sum)\n+ + (right1_sum * right1_sum);\nfloat ls_mss1 = (lmrs_sum.lane<0>() * lmrs_sum.lane<0>())\n+ (2.0f * lmrs_sum.lane<1>() * lmrs_sum.lane<1>())\n+ (lmrs_sum.lane<2>() * lmrs_sum.lane<2>());\n- vfloat4 ep0 = (right_sum * color_vec_x - middle_sum * color_vec_y) * color_rdet1;\n- vfloat4 ep1 = (left_sum * color_vec_y - middle_sum * color_vec_x) * color_rdet1;\n+ vfloat4 ep0 = (right1_sum * color_vec_x - middle1_sum * color_vec_y) * color_rdet1;\n+ vfloat4 ep1 = (left1_sum * color_vec_y - middle1_sum * color_vec_x) * color_rdet1;\nfloat scale_ep0 = (lmrs_sum.lane<2>() * scale_vec.lane<0>() - lmrs_sum.lane<1>() * scale_vec.lane<1>()) * ls_rdet1;\nfloat scale_ep1 = (lmrs_sum.lane<0>() * scale_vec.lane<1>() - lmrs_sum.lane<1>() * scale_vec.lane<0>()) * ls_rdet1;\n@@ -1464,7 +1457,7 @@ void recompute_ideal_colors_2planes(\nif (fabsf(ls_det1) > (ls_mss1 * 1e-4f) && scale_ep0 == scale_ep0 && scale_ep1 == scale_ep1 && scale_ep0 < scale_ep1)\n{\nfloat scalediv2 = scale_ep0 * (1.0f / scale_ep1);\n- vfloat4 sdsm = scale_direction * scale_ep1;\n+ vfloat4 sdsm = scale_dir * scale_ep1;\nrgbs_vector = vfloat4(sdsm.lane<0>(), sdsm.lane<1>(), sdsm.lane<2>(), scalediv2);\n}\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Sclarize left/mid/right sum calculation
61,745
21.02.2022 22:28:08
0
e1a01aadc0de7c8ded7e4768e4788ed53428e266
Refactoring recompute_ideal_colors to reduce code size
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1113,7 +1113,7 @@ void recompute_ideal_colors_1plane(\nvfloat4 scale_vec = vfloat4::zero();\n- vfloat4 weight_weight_sum = vfloat4(1e-17f);\n+ float weight_weight_sum_s = 1e-17f;\nfloat psum = 1e-17f;\nvfloat4 color_weight = blk.channel_weight;\n@@ -1147,6 +1147,7 @@ void recompute_ideal_colors_1plane(\nleft_sum_s += om_idx0 * om_idx0;\nmiddle_sum_s += om_idx0 * idx0;\nright_sum_s += idx0 * idx0;\n+ weight_weight_sum_s += idx0;\nvfloat4 color_idx(idx0);\nvfloat4 cwprod = color_weight * rgba;\n@@ -1155,8 +1156,7 @@ void recompute_ideal_colors_1plane(\ncolor_vec_y += cwiprod;\ncolor_vec_x += cwprod - cwiprod;\n- scale_vec += vfloat2(om_idx0, idx0) * (ls_weight * scale);\n- weight_weight_sum += color_weight * color_idx;\n+ scale_vec += vfloat2(om_idx0, idx0) * scale;\npsum += dot3_s(color_weight * color_idx, color_idx);\n}\n@@ -1165,19 +1165,8 @@ void recompute_ideal_colors_1plane(\nvfloat4 right_sum = vfloat4(right_sum_s) * color_weight;\nvfloat4 lmrs_sum = vfloat3(left_sum_s, middle_sum_s, right_sum_s) * ls_weight;\n- // Calculations specific to mode #7, the HDR RGB-scale mode\n- vfloat4 rgbq_sum = color_vec_x + color_vec_y;\n- rgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));\n-\n- vfloat4 rgbovec = compute_rgbo_vector(rgba_weight_sum, weight_weight_sum,\n- rgbq_sum, psum);\n- rgbo_vectors[i] = rgbovec;\n-\n- // We will occasionally get a failure due to the use of a singular (non-invertible) matrix.\n- // Record whether such a failure has taken place; if it did, compute rgbo_vectors[] with a\n- // different method later\n- float chkval = dot_s(rgbovec, rgbovec);\n- int rgbo_fail = chkval != chkval;\n+ vfloat4 weight_weight_sum = vfloat4(weight_weight_sum_s) * color_weight;\n+ scale_vec = scale_vec * ls_weight;\n// Initialize the luminance and scale vectors with a reasonable default\nfloat scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\n@@ -1238,8 +1227,16 @@ void recompute_ideal_colors_1plane(\n}\n}\n- // If the calculation of an RGB-offset vector failed, try to compute a value another way\n- if (rgbo_fail)\n+ // Calculations specific to mode #7, the HDR RGB-scale mode\n+ vfloat4 rgbq_sum = color_vec_x + color_vec_y;\n+ rgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));\n+\n+ vfloat4 rgbovec = compute_rgbo_vector(rgba_weight_sum, weight_weight_sum, rgbq_sum, psum);\n+ rgbo_vectors[i] = rgbovec;\n+\n+ // We can get a failure due to the use of a singular (non-invertible) matrix\n+ // If it failed, compute rgbo_vectors[] with a different method ...\n+ if (astc::isnan(dot_s(rgbovec, rgbovec)))\n{\nvfloat4 v0 = ep.endpt0[i];\nvfloat4 v1 = ep.endpt1[i];\n@@ -1249,7 +1246,6 @@ void recompute_ideal_colors_1plane(\nvfloat4 avg = (v0 + v1) * 0.5f;\nvfloat4 ep0 = avg - vfloat4(avgdif) * 0.5f;\n-\nrgbo_vectors[i] = vfloat4(ep0.lane<0>(), ep0.lane<1>(), ep0.lane<2>(), avgdif);\n}\n}\n@@ -1387,18 +1383,6 @@ void recompute_ideal_colors_2planes(\nvfloat4 middle2_sum = vfloat4(middle2_sum_s) * color_weight;\nvfloat4 right2_sum = vfloat4(right2_sum_s) * color_weight;\n- // Calculations specific to mode #7, the HDR RGB-scale mode\n- vfloat4 rgbq_sum = color_vec_x + color_vec_y;\n- rgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));\n-\n- rgbo_vector = compute_rgbo_vector(rgba_weight_sum, weight_weight_sum, rgbq_sum, psum);\n-\n- // We will occasionally get a failure due to the use of a singular (non-invertible) matrix.\n- // Record whether such a failure has taken place; if it did, compute rgbo_vectors[] with a\n- // different method later\n- float chkval = dot_s(rgbo_vector, rgbo_vector);\n- int rgbo_fail = chkval != chkval;\n-\n// Initialize the luminance and scale vectors with a reasonable default\nfloat scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\nscalediv = astc::clamp1f(scalediv);\n@@ -1498,8 +1482,15 @@ void recompute_ideal_colors_2planes(\nep.endpt1[0] = select(ep.endpt1[0], ep1, full_mask);\n}\n- // If the calculation of an RGB-offset vector failed, try to compute a value another way\n- if (rgbo_fail)\n+ // Calculations specific to mode #7, the HDR RGB-scale mode\n+ vfloat4 rgbq_sum = color_vec_x + color_vec_y;\n+ rgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));\n+\n+ rgbo_vector = compute_rgbo_vector(rgba_weight_sum, weight_weight_sum, rgbq_sum, psum);\n+\n+ // We can get a failure due to the use of a singular (non-invertible) matrix\n+ // If it failed, compute rgbo_vectors[] with a different method ...\n+ if (astc::isnan(dot_s(rgbo_vector, rgbo_vector)))\n{\nvfloat4 v0 = ep.endpt0[0];\nvfloat4 v1 = ep.endpt1[0];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Refactoring recompute_ideal_colors to reduce code size
61,745
21.02.2022 22:46:15
0
dafc7460bf54a20a993da49ae60e92248adb5b40
Defer calculation of RGBO psum
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1114,7 +1114,6 @@ void recompute_ideal_colors_1plane(\nvfloat4 scale_vec = vfloat4::zero();\nfloat weight_weight_sum_s = 1e-17f;\n- float psum = 1e-17f;\nvfloat4 color_weight = blk.channel_weight;\nfloat ls_weight = hadd_rgb_s(color_weight);\n@@ -1157,7 +1156,6 @@ void recompute_ideal_colors_1plane(\ncolor_vec_x += cwprod - cwiprod;\nscale_vec += vfloat2(om_idx0, idx0) * scale;\n- psum += dot3_s(color_weight * color_idx, color_idx);\n}\nvfloat4 left_sum = vfloat4(left_sum_s) * color_weight;\n@@ -1167,6 +1165,7 @@ void recompute_ideal_colors_1plane(\nvfloat4 weight_weight_sum = vfloat4(weight_weight_sum_s) * color_weight;\nscale_vec = scale_vec * ls_weight;\n+ float psum = right_sum_s * hadd_rgb_s(color_weight);\n// Initialize the luminance and scale vectors with a reasonable default\nfloat scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\n@@ -1309,8 +1308,8 @@ void recompute_ideal_colors_2planes(\nvfloat4 scale_vec = vfloat4::zero();\nvfloat4 weight_weight_sum = vfloat4(1e-17f);\n- float psum = 1e-17f;\n+ vmask4 p2_mask = vint4::lane_id() == vint4(plane2_component);\nvfloat4 color_weight = blk.channel_weight;\nfloat ls_weight = hadd_rgb_s(color_weight);\n@@ -1360,7 +1359,6 @@ void recompute_ideal_colors_2planes(\nmiddle2_sum_s += om_idx1 * idx1;\nright2_sum_s += idx1 * idx1;\n- vmask4 p2_mask = vint4::lane_id() == vint4(plane2_component);\nvfloat4 color_idx = select(vfloat4(idx0), vfloat4(idx1), p2_mask);\nvfloat4 cwprod = color_weight * rgba;\n@@ -1371,7 +1369,6 @@ void recompute_ideal_colors_2planes(\nscale_vec += vfloat2(om_idx0, idx0) * (ls_weight * scale);\nweight_weight_sum += (color_weight * color_idx);\n- psum += dot3_s(color_weight * color_idx, color_idx);\n}\nvfloat4 left1_sum = vfloat4(left1_sum_s) * color_weight;\n@@ -1386,7 +1383,7 @@ void recompute_ideal_colors_2planes(\n// Initialize the luminance and scale vectors with a reasonable default\nfloat scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\nscalediv = astc::clamp1f(scalediv);\n-\n+ float psum = dot3_s(select(right1_sum, right2_sum, p2_mask), color_weight);\nvfloat4 sds = scale_dir * scale_max;\nrgbs_vector = vfloat4(sds.lane<0>(), sds.lane<1>(), sds.lane<2>(), scalediv);\n@@ -1452,7 +1449,6 @@ void recompute_ideal_colors_2planes(\n// the partition and use that as both endpoint colors\nvfloat4 avg = (color_vec_x + color_vec_y) * (1.0f / rgba_weight_sum);\n- vmask4 p2_mask = vint4::lane_id() == vint4(plane2_component);\nvmask4 notnan_mask = avg == avg;\nvmask4 full_mask = p2_mask & notnan_mask;\n@@ -1473,7 +1469,6 @@ void recompute_ideal_colors_2planes(\nvfloat4 ep0 = (right2_sum * color_vec_x - middle2_sum * color_vec_y) * color_rdet2;\nvfloat4 ep1 = (left2_sum * color_vec_y - middle2_sum * color_vec_x) * color_rdet2;\n- vmask4 p2_mask = vint4::lane_id() == vint4(plane2_component);\nvmask4 det_mask = abs(color_det2) > (color_mss2 * 1e-4f);\nvmask4 notnan_mask = (ep0 == ep0) & (ep1 == ep1);\nvmask4 full_mask = p2_mask & det_mask & notnan_mask;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Defer calculation of RGBO psum
61,745
21.02.2022 22:57:31
0
db8b5099c6b7331511ba9130ddb453bc1356f5ea
More loop refactoring
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1149,13 +1149,13 @@ void recompute_ideal_colors_1plane(\nweight_weight_sum_s += idx0;\nvfloat4 color_idx(idx0);\n- vfloat4 cwprod = color_weight * rgba;\n+ vfloat4 cwprod = rgba;\nvfloat4 cwiprod = cwprod * color_idx;\ncolor_vec_y += cwiprod;\ncolor_vec_x += cwprod - cwiprod;\n- scale_vec += vfloat2(om_idx0, idx0) * scale;\n+ scale_vec += vfloat2(om_idx0, idx0) * (scale * ls_weight);\n}\nvfloat4 left_sum = vfloat4(left_sum_s) * color_weight;\n@@ -1164,9 +1164,11 @@ void recompute_ideal_colors_1plane(\nvfloat4 lmrs_sum = vfloat3(left_sum_s, middle_sum_s, right_sum_s) * ls_weight;\nvfloat4 weight_weight_sum = vfloat4(weight_weight_sum_s) * color_weight;\n- scale_vec = scale_vec * ls_weight;\nfloat psum = right_sum_s * hadd_rgb_s(color_weight);\n+ color_vec_x = color_vec_x * color_weight;\n+ color_vec_y = color_vec_y * color_weight;\n+\n// Initialize the luminance and scale vectors with a reasonable default\nfloat scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\nscalediv = astc::clamp1f(scalediv);\n@@ -1361,7 +1363,7 @@ void recompute_ideal_colors_2planes(\nvfloat4 color_idx = select(vfloat4(idx0), vfloat4(idx1), p2_mask);\n- vfloat4 cwprod = color_weight * rgba;\n+ vfloat4 cwprod = rgba;\nvfloat4 cwiprod = cwprod * color_idx;\ncolor_vec_y += cwiprod;\n@@ -1380,10 +1382,15 @@ void recompute_ideal_colors_2planes(\nvfloat4 middle2_sum = vfloat4(middle2_sum_s) * color_weight;\nvfloat4 right2_sum = vfloat4(right2_sum_s) * color_weight;\n+ float psum = dot3_s(select(right1_sum, right2_sum, p2_mask), color_weight);\n+\n+ color_vec_x = color_vec_x * color_weight;\n+ color_vec_y = color_vec_y * color_weight;\n+\n// Initialize the luminance and scale vectors with a reasonable default\nfloat scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\nscalediv = astc::clamp1f(scalediv);\n- float psum = dot3_s(select(right1_sum, right2_sum, p2_mask), color_weight);\n+\nvfloat4 sds = scale_dir * scale_max;\nrgbs_vector = vfloat4(sds.lane<0>(), sds.lane<1>(), sds.lane<2>(), scalediv);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
More loop refactoring
61,745
21.02.2022 23:28:08
0
b72beb3e3efbf925051ce8d6d42f15489d139f31
Avoid NaN for 2 plane ideal_ep_and_wt
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1282,9 +1282,8 @@ void recompute_ideal_colors_2planes(\ndec_weights_quant_uvalue_plane2[i] = qat->unquantized_value[dec_weights_quant_pvalue_plane2[i]] * (1.0f / 64.0f);\n}\n- vfloat4 rgba_weight_sum = blk.channel_weight * bsd.texel_count;\n-\nunsigned int texel_count = bsd.texel_count;\n+ vfloat4 rgba_weight_sum = max(blk.channel_weight * static_cast<float>(texel_count), 1e-17f);\nvfloat4 scale_dir = normalize(blk.data_mean.swz<0, 1, 2>());\nfloat scale_max = 0.0f;\n@@ -1399,7 +1398,7 @@ void recompute_ideal_colors_2planes(\n{\n// If all weights in the partition were equal, then just take average of all colors in\n// the partition and use that as both endpoint colors\n- vfloat4 avg = (color_vec_x + color_vec_y) * (1.0f / rgba_weight_sum);\n+ vfloat4 avg = (color_vec_x + color_vec_y) / rgba_weight_sum;\nvmask4 p1_mask = vint4::lane_id() != vint4(plane2_component);\nvmask4 notnan_mask = avg == avg;\n@@ -1454,7 +1453,7 @@ void recompute_ideal_colors_2planes(\n{\n// If all weights in the partition were equal, then just take average of all colors in\n// the partition and use that as both endpoint colors\n- vfloat4 avg = (color_vec_x + color_vec_y) * (1.0f / rgba_weight_sum);\n+ vfloat4 avg = (color_vec_x + color_vec_y) / rgba_weight_sum;\nvmask4 notnan_mask = avg == avg;\nvmask4 full_mask = p2_mask & notnan_mask;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Avoid NaN for 2 plane ideal_ep_and_wt
61,745
22.02.2022 10:08:34
0
42a8f6ee01715f45edffb6773e34b8bb914a47df
Add update to change log
[ { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-3x.md", "new_path": "Docs/ChangeLog-3x.md", "diff": "@@ -7,6 +7,39 @@ All performance data on this page is measured on an Intel Core i5-9600K\nclocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.\n+<!-- ---------------------------------------------------------------------- -->\n+## 3.4\n+\n+**Status:** In development\n+\n+The 3.4 release introduces another round of optimizations, removing a number\n+of power-user configuration options to simplify the core compressor data path.\n+\n+* **General:**\n+ * **Feature:** The `-v` and `-va` options to set a per-texel error weight\n+ function are no longer supported.\n+ * **Feature:** The `-b` option to set a per-texel error weight boost for\n+ block border texels is no longer supported.\n+ * **Feature:** The `-a` option to set a per-texel error weight based on texel\n+ alpha value is no longer supported as an error weighting tool, but is still\n+ supported for providing sprite-sheet RDO.\n+ * **Feature:** The `-mask` option to set an error metric for mask map\n+ textures is still supported, but is currently a no-op in the compressor.\n+ * **Feature:** The `-perceptual` option to set a perceptual error metric is\n+ still supported, but is currently a no-op in the compressor for mask map\n+ and normal map textures.\n+\n+### Performance:\n+\n+Key for charts:\n+\n+* Color = block size (see legend).\n+* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).\n+\n+**Relative performance vs 3.3 release:**\n+\n+Pending ...\n+\n<!-- ---------------------------------------------------------------------- -->\n## 3.3\n@@ -46,12 +79,11 @@ performance differences are expected.\n**Status:** July 2021\n-The 3.1 release is the second release in the 3.x series. This release gives\n-another performance boost, typically between 5 and 20% faster than the 3.0\n-release, as well as further incremental improvements to image quality. A number\n-of build system improvements make astcenc easier and faster to integrate into\n-other projects as a library, including support for building universal binaries\n-on macOS. Full change list is shown below.\n+The 3.1 release gives another performance boost, typically between 5 and 20%\n+faster than the 3.0 release, as well as further incremental improvements to\n+image quality. A number of build system improvements make astcenc easier and\n+faster to integrate into other projects as a library, including support for\n+building universal binaries on macOS. Full change list is shown below.\nReminder for users of the library interface - the API is not designed to be\nbinary compatible across versions, and this release is not compatible with\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add update to change log
61,745
22.02.2022 20:28:30
0
ed365e7e5ff5c1f60c012f8806616c590ed81442
Support build-time restriction on block size
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "# SPDX-License-Identifier: Apache-2.0\n# ----------------------------------------------------------------------------\n-# Copyright 2020-2021 Arm Limited\n+# Copyright 2020-2022 Arm Limited\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy\n@@ -189,6 +189,9 @@ function(printopt optName optVal)\nendif()\nendfunction()\n+if(\"${BLOCK_MAX_TEXELS}\")\n+ message(STATUS \" Max block texels - ${BLOCK_MAX_TEXELS}\")\n+endif()\nprintopt(\"AVX2 backend \" ${ISA_AVX2})\nprintopt(\"SSE4.1 backend \" ${ISA_SSE41})\nprintopt(\"SSE2 backend \" ${ISA_SSE2})\n" }, { "change_type": "MODIFY", "old_path": "Docs/Building.md", "new_path": "Docs/Building.md", "diff": "@@ -118,17 +118,6 @@ make install -j16\nFor codec developers there are a number of useful features in the build system.\n-### No intrinsics build\n-\n-All normal builds will use SIMD accelerated code paths using intrinsics, as all\n-target architectures (x86-64 and aarch64) guarantee SIMD availability. For\n-development purposes it is possible to build an intrinsic-free build which uses\n-no explicit SIMD acceleration (the compiler may still auto-vectorize).\n-\n-To enable this binary variant add `-DISA_NONE=ON` to the CMake command line\n-when configuring. It is NOT recommended to use this for production; it is\n-significantly slower than the vectorized SIMD builds.\n-\n### Build Types\nWe support and test the following `CMAKE_BUILD_TYPE` options.\n@@ -142,6 +131,26 @@ We support and test the following `CMAKE_BUILD_TYPE` options.\nNote that optimized release builds are compiled with link-time optimization,\nwhich can make profiling more challenging ...\n+### No intrinsics builds\n+\n+All normal builds will use SIMD accelerated code paths using intrinsics, as all\n+target architectures (x86-64 and aarch64) guarantee SIMD availability. For\n+development purposes it is possible to build an intrinsic-free build which uses\n+no explicit SIMD acceleration (the compiler may still auto-vectorize).\n+\n+To enable this binary variant add `-DISA_NONE=ON` to the CMake command line\n+when configuring. It is NOT recommended to use this for production; it is\n+significantly slower than the vectorized SIMD builds.\n+\n+### Constrained block sizebuilds\n+\n+All normal builds will support all ASTC block sizes, including the worst case\n+6x6x6 3D block size (216 texels per block). Compressor memory footprint and\n+performance can be improved by limiting the block sizes supported in the build\n+by adding `-DBLOCK_MAX_TEXELS=<texel_count>` to to CMake command line when\n+configuring. Legal block sizes that are unavailable in a restricted build will\n+return the error `ASTCENC_ERR_NOT_IMPLEMENTED` during context creation.\n+\n### Testing\nWe support building unit tests.\n" }, { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-3x.md", "new_path": "Docs/ChangeLog-3x.md", "diff": "@@ -16,6 +16,9 @@ The 3.4 release introduces another round of optimizations, removing a number\nof power-user configuration options to simplify the core compressor data path.\n* **General:**\n+ * **Feature:** Builds now support `-DBLOCK_MAX_TEXELS=<count>` to allow a\n+ compressor to support a subset of block sizes. This can reduce binary size\n+ and runtime memory footprint, and improve performance.\n* **Feature:** The `-v` and `-va` options to set a per-texel error weight\nfunction are no longer supported.\n* **Feature:** The `-b` option to set a per-texel error weight boost for\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_entry.cpp", "new_path": "Source/astcenc_entry.cpp", "diff": "@@ -231,13 +231,22 @@ static astcenc_error validate_block_size(\nunsigned int block_y,\nunsigned int block_z\n) {\n- if (((block_z <= 1) && is_legal_2d_block_size(block_x, block_y)) ||\n- ((block_z >= 2) && is_legal_3d_block_size(block_x, block_y, block_z)))\n+ // Test if this is a legal block size at all\n+ bool is_legal = (((block_z <= 1) && is_legal_2d_block_size(block_x, block_y)) ||\n+ ((block_z >= 2) && is_legal_3d_block_size(block_x, block_y, block_z)));\n+ if (!is_legal)\n{\n- return ASTCENC_SUCCESS;\n+ return ASTCENC_ERR_BAD_BLOCK_SIZE;\n}\n- return ASTCENC_ERR_BAD_BLOCK_SIZE;\n+ // Test if this build has sufficient capacity for this block size\n+ bool have_capacity = (block_x * block_y * block_z) <= BLOCK_MAX_TEXELS;\n+ if (!have_capacity)\n+ {\n+ return ASTCENC_ERR_NOT_IMPLEMENTED;\n+ }\n+\n+ return ASTCENC_SUCCESS;\n}\n/**\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "/* ============================================================================\nConstants\n============================================================================ */\n+#if !defined(ASTCENC_BLOCK_MAX_TEXELS)\n+ #define ASTCENC_BLOCK_MAX_TEXELS 216 // A 3D 6x6x6 block\n+#endif\n+\n+/** @brief The maximum number of texels a block can support (6x6x6 block). */\n+static constexpr unsigned int BLOCK_MAX_TEXELS { ASTCENC_BLOCK_MAX_TEXELS };\n+\n/** @brief The maximum number of components a block can support. */\nstatic constexpr unsigned int BLOCK_MAX_COMPONENTS { 4 };\n@@ -75,9 +82,6 @@ static constexpr unsigned int BLOCK_MAX_PARTITIONS { 4 };\n/** @brief The number of partitionings, per partition count, suported by the ASTC format. */\nstatic constexpr unsigned int BLOCK_MAX_PARTITIONINGS { 1024 };\n-/** @brief The maximum number of texels a block can support (6x6x6 block). */\n-static constexpr unsigned int BLOCK_MAX_TEXELS { 216 };\n-\n/** @brief The maximum number of weights used during partition selection for texel clustering. */\nstatic constexpr uint8_t BLOCK_MAX_KMEANS_TEXELS { 64 };\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_percentile_tables.cpp", "new_path": "Source/astcenc_percentile_tables.cpp", "diff": "@@ -45,6 +45,7 @@ struct packed_percentile_table\nconst uint16_t *items[2];\n};\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (4 * 4)\nstatic const uint16_t percentile_arr_4x4_0[61] {\n0x0242,0x7243,0x6A51,0x6A52,0x5A41,0x4A53,0x8851,0x3842,\n0x3852,0x3853,0x3043,0xFA33,0x1BDF,0x2022,0x1032,0x29CE,\n@@ -77,7 +78,9 @@ static const packed_percentile_table block_pcd_4x4 {\n{ 0, 53 },\n{ percentile_arr_4x4_0, percentile_arr_4x4_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (5 * 4)\nstatic const uint16_t percentile_arr_5x4_0[91] {\n0x02C1,0xFAD1,0xE8D3,0xDAC2,0xA8D2,0x70D1,0x50C2,0x80C3,\n0xD2C3,0x4AA2,0x2AD2,0x2242,0x2251,0x42A3,0x1A43,0x4A52,\n@@ -116,7 +119,9 @@ static const packed_percentile_table block_pcd_5x4 {\n{ 0, 202 },\n{ percentile_arr_5x4_0, percentile_arr_5x4_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (5 * 5)\nstatic const uint16_t percentile_arr_5x5_0[129] {\n0x00F3,0xF8F2,0x70E3,0x62E1,0x60E1,0x4AC1,0x3261,0x38D3,\n0x3271,0x5AF1,0x5873,0x2AD1,0x28E2,0x28F1,0x2262,0x9AC2,\n@@ -163,7 +168,9 @@ static const packed_percentile_table block_pcd_5x5 {\n{ 0, 116 },\n{ percentile_arr_5x5_0, percentile_arr_5x5_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (6 * 5)\nstatic const uint16_t percentile_arr_6x5_0[165] {\n0x0163,0xF8F3,0x9962,0x8972,0x7961,0x7173,0x6953,0x5943,\n0x4B41,0x3AE1,0x38E3,0x6971,0x32C1,0x28D3,0x2A61,0xC8F2,\n@@ -217,7 +224,9 @@ static const packed_percentile_table block_pcd_6x5 {\n{ 0, 156 },\n{ percentile_arr_6x5_0, percentile_arr_6x5_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (6 * 6)\nstatic const uint16_t percentile_arr_6x6_0[206] {\n0x006F,0xF908,0xF104,0xE918,0xE963,0xD114,0xB0F3,0xA07E,\n0x7972,0x705F,0x687F,0x6162,0x5953,0x586E,0x610C,0x524D,\n@@ -278,7 +287,9 @@ static const packed_percentile_table block_pcd_6x6 {\n{ 0, 256 },\n{ percentile_arr_6x6_0, percentile_arr_6x6_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 5)\nstatic const uint16_t percentile_arr_8x5_0[226] {\n0x0066,0xF865,0xE963,0xA856,0xA1F2,0x9875,0x91C3,0x91E2,\n0x80F3,0x8076,0x61E3,0x6153,0x5172,0x59D2,0x51D3,0x5047,\n@@ -342,7 +353,9 @@ static const packed_percentile_table block_pcd_8x5 {\n{ 0, 178 },\n{ percentile_arr_8x5_0, percentile_arr_8x5_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 6)\nstatic const uint16_t percentile_arr_8x6_0[273] {\n0x0154,0xF944,0xE066,0xA128,0x9963,0x8118,0x806F,0x79F2,\n0x79E2,0x7108,0xD934,0x6056,0x69C3,0x60F3,0x5972,0x59E3,\n@@ -415,7 +428,9 @@ static const packed_percentile_table block_pcd_8x6 {\n{ 0, 64 },\n{ percentile_arr_8x6_0, percentile_arr_8x6_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 8)\nstatic const uint16_t percentile_arr_8x8_0[347] {\n0x0334,0xFD44,0xDD14,0x9154,0x9B08,0x906A,0x8928,0x8108,\n0xE866,0xC918,0x606F,0xC0FE,0x5963,0x58EE,0x6534,0x505A,\n@@ -499,7 +514,9 @@ static const packed_percentile_table block_pcd_8x8 {\n{ 0, 38 },\n{ percentile_arr_8x8_0, percentile_arr_8x8_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 5)\nstatic const uint16_t percentile_arr_10x5_0[274] {\n0x0165,0xF975,0xD866,0xC056,0xA946,0x90C6,0x90F5,0x8963,\n0x80D6,0x80E6,0x60F3,0x61C3,0x59F2,0xA927,0x5075,0x4847,\n@@ -571,7 +588,9 @@ static const packed_percentile_table block_pcd_10x5 {\n{ 0, 79 },\n{ percentile_arr_10x5_0, percentile_arr_10x5_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 6)\nstatic const uint16_t percentile_arr_10x6_0[325] {\n0x01A4,0xF954,0xA066,0x9975,0x80F5,0x7056,0x6918,0x6963,\n0x58C6,0x5946,0x5928,0x5174,0x586F,0xA0E6,0x5108,0x48D6,\n@@ -651,7 +670,9 @@ static const packed_percentile_table block_pcd_10x6 {\n{ 0, 78 },\n{ percentile_arr_10x6_0, percentile_arr_10x6_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 8)\nstatic const uint16_t percentile_arr_10x8_0[400] {\n0x0154,0xAB34,0xAD44,0x8308,0x7866,0x7B64,0x79A4,0x7975,\n0x686A,0x6908,0xC514,0x6174,0x6128,0x6118,0x5B54,0x5163,\n@@ -744,7 +765,9 @@ static const packed_percentile_table block_pcd_10x8 =\n{ 0, 52 },\n{ percentile_arr_10x8_0, percentile_arr_10x8_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 10)\nstatic const uint16_t percentile_arr_10x10_0[453] {\n0x0334,0x9514,0x8954,0x806A,0x6F14,0x6724,0x6108,0x6364,\n0x5175,0x5D44,0x5866,0x5118,0x5308,0xA179,0x5128,0xF534,\n@@ -845,7 +868,9 @@ static const packed_percentile_table block_pcd_10x10 {\n{ 0, 70 },\n{ percentile_arr_10x10_0, percentile_arr_10x10_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (12 * 10)\nstatic const uint16_t percentile_arr_12x10_0[491] {\n0x0334,0x9954,0x8514,0x7128,0x6364,0xC174,0x5D34,0x5866,\n0x5975,0x5354,0xAF14,0x506A,0x5108,0x5724,0x5308,0x4544,\n@@ -952,7 +977,9 @@ static const packed_percentile_table block_pcd_12x10 =\n{ 0, 23 },\n{ percentile_arr_12x10_0, percentile_arr_12x10_1 }\n};\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (12 * 12)\nstatic const uint16_t percentile_arr_12x12_0[529] {\n0x0334,0xF534,0x8514,0x8954,0x7F14,0xFB54,0x7B08,0x7128,\n0x7974,0x6179,0x6B64,0x6908,0x606A,0x6724,0xB544,0xB066,\n@@ -1064,6 +1091,7 @@ static const packed_percentile_table block_pcd_12x12 {\n{ 0, 22 },\n{ percentile_arr_12x12_0, percentile_arr_12x12_1 }\n};\n+#endif\n/**\n* @brief Fetch the packed percentile table for the given 2D block size.\n@@ -1080,20 +1108,48 @@ static const packed_percentile_table *get_packed_table(\nint idx = (ydim << 8) | xdim;\nswitch (idx)\n{\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (4 * 4)\ncase 0x0404: return &block_pcd_4x4;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (5 * 4)\ncase 0x0405: return &block_pcd_5x4;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (5 * 5)\ncase 0x0505: return &block_pcd_5x5;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (6 * 5)\ncase 0x0506: return &block_pcd_6x5;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (6 * 6)\ncase 0x0606: return &block_pcd_6x6;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 5)\ncase 0x0508: return &block_pcd_8x5;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 6)\ncase 0x0608: return &block_pcd_8x6;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (8 * 8)\ncase 0x0808: return &block_pcd_8x8;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 5)\ncase 0x050A: return &block_pcd_10x5;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 6)\ncase 0x060A: return &block_pcd_10x6;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 8)\ncase 0x080A: return &block_pcd_10x8;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (10 * 10)\ncase 0x0A0A: return &block_pcd_10x10;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (12 * 10)\ncase 0x0A0C: return &block_pcd_12x10;\n+#endif\n+#if ASTCENC_BLOCK_MAX_TEXELS >= (12 * 12)\ncase 0x0C0C: return &block_pcd_12x12;\n+#endif\n}\n// Should never hit this with a valid 2D block size\n" }, { "change_type": "MODIFY", "old_path": "Source/cmake_core.cmake", "new_path": "Source/cmake_core.cmake", "diff": "@@ -89,6 +89,12 @@ macro(astcenc_set_properties NAME)\nASTCENC_DECOMPRESS_ONLY)\nendif()\n+ if(${BLOCK_MAX_TEXELS})\n+ target_compile_definitions(${NAME}\n+ PRIVATE\n+ ASTCENC_BLOCK_MAX_TEXELS=${BLOCK_MAX_TEXELS})\n+ endif()\n+\nif(${DIAGNOSTICS})\ntarget_compile_definitions(${NAME}\nPUBLIC\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Support build-time restriction on block size
61,745
22.02.2022 22:05:20
0
34e5696d5d4e617f6f479ac0a07270d949905d04
Move large array allocations off the stack
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_block_sizes.cpp", "new_path": "Source/astcenc_block_sizes.cpp", "diff": "@@ -243,25 +243,20 @@ static bool decode_block_mode_3d(\n* @param x_weights The number of weights in the X dimension.\n* @param y_weights The number of weights in the Y dimension.\n* @param[out] di The decimation info structure to populate.\n+ * @param[out] wb The decimation table init scratch working buffers.\n*/\nstatic void init_decimation_info_2d(\nunsigned int x_texels,\nunsigned int y_texels,\nunsigned int x_weights,\nunsigned int y_weights,\n- decimation_info& di\n+ decimation_info& di,\n+ dt_init_working_buffers& wb\n) {\nunsigned int texels_per_block = x_texels * y_texels;\nunsigned int weights_per_block = x_weights * y_weights;\n- uint8_t weight_count_of_texel[BLOCK_MAX_TEXELS];\n- uint8_t grid_weights_of_texel[BLOCK_MAX_TEXELS][4];\n- uint8_t weights_of_texel[BLOCK_MAX_TEXELS][4];\n-\n- uint8_t texel_count_of_weight[BLOCK_MAX_WEIGHTS];\nuint8_t max_texel_count_of_weight = 0;\n- uint8_t texels_of_weight[BLOCK_MAX_WEIGHTS][BLOCK_MAX_TEXELS];\n- uint8_t texel_weights_of_weight[BLOCK_MAX_WEIGHTS][BLOCK_MAX_TEXELS];\npromise(weights_per_block > 0);\npromise(texels_per_block > 0);\n@@ -270,12 +265,12 @@ static void init_decimation_info_2d(\nfor (unsigned int i = 0; i < weights_per_block; i++)\n{\n- texel_count_of_weight[i] = 0;\n+ wb.texel_count_of_weight[i] = 0;\n}\nfor (unsigned int i = 0; i < texels_per_block; i++)\n{\n- weight_count_of_texel[i] = 0;\n+ wb.weight_count_of_texel[i] = 0;\n}\nfor (unsigned int y = 0; y < y_texels; y++)\n@@ -311,13 +306,13 @@ static void init_decimation_info_2d(\n{\nif (weight[i] != 0)\n{\n- grid_weights_of_texel[texel][weight_count_of_texel[texel]] = static_cast<uint8_t>(qweight[i]);\n- weights_of_texel[texel][weight_count_of_texel[texel]] = static_cast<uint8_t>(weight[i]);\n- weight_count_of_texel[texel]++;\n- texels_of_weight[qweight[i]][texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(texel);\n- texel_weights_of_weight[qweight[i]][texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(weight[i]);\n- texel_count_of_weight[qweight[i]]++;\n- max_texel_count_of_weight = astc::max(max_texel_count_of_weight, texel_count_of_weight[qweight[i]]);\n+ wb.grid_weights_of_texel[texel][wb.weight_count_of_texel[texel]] = static_cast<uint8_t>(qweight[i]);\n+ wb.weights_of_texel[texel][wb.weight_count_of_texel[texel]] = static_cast<uint8_t>(weight[i]);\n+ wb.weight_count_of_texel[texel]++;\n+ wb.texels_of_weight[qweight[i]][wb.texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(texel);\n+ wb.texel_weights_of_weight[qweight[i]][wb.texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(weight[i]);\n+ wb.texel_count_of_weight[qweight[i]]++;\n+ max_texel_count_of_weight = astc::max(max_texel_count_of_weight, wb.texel_count_of_weight[qweight[i]]);\n}\n}\n}\n@@ -325,17 +320,17 @@ static void init_decimation_info_2d(\nfor (unsigned int i = 0; i < texels_per_block; i++)\n{\n- di.texel_weight_count[i] = weight_count_of_texel[i];\n+ di.texel_weight_count[i] = wb.weight_count_of_texel[i];\n- for (unsigned int j = 0; j < weight_count_of_texel[i]; j++)\n+ for (unsigned int j = 0; j < wb.weight_count_of_texel[i]; j++)\n{\n- di.texel_weights_int_4t[j][i] = weights_of_texel[i][j];\n- di.texel_weights_float_4t[j][i] = ((float)weights_of_texel[i][j]) * (1.0f / WEIGHTS_TEXEL_SUM);\n- di.texel_weights_4t[j][i] = grid_weights_of_texel[i][j];\n+ di.texel_weights_int_4t[j][i] = wb.weights_of_texel[i][j];\n+ di.texel_weights_float_4t[j][i] = ((float)wb.weights_of_texel[i][j]) * (1.0f / WEIGHTS_TEXEL_SUM);\n+ di.texel_weights_4t[j][i] = wb.grid_weights_of_texel[i][j];\n}\n// Init all 4 entries so we can rely on zeros for vectorization\n- for (unsigned int j = weight_count_of_texel[i]; j < 4; j++)\n+ for (unsigned int j = wb.weight_count_of_texel[i]; j < 4; j++)\n{\ndi.texel_weights_int_4t[j][i] = 0;\ndi.texel_weights_float_4t[j][i] = 0.0f;\n@@ -345,16 +340,16 @@ static void init_decimation_info_2d(\nfor (unsigned int i = 0; i < weights_per_block; i++)\n{\n- unsigned int texel_count_wt = texel_count_of_weight[i];\n+ unsigned int texel_count_wt = wb.texel_count_of_weight[i];\ndi.weight_texel_count[i] = (uint8_t)texel_count_wt;\nfor (unsigned int j = 0; j < texel_count_wt; j++)\n{\n- uint8_t texel = texels_of_weight[i][j];\n+ uint8_t texel = wb.texels_of_weight[i][j];\n// Create transposed versions of these for better vectorization\ndi.weight_texel[j][i] = texel;\n- di.weights_flt[j][i] = (float)texel_weights_of_weight[i][j];\n+ di.weights_flt[j][i] = (float)wb.texel_weights_of_weight[i][j];\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@@ -409,7 +404,7 @@ static void init_decimation_info_2d(\n// Initialize array tail so we can over-fetch with SIMD later to avoid loop tails\n// Match last texel in active lane in SIMD group, for better gathers\n- unsigned int last_texel_count_wt = texel_count_of_weight[weights_per_block - 1];\n+ unsigned int last_texel_count_wt = wb.texel_count_of_weight[weights_per_block - 1];\nuint8_t last_texel = di.weight_texel[last_texel_count_wt - 1][weights_per_block - 1];\nunsigned int weights_per_block_simd = round_up_to_simd_multiple_vla(weights_per_block);\n@@ -441,6 +436,7 @@ static void init_decimation_info_2d(\n* @param y_weights The number of weights in the Y dimension.\n* @param z_weights The number of weights in the Z dimension.\n* @param[out] di The decimation info structure to populate.\n+ @param[out] wb The decimation table init scratch working buffers.\n*/\nstatic void init_decimation_info_3d(\nunsigned int x_texels,\n@@ -449,31 +445,25 @@ static void init_decimation_info_3d(\nunsigned int x_weights,\nunsigned int y_weights,\nunsigned int z_weights,\n- decimation_info& di\n+ decimation_info& di,\n+ dt_init_working_buffers& wb\n) {\nunsigned int texels_per_block = x_texels * y_texels * z_texels;\nunsigned int weights_per_block = x_weights * y_weights * z_weights;\n- uint8_t weight_count_of_texel[BLOCK_MAX_TEXELS];\n- uint8_t grid_weights_of_texel[BLOCK_MAX_TEXELS][4];\n- uint8_t weights_of_texel[BLOCK_MAX_TEXELS][4];\n-\n- uint8_t texel_count_of_weight[BLOCK_MAX_WEIGHTS];\nuint8_t max_texel_count_of_weight = 0;\n- uint8_t texels_of_weight[BLOCK_MAX_WEIGHTS][BLOCK_MAX_TEXELS];\n- uint8_t texel_weights_of_weight[BLOCK_MAX_WEIGHTS][BLOCK_MAX_TEXELS];\npromise(weights_per_block > 0);\npromise(texels_per_block > 0);\nfor (unsigned int i = 0; i < weights_per_block; i++)\n{\n- texel_count_of_weight[i] = 0;\n+ wb.texel_count_of_weight[i] = 0;\n}\nfor (unsigned int i = 0; i < texels_per_block; i++)\n{\n- weight_count_of_texel[i] = 0;\n+ wb.weight_count_of_texel[i] = 0;\n}\nfor (unsigned int z = 0; z < z_texels; z++)\n@@ -580,13 +570,13 @@ static void init_decimation_info_3d(\n{\nif (weight[i] != 0)\n{\n- grid_weights_of_texel[texel][weight_count_of_texel[texel]] = static_cast<uint8_t>(qweight[i]);\n- weights_of_texel[texel][weight_count_of_texel[texel]] = static_cast<uint8_t>(weight[i]);\n- weight_count_of_texel[texel]++;\n- texels_of_weight[qweight[i]][texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(texel);\n- texel_weights_of_weight[qweight[i]][texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(weight[i]);\n- texel_count_of_weight[qweight[i]]++;\n- max_texel_count_of_weight = astc::max(max_texel_count_of_weight, texel_count_of_weight[qweight[i]]);\n+ wb.grid_weights_of_texel[texel][wb.weight_count_of_texel[texel]] = static_cast<uint8_t>(qweight[i]);\n+ wb.weights_of_texel[texel][wb.weight_count_of_texel[texel]] = static_cast<uint8_t>(weight[i]);\n+ wb.weight_count_of_texel[texel]++;\n+ wb.texels_of_weight[qweight[i]][wb.texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(texel);\n+ wb.texel_weights_of_weight[qweight[i]][wb.texel_count_of_weight[qweight[i]]] = static_cast<uint8_t>(weight[i]);\n+ wb.texel_count_of_weight[qweight[i]]++;\n+ max_texel_count_of_weight = astc::max(max_texel_count_of_weight, wb.texel_count_of_weight[qweight[i]]);\n}\n}\n}\n@@ -595,7 +585,7 @@ static void init_decimation_info_3d(\nfor (unsigned int i = 0; i < texels_per_block; i++)\n{\n- di.texel_weight_count[i] = weight_count_of_texel[i];\n+ di.texel_weight_count[i] = wb.weight_count_of_texel[i];\n// Init all 4 entries so we can rely on zeros for vectorization\nfor (unsigned int j = 0; j < 4; j++)\n@@ -605,26 +595,26 @@ static void init_decimation_info_3d(\ndi.texel_weights_4t[j][i] = 0;\n}\n- for (unsigned int j = 0; j < weight_count_of_texel[i]; j++)\n+ for (unsigned int j = 0; j < wb.weight_count_of_texel[i]; j++)\n{\n- di.texel_weights_int_4t[j][i] = weights_of_texel[i][j];\n- di.texel_weights_float_4t[j][i] = ((float)weights_of_texel[i][j]) * (1.0f / WEIGHTS_TEXEL_SUM);\n- di.texel_weights_4t[j][i] = grid_weights_of_texel[i][j];\n+ di.texel_weights_int_4t[j][i] = wb.weights_of_texel[i][j];\n+ di.texel_weights_float_4t[j][i] = ((float)wb.weights_of_texel[i][j]) * (1.0f / WEIGHTS_TEXEL_SUM);\n+ di.texel_weights_4t[j][i] = wb.grid_weights_of_texel[i][j];\n}\n}\nfor (unsigned int i = 0; i < weights_per_block; i++)\n{\n- unsigned int texel_count_wt = texel_count_of_weight[i];\n+ unsigned int texel_count_wt = wb.texel_count_of_weight[i];\ndi.weight_texel_count[i] = (uint8_t)texel_count_wt;\nfor (unsigned int j = 0; j < texel_count_wt; j++)\n{\n- unsigned int texel = texels_of_weight[i][j];\n+ unsigned int texel = wb.texels_of_weight[i][j];\n// Create transposed versions of these for better vectorization\ndi.weight_texel[j][i] = static_cast<uint8_t>(texel);\n- di.weights_flt[j][i] = static_cast<float>(texel_weights_of_weight[i][j]);\n+ di.weights_flt[j][i] = static_cast<float>(wb.texel_weights_of_weight[i][j]);\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@@ -679,7 +669,7 @@ static void init_decimation_info_3d(\n// Initialize array tail so we can over-fetch with SIMD later to avoid loop tails\n// Match last texel in active lane in SIMD group, for better gathers\n- int last_texel_count_wt = texel_count_of_weight[weights_per_block - 1];\n+ int last_texel_count_wt = wb.texel_count_of_weight[weights_per_block - 1];\nuint8_t last_texel = di.weight_texel[last_texel_count_wt - 1][weights_per_block - 1];\nunsigned int weights_per_block_simd = round_up_to_simd_multiple_vla(weights_per_block);\n@@ -755,6 +745,8 @@ static void assign_kmeans_texels(\n* @param y_texels The number of texels in the Y dimension.\n* @param x_weights The number of weights in the X dimension.\n* @param y_weights The number of weights in the Y dimension.\n+ * @param bsd The block size descriptor we are populating.\n+ * @param wb The decimation table init scratch working buffers.\n*\n* @return The new entry's index in the compacted decimation table array.\n*/\n@@ -763,7 +755,8 @@ static int construct_dt_entry_2d(\nunsigned int y_texels,\nunsigned int x_weights,\nunsigned int y_weights,\n- block_size_descriptor& bsd\n+ block_size_descriptor& bsd,\n+ dt_init_working_buffers& wb\n) {\nunsigned int dm_index = bsd.decimation_mode_count;\nunsigned int weight_count = x_weights * y_weights;\n@@ -772,7 +765,7 @@ static int construct_dt_entry_2d(\nbool try_2planes = (2 * weight_count) <= BLOCK_MAX_WEIGHTS;\ndecimation_info *di = aligned_malloc<decimation_info>(sizeof(decimation_info), ASTCENC_VECALIGN);\n- init_decimation_info_2d(x_texels, y_texels, x_weights, y_weights, *di);\n+ init_decimation_info_2d(x_texels, y_texels, x_weights, y_weights, *di, wb);\nint maxprec_1plane = -1;\nint maxprec_2planes = -1;\n@@ -829,6 +822,8 @@ static void construct_block_size_descriptor_2d(\nstatic const unsigned int MAX_DMI = 12 * 16 + 12;\nint decimation_mode_index[MAX_DMI];\n+ dt_init_working_buffers* wb = new dt_init_working_buffers;\n+\nbsd.xdim = static_cast<uint8_t>(x_texels);\nbsd.ydim = static_cast<uint8_t>(y_texels);\nbsd.zdim = 1;\n@@ -909,7 +904,7 @@ static void construct_block_size_descriptor_2d(\nint decimation_mode = decimation_mode_index[y_weights * 16 + x_weights];\nif (decimation_mode < 0)\n{\n- decimation_mode = construct_dt_entry_2d(x_texels, y_texels, x_weights, y_weights, bsd);\n+ decimation_mode = construct_dt_entry_2d(x_texels, y_texels, x_weights, y_weights, bsd, *wb);\ndecimation_mode_index[y_weights * 16 + x_weights] = decimation_mode;\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\n@@ -970,6 +965,8 @@ static void construct_block_size_descriptor_2d(\n// Determine the texels to use for kmeans clustering.\nassign_kmeans_texels(bsd);\n+\n+ delete wb;\n}\n/**\n@@ -995,6 +992,8 @@ static void construct_block_size_descriptor_3d(\nint decimation_mode_index[MAX_DMI];\nunsigned int decimation_mode_count = 0;\n+ dt_init_working_buffers* wb = new dt_init_working_buffers;\n+\nbsd.xdim = static_cast<uint8_t>(x_texels);\nbsd.ydim = static_cast<uint8_t>(y_texels);\nbsd.zdim = static_cast<uint8_t>(z_texels);\n@@ -1020,7 +1019,7 @@ static void construct_block_size_descriptor_3d(\ndecimation_info *di = aligned_malloc<decimation_info>(sizeof(decimation_info), ASTCENC_VECALIGN);\ndecimation_mode_index[z_weights * 64 + y_weights * 8 + x_weights] = decimation_mode_count;\n- init_decimation_info_3d(x_texels, y_texels, z_texels, x_weights, y_weights, z_weights, *di);\n+ init_decimation_info_3d(x_texels, y_texels, z_texels, x_weights, y_weights, z_weights, *di, *wb);\nint maxprec_1plane = -1;\nint maxprec_2planes = -1;\n@@ -1114,6 +1113,8 @@ static void construct_block_size_descriptor_3d(\n// Determine the texels to use for kmeans clustering.\nassign_kmeans_texels(bsd);\n+\n+ delete wb;\n}\n/* See header for documentation. */\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -300,23 +300,22 @@ static float compress_symbolic_block_for_partition_1plane(\nfloat min_wt_cutoff = hmin_s(min_ep);\n// For each mode, use the angular method to compute a shift\n- float weight_low_value[WEIGHTS_MAX_BLOCK_MODES];\n- float weight_high_value[WEIGHTS_MAX_BLOCK_MODES];\n-\ncompute_angular_endpoints_1plane(\nconfig.tune_low_weight_count_limit,\nonly_always, bsd,\ndec_weights_ideal_value, dec_weights_ideal_sig,\n- weight_low_value, weight_high_value);\n+ tmpbuf);\n+\n+ float* weight_low_value = tmpbuf.weight_low_value1;\n+ float* weight_high_value = tmpbuf.weight_high_value1;\n+ int* qwt_bitcounts = tmpbuf.qwt_bitcounts;\n+ float* qwt_errors = tmpbuf.qwt_errors;\n// For each mode (which specifies a decimation and a quantization):\n// * Compute number of bits needed for the quantized weights\n// * Generate an optimized set of quantized weights\n// * Compute quantization errors for the mode\n- int qwt_bitcounts[WEIGHTS_MAX_BLOCK_MODES];\n- float qwt_errors[WEIGHTS_MAX_BLOCK_MODES];\n-\nfor (unsigned int i = 0; i < bsd.block_mode_count; ++i)\n{\nqwt_errors[i] = 1e38f;\n@@ -380,7 +379,7 @@ static float compress_symbolic_block_for_partition_1plane(\nunsigned int candidate_count = compute_ideal_endpoint_formats(\nbsd, pi, blk, ei.ep, qwt_bitcounts, qwt_errors,\nconfig.tune_candidate_limit, partition_format_specifiers, block_mode_index,\n- color_quant_level, color_quant_level_mod);\n+ color_quant_level, color_quant_level_mod, tmpbuf);\n// Iterate over the N believed-to-be-best modes to find out which one is actually best\nfloat best_errorval_in_mode = ERROR_CALC_DEFAULT;\n@@ -667,24 +666,24 @@ static float compress_symbolic_block_for_partition_2planes(\n// Set the minwt2 to the plane2 component min in ep2\nfloat min_wt_cutoff2 = hmin_s(select(err_max, min_ep2, err_mask));\n- float weight_low_value1[WEIGHTS_MAX_BLOCK_MODES];\n- float weight_high_value1[WEIGHTS_MAX_BLOCK_MODES];\n- float weight_low_value2[WEIGHTS_MAX_BLOCK_MODES];\n- float weight_high_value2[WEIGHTS_MAX_BLOCK_MODES];\n-\ncompute_angular_endpoints_2planes(\nconfig.tune_low_weight_count_limit,\nbsd, dec_weights_ideal_value, dec_weights_ideal_sig,\n- weight_low_value1, weight_high_value1,\n- weight_low_value2, weight_high_value2);\n+ tmpbuf);\n// For each mode (which specifies a decimation and a quantization):\n// * Compute number of bits needed for the quantized weights\n// * Generate an optimized set of quantized weights\n// * Compute quantization errors for the mode\n- int qwt_bitcounts[WEIGHTS_MAX_BLOCK_MODES];\n- float qwt_errors[WEIGHTS_MAX_BLOCK_MODES];\n+ float* weight_low_value1 = tmpbuf.weight_low_value1;\n+ float* weight_high_value1 = tmpbuf.weight_high_value1;\n+ float* weight_low_value2 = tmpbuf.weight_low_value2;\n+ float* weight_high_value2 = tmpbuf.weight_high_value2;\n+\n+ int* qwt_bitcounts = tmpbuf.qwt_bitcounts;\n+ float* qwt_errors = tmpbuf.qwt_errors;\n+\nfor (unsigned int i = 0; i < bsd.block_mode_count; ++i)\n{\nconst block_mode& bm = bsd.block_modes[i];\n@@ -762,7 +761,7 @@ static float compress_symbolic_block_for_partition_2planes(\nunsigned int candidate_count = compute_ideal_endpoint_formats(\nbsd, pi, blk, epm, qwt_bitcounts, qwt_errors,\nconfig.tune_candidate_limit, partition_format_specifiers, block_mode_index,\n- color_quant_level, color_quant_level_mod);\n+ color_quant_level, color_quant_level_mod, tmpbuf);\n// Iterate over the N believed-to-be-best modes to find out which one is actually best\nfloat best_errorval_in_mode = ERROR_CALC_DEFAULT;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -1026,6 +1026,59 @@ struct alignas(ASTCENC_VECALIGN) compression_working_buffers\n* For two plane encodings, second plane weights start at @c WEIGHTS_PLANE2_OFFSET offsets.\n*/\nalignas(ASTCENC_VECALIGN) uint8_t dec_weights_quant_pvalue[WEIGHTS_MAX_BLOCK_MODES * BLOCK_MAX_WEIGHTS];\n+\n+ /** @brief Error of the best encoding combination for each block mode. */\n+ alignas(ASTCENC_VECALIGN) float errors_of_best_combination[WEIGHTS_MAX_BLOCK_MODES];\n+\n+ /** @brief The best color quant for each block mode. */\n+ alignas(ASTCENC_VECALIGN) quant_method best_quant_levels[WEIGHTS_MAX_BLOCK_MODES];\n+\n+ /** @brief The best color quant for each block mode if modes are the same and we have spare bits. */\n+ quant_method best_quant_levels_mod[WEIGHTS_MAX_BLOCK_MODES];\n+\n+ /** @brief The best endpoint format for each partition. */\n+ int best_ep_formats[WEIGHTS_MAX_BLOCK_MODES][BLOCK_MAX_PARTITIONS];\n+\n+ /** @brief The total bit storage needed for quantized weights for each block mode. */\n+ int qwt_bitcounts[WEIGHTS_MAX_BLOCK_MODES];\n+\n+ /** @brief The cumulative error for quantized weights for each block mode. */\n+ float qwt_errors[WEIGHTS_MAX_BLOCK_MODES];\n+\n+ /** @brief The low weight value in plane 1 for each block mode. */\n+ float weight_low_value1[WEIGHTS_MAX_BLOCK_MODES];\n+\n+ /** @brief The high weight value in plane 1 for each block mode. */\n+ float weight_high_value1[WEIGHTS_MAX_BLOCK_MODES];\n+\n+ /** @brief The low weight value in plane 1 for each quant level and decimation mode. */\n+ float weight_low_values1[WEIGHTS_MAX_DECIMATION_MODES][12];\n+\n+ /** @brief The high weight value in plane 1 for each quant level and decimation mode. */\n+ float weight_high_values1[WEIGHTS_MAX_DECIMATION_MODES][12];\n+\n+ /** @brief The low weight value in plane 2 for each block mode. */\n+ float weight_low_value2[WEIGHTS_MAX_BLOCK_MODES];\n+\n+ /** @brief The high weight value in plane 2 for each block mode. */\n+ float weight_high_value2[WEIGHTS_MAX_BLOCK_MODES];\n+\n+ /** @brief The low weight value in plane 2 for each quant level and decimation mode. */\n+ float weight_low_values2[WEIGHTS_MAX_DECIMATION_MODES][12];\n+\n+ /** @brief The high weight value in plane 2 for each quant level and decimation mode. */\n+ float weight_high_values2[WEIGHTS_MAX_DECIMATION_MODES][12];\n+};\n+\n+struct dt_init_working_buffers\n+{\n+ uint8_t weight_count_of_texel[BLOCK_MAX_TEXELS];\n+ uint8_t grid_weights_of_texel[BLOCK_MAX_TEXELS][4];\n+ uint8_t weights_of_texel[BLOCK_MAX_TEXELS][4];\n+\n+ uint8_t texel_count_of_weight[BLOCK_MAX_WEIGHTS];\n+ uint8_t texels_of_weight[BLOCK_MAX_WEIGHTS][BLOCK_MAX_TEXELS];\n+ uint8_t texel_weights_of_weight[BLOCK_MAX_WEIGHTS][BLOCK_MAX_TEXELS];\n};\n/**\n@@ -1939,6 +1992,7 @@ void unpack_weights(\n* @param[out] block_mode The best packed block mode indexes.\n* @param[out] quant_level The best color quant level.\n* @param[out] quant_level_mod The best color quant level if endpoints are the same.\n+ * @param[out] tmpbuf Preallocated scratch buffers for the compressor.\n*\n* @return The actual number of candidate matches returned.\n*/\n@@ -1953,7 +2007,8 @@ unsigned int compute_ideal_endpoint_formats(\nint partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS],\nint block_mode[TUNE_MAX_TRIAL_CANDIDATES],\nquant_method quant_level[TUNE_MAX_TRIAL_CANDIDATES],\n- quant_method quant_level_mod[TUNE_MAX_TRIAL_CANDIDATES]);\n+ quant_method quant_level_mod[TUNE_MAX_TRIAL_CANDIDATES],\n+ compression_working_buffers& tmpbuf);\n/**\n* @brief For a given 1 plane weight set recompute the endpoint colors.\n@@ -2022,8 +2077,7 @@ void prepare_angular_tables();\n* @param bsd The block size descriptor for the current trial.\n* @param dec_weight_quant_uvalue The decimated and quantized weight values.\n* @param dec_weight_quant_sig The significance of each weight.\n- * @param[out] low_value The lowest weight to consider for each block mode.\n- * @param[out] high_value The highest weight to consider for each block mode.\n+ * @param[out] tmpbuf Preallocated scratch buffers for the compressor.\n*/\nvoid compute_angular_endpoints_1plane(\nunsigned int tune_low_weight_limit,\n@@ -2031,8 +2085,7 @@ void compute_angular_endpoints_1plane(\nconst block_size_descriptor& bsd,\nconst float* dec_weight_quant_uvalue,\nconst float* dec_weight_quant_sig,\n- float low_value[WEIGHTS_MAX_BLOCK_MODES],\n- float high_value[WEIGHTS_MAX_BLOCK_MODES]);\n+ compression_working_buffers& tmpbuf);\n/**\n* @brief Compute the angular endpoints for two planes for each block mode.\n@@ -2041,20 +2094,14 @@ void compute_angular_endpoints_1plane(\n* @param bsd The block size descriptor for the current trial.\n* @param dec_weight_quant_uvalue The decimated and quantized weight values.\n* @param dec_weight_quant_sig The significance of each weight.\n- * @param[out] low_value1 The lowest weight p1 to consider for each block mode.\n- * @param[out] high_value1 The highest weight p1 to consider for each block mode.\n- * @param[out] low_value2 The lowest weight p2 to consider for each block mode.\n- * @param[out] high_value2 The highest weight p2 to consider for each block mode.\n+ * @param[out] tmpbuf Preallocated scratch buffers for the compressor.\n*/\nvoid compute_angular_endpoints_2planes(\nunsigned int tune_low_weight_limit,\nconst block_size_descriptor& bsd,\nconst float* dec_weight_quant_uvalue,\nconst float* dec_weight_quant_sig,\n- float low_value1[WEIGHTS_MAX_BLOCK_MODES],\n- float high_value1[WEIGHTS_MAX_BLOCK_MODES],\n- float low_value2[WEIGHTS_MAX_BLOCK_MODES],\n- float high_value2[WEIGHTS_MAX_BLOCK_MODES]);\n+ compression_working_buffers& tmpbuf);\n/* ============================================================================\nFunctionality for high level compression and decompression access.\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_partition_tables.cpp", "new_path": "Source/astcenc_partition_tables.cpp", "diff": "@@ -93,15 +93,15 @@ static bool compare_canonical_partitionings(\n* which have the same texel assignment groupings. It is only useful for the compressor to test one\n* of each, so we mark duplicates as invalid.\n*\n+* @param bit_patterns The scratch memory for the bit patterns.\n* @param texel_count The first canonical bit pattern to check.\n* @param[in,out] pt The table of partitioning information entries.\n*/\nstatic void remove_duplicate_partitionings(\n+ uint64_t* bit_patterns,\nint texel_count,\npartition_info pt[BLOCK_MAX_PARTITIONINGS]\n) {\n- uint64_t bit_patterns[BLOCK_MAX_PARTITIONINGS * 7];\n-\nfor (unsigned int i = 0; i < BLOCK_MAX_PARTITIONINGS; i++)\n{\ngenerate_canonical_partitioning(texel_count, pt[i].partition_of_texel, bit_patterns + i * 7);\n@@ -373,7 +373,11 @@ void init_partition_tables(\ngenerate_one_partition_info_entry(bsd, 4, i, par_tab4[i]);\n}\n- remove_duplicate_partitionings(bsd.texel_count, par_tab2);\n- remove_duplicate_partitionings(bsd.texel_count, par_tab3);\n- remove_duplicate_partitionings(bsd.texel_count, par_tab4);\n+ uint64_t* bit_patterns = new uint64_t[BLOCK_MAX_PARTITIONINGS * 7];\n+\n+ remove_duplicate_partitionings(bit_patterns, bsd.texel_count, par_tab2);\n+ remove_duplicate_partitionings(bit_patterns, bsd.texel_count, par_tab3);\n+ remove_duplicate_partitionings(bit_patterns, bsd.texel_count, par_tab4);\n+\n+ delete[] bit_patterns;\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_pick_best_endpoint_format.cpp", "new_path": "Source/astcenc_pick_best_endpoint_format.cpp", "diff": "@@ -1052,7 +1052,8 @@ unsigned int compute_ideal_endpoint_formats(\nint partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS],\nint block_mode[TUNE_MAX_TRIAL_CANDIDATES],\nquant_method quant_level[TUNE_MAX_TRIAL_CANDIDATES],\n- quant_method quant_level_mod[TUNE_MAX_TRIAL_CANDIDATES]\n+ quant_method quant_level_mod[TUNE_MAX_TRIAL_CANDIDATES],\n+ compression_working_buffers& tmpbuf\n) {\nint partition_count = pi.partition_count;\n@@ -1077,10 +1078,10 @@ unsigned int compute_ideal_endpoint_formats(\nformat_of_choice[i]);\n}\n- alignas(ASTCENC_VECALIGN) float errors_of_best_combination[WEIGHTS_MAX_BLOCK_MODES];\n- alignas(ASTCENC_VECALIGN) quant_method best_quant_levels[WEIGHTS_MAX_BLOCK_MODES];\n- quant_method best_quant_levels_mod[WEIGHTS_MAX_BLOCK_MODES];\n- int best_ep_formats[WEIGHTS_MAX_BLOCK_MODES][4];\n+ float* errors_of_best_combination = tmpbuf.errors_of_best_combination;\n+ quant_method* best_quant_levels = tmpbuf.best_quant_levels;\n+ quant_method* best_quant_levels_mod = tmpbuf.best_quant_levels_mod;\n+ int (&best_ep_formats)[WEIGHTS_MAX_BLOCK_MODES][BLOCK_MAX_PARTITIONS] = tmpbuf.best_ep_formats;\n// Ensure that the \"overstep\" of the last iteration in the vectorized loop will contain data\n// that will never be picked as best candidate\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_weight_align.cpp", "new_path": "Source/astcenc_weight_align.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2021 Arm Limited\n+// Copyright 2011-2022 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -518,11 +518,13 @@ void compute_angular_endpoints_1plane(\nconst block_size_descriptor& bsd,\nconst float* dec_weight_quant_uvalue,\nconst float* dec_weight_quant_sig,\n- float low_value[WEIGHTS_MAX_BLOCK_MODES],\n- float high_value[WEIGHTS_MAX_BLOCK_MODES]\n+ compression_working_buffers& tmpbuf\n) {\n- float low_values[WEIGHTS_MAX_DECIMATION_MODES][12];\n- float high_values[WEIGHTS_MAX_DECIMATION_MODES][12];\n+ float (&low_value)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_low_value1;\n+ float (&high_value)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_high_value1;\n+\n+ float (&low_values)[WEIGHTS_MAX_DECIMATION_MODES][12] = tmpbuf.weight_low_values1;\n+ float (&high_values)[WEIGHTS_MAX_DECIMATION_MODES][12] = tmpbuf.weight_high_values1;\nunsigned int max_decimation_modes = only_always ? bsd.always_decimation_mode_count\n: bsd.decimation_mode_count;\n@@ -580,15 +582,17 @@ void compute_angular_endpoints_2planes(\nconst block_size_descriptor& bsd,\nconst float* dec_weight_quant_uvalue,\nconst float* dec_weight_quant_sig,\n- float low_value1[WEIGHTS_MAX_BLOCK_MODES],\n- float high_value1[WEIGHTS_MAX_BLOCK_MODES],\n- float low_value2[WEIGHTS_MAX_BLOCK_MODES],\n- float high_value2[WEIGHTS_MAX_BLOCK_MODES]\n+ compression_working_buffers& tmpbuf\n) {\n- float low_values1[WEIGHTS_MAX_DECIMATION_MODES][12];\n- float high_values1[WEIGHTS_MAX_DECIMATION_MODES][12];\n- float low_values2[WEIGHTS_MAX_DECIMATION_MODES][12];\n- float high_values2[WEIGHTS_MAX_DECIMATION_MODES][12];\n+ float (&low_value1)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_low_value1;\n+ float (&high_value1)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_high_value1;\n+ float (&low_value2)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_low_value2;\n+ float (&high_value2)[WEIGHTS_MAX_BLOCK_MODES] = tmpbuf.weight_high_value2;\n+\n+ float (&low_values1)[WEIGHTS_MAX_DECIMATION_MODES][12] = tmpbuf.weight_low_values1;\n+ float (&high_values1)[WEIGHTS_MAX_DECIMATION_MODES][12] = tmpbuf.weight_high_values1;\n+ float (&low_values2)[WEIGHTS_MAX_DECIMATION_MODES][12] = tmpbuf.weight_low_values2;\n+ float (&high_values2)[WEIGHTS_MAX_DECIMATION_MODES][12] = tmpbuf.weight_high_values2;\npromise(bsd.decimation_mode_count > 0);\nfor (unsigned int i = 0; i < bsd.decimation_mode_count; i++)\n" }, { "change_type": "MODIFY", "old_path": "Source/cmake_core.cmake", "new_path": "Source/cmake_core.cmake", "diff": "# SPDX-License-Identifier: Apache-2.0\n# ----------------------------------------------------------------------------\n-# Copyright 2020-2021 Arm Limited\n+# Copyright 2020-2022 Arm Limited\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Move large array allocations off the stack
61,745
22.02.2022 22:20:00
0
bab8160ec48cb7429fc89665a9d2ec05ce6e3c2d
Add stack usage reduction to ChangeLog
[ { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-3x.md", "new_path": "Docs/ChangeLog-3x.md", "diff": "@@ -16,6 +16,10 @@ The 3.4 release introduces another round of optimizations, removing a number\nof power-user configuration options to simplify the core compressor data path.\n* **General:**\n+ * **Feature:** Many memory allocations have been moved off the stack into\n+ dynamically allocated working memory. This significantly reduces the peak\n+ stack usage, allowing the compressor to run in systems with 128KB stack\n+ limits.\n* **Feature:** Builds now support `-DBLOCK_MAX_TEXELS=<count>` to allow a\ncompressor to support a subset of block sizes. This can reduce binary size\nand runtime memory footprint, and improve performance.\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add stack usage reduction to ChangeLog
61,745
23.02.2022 00:41:16
0
356981884bc9e8784a5dc2624b11d0f373ed7f3c
Add competitive test sweep utility
[ { "change_type": "ADD", "old_path": null, "new_path": "Test/astc_test_competitive.py", "diff": "+#!/usr/bin/env python3\n+# SPDX-License-Identifier: Apache-2.0\n+# -----------------------------------------------------------------------------\n+# Copyright 2022 Arm Limited\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n+# use this file except in compliance with the License. You may obtain a copy\n+# of the License at:\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+# License for the specific language governing permissions and limitations\n+# under the License.\n+# -----------------------------------------------------------------------------\n+\"\"\"\n+This script is a simple test runner for sweeps on multiple compressors.\n+\"\"\"\n+\n+import os\n+import subprocess as sp\n+import re\n+import sys\n+\n+LOG_COMMANDS = False\n+LOG_PATTERN = re.compile(r\"\\s*Coding rate:\\s*(.*)\\s*MT/s\")\n+\n+ISPC_BIN = \"./Binaries/ISPC/ispc_astc.exe\"\n+ISPC_QUALITY = [\"rgba\", \"rgb\"]\n+\n+ASTC_BIN = \"./astcenc/astcenc-avx2\"\n+ASTC_QUALITY = [\"-medium\", \"-fast\", \"-fastest\"]\n+\n+TEST_BLOCK_SIZES = [\"4x4\", \"6x6\", \"8x8\"]\n+\n+TEST_IMAGE = \"./Test/Images/Kodak/LDR-RGB/ldr-rgb-kodak%02u.png\"\n+TEST_RANGE = 24\n+TEST_REPEATS = 5\n+\n+OUT_CIMAGE = \"out.astc\"\n+OUT_DIMAGE = \"out.png\"\n+\n+\n+def run(command):\n+ if LOG_COMMANDS:\n+ print(\" \".join(command))\n+\n+ return sp.run(command, capture_output=True, universal_newlines=True)\n+\n+\n+def run_astcenc(in_image, out_image, block_size, quality):\n+ args = [ASTC_BIN, \"-tl\", in_image, out_image, block_size, quality, \"-j\", \"1\"]\n+ result = run(args)\n+ return float(LOG_PATTERN.search(result.stdout).group(1))\n+\n+\n+def run_ispc(in_image, out_image, block_size, quality):\n+ args = [ISPC_BIN, in_image, out_image, block_size, quality]\n+ result = run(args)\n+ return float(LOG_PATTERN.search(result.stdout).group(1))\n+\n+\n+def decompress(in_image, out_image):\n+ args = [ASTC_BIN, \"-dl\", in_image, out_image]\n+ result = run(args)\n+ os.remove(in_image)\n+\n+\n+def compare(in_image, out_image):\n+ args = [\"compare\", \"-metric\", \"PSNR\", in_image, out_image, \"diff.png\"]\n+ result = run(args)\n+ os.remove(\"diff.png\")\n+ os.remove(out_image)\n+ return float(result.stderr)\n+\n+\n+def main():\n+ \"\"\"\n+ The main function.\n+\n+ Returns:\n+ int: The process return code.\n+ \"\"\"\n+ # ISPC Tests\n+ for block_size in TEST_BLOCK_SIZES:\n+ for quality in ISPC_QUALITY:\n+ print(f\"ISPC {quality} {block_size}\")\n+ print(f\"ISPC {quality} {block_size}\", file=sys.stderr)\n+ for index in range(1, TEST_RANGE + 1):\n+ result_rate = 0.0\n+ for repeat in range(0, TEST_REPEATS):\n+ image = TEST_IMAGE % index\n+ result_rate += run_ispc(image, OUT_CIMAGE, block_size, quality)\n+ decompress(OUT_CIMAGE, OUT_DIMAGE)\n+ result_error = compare(image, OUT_DIMAGE)\n+ result_rate /= TEST_REPEATS\n+\n+ print(\"%s,Kodak%02u,%0.4f,%0.4f\" % (block_size, index, result_rate, result_error))\n+\n+ # ASTCENC Tests\n+ for block_size in TEST_BLOCK_SIZES:\n+ for quality in ASTC_QUALITY:\n+ print(f\"ASTC {quality} {block_size}\")\n+ print(f\"ASTC {quality} {block_size}\", file=sys.stderr)\n+ for index in range(1, TEST_RANGE + 1):\n+ result_rate = 0.0\n+ for repeat in range(0, TEST_REPEATS):\n+ image = TEST_IMAGE % index\n+ result_rate += run_astcenc(image, OUT_DIMAGE, block_size, quality)\n+ result_error = compare(image, OUT_DIMAGE)\n+ result_rate /= TEST_REPEATS\n+\n+ print(\"%s,Kodak%02u,%0.4f,%0.4f\" % (block_size, index, result_rate, result_error))\n+\n+ return 0\n+\n+\n+if __name__ == \"__main__\":\n+ try:\n+ sys.exit(main())\n+ except sp.CalledProcessError as ex:\n+ print(ex.stdout)\n+ print(ex.stderr)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/astc_test_competitive_plot.py", "diff": "+#!/usr/bin/env python3\n+# SPDX-License-Identifier: Apache-2.0\n+# -----------------------------------------------------------------------------\n+# Copyright 2022 Arm Limited\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n+# use this file except in compliance with the License. You may obtain a copy\n+# of the License at:\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+# License for the specific language governing permissions and limitations\n+# under the License.\n+# -----------------------------------------------------------------------------\n+\"\"\"\n+This script is a simple test result plotter for sweeps on multiple compressors.\n+\"\"\"\n+import csv\n+import numpy as np\n+import matplotlib.pyplot as plt\n+import sys\n+\n+DATABASE = \"log.csv\"\n+\n+\n+class Series:\n+\n+ def __init__(self, name, perf, qual):\n+ self.name = name\n+ self.perf = perf\n+ self.qual = qual\n+\n+\n+def get_series(database, compressor, quality, block_size):\n+ title = f\"{compressor} {quality} {block_size}\"\n+ in_section = False\n+\n+ perf = []\n+ qual = []\n+\n+ with open(database) as csvfile:\n+ reader = csv.reader(csvfile)\n+ for row in reader:\n+ if len(row) == 1:\n+ in_section = row[0] == title\n+ continue\n+\n+ if in_section:\n+ perf.append(float(row[2]))\n+ qual.append(float(row[3]))\n+\n+ return (perf, qual)\n+\n+\n+def plot(block_size, series_set):\n+\n+ for series in series_set:\n+ plt.scatter(series.perf, series.qual, s=2, label=series.name)\n+\n+ plt.xlabel(\"Speed (MT/s)\")\n+ plt.ylabel(\"PSNR dB\")\n+ plt.legend(loc='lower right', prop={'size': 6})\n+\n+ plt.tight_layout()\n+ plt.savefig(f\"ASTC_v_ISPC_{block_size}.png\")\n+ plt.clf()\n+\n+\n+def plot_diff(series_a, series_b):\n+\n+ diff_perf = np.divide(series_a.perf, series_b.perf)\n+ diff_qual = np.subtract(series_a.qual, series_b.qual)\n+ label = f\"{series_a.name} vs {series_b.name}\"\n+\n+ plt.scatter(diff_perf, diff_qual, s=2, label=label)\n+\n+ plt.axhline(y=0, color=\"r\", linestyle=\"dotted\", lw=0.5)\n+ plt.axvline(x=1, color=\"r\", linestyle=\"dotted\", lw=0.5)\n+\n+ plt.xlabel(\"Relative speed\")\n+ plt.ylabel(\"PSNR diff (dB)\")\n+ plt.legend(loc='lower right', prop={'size': 6})\n+\n+ plt.tight_layout()\n+ file_name = label.replace(\" \", \"_\") + \".png\"\n+ plt.savefig(file_name)\n+ plt.clf()\n+\n+\n+def main():\n+\n+ block_sizes = [\"4x4\", \"6x6\", \"8x8\"]\n+\n+ for block_size in block_sizes:\n+ series_set = []\n+\n+ perf, qual = get_series(DATABASE, \"ISPC\", \"rgba\", block_size)\n+ series_set.append(Series(f\"{block_size} IPSC Slow\", perf, qual))\n+\n+ perf, qual = get_series(DATABASE, \"ISPC\", \"rgb\", block_size)\n+ series_set.append(Series(f\"{block_size} IPSC Fast\", perf, qual))\n+\n+ perf, qual = get_series(DATABASE, \"ASTC\", \"-medium\", block_size)\n+ series_set.append(Series(f\"{block_size} ASTC Medium\", perf, qual))\n+\n+ perf, qual = get_series(DATABASE, \"ASTC\", \"-fast\", block_size)\n+ series_set.append(Series(f\"{block_size} ASTC Fast\", perf, qual))\n+\n+ perf, qual = get_series(DATABASE, \"ASTC\", \"-fastest\", block_size)\n+ series_set.append(Series(f\"{block_size} ASTC Fastest\", perf, qual))\n+\n+ plot(block_size, series_set)\n+\n+ plot_diff(series_set[2], series_set[0])\n+ plot_diff(series_set[3], series_set[0])\n+ plot_diff(series_set[3], series_set[1])\n+ plot_diff(series_set[4], series_set[1])\n+\n+ return 0\n+\n+\n+if __name__ == \"__main__\":\n+ sys.exit(main())\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add competitive test sweep utility
61,745
23.02.2022 14:21:36
0
cd4ebfa32a432e4429ab91fc715f2b8a42bae9b8
Fix image component count identification for KTX output
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_image.cpp", "new_path": "Source/astcenccli_image.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2021 Arm Limited\n+// Copyright 2011-2022 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -169,7 +169,7 @@ int determine_image_components(const astcenc_image * img)\n}\n}\n- int image_components = 1 + (is_luma == 0 ? 0 : 2) + (has_alpha ? 0 : 1);\n+ int image_components = 1 + (is_luma == 0 ? 2 : 0) + (has_alpha ? 1 : 0);\nreturn image_components;\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix image component count identification for KTX output
61,745
23.02.2022 15:10:59
0
ffbccca244a06f4ce1182c9cac16ca32bb281c17
Fix error block output color handling
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_image.cpp", "new_path": "Source/astcenc_image.cpp", "diff": "@@ -318,9 +318,9 @@ void write_image_block(\n{\nvint4 colori = vint4::zero();\n- if (blk.data_r[idx] == std::numeric_limits<float>::quiet_NaN())\n+ // Errors are NaN encoded - convert to magenta error color\n+ if (blk.data_r[idx] != blk.data_r[idx])\n{\n- // Can't display NaN - show magenta error color\ncolori = vint4(0xFF, 0x00, 0xFF, 0xFF);\n}\nelse if (needs_swz)\n@@ -374,7 +374,8 @@ void write_image_block(\n{\nvint4 color;\n- if (blk.data_r[idx] == std::numeric_limits<float>::quiet_NaN())\n+ // Errors are NaN encoded - convert to FP16 NaN\n+ if (blk.data_r[idx] != blk.data_r[idx])\n{\ncolor = vint4(0xFFFF);\n}\n@@ -433,7 +434,8 @@ void write_image_block(\n{\nvfloat4 color = blk.texel(idx);\n- if (color.lane<0>() == std::numeric_limits<float>::quiet_NaN())\n+ // Errors are NaN encoded - convert to FP32 NaN\n+ if (color.lane<0>() != color.lane<0>())\n{\ncolor = vfloat4(std::numeric_limits<float>::quiet_NaN());\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix error block output color handling
61,745
23.02.2022 22:20:27
0
1c97c24b192777f48bc203b1974cc948053cdc8d
Remove array initializer
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_weight_align.cpp", "new_path": "Source/astcenc_weight_align.cpp", "diff": "@@ -111,7 +111,7 @@ static void compute_angular_offsets(\npromise(weight_count > 0);\npromise(max_angular_steps > 0);\n- alignas(ASTCENC_VECALIGN) int isamplev[BLOCK_MAX_WEIGHTS] { 0 };\n+ alignas(ASTCENC_VECALIGN) int isamplev[BLOCK_MAX_WEIGHTS];\n// Precompute isample; arrays are always allocated 64 elements long\nfor (unsigned int i = 0; i < weight_count; i += ASTCENC_SIMD_WIDTH)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove array initializer
61,745
24.02.2022 00:27:22
0
ffddcd5b6258fa413ca442090364482edad1e4e3
Add undecimated specialization for realign_weights
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -50,6 +50,142 @@ static void merge_endpoints(\nresult.endpt1[0] = select(ep_plane1.endpt1[0], ep_plane2.endpt1[0], sep_mask);\n}\n+/**\n+ * @brief Attempt to improve weights given a chosen configuration.\n+ *\n+ * Given a fixed weight grid decimation and weight value quantization, iterate over all weights (per\n+ * partition and per plane) and attempt to improve image quality by moving each weight up by one or\n+ * down by one quantization step.\n+ *\n+ * This is a specialized function which only supports operating on undecimated weight grids,\n+ * therefore primarily improving the performance of 4x4 and 5x5 blocks where grid decimation\n+ * is needed less often.\n+ *\n+ * @param decode_mode The decode mode (LDR, HDR).\n+ * @param bsd The block size information.\n+ * @param blk The image block color data to compress.\n+ * @param[out] scb The symbolic compressed block output.\n+ * @param[out] dec_weights_quant_pvalue_plane1 The weights for plane 1.\n+ * @param[out] dec_weights_quant_pvalue_plane2 The weights for plane 2, or @c nullptr if 1 plane.\n+ */\n+static bool realign_weights_undecimated(\n+ astcenc_profile decode_mode,\n+ const block_size_descriptor& bsd,\n+ const image_block& blk,\n+ symbolic_compressed_block& scb,\n+ uint8_t* dec_weights_quant_pvalue_plane1,\n+ uint8_t* dec_weights_quant_pvalue_plane2\n+) {\n+ // Get the partition descriptor\n+ unsigned int partition_count = scb.partition_count;\n+ const auto& pi = bsd.get_partition_info(partition_count, scb.partition_index);\n+\n+ // Get the quantization table\n+ const block_mode& bm = bsd.get_block_mode(scb.block_mode);\n+ unsigned int weight_quant_level = bm.quant_mode;\n+ const quantization_and_transfer_table *qat = &(quant_and_xfer_tables[weight_quant_level]);\n+\n+ unsigned int max_plane = bm.is_dual_plane;\n+ int plane2_component = bm.is_dual_plane ? scb.plane2_component : -1;\n+ vmask4 plane_mask = vint4::lane_id() == vint4(plane2_component);\n+\n+ // Decode the color endpoints\n+ bool rgb_hdr;\n+ bool alpha_hdr;\n+ vint4 endpnt0[BLOCK_MAX_PARTITIONS];\n+ vint4 endpnt1[BLOCK_MAX_PARTITIONS];\n+ vfloat4 endpnt0f[BLOCK_MAX_PARTITIONS];\n+ vfloat4 offset[BLOCK_MAX_PARTITIONS];\n+\n+ promise(partition_count > 0);\n+\n+ for (unsigned 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.get_color_quant_mode(),\n+ scb.color_values[pa_idx],\n+ rgb_hdr, alpha_hdr,\n+ endpnt0[pa_idx],\n+ endpnt1[pa_idx]);\n+ }\n+\n+ uint8_t* dec_weights_quant_pvalue = dec_weights_quant_pvalue_plane1;\n+ bool adjustments = false;\n+\n+ // For each plane and partition ...\n+ for (unsigned int pl_idx = 0; pl_idx <= max_plane; pl_idx++)\n+ {\n+ for (unsigned int pa_idx = 0; pa_idx < partition_count; pa_idx++)\n+ {\n+ // Compute the endpoint delta for all components in current plane\n+ vint4 epd = endpnt1[pa_idx] - endpnt0[pa_idx];\n+ epd = select(epd, vint4::zero(), plane_mask);\n+\n+ endpnt0f[pa_idx] = int_to_float(endpnt0[pa_idx]);\n+ offset[pa_idx] = int_to_float(epd) * (1.0f / 64.0f);\n+ }\n+\n+ // For each weight compute previous, current, and next errors\n+ promise(bsd.texel_count > 0);\n+ for (unsigned int we_idx = 0; we_idx < bsd.texel_count; we_idx++)\n+ {\n+ unsigned int texel = we_idx; // Undecimated, so 1:1 mapping\n+ unsigned int uqw = qat->unquantized_value[dec_weights_quant_pvalue[we_idx]];\n+ unsigned int uqwf = static_cast<float>(uqw);\n+\n+ uint32_t prev_and_next = qat->prev_next_values[uqw];\n+ unsigned int prev_wt_uq = prev_and_next & 0xFF;\n+ unsigned int next_wt_uq = (prev_and_next >> 8) & 0xFF;\n+\n+ float uqw_next_dif = static_cast<float>(next_wt_uq) - uqwf;\n+ float uqw_prev_dif = static_cast<float>(prev_wt_uq) - uqwf;\n+\n+ // Interpolate the colors to create the diffs\n+ unsigned int partition = pi.partition_of_texel[texel];\n+\n+ float weight_base = uqwf + 0.5f;\n+ float plane_weight = astc::flt_rd(weight_base);\n+ float plane_up_weight = astc::flt_rd(weight_base + uqw_next_dif) - plane_weight;\n+ float plane_down_weight = astc::flt_rd(weight_base + uqw_prev_dif) - plane_weight;\n+\n+ vfloat4 color_offset = offset[partition];\n+ vfloat4 color_base = endpnt0f[partition];\n+\n+ vfloat4 color = color_base + color_offset * plane_weight;\n+\n+ vfloat4 origcolor = blk.texel(texel);\n+ vfloat4 error_weight = blk.channel_weight;\n+\n+ vfloat4 colordiff = color - origcolor;\n+ vfloat4 color_up_diff = colordiff + color_offset * plane_up_weight;\n+ vfloat4 color_down_diff = colordiff + color_offset * plane_down_weight;\n+\n+ float current_error = dot_s(colordiff * colordiff, error_weight);\n+ float up_error = dot_s(color_up_diff * color_up_diff, error_weight);\n+ float down_error = dot_s(color_down_diff * color_down_diff, error_weight);\n+\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+ dec_weights_quant_pvalue[we_idx] = (uint8_t)((prev_and_next >> 24) & 0xFF);\n+ adjustments = true;\n+ }\n+ else if (down_error < current_error)\n+ {\n+ dec_weights_quant_pvalue[we_idx] = (uint8_t)((prev_and_next >> 16) & 0xFF);\n+ adjustments = true;\n+ }\n+ }\n+\n+ // Prepare iteration for plane 2\n+ dec_weights_quant_pvalue = dec_weights_quant_pvalue_plane2;\n+ plane_mask = ~plane_mask;\n+ }\n+\n+ return adjustments;\n+}\n+\n/**\n* @brief Attempt to improve weights given a chosen configuration.\n*\n@@ -64,7 +200,7 @@ static void merge_endpoints(\n* @param[out] dec_weights_quant_pvalue_plane1 The weights for plane 1.\n* @param[out] dec_weights_quant_pvalue_plane2 The weights for plane 2, or @c nullptr if 1 plane.\n*/\n-static bool realign_weights(\n+static bool realign_weights_generic(\nastcenc_profile decode_mode,\nconst block_size_descriptor& bsd,\nconst image_block& blk,\n@@ -84,6 +220,7 @@ static bool realign_weights(\n// Get the decimation table\nconst decimation_info& di = bsd.get_decimation_info(bm.decimation_mode);\nunsigned int weight_count = di.weight_count;\n+ bool is_decimated = weight_count != bsd.texel_count;\nunsigned int max_plane = bm.is_dual_plane;\nint plane2_component = bm.is_dual_plane ? scb.plane2_component : -1;\n@@ -112,6 +249,7 @@ static bool realign_weights(\n}\nuint8_t uq_pl_weights[BLOCK_MAX_WEIGHTS];\n+ float uq_pl_weightsf[BLOCK_MAX_WEIGHTS];\nuint8_t* dec_weights_quant_pvalue = dec_weights_quant_pvalue_plane1;\nbool adjustments = false;\n@@ -132,19 +270,21 @@ static bool realign_weights(\nfor (unsigned int we_idx = 0; we_idx < weight_count; we_idx++)\n{\nuq_pl_weights[we_idx] = qat->unquantized_value[dec_weights_quant_pvalue[we_idx]];\n+ uq_pl_weightsf[we_idx] = static_cast<float>(uq_pl_weights[we_idx]);\n}\n// For each weight compute previous, current, and next errors\nfor (unsigned int we_idx = 0; we_idx < weight_count; we_idx++)\n{\nunsigned int uqw = uq_pl_weights[we_idx];\n+ unsigned int uqwf = uq_pl_weightsf[we_idx];\nuint32_t prev_and_next = qat->prev_next_values[uqw];\nunsigned int prev_wt_uq = prev_and_next & 0xFF;\nunsigned int next_wt_uq = (prev_and_next >> 8) & 0xFF;\n- int uqw_next_dif = next_wt_uq - uqw;\n- int uqw_prev_dif = prev_wt_uq - uqw;\n+ float uqw_next_dif = static_cast<float>(next_wt_uq) - uqwf;\n+ float uqw_prev_dif = static_cast<float>(prev_wt_uq) - uqwf;\nfloat current_error = 0.0f;\nfloat up_error = 0.0f;\n@@ -156,20 +296,21 @@ static bool realign_weights(\nfor (unsigned int te_idx = 0; te_idx < texels_to_evaluate; te_idx++)\n{\nunsigned int texel = di.weight_texel[te_idx][we_idx];\n- const uint8_t *texel_weights = di.texel_weights_texel[we_idx][te_idx];\n- const float *texel_weights_float = di.texel_weights_float_texel[we_idx][te_idx];\n- float twf0 = texel_weights_float[0];\n-\n- float weight_base = static_cast<float>(uqw) * twf0;\n+ float weight_base = uqwf;\n+ float twf0 = 1.0f;\n// Don't interpolate filtered weights for a 1:1 weight grid\n- if (weight_count != bsd.texel_count)\n+ if (is_decimated)\n{\n+ const uint8_t *texel_weights = di.texel_weights_texel[we_idx][te_idx];\n+ const float *texel_weights_float = di.texel_weights_float_texel[we_idx][te_idx];\n+ twf0 = texel_weights_float[0];\n+\nweight_base =\n- (( weight_base\n- + static_cast<float>(uq_pl_weights[texel_weights[1]]) * texel_weights_float[1])\n- + (static_cast<float>(uq_pl_weights[texel_weights[2]]) * texel_weights_float[2]\n- + static_cast<float>(uq_pl_weights[texel_weights[3]]) * texel_weights_float[3]));\n+ ((uqwf * twf0\n+ + uq_pl_weightsf[texel_weights[1]] * texel_weights_float[1])\n+ + (uq_pl_weightsf[texel_weights[2]] * texel_weights_float[2]\n+ + uq_pl_weightsf[texel_weights[3]] * texel_weights_float[3]));\n}\nunsigned int partition = pi.partition_of_texel[texel];\n@@ -199,12 +340,14 @@ static bool realign_weights(\nif ((up_error < current_error) && (up_error < down_error))\n{\nuq_pl_weights[we_idx] = static_cast<uint8_t>(next_wt_uq);\n+ uq_pl_weightsf[we_idx] = static_cast<float>(next_wt_uq);\ndec_weights_quant_pvalue[we_idx] = (uint8_t)((prev_and_next >> 24) & 0xFF);\nadjustments = true;\n}\nelse if (down_error < current_error)\n{\nuq_pl_weights[we_idx] = static_cast<uint8_t>(prev_wt_uq);\n+ uq_pl_weightsf[we_idx] = static_cast<float>(prev_wt_uq);\ndec_weights_quant_pvalue[we_idx] = (uint8_t)((prev_and_next >> 16) & 0xFF);\nadjustments = true;\n}\n@@ -218,6 +361,7 @@ static bool realign_weights(\nreturn adjustments;\n}\n+\n/**\n* @brief Compress a block using a chosen partitioning and 1 plane of weights.\n*\n@@ -529,10 +673,19 @@ static float compress_symbolic_block_for_partition_1plane(\n}\n}\n- // Perform a final pass over the weights to try to improve them.\n- bool adjustments = realign_weights(\n+ bool adjustments;\n+ if (di.weight_count != bsd.texel_count)\n+ {\n+ adjustments = realign_weights_generic(\nconfig.profile, bsd, blk, workscb,\nworkscb.weights, nullptr);\n+ }\n+ else\n+ {\n+ adjustments = realign_weights_undecimated(\n+ config.profile, bsd, blk, workscb,\n+ workscb.weights, nullptr);\n+ }\n// Post-realign test\nfloat errorval = compute_symbolic_block_difference(config, bsd, workscb, blk);\n@@ -871,10 +1024,20 @@ static float compress_symbolic_block_for_partition_2planes(\n}\n}\n- // Perform a final pass over the weights to try to improve them\n- bool adjustments = realign_weights(\n+ // Perform a final pass over the weights to try to improve them.\n+ bool adjustments;\n+ if (di.weight_count != bsd.texel_count)\n+ {\n+ adjustments = realign_weights_generic(\n+ config.profile, bsd, blk, workscb,\n+ workscb.weights, workscb.weights + WEIGHTS_PLANE2_OFFSET);\n+ }\n+ else\n+ {\n+ adjustments = realign_weights_undecimated(\nconfig.profile, bsd, blk, workscb,\nworkscb.weights, workscb.weights + WEIGHTS_PLANE2_OFFSET);\n+ }\n// Post-realign test\nfloat errorval = compute_symbolic_block_difference(config, bsd, workscb, blk);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add undecimated specialization for realign_weights
61,745
24.02.2022 07:26:00
0
4ea36836953cff3c8ab4653559ca10a8c6973296
Allow single channel NaNs in void-extent blocks The spec allows single color channels to decode to NaN in void-extent blocks. Prior to this fix the 3.x compressor would force the entire texel to NaN if component 0 was NaN.
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_decompress_symbolic.cpp", "new_path": "Source/astcenc_decompress_symbolic.cpp", "diff": "@@ -171,6 +171,20 @@ void unpack_weights(\n}\n}\n+/**\n+ * @brief Return an FP32 NaN value for use in error colors.\n+ *\n+ * This NaN encoding will turn into 0xFFFF when converted to an FP16 NaN.\n+ *\n+ * @return The float color value.\n+ */\n+static float error_color_nan()\n+{\n+ if32 v;\n+ v.u = 0xFFFFE000U;\n+ return v.f;\n+}\n+\n/* See header for documentation. */\nvoid decompress_symbolic_block(\nastcenc_profile decode_mode,\n@@ -195,10 +209,10 @@ void decompress_symbolic_block(\n{\nfor (unsigned int i = 0; i < bsd.texel_count; i++)\n{\n- blk.data_r[i] = std::numeric_limits<float>::quiet_NaN();\n- blk.data_g[i] = std::numeric_limits<float>::quiet_NaN();\n- blk.data_b[i] = std::numeric_limits<float>::quiet_NaN();\n- blk.data_a[i] = std::numeric_limits<float>::quiet_NaN();\n+ blk.data_r[i] = error_color_nan();\n+ blk.data_g[i] = error_color_nan();\n+ blk.data_b[i] = error_color_nan();\n+ blk.data_a[i] = error_color_nan();\nblk.rgb_lns[i] = 0;\nblk.alpha_lns[i] = 0;\n}\n@@ -234,7 +248,7 @@ void decompress_symbolic_block(\n{\ncase ASTCENC_PRF_LDR_SRGB:\ncase ASTCENC_PRF_LDR:\n- color = vfloat4(std::numeric_limits<float>::quiet_NaN());\n+ color = vfloat4(error_color_nan());\nbreak;\ncase ASTCENC_PRF_HDR_RGB_LDR_A:\ncase ASTCENC_PRF_HDR:\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_image.cpp", "new_path": "Source/astcenc_image.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2021 Arm Limited\n+// Copyright 2011-2022 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -374,12 +374,8 @@ void write_image_block(\n{\nvint4 color;\n- // Errors are NaN encoded - convert to FP16 NaN\n- if (blk.data_r[idx] != blk.data_r[idx])\n- {\n- color = vint4(0xFFFF);\n- }\n- else if (needs_swz)\n+ // NaNs are handled inline - no need to special case\n+ if (needs_swz)\n{\ndata[ASTCENC_SWZ_R] = blk.data_r[idx];\ndata[ASTCENC_SWZ_G] = blk.data_g[idx];\n@@ -434,12 +430,8 @@ void write_image_block(\n{\nvfloat4 color = blk.texel(idx);\n- // Errors are NaN encoded - convert to FP32 NaN\n- if (color.lane<0>() != color.lane<0>())\n- {\n- color = vfloat4(std::numeric_limits<float>::quiet_NaN());\n- }\n- else if (needs_swz)\n+ // NaNs are handled inline - no need to special case\n+ if (needs_swz)\n{\ndata[ASTCENC_SWZ_R] = color.lane<0>();\ndata[ASTCENC_SWZ_G] = color.lane<1>();\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Allow single channel NaNs in void-extent blocks The spec allows single color channels to decode to NaN in void-extent blocks. Prior to this fix the 3.x compressor would force the entire texel to NaN if component 0 was NaN.
61,745
24.02.2022 08:37:14
0
a33dbb44739da188e32d8f90e2342a780cf751fe
Exploit integer weights in realign_weights_undecimated
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -128,52 +128,46 @@ static bool realign_weights_undecimated(\n// For each weight compute previous, current, and next errors\npromise(bsd.texel_count > 0);\n- for (unsigned int we_idx = 0; we_idx < bsd.texel_count; we_idx++)\n+ for (unsigned int texel = 0; texel < bsd.texel_count; texel++)\n{\n- unsigned int texel = we_idx; // Undecimated, so 1:1 mapping\n- unsigned int uqw = qat->unquantized_value[dec_weights_quant_pvalue[we_idx]];\n- unsigned int uqwf = static_cast<float>(uqw);\n+ unsigned int uqw = qat->unquantized_value[dec_weights_quant_pvalue[texel]];\nuint32_t prev_and_next = qat->prev_next_values[uqw];\n- unsigned int prev_wt_uq = prev_and_next & 0xFF;\n- unsigned int next_wt_uq = (prev_and_next >> 8) & 0xFF;\n-\n- float uqw_next_dif = static_cast<float>(next_wt_uq) - uqwf;\n- float uqw_prev_dif = static_cast<float>(prev_wt_uq) - uqwf;\n+ int prev_wt_uq = prev_and_next & 0xFF;\n+ int next_wt_uq = (prev_and_next >> 8) & 0xFF;\n// Interpolate the colors to create the diffs\nunsigned int partition = pi.partition_of_texel[texel];\n- float weight_base = uqwf + 0.5f;\n- float plane_weight = astc::flt_rd(weight_base);\n- float plane_up_weight = astc::flt_rd(weight_base + uqw_next_dif) - plane_weight;\n- float plane_down_weight = astc::flt_rd(weight_base + uqw_prev_dif) - plane_weight;\n+ int plane_weight = uqw;\n+ int plane_up_weight = next_wt_uq - uqw;\n+ int plane_down_weight = prev_wt_uq - uqw;\nvfloat4 color_offset = offset[partition];\nvfloat4 color_base = endpnt0f[partition];\nvfloat4 color = color_base + color_offset * plane_weight;\n- vfloat4 origcolor = blk.texel(texel);\n+ vfloat4 orig_color = blk.texel(texel);\nvfloat4 error_weight = blk.channel_weight;\n- vfloat4 colordiff = color - origcolor;\n- vfloat4 color_up_diff = colordiff + color_offset * plane_up_weight;\n- vfloat4 color_down_diff = colordiff + color_offset * plane_down_weight;\n+ vfloat4 color_diff = color - orig_color;\n+ vfloat4 color_up_diff = color_diff + color_offset * plane_up_weight;\n+ vfloat4 color_down_diff = color_diff + color_offset * plane_down_weight;\n- float current_error = dot_s(colordiff * colordiff, error_weight);\n+ float current_error = dot_s(color_diff * color_diff, error_weight);\nfloat up_error = dot_s(color_up_diff * color_up_diff, error_weight);\nfloat down_error = dot_s(color_down_diff * color_down_diff, error_weight);\n// Check if the prev or next error is better, and if so use it\nif ((up_error < current_error) && (up_error < down_error))\n{\n- dec_weights_quant_pvalue[we_idx] = (uint8_t)((prev_and_next >> 24) & 0xFF);\n+ dec_weights_quant_pvalue[texel] = (uint8_t)((prev_and_next >> 24) & 0xFF);\nadjustments = true;\n}\nelse if (down_error < current_error)\n{\n- dec_weights_quant_pvalue[we_idx] = (uint8_t)((prev_and_next >> 16) & 0xFF);\n+ dec_weights_quant_pvalue[texel] = (uint8_t)((prev_and_next >> 16) & 0xFF);\nadjustments = true;\n}\n}\n@@ -325,13 +319,13 @@ static bool realign_weights_generic(\nvfloat4 color = color_base + color_offset * plane_weight;\n- vfloat4 origcolor = blk.texel(texel);\n+ vfloat4 orig_color = blk.texel(texel);\nvfloat4 error_weight = blk.channel_weight;\n- vfloat4 colordiff = color - origcolor;\n- vfloat4 color_up_diff = colordiff + color_offset * plane_up_weight;\n- vfloat4 color_down_diff = colordiff + color_offset * plane_down_weight;\n- current_error += dot_s(colordiff * colordiff, error_weight);\n+ vfloat4 color_diff = color - orig_color;\n+ vfloat4 color_up_diff = color_diff + color_offset * plane_up_weight;\n+ vfloat4 color_down_diff = color_diff + color_offset * plane_down_weight;\n+ current_error += dot_s(color_diff * color_diff, error_weight);\nup_error += dot_s(color_up_diff * color_up_diff, error_weight);\ndown_error += dot_s(color_down_diff * color_down_diff, error_weight);\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Exploit integer weights in realign_weights_undecimated
61,745
26.02.2022 00:47:41
0
c2551a380777a1889cff372599c38eb567a1dad5
Vectorize header for compute_ideal_weights_for_decimation
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -762,7 +762,7 @@ void compute_ideal_weights_for_decimation(\n) {\nunsigned int texel_count = di.texel_count;\nunsigned int weight_count = di.weight_count;\n-\n+ bool is_direct = texel_count == weight_count;\npromise(texel_count > 0);\npromise(weight_count > 0);\n@@ -774,42 +774,34 @@ void compute_ideal_weights_for_decimation(\n// Ensure that the end of the output arrays that are used for SIMD paths later are filled so we\n// can safely run SIMD elsewhere without a loop tail. Note that this is always safe as weight\n// arrays always contain space for 64 elements\n- unsigned int weight_count_simd = round_up_to_simd_multiple_vla(weight_count);\n- for (unsigned int i = weight_count; i < weight_count_simd; i++)\n- {\n- dec_weight_ideal_value[i] = 0.0f;\n- }\n+ unsigned int prev_weight_count_simd = round_down_to_simd_multiple_vla(weight_count - 1);\n+ storea(vfloat::zero(), dec_weight_ideal_value + prev_weight_count_simd);\n// If we have a 1:1 mapping just shortcut the computation - clone the weights into both the\n// weight set and the output epw copy.\n// Transfer enough to also copy zero initialized SIMD over-fetch region\nunsigned int texel_count_simd = round_up_to_simd_multiple_vla(texel_count);\n- if (texel_count == weight_count)\n- {\n- for (unsigned int i = 0; i < texel_count_simd; i++)\n+ for (unsigned int i = 0; i < texel_count_simd; i += ASTCENC_SIMD_WIDTH)\n{\n- // Assert it's an identity map for valid texels, and last valid value for any overspill\n- assert(((i < texel_count) && (i == di.weight_texel[0][i])) ||\n- ((i >= texel_count) && (texel_count - 1 == di.weight_texel[0][i])));\n- dec_weight_ideal_value[i] = eai_in.weights[i];\n- dec_weight_ideal_sig[i] = eai_in.weight_error_scale[i];\n+ vfloat weight(eai_in.weights + i);\n+ vfloat weight_error_scale(eai_in.weight_error_scale + i);\n- eai_out.weights[i] = eai_in.weights[i];\n- eai_out.weight_error_scale[i] = eai_in.weight_error_scale[i];\n- }\n+ storea(weight, eai_out.weights + i);\n+ storea(weight_error_scale, eai_out.weight_error_scale + i);\n- return;\n- }\n- // If we don't have a 1:1 mapping just clone the weights into the output epw copy and then do\n- // the full algorithm to decimate weights.\n- else\n- {\n- for (unsigned int i = 0; i < texel_count_simd; i++)\n+ // Direct 1:1 weight mapping, so clone weights directly\n+ // TODO: Can we just avoid the copy for direct cases?\n+ if (is_direct)\n{\n- eai_out.weights[i] = eai_in.weights[i];\n- eai_out.weight_error_scale[i] = eai_in.weight_error_scale[i];\n+ storea(weight, dec_weight_ideal_value + i);\n+ storea(weight_error_scale, dec_weight_ideal_sig + i);\n+ }\n}\n+\n+ if (is_direct)\n+ {\n+ return;\n}\n// Otherwise compute an estimate and perform single refinement iteration\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Vectorize header for compute_ideal_weights_for_decimation
61,745
26.02.2022 10:27:57
0
605ef33f44588c0114dc8547e3d802b7e0ffb9af
Remove lane selects from compute_ideal_weights No longer needed as arrays are padded with safe values
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "@@ -826,14 +826,8 @@ void compute_ideal_weights_for_decimation(\nfor (unsigned int j = 0; j < max_texel_count; j++)\n{\n- // Not all lanes may actually use j texels, so mask out if idle\n- vmask active = weight_texel_count > vint(j);\n-\nvint texel(di.weight_texel[j] + i);\n- texel = select(vint::zero(), texel, active);\n-\nvfloat weight = loada(di.weights_flt[j] + i);\n- weight = select(vfloat::zero(), weight, active);\nif (!constant_wes)\n{\n@@ -880,14 +874,8 @@ void compute_ideal_weights_for_decimation(\nfor (unsigned int j = 0; j < max_texel_count; j++)\n{\n- // Not all lanes may actually use j texels, so mask out if idle\n- vmask active = weight_texel_count > vint(j);\n-\nvint texel(di.weight_texel[j] + i);\n- texel = select(vint::zero(), texel, active);\n-\nvfloat contrib_weight = loada(di.weights_flt[j] + i);\n- contrib_weight = select(vfloat::zero(), contrib_weight, active);\nif (!constant_wes)\n{\n@@ -902,7 +890,6 @@ void compute_ideal_weights_for_decimation(\nerror_change1 += (old_weight - ideal_weight) * scale;\n}\n-\nvfloat step = (error_change1 * chd_scale) / error_change0;\nstep = clamp(-stepsize, stepsize, step);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove lane selects from compute_ideal_weights No longer needed as arrays are padded with safe values
61,745
26.02.2022 11:22:36
0
25129301f44006334bacefba9372c205853db3c8
Remove int rounding from realign_weights_generic
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -309,10 +309,14 @@ static bool realign_weights_generic(\nunsigned int partition = pi.partition_of_texel[texel];\n- weight_base = weight_base + 0.5f;\n- float plane_weight = astc::flt_rd(weight_base);\n- float plane_up_weight = astc::flt_rd(weight_base + uqw_next_dif * twf0) - plane_weight;\n- float plane_down_weight = astc::flt_rd(weight_base + uqw_prev_dif * twf0) - plane_weight;\n+ // Ideally this is integer rounded, but IQ gain it isn't worth the overhead\n+ // float plane_weight = astc::flt_rd(weight_base + 0.5f);\n+ // float plane_up_weight = astc::flt_rd(weight_base + 0.5f + uqw_next_dif * twf0) - plane_weight;\n+ // float plane_down_weight = astc::flt_rd(weight_base + 0.5f + uqw_prev_dif * twf0) - plane_weight;\n+\n+ float plane_weight = weight_base;\n+ float plane_up_weight = weight_base + uqw_next_dif * twf0 - plane_weight;\n+ float plane_down_weight = weight_base + uqw_prev_dif * twf0 - plane_weight;\nvfloat4 color_offset = offset[partition];\nvfloat4 color_base = endpnt0f[partition];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove int rounding from realign_weights_generic
61,745
26.02.2022 15:36:48
0
33120f5b1b297cfd96f1d60d087a0c4aad985d42
Store weight_bits in block_mode structure
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_block_sizes.cpp", "new_path": "Source/astcenc_block_sizes.cpp", "diff": "* @param[out] y_weights The number of weights in the Y dimension.\n* @param[out] is_dual_plane True if this block mode has two weight planes.\n* @param[out] quant_mode The quantization level for the weights.\n+ * @param[out] weight_bits The storage bit count for the weights.\n*\n* @return Returns true if a valid mode, false otherwise.\n*/\n@@ -37,7 +38,8 @@ static bool decode_block_mode_2d(\nunsigned int& x_weights,\nunsigned int& y_weights,\nbool& is_dual_plane,\n- unsigned int& quant_mode\n+ unsigned int& quant_mode,\n+ unsigned int& weight_bits\n) {\nunsigned int base_quant_mode = (block_mode >> 4) & 1;\nunsigned int H = (block_mode >> 9) & 1;\n@@ -128,7 +130,7 @@ static bool decode_block_mode_2d(\nquant_mode = (base_quant_mode - 2) + 6 * H;\nis_dual_plane = D != 0;\n- unsigned int weight_bits = get_ise_sequence_bitcount(weight_count, (quant_method)quant_mode);\n+ weight_bits = get_ise_sequence_bitcount(weight_count, (quant_method)quant_mode);\nreturn (weight_count <= BLOCK_MAX_WEIGHTS &&\nweight_bits >= BLOCK_MIN_WEIGHT_BITS &&\nweight_bits <= BLOCK_MAX_WEIGHT_BITS);\n@@ -143,6 +145,7 @@ static bool decode_block_mode_2d(\n* @param[out] z_weights The number of weights in the Z dimension.\n* @param[out] is_dual_plane True if this block mode has two weight planes.\n* @param[out] quant_mode The quantization level for the weights.\n+ * @param[out] weight_bits The storage bit count for the weights.\n*\n* @return Returns true if a valid mode, false otherwise.\n*/\n@@ -152,7 +155,8 @@ static bool decode_block_mode_3d(\nunsigned int& y_weights,\nunsigned int& z_weights,\nbool& is_dual_plane,\n- unsigned int& quant_mode\n+ unsigned int& quant_mode,\n+ unsigned int& weight_bits\n) {\nunsigned int base_quant_mode = (block_mode >> 4) & 1;\nunsigned int H = (block_mode >> 9) & 1;\n@@ -229,7 +233,7 @@ static bool decode_block_mode_3d(\nquant_mode = (base_quant_mode - 2) + 6 * H;\nis_dual_plane = D != 0;\n- unsigned int weight_bits = get_ise_sequence_bitcount(weight_count, (quant_method)quant_mode);\n+ weight_bits = get_ise_sequence_bitcount(weight_count, (quant_method)quant_mode);\nreturn (weight_count <= BLOCK_MAX_WEIGHTS &&\nweight_bits >= BLOCK_MIN_WEIGHT_BITS &&\nweight_bits <= BLOCK_MAX_WEIGHT_BITS);\n@@ -857,10 +861,11 @@ static void construct_block_size_descriptor_2d(\n{\nfor (unsigned int i = 0; i < WEIGHTS_MAX_BLOCK_MODES; i++)\n{\n- unsigned int x_weights, y_weights;\n+ unsigned int x_weights;\n+ unsigned int y_weights;\nbool is_dual_plane;\n-\nunsigned int quant_mode;\n+ unsigned int weight_bits;\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\nfloat percentile = percentiles[i];\n@@ -893,7 +898,7 @@ static void construct_block_size_descriptor_2d(\n// is technically permitted by the specification.\n// Skip modes that are invalid, too large, or not selected by heuristic\n- bool valid = decode_block_mode_2d(i, x_weights, y_weights, is_dual_plane, quant_mode);\n+ bool valid = decode_block_mode_2d(i, x_weights, y_weights, is_dual_plane, quant_mode, weight_bits);\nif (!selected || !valid || (x_weights > x_texels) || (y_weights > y_texels))\n{\nbsd.block_mode_packed_index[i] = BLOCK_BAD_BLOCK_MODE;\n@@ -937,6 +942,7 @@ static void construct_block_size_descriptor_2d(\nbsd.block_modes[packed_idx].decimation_mode = static_cast<uint8_t>(decimation_mode);\nbsd.block_modes[packed_idx].quant_mode = static_cast<uint8_t>(quant_mode);\nbsd.block_modes[packed_idx].is_dual_plane = static_cast<uint8_t>(is_dual_plane);\n+ bsd.block_modes[packed_idx].weight_bits = static_cast<uint8_t>(weight_bits);\nbsd.block_modes[packed_idx].mode_index = static_cast<uint16_t>(i);\nbsd.block_mode_packed_index[i] = static_cast<uint16_t>(packed_idx);\npacked_idx++;\n@@ -1067,12 +1073,15 @@ static void construct_block_size_descriptor_3d(\nunsigned int packed_idx = 0;\nfor (unsigned int i = 0; i < WEIGHTS_MAX_BLOCK_MODES; i++)\n{\n- unsigned int x_weights, y_weights, z_weights;\n+ unsigned int x_weights;\n+ unsigned int y_weights;\n+ unsigned int z_weights;\nbool is_dual_plane;\nunsigned int quant_mode;\n+ unsigned int weight_bits;\nbool permit_encode = true;\n- if (decode_block_mode_3d(i, x_weights, y_weights, z_weights, is_dual_plane, quant_mode))\n+ if (decode_block_mode_3d(i, x_weights, y_weights, z_weights, is_dual_plane, quant_mode, weight_bits))\n{\nif (x_weights > x_texels || y_weights > y_texels || z_weights > z_texels)\n{\n@@ -1093,6 +1102,7 @@ static void construct_block_size_descriptor_3d(\nint decimation_mode = decimation_mode_index[z_weights * 64 + y_weights * 8 + x_weights];\nbsd.block_modes[packed_idx].decimation_mode = static_cast<uint8_t>(decimation_mode);\nbsd.block_modes[packed_idx].quant_mode = static_cast<uint8_t>(quant_mode);\n+ bsd.block_modes[packed_idx].weight_bits = static_cast<uint8_t>(weight_bits);\nbsd.block_modes[packed_idx].is_dual_plane = static_cast<uint8_t>(is_dual_plane);\nbsd.block_modes[packed_idx].mode_index = static_cast<uint16_t>(i);\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -388,10 +388,6 @@ static float compress_symbolic_block_for_partition_1plane(\npromise(config.tune_refinement_limit > 0);\npromise(bsd.decimation_mode_count > 0);\n- static const int free_bits_for_partition_count[5] {\n- 0, 115 - 4, 111 - 4 - PARTITION_INDEX_BITS, 108 - 4 - PARTITION_INDEX_BITS, 105 - 4 - PARTITION_INDEX_BITS\n- };\n-\nconst auto& pi = bsd.get_partition_info(partition_count, partition_index);\n// Compute ideal weights and endpoint colors, with no quantization or decimation\n@@ -455,10 +451,10 @@ static float compress_symbolic_block_for_partition_1plane(\n// * Generate an optimized set of quantized weights\n// * Compute quantization errors for the mode\n- for (unsigned int i = 0; i < bsd.block_mode_count; ++i)\n- {\n- qwt_errors[i] = 1e38f;\n- }\n+\n+ static const int8_t free_bits_for_partition_count[4] {\n+ 115 - 4, 111 - 4 - PARTITION_INDEX_BITS, 108 - 4 - PARTITION_INDEX_BITS, 105 - 4 - PARTITION_INDEX_BITS\n+ };\nunsigned int max_block_modes = only_always ? bsd.always_block_mode_count\n: bsd.block_mode_count;\n@@ -466,8 +462,10 @@ static float compress_symbolic_block_for_partition_1plane(\nfor (unsigned int i = 0; i < max_block_modes; ++i)\n{\nconst block_mode& bm = bsd.block_modes[i];\n- if (bm.is_dual_plane || !bm.percentile_hit)\n+ int bitcount = free_bits_for_partition_count[partition_count - 1] - bm.weight_bits;\n+ if (bm.is_dual_plane || !bm.percentile_hit || bitcount <= 0)\n{\n+ qwt_errors[i] = 1e38f;\ncontinue;\n}\n@@ -479,17 +477,6 @@ static float compress_symbolic_block_for_partition_1plane(\nint decimation_mode = bm.decimation_mode;\nconst auto& di = bsd.get_decimation_info(decimation_mode);\n- // Compute weight bitcount for the mode\n- unsigned int bits_used_by_weights = get_ise_sequence_bitcount(\n- di.weight_count,\n- bm.get_weight_quant_mode());\n-\n- int bitcount = free_bits_for_partition_count[partition_count] - bits_used_by_weights;\n- if (bitcount <= 0)\n- {\n- continue;\n- }\n-\nqwt_bitcounts[i] = bitcount;\n// Generate the optimized set of weights for the weight mode\n@@ -517,7 +504,8 @@ static float compress_symbolic_block_for_partition_1plane(\nunsigned int candidate_count = compute_ideal_endpoint_formats(\nbsd, pi, blk, ei.ep, qwt_bitcounts, qwt_errors,\n- config.tune_candidate_limit, partition_format_specifiers, block_mode_index,\n+ config.tune_candidate_limit, max_block_modes,\n+ partition_format_specifiers, block_mode_index,\ncolor_quant_level, color_quant_level_mod, tmpbuf);\n// Iterate over the N believed-to-be-best modes to find out which one is actually best\n@@ -832,14 +820,14 @@ static float compress_symbolic_block_for_partition_2planes(\nfor (unsigned int i = 0; i < bsd.block_mode_count; ++i)\n{\nconst block_mode& bm = bsd.block_modes[i];\n- if (!bm.is_dual_plane || !bm.percentile_hit)\n+ int bitcount = 109 - bm.weight_bits;\n+ if (!bm.is_dual_plane || !bm.percentile_hit || bitcount <= 0)\n{\nqwt_errors[i] = 1e38f;\ncontinue;\n}\n- unsigned int decimation_mode = bm.decimation_mode;\n- const auto& di = bsd.get_decimation_info(decimation_mode);\n+ qwt_bitcounts[i] = bitcount;\nif (weight_high_value1[i] > 1.02f * min_wt_cutoff1)\n{\n@@ -851,18 +839,8 @@ static float compress_symbolic_block_for_partition_2planes(\nweight_high_value2[i] = 1.0f;\n}\n- // Compute weight bitcount for the mode\n- unsigned int bits_used_by_weights = get_ise_sequence_bitcount(\n- 2 * di.weight_count,\n- bm.get_weight_quant_mode());\n-\n- int bitcount = 113 - 4 - bits_used_by_weights;\n- if (bitcount <= 0)\n- {\n- continue;\n- }\n-\n- qwt_bitcounts[i] = bitcount;\n+ unsigned int decimation_mode = bm.decimation_mode;\n+ const auto& di = bsd.get_decimation_info(decimation_mode);\n// Generate the optimized set of weights for the mode\ncompute_quantized_weights_for_decimation(\n@@ -905,7 +883,8 @@ static float compress_symbolic_block_for_partition_2planes(\nconst auto& pi = bsd.get_partition_info(1, 0);\nunsigned int candidate_count = compute_ideal_endpoint_formats(\nbsd, pi, blk, epm, qwt_bitcounts, qwt_errors,\n- config.tune_candidate_limit, partition_format_specifiers, block_mode_index,\n+ config.tune_candidate_limit, bsd.block_mode_count,\n+ partition_format_specifiers, block_mode_index,\ncolor_quant_level, color_quant_level_mod, tmpbuf);\n// Iterate over the N believed-to-be-best modes to find out which one is actually best\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -600,6 +600,9 @@ struct block_mode\n/** @brief The weight quantization used by this block mode. */\nuint8_t quant_mode;\n+ /** @brief The weight quantization used by this block mode. */\n+ uint8_t weight_bits;\n+\n/** @brief Is a dual weight plane used by this block mode? */\nuint8_t is_dual_plane : 1;\n@@ -1979,6 +1982,7 @@ void unpack_weights(\n* @param qwt_bitcounts Bit counts for different quantization methods.\n* @param qwt_errors Errors for different quantization methods.\n* @param tune_candidate_limit The max number of candidates to return, may be less.\n+ * @param block_mode_count The number of blocks mofdes candidates to inspect.\n* @param[out] partition_format_specifiers The best formats per partition.\n* @param[out] block_mode The best packed block mode indexes.\n* @param[out] quant_level The best color quant level.\n@@ -1995,6 +1999,7 @@ unsigned int compute_ideal_endpoint_formats(\nconst int* qwt_bitcounts,\nconst float* qwt_errors,\nunsigned int tune_candidate_limit,\n+ unsigned int block_mode_count,\nint partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS],\nint block_mode[TUNE_MAX_TRIAL_CANDIDATES],\nquant_method quant_level[TUNE_MAX_TRIAL_CANDIDATES],\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_pick_best_endpoint_format.cpp", "new_path": "Source/astcenc_pick_best_endpoint_format.cpp", "diff": "@@ -1048,6 +1048,7 @@ unsigned int compute_ideal_endpoint_formats(\nconst int* qwt_bitcounts,\nconst float* qwt_errors,\nunsigned int tune_candidate_limit,\n+ unsigned int block_mode_count,\n// output data\nint partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS],\nint block_mode[TUNE_MAX_TRIAL_CANDIDATES],\n@@ -1058,7 +1059,7 @@ unsigned int compute_ideal_endpoint_formats(\nint partition_count = pi.partition_count;\npromise(partition_count > 0);\n- promise(bsd.block_mode_count > 0);\n+ promise(block_mode_count > 0);\nint encode_hdr_rgb = blk.rgb_lns[0];\nint encode_hdr_alpha = blk.alpha_lns[0];\n@@ -1085,9 +1086,8 @@ unsigned int compute_ideal_endpoint_formats(\n// Ensure that the \"overstep\" of the last iteration in the vectorized loop will contain data\n// that will never be picked as best candidate\n- const int packed_mode_count = bsd.block_mode_count;\n- const int packed_mode_count_simd_up = round_up_to_simd_multiple_vla(packed_mode_count);\n- for (int i = packed_mode_count; i < packed_mode_count_simd_up; i++)\n+ const int packed_mode_count_simd_up = round_up_to_simd_multiple_vla(block_mode_count);\n+ for (int i = block_mode_count; i < packed_mode_count_simd_up; i++)\n{\nerrors_of_best_combination[i] = ERROR_CALC_DEFAULT;\nbest_quant_levels[i] = QUANT_2;\n@@ -1101,7 +1101,7 @@ unsigned int compute_ideal_endpoint_formats(\n// The block contains 1 partition\nif (partition_count == 1)\n{\n- for (unsigned int i = 0; i < bsd.block_mode_count; ++i)\n+ for (unsigned int i = 0; i < block_mode_count; ++i)\n{\nif (qwt_errors[i] >= ERROR_CALC_DEFAULT)\n{\n@@ -1133,7 +1133,7 @@ unsigned int compute_ideal_endpoint_formats(\ntwo_partitions_find_best_combination_for_every_quantization_and_integer_count(\nbest_error, format_of_choice, combined_best_error, formats_of_choice);\n- for (unsigned int i = 0; i < bsd.block_mode_count; ++i)\n+ for (unsigned int i = 0; i < block_mode_count; ++i)\n{\nif (qwt_errors[i] >= ERROR_CALC_DEFAULT)\n{\n@@ -1165,7 +1165,7 @@ unsigned int compute_ideal_endpoint_formats(\nthree_partitions_find_best_combination_for_every_quantization_and_integer_count(\nbest_error, format_of_choice, combined_best_error, formats_of_choice);\n- for (unsigned int i = 0; i < bsd.block_mode_count; ++i)\n+ for (unsigned int i = 0; i < block_mode_count; ++i)\n{\nif (qwt_errors[i] >= ERROR_CALC_DEFAULT)\n{\n@@ -1198,7 +1198,7 @@ unsigned int compute_ideal_endpoint_formats(\nfour_partitions_find_best_combination_for_every_quantization_and_integer_count(\nbest_error, format_of_choice, combined_best_error, formats_of_choice);\n- for (unsigned int i = 0; i < bsd.block_mode_count; ++i)\n+ for (unsigned int i = 0; i < block_mode_count; ++i)\n{\nif (qwt_errors[i] >= ERROR_CALC_DEFAULT)\n{\n@@ -1237,7 +1237,7 @@ unsigned int compute_ideal_endpoint_formats(\nvint vbest_error_index(-1);\nvfloat vbest_ep_error(ERROR_CALC_DEFAULT);\nvint lane_ids = vint::lane_id();\n- for (unsigned int j = 0; j < bsd.block_mode_count; j += ASTCENC_SIMD_WIDTH)\n+ for (unsigned int j = 0; j < block_mode_count; j += ASTCENC_SIMD_WIDTH)\n{\nvfloat err = vfloat(&errors_of_best_combination[j]);\nvmask mask1 = err < vbest_ep_error;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Store weight_bits in block_mode structure
61,745
26.02.2022 19:09:49
0
90607171aec0427b603a9470c033461857d21bfb
Add more options to competitive script
[ { "change_type": "MODIFY", "old_path": "Test/astc_test_competitive.py", "new_path": "Test/astc_test_competitive.py", "diff": "@@ -31,7 +31,7 @@ ISPC_BIN = \"./Binaries/ISPC/ispc_astc.exe\"\nISPC_QUALITY = [\"rgba\", \"rgb\"]\nASTC_BIN = \"./astcenc/astcenc-avx2\"\n-ASTC_QUALITY = [\"-medium\", \"-fast\", \"-fastest\"]\n+ASTC_QUALITY = [\"0\", \"8\", \"10\", \"20\", \"30\", \"40\", \"50\", \"60\"]\nTEST_BLOCK_SIZES = [\"4x4\", \"6x6\", \"8x8\"]\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_competitive_plot.py", "new_path": "Test/astc_test_competitive_plot.py", "diff": "@@ -23,7 +23,7 @@ import numpy as np\nimport matplotlib.pyplot as plt\nimport sys\n-DATABASE = \"log.csv\"\n+DATABASE = \"competitive.csv\"\nclass Series:\n@@ -75,7 +75,8 @@ def plot_diff(series_a, series_b):\ndiff_qual = np.subtract(series_a.qual, series_b.qual)\nlabel = f\"{series_a.name} vs {series_b.name}\"\n- plt.scatter(diff_perf, diff_qual, s=2, label=label)\n+ plt.scatter(diff_perf, diff_qual, s=2, c=\"#0091BD\", label=label)\n+ plt.scatter(np.mean(diff_perf), np.mean(diff_qual), s=10, c=\"#FFA500\", marker=\"*\")\nplt.axhline(y=0, color=\"r\", linestyle=\"dotted\", lw=0.5)\nplt.axvline(x=1, color=\"r\", linestyle=\"dotted\", lw=0.5)\n@@ -103,21 +104,21 @@ def main():\nperf, qual = get_series(DATABASE, \"ISPC\", \"rgb\", block_size)\nseries_set.append(Series(f\"{block_size} IPSC Fast\", perf, qual))\n- perf, qual = get_series(DATABASE, \"ASTC\", \"-medium\", block_size)\n- series_set.append(Series(f\"{block_size} ASTC Medium\", perf, qual))\n+ perf, qual = get_series(DATABASE, \"ASTC\", \"60\", block_size)\n+ series_set.append(Series(f\"{block_size} ASTC 60\", perf, qual))\n- perf, qual = get_series(DATABASE, \"ASTC\", \"-fast\", block_size)\n- series_set.append(Series(f\"{block_size} ASTC Fast\", perf, qual))\n+ perf, qual = get_series(DATABASE, \"ASTC\", \"50\", block_size)\n+ series_set.append(Series(f\"{block_size} ASTC 50\", perf, qual))\n- perf, qual = get_series(DATABASE, \"ASTC\", \"-fastest\", block_size)\n- series_set.append(Series(f\"{block_size} ASTC Fastest\", perf, qual))\n+ perf, qual = get_series(DATABASE, \"ASTC\", \"10\", block_size)\n+ series_set.append(Series(f\"{block_size} ASTC 10\", perf, qual))\n+\n+ perf, qual = get_series(DATABASE, \"ASTC\", \"8\", block_size)\n+ series_set.append(Series(f\"{block_size} ASTC 8\", perf, qual))\nplot(block_size, series_set)\n- plot_diff(series_set[2], series_set[0])\nplot_diff(series_set[3], series_set[0])\n- plot_diff(series_set[3], series_set[1])\n- plot_diff(series_set[4], series_set[1])\nreturn 0\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add more options to competitive script
61,745
26.02.2022 20:30:40
0
c5af495584d47db626361d765edc56b4240f5cb5
Remove unused texel weight check
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_decompress_symbolic.cpp", "new_path": "Source/astcenc_decompress_symbolic.cpp", "diff": "@@ -283,9 +283,9 @@ void decompress_symbolic_block(\nint is_dual_plane = bm.is_dual_plane;\n// Unquantize and undecimate the weights\n- int weights[BLOCK_MAX_TEXELS];\n+ int plane1_weights[BLOCK_MAX_TEXELS];\nint plane2_weights[BLOCK_MAX_TEXELS];\n- unpack_weights(bsd, scb, di, is_dual_plane, bm.get_weight_quant_mode(), weights, plane2_weights);\n+ unpack_weights(bsd, scb, di, is_dual_plane, bm.get_weight_quant_mode(), plane1_weights, plane2_weights);\n// Now that we have endpoint colors and weights, we can unpack texel colors\nint plane2_component = is_dual_plane ? scb.plane2_component : -1;\n@@ -315,7 +315,7 @@ void decompress_symbolic_block(\nvint4 color = lerp_color_int(decode_mode,\nep0,\nep1,\n- weights[tix],\n+ plane1_weights[tix],\nplane2_weights[tix],\nplane2_mask);\n@@ -353,13 +353,12 @@ float compute_symbolic_block_difference(\n// Get the appropriate block descriptor\nconst block_mode& bm = bsd.get_block_mode(scb.block_mode);\nconst decimation_info& di = *(bsd.decimation_tables[bm.decimation_mode]);\n-\nbool is_dual_plane = bm.is_dual_plane != 0;\n// Unquantize and undecimate the weights\n- int weights[BLOCK_MAX_TEXELS];\n+ int plane1_weights[BLOCK_MAX_TEXELS];\nint plane2_weights[BLOCK_MAX_TEXELS];\n- unpack_weights(bsd, scb, di, is_dual_plane, bm.get_weight_quant_mode(), weights, plane2_weights);\n+ unpack_weights(bsd, scb, di, is_dual_plane, bm.get_weight_quant_mode(), plane1_weights, plane2_weights);\nint plane2_component = is_dual_plane ? scb.plane2_component : -1;\nvmask4 plane2_mask = vint4::lane_id() == vint4(plane2_component);\n@@ -380,8 +379,6 @@ float compute_symbolic_block_difference(\nrgb_lns, a_lns,\nep0, ep1);\n- vmask4 lns_mask(rgb_lns, rgb_lns, rgb_lns, a_lns);\n-\n// Unpack and compute error for each texel in the partition\nint texel_count = pi.partition_texel_count[i];\nfor (int j = 0; j < texel_count; j++)\n@@ -389,7 +386,7 @@ float compute_symbolic_block_difference(\nint tix = pi.texels_of_partition[i][j];\nvint4 colori = lerp_color_int(config.profile,\nep0, ep1,\n- weights[tix],\n+ plane1_weights[tix],\nplane2_weights[tix], plane2_mask);\nvfloat4 color = int_to_float(colori);\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_pick_best_endpoint_format.cpp", "new_path": "Source/astcenc_pick_best_endpoint_format.cpp", "diff": "@@ -95,12 +95,6 @@ static void compute_error_squared_rgb_single_partition(\nfor (int i = 0; i < texels_in_partition; i++)\n{\nint tix = pi.texels_of_partition[partition_index][i];\n- float texel_weight = hadd_s(blk.channel_weight.swz<0, 1, 2>()) / 3.0f;\n- if (texel_weight < 1e-20f)\n- {\n- continue;\n- }\n-\nvfloat4 point = blk.texel(tix);\nvfloat4 ews = blk.channel_weight;\n@@ -116,7 +110,7 @@ static void compute_error_squared_rgb_single_partition(\nfloat param2 = dot3_s(point, samec_pline.bs);\n// No samec amod - we know it's always zero\n- vfloat4 rp2 = /* samec_pline.amod + */ param2 * samec_pline.bs;\n+ vfloat4 rp2 = param2 * samec_pline.bs;\nvfloat4 dist2 = rp2 - point;\nsamec_err += dot3_s(ews, dist2 * dist2);\n@@ -127,7 +121,7 @@ static void compute_error_squared_rgb_single_partition(\nfloat param4 = dot3_s(point, l_pline.bs);\n// No luma amod - we know it's always zero\n- vfloat4 rp4 = /* l_pline.amod + */ param4 * l_pline.bs;\n+ vfloat4 rp4 = param4 * l_pline.bs;\nvfloat4 dist4 = rp4 - point;\nl_err += dot3_s(ews, dist4 * dist4);\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove unused texel weight check
61,745
27.02.2022 08:49:45
0
4227d60386c8522fc255c1a5bd89880a6a46025a
Update CMake project version
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -24,7 +24,7 @@ if(MSVC)\nadd_compile_options(\"/wd4324\") # Disable structure was padded due to alignment specifier\nendif()\n-project(astcencoder VERSION 3.3.0)\n+project(astcencoder VERSION 3.4.0)\nset(CMAKE_CXX_STANDARD 14)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update CMake project version
61,745
27.02.2022 09:06:52
0
8a93788fc14392c6542da7a84e39fbaa40699308
Update change log for 3.4 release
[ { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-3x.md", "new_path": "Docs/ChangeLog-3x.md", "diff": "@@ -10,11 +10,16 @@ clocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.\n<!-- ---------------------------------------------------------------------- -->\n## 3.4\n-**Status:** In development\n+**Status:** March 2022\nThe 3.4 release introduces another round of optimizations, removing a number\nof power-user configuration options to simplify the core compressor data path.\n+Reminder for users of the library interface - the API is not designed to be\n+binary compatible across versions, and this release is not compatible with\n+earlier releases. Please update and rebuild your client-side code using the\n+updated `astcenc.h` header.\n+\n* **General:**\n* **Feature:** Many memory allocations have been moved off the stack into\ndynamically allocated working memory. This significantly reduces the peak\n@@ -35,6 +40,10 @@ of power-user configuration options to simplify the core compressor data path.\n* **Feature:** The `-perceptual` option to set a perceptual error metric is\nstill supported, but is currently a no-op in the compressor for mask map\nand normal map textures.\n+ * **Bug-fix:** Corrected decompression of error blocks in some cases, so now\n+ returning the expected error color (magenta for LDR, NaN for HDR). Note\n+ that astcenc determines the error color to use based on the output image\n+ data type not the decoder profile.\n### Performance:\n@@ -45,7 +54,8 @@ Key for charts:\n**Relative performance vs 3.3 release:**\n-Pending ...\n+![Relative scores 3.4 vs 3.3](./ChangeLogImg/relative-3.3-to-3.4.png)\n+\n<!-- ---------------------------------------------------------------------- -->\n## 3.3\n" }, { "change_type": "ADD", "old_path": "Docs/ChangeLogImg/relative-3.3-to-3.4.png", "new_path": "Docs/ChangeLogImg/relative-3.3-to-3.4.png", "diff": "Binary files /dev/null and b/Docs/ChangeLogImg/relative-3.3-to-3.4.png differ\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update change log for 3.4 release
61,745
28.02.2022 07:55:48
0
7e929e70335b56b36c6be7e3f5102ddda74ef789
Fix compile warning in DECOMPRESSOR=ON builds
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_block_sizes.cpp", "new_path": "Source/astcenc_block_sizes.cpp", "diff": "@@ -842,6 +842,7 @@ static void construct_block_size_descriptor_2d(\n// Gather all the decimation grids that can be used with the current block\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\nconst float *percentiles = get_2d_percentile_table(x_texels, y_texels);\n+ float always_threshold = 0.0f;\n#else\n// Unused in decompress-only builds\n(void)can_omit_modes;\n@@ -853,8 +854,6 @@ static void construct_block_size_descriptor_2d(\nunsigned int always_block_mode_count = 0;\nunsigned int always_decimation_mode_count = 0;\n- float always_threshold = 0.0f;\n-\n// Iterate twice; first time keep the \"always\" blocks, second time keep the \"non-always\" blocks.\n// This ensures that the always block modes and decimation modes are at the start of the list.\nfor (unsigned int j = 0; j < 2; j ++)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix compile warning in DECOMPRESSOR=ON builds
61,745
01.03.2022 20:08:45
0
5cfb98cdb1c5baaa8aa7a7e65ca7c14d9d63b5f2
Add missing error for unknown uncompressed file type
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel.cpp", "new_path": "Source/astcenccli_toplevel.cpp", "diff": "@@ -1461,6 +1461,9 @@ int main(\nint bitness = get_output_filename_enforced_bitness(output_filename.c_str());\nif (bitness < 0)\n{\n+ const char *eptr = strrchr(output_filename.c_str(), '.');\n+ eptr = eptr ? eptr : \"\";\n+ printf(\"ERROR: Unknown uncompressed output file type '%s'\\n\", eptr);\nreturn 1;\n}\n}\n@@ -1475,7 +1478,9 @@ int main(\nif (!(is_null || ends_with(output_filename, \".astc\") || ends_with(output_filename, \".ktx\")))\n{\n- printf(\"ERROR: Unknown compressed output file type\\n\");\n+ const char *eptr = strrchr(output_filename.c_str(), '.');\n+ eptr = eptr ? eptr : \"\";\n+ printf(\"ERROR: Unknown compressed output file type '%s'\\n\", eptr);\nreturn 1;\n}\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add missing error for unknown uncompressed file type
61,745
05.03.2022 22:45:15
0
5c6e990c7661a79a966ebc4e577bfd6f9c939ca5
Add block texel_count to image_block
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -393,7 +393,7 @@ static float compress_symbolic_block_for_partition_1plane(\n// Compute ideal weights and endpoint colors, with no quantization or decimation\nendpoints_and_weights& ei = tmpbuf.ei1;\nendpoints_and_weights *eix = tmpbuf.eix1;\n- compute_ideal_colors_and_weights_1plane(bsd, blk, pi, ei);\n+ compute_ideal_colors_and_weights_1plane(blk, pi, ei);\n// Compute ideal weights and endpoint colors for every decimation\nfloat *dec_weights_ideal_value = tmpbuf.dec_weights_ideal_value;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_entry.cpp", "new_path": "Source/astcenc_entry.cpp", "diff": "@@ -807,11 +807,13 @@ static void compress_image(\n) {\nconst block_size_descriptor *bsd = ctx.bsd;\nastcenc_profile decode_mode = ctx.config.profile;\n+\nimage_block blk;\nint block_x = bsd->xdim;\nint block_y = bsd->ydim;\nint block_z = bsd->zdim;\n+ blk.texel_count = block_x * block_y * block_z;\nint dim_x = image.dim_x;\nint dim_y = image.dim_y;\n@@ -1079,6 +1081,7 @@ astcenc_error astcenc_decompress_image(\n}\nimage_block blk;\n+ blk.texel_count = block_x * block_y * block_z;\n// If context thread count is one then implicitly reset\nif (ctx->thread_count == 1)\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp", "diff": "/**\n* @brief Compute the ideal endpoints and weights for 1 color component.\n*\n- * @param bsd The block size information.\n* @param blk The image block color data to compress.\n* @param pi The partition info for the current trial.\n* @param[out] ei The computed ideal endpoints and weights.\n* @param component The color component to compute.\n*/\nstatic void compute_ideal_colors_and_weights_1_comp(\n- const block_size_descriptor& bsd,\nconst image_block& blk,\nconst partition_info& pi,\nendpoints_and_weights& ei,\n@@ -46,7 +44,7 @@ static void compute_ideal_colors_and_weights_1_comp(\nei.ep.partition_count = partition_count;\npromise(partition_count > 0);\n- unsigned int texel_count = bsd.texel_count;\n+ unsigned int texel_count = blk.texel_count;\npromise(texel_count > 0);\nfloat error_weight;\n@@ -140,7 +138,6 @@ static void compute_ideal_colors_and_weights_1_comp(\n/**\n* @brief Compute the ideal endpoints and weights for 2 color components.\n*\n- * @param bsd The block size information.\n* @param blk The image block color data to compress.\n* @param pi The partition info for the current trial.\n* @param[out] ei The computed ideal endpoints and weights.\n@@ -148,7 +145,6 @@ static void compute_ideal_colors_and_weights_1_comp(\n* @param component2 The second color component to compute.\n*/\nstatic void compute_ideal_colors_and_weights_2_comp(\n- const block_size_descriptor& bsd,\nconst image_block& blk,\nconst partition_info& pi,\nendpoints_and_weights& ei,\n@@ -159,7 +155,7 @@ static void compute_ideal_colors_and_weights_2_comp(\nei.ep.partition_count = partition_count;\npromise(partition_count > 0);\n- unsigned int texel_count = bsd.texel_count;\n+ unsigned int texel_count = blk.texel_count;\npromise(texel_count > 0);\npartition_metrics pms[BLOCK_MAX_PARTITIONS];\n@@ -280,14 +276,12 @@ static void compute_ideal_colors_and_weights_2_comp(\n/**\n* @brief Compute the ideal endpoints and weights for 3 color components.\n*\n- * @param bsd The block size information.\n* @param blk The image block color data to compress.\n* @param pi The partition info for the current trial.\n* @param[out] ei The computed ideal endpoints and weights.\n* @param omitted_component The color component excluded from the calculation.\n*/\nstatic void compute_ideal_colors_and_weights_3_comp(\n- const block_size_descriptor& bsd,\nconst image_block& blk,\nconst partition_info& pi,\nendpoints_and_weights& ei,\n@@ -297,7 +291,7 @@ static void compute_ideal_colors_and_weights_3_comp(\nei.ep.partition_count = partition_count;\npromise(partition_count > 0);\n- unsigned int texel_count = bsd.texel_count;\n+ unsigned int texel_count = blk.texel_count;\npromise(texel_count > 0);\npartition_metrics pms[BLOCK_MAX_PARTITIONS];\n@@ -440,13 +434,11 @@ static void compute_ideal_colors_and_weights_3_comp(\n/**\n* @brief Compute the ideal endpoints and weights for 4 color components.\n*\n- * @param bsd The block size information.\n* @param blk The image block color data to compress.\n* @param pi The partition info for the current trial.\n* @param[out] ei The computed ideal endpoints and weights.\n*/\nstatic void compute_ideal_colors_and_weights_4_comp(\n- const block_size_descriptor& bsd,\nconst image_block& blk,\nconst partition_info& pi,\nendpoints_and_weights& ei\n@@ -455,7 +447,7 @@ static void compute_ideal_colors_and_weights_4_comp(\nunsigned int partition_count = pi.partition_count;\n- unsigned int texel_count= bsd.texel_count;\n+ unsigned int texel_count = blk.texel_count;\npromise(texel_count > 0);\npromise(partition_count > 0);\n@@ -539,7 +531,6 @@ static void compute_ideal_colors_and_weights_4_comp(\n/* See header for documentation. */\nvoid compute_ideal_colors_and_weights_1plane(\n- const block_size_descriptor& bsd,\nconst image_block& blk,\nconst partition_info& pi,\nendpoints_and_weights& ei\n@@ -548,11 +539,11 @@ void compute_ideal_colors_and_weights_1plane(\nif (uses_alpha)\n{\n- compute_ideal_colors_and_weights_4_comp(bsd, blk, pi, ei);\n+ compute_ideal_colors_and_weights_4_comp(blk, pi, ei);\n}\nelse\n{\n- compute_ideal_colors_and_weights_3_comp(bsd, blk, pi, ei, 3);\n+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei, 3);\n}\n}\n@@ -573,43 +564,43 @@ void compute_ideal_colors_and_weights_2planes(\ncase 0: // Separate weights for red\nif (uses_alpha)\n{\n- compute_ideal_colors_and_weights_3_comp(bsd, blk, pi, ei1, 0);\n+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei1, 0);\n}\nelse\n{\n- compute_ideal_colors_and_weights_2_comp(bsd, blk, pi, ei1, 1, 2);\n+ compute_ideal_colors_and_weights_2_comp(blk, pi, ei1, 1, 2);\n}\n- compute_ideal_colors_and_weights_1_comp(bsd, blk, pi, ei2, 0);\n+ compute_ideal_colors_and_weights_1_comp(blk, pi, ei2, 0);\nbreak;\ncase 1: // Separate weights for green\nif (uses_alpha)\n{\n- compute_ideal_colors_and_weights_3_comp(bsd,blk, pi, ei1, 1);\n+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei1, 1);\n}\nelse\n{\n- compute_ideal_colors_and_weights_2_comp(bsd, blk, pi, ei1, 0, 2);\n+ compute_ideal_colors_and_weights_2_comp(blk, pi, ei1, 0, 2);\n}\n- compute_ideal_colors_and_weights_1_comp(bsd, blk, pi, ei2, 1);\n+ compute_ideal_colors_and_weights_1_comp(blk, pi, ei2, 1);\nbreak;\ncase 2: // Separate weights for blue\nif (uses_alpha)\n{\n- compute_ideal_colors_and_weights_3_comp(bsd, blk, pi, ei1, 2);\n+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei1, 2);\n}\nelse\n{\n- compute_ideal_colors_and_weights_2_comp(bsd, blk, pi, ei1, 0, 1);\n+ compute_ideal_colors_and_weights_2_comp(blk, pi, ei1, 0, 1);\n}\n- compute_ideal_colors_and_weights_1_comp(bsd, blk, pi, ei2, 2);\n+ compute_ideal_colors_and_weights_1_comp(blk, pi, ei2, 2);\nbreak;\ndefault: // Separate weights for alpha\nassert(uses_alpha);\n- compute_ideal_colors_and_weights_3_comp(bsd, blk, pi, ei1, 3);\n- compute_ideal_colors_and_weights_1_comp(bsd, blk, pi, ei2, 3);\n+ compute_ideal_colors_and_weights_3_comp(blk, pi, ei1, 3);\n+ compute_ideal_colors_and_weights_1_comp(blk, pi, ei2, 3);\nbreak;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -811,6 +811,9 @@ struct image_block\n/** @brief The input (compress) or output (decompress) data for the alpha color component. */\nfloat data_a[BLOCK_MAX_TEXELS];\n+ /** @brief The number of texels in the block. */\n+ uint8_t texel_count;\n+\n/** @brief The original data for texel 0 for constant color block encoding. */\nvfloat4 origin_texel;\n@@ -1727,13 +1730,11 @@ void write_image_block(\n* defines an exact position on the partition color line. We can then use these to assess the error\n* introduced by removing and quantizing the weight grid.\n*\n- * @param bsd The block size information.\n* @param blk The image block color data to compress.\n* @param pi The partition info for the current trial.\n* @param[out] ei The endpoint and weight values.\n*/\nvoid compute_ideal_colors_and_weights_1plane(\n- const block_size_descriptor& bsd,\nconst image_block& blk,\nconst partition_info& pi,\nendpoints_and_weights& ei);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add block texel_count to image_block
61,745
06.03.2022 19:31:38
0
f3f514da5c7b0cc75c6099be54554ef0aee7f2ad
Specialize compute_symbolic_block_difference
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -388,6 +388,12 @@ static float compress_symbolic_block_for_partition_1plane(\npromise(config.tune_refinement_limit > 0);\npromise(bsd.decimation_mode_count > 0);\n+ auto compute_difference = &compute_symbolic_block_difference_1plane;\n+ if ((partition_count == 1) && !(config.flags & ASTCENC_FLG_MAP_RGBM))\n+ {\n+ compute_difference = &compute_symbolic_block_difference_1plane_1partition;\n+ }\n+\nconst auto& pi = bsd.get_partition_info(partition_count, partition_index);\n// Compute ideal weights and endpoint colors, with no quantization or decimation\n@@ -620,7 +626,7 @@ static float compress_symbolic_block_for_partition_1plane(\n// Pre-realign test\nif (l == 0)\n{\n- float errorval = compute_symbolic_block_difference(config, bsd, workscb, blk);\n+ float errorval = compute_difference(config, bsd, workscb, blk);\nif (errorval == -ERROR_CALC_DEFAULT)\n{\nerrorval = -errorval;\n@@ -671,7 +677,7 @@ static float compress_symbolic_block_for_partition_1plane(\n}\n// Post-realign test\n- float errorval = compute_symbolic_block_difference(config, bsd, workscb, blk);\n+ float errorval = compute_difference(config, bsd, workscb, blk);\nif (errorval == -ERROR_CALC_DEFAULT)\n{\nerrorval = -errorval;\n@@ -959,7 +965,7 @@ static float compress_symbolic_block_for_partition_2planes(\n// Pre-realign test\nif (l == 0)\n{\n- float errorval = compute_symbolic_block_difference(config, bsd, workscb, blk);\n+ float errorval = compute_symbolic_block_difference_2plane(config, bsd, workscb, blk);\nif (errorval == -ERROR_CALC_DEFAULT)\n{\nerrorval = -errorval;\n@@ -1011,7 +1017,7 @@ static float compress_symbolic_block_for_partition_2planes(\n}\n// Post-realign test\n- float errorval = compute_symbolic_block_difference(config, bsd, workscb, blk);\n+ float errorval = compute_symbolic_block_difference_2plane(config, bsd, workscb, blk);\nif (errorval == -ERROR_CALC_DEFAULT)\n{\nerrorval = -errorval;\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_decompress_symbolic.cpp", "new_path": "Source/astcenc_decompress_symbolic.cpp", "diff": "@@ -60,9 +60,7 @@ static vint compute_value_of_texel_weight_int_vla(\n* @param decode_mode The ASTC profile (linear or sRGB)\n* @param color0 The endpoint0 color.\n* @param color1 The endpoint1 color.\n- * @param weight_plane1 The interpolation weight (between 0 and 64) for plane 1.\n- * @param weight_plane2 The interpolation weight (between 0 and 64) for plane 2.\n- * @param plane2_mask The mask pattern for the plane assignment (set = plane 2).\n+ * @param weights The interpolation weight (between 0 and 64).\n*\n* @return The interpolated color.\n*/\n@@ -70,11 +68,9 @@ static vint4 lerp_color_int(\nastcenc_profile decode_mode,\nvint4 color0,\nvint4 color1,\n- int weight_plane1,\n- int weight_plane2,\n- vmask4 plane2_mask\n+ vint4 weights\n) {\n- vint4 weight1 = select(vint4(weight_plane1), vint4(weight_plane2), plane2_mask);\n+ vint4 weight1 = weights;\nvint4 weight0 = vint4(64) - weight1;\nif (decode_mode == ASTCENC_PRF_LDR_SRGB)\n@@ -94,6 +90,7 @@ static vint4 lerp_color_int(\nreturn color;\n}\n+\n/**\n* @brief Convert integer color value into a float value for the decoder.\n*\n@@ -312,13 +309,8 @@ void decompress_symbolic_block(\nfor (int j = 0; j < texel_count; j++)\n{\nint tix = pi.texels_of_partition[i][j];\n- vint4 color = lerp_color_int(decode_mode,\n- ep0,\n- ep1,\n- plane1_weights[tix],\n- plane2_weights[tix],\n- plane2_mask);\n-\n+ vint4 weight = select(vint4(plane1_weights[tix]), vint4(plane2_weights[tix]), plane2_mask);\n+ vint4 color = lerp_color_int(decode_mode, ep0, ep1, weight);\nvfloat4 colorf = decode_texel(color, lns_mask);\nblk.data_r[tix] = colorf.lane<0>();\n@@ -332,12 +324,107 @@ void decompress_symbolic_block(\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\n/* See header for documentation. */\n-float compute_symbolic_block_difference(\n+float compute_symbolic_block_difference_2plane(\n+ const astcenc_config& config,\n+ const block_size_descriptor& bsd,\n+ const symbolic_compressed_block& scb,\n+ const image_block& blk\n+) {\n+ // If we detected an error-block, blow up immediately.\n+ if (scb.block_type == SYM_BTYPE_ERROR)\n+ {\n+ return ERROR_CALC_DEFAULT;\n+ }\n+\n+ assert(scb.block_mode >= 0);\n+ assert(scb.partition_count == 1);\n+ assert(bsd.get_block_mode(scb.block_mode).is_dual_plane == 1);\n+\n+ // Get the appropriate block descriptor\n+ const block_mode& bm = bsd.get_block_mode(scb.block_mode);\n+ const decimation_info& di = *(bsd.decimation_tables[bm.decimation_mode]);\n+\n+ // Unquantize and undecimate the weights\n+ int plane1_weights[BLOCK_MAX_TEXELS];\n+ int plane2_weights[BLOCK_MAX_TEXELS];\n+ unpack_weights(bsd, scb, di, true, bm.get_weight_quant_mode(), plane1_weights, plane2_weights);\n+\n+ vmask4 plane2_mask = vint4::lane_id() == vint4(scb.plane2_component);\n+\n+ float summa = 0.0f;\n+ // Decode the color endpoints for this partition\n+ vint4 ep0;\n+ vint4 ep1;\n+ bool rgb_lns;\n+ bool a_lns;\n+\n+ unpack_color_endpoints(config.profile,\n+ scb.color_formats[0],\n+ scb.get_color_quant_mode(),\n+ scb.color_values[0],\n+ rgb_lns, a_lns,\n+ ep0, ep1);\n+\n+ // Unpack and compute error for each texel in the partition\n+ unsigned int texel_count = bsd.texel_count;\n+ for (unsigned int i = 0; i < texel_count; i++)\n+ {\n+ vint4 weight = select(vint4(plane1_weights[i]), vint4(plane2_weights[i]), plane2_mask);\n+ vint4 colori = lerp_color_int(config.profile, ep0, ep1, weight);\n+\n+ vfloat4 color = int_to_float(colori);\n+ vfloat4 oldColor = blk.texel(i);\n+\n+ // Compare error using a perceptual decode metric for RGBM textures\n+ if (config.flags & ASTCENC_FLG_MAP_RGBM)\n+ {\n+ // Fail encodings that result in zero weight M pixels. Note that this can cause\n+ // \"interesting\" artifacts if we reject all useful encodings - we typically get max\n+ // brightness encodings instead which look just as bad. We recommend users apply a\n+ // bias to their stored M value, limiting the lower value to 16 or 32 to avoid\n+ // getting small M values post-quantization, but we can't prove it would never\n+ // happen, especially at low bit rates ...\n+ if (color.lane<3>() == 0.0f)\n+ {\n+ return -ERROR_CALC_DEFAULT;\n+ }\n+\n+ // Compute error based on decoded RGBM color\n+ color = vfloat4(\n+ color.lane<0>() * color.lane<3>() * config.rgbm_m_scale,\n+ color.lane<1>() * color.lane<3>() * config.rgbm_m_scale,\n+ color.lane<2>() * color.lane<3>() * config.rgbm_m_scale,\n+ 1.0f\n+ );\n+\n+ oldColor = vfloat4(\n+ oldColor.lane<0>() * oldColor.lane<3>() * config.rgbm_m_scale,\n+ oldColor.lane<1>() * oldColor.lane<3>() * config.rgbm_m_scale,\n+ oldColor.lane<2>() * oldColor.lane<3>() * config.rgbm_m_scale,\n+ 1.0f\n+ );\n+ }\n+\n+ vfloat4 error = oldColor - color;\n+ error = min(abs(error), 1e15f);\n+ error = error * error;\n+\n+ float metric = dot_s(error, blk.channel_weight);\n+ summa += astc::min(metric, ERROR_CALC_DEFAULT);\n+ }\n+\n+ return summa;\n+}\n+\n+/* See header for documentation. */\n+float compute_symbolic_block_difference_1plane(\nconst astcenc_config& config,\nconst block_size_descriptor& bsd,\nconst symbolic_compressed_block& scb,\nconst image_block& blk\n) {\n+ assert(bsd.get_block_mode(scb.block_mode).is_dual_plane == 0);\n+\n// If we detected an error-block, blow up immediately.\nif (scb.block_type == SYM_BTYPE_ERROR)\n{\n@@ -347,24 +434,19 @@ float compute_symbolic_block_difference(\nassert(scb.block_mode >= 0);\n// Get the appropriate partition-table entry\n- int partition_count = scb.partition_count;\n+ unsigned int partition_count = scb.partition_count;\nconst auto& pi = bsd.get_partition_info(partition_count, scb.partition_index);\n// Get the appropriate block descriptor\nconst block_mode& bm = bsd.get_block_mode(scb.block_mode);\nconst decimation_info& di = *(bsd.decimation_tables[bm.decimation_mode]);\n- bool is_dual_plane = bm.is_dual_plane != 0;\n// Unquantize and undecimate the weights\nint plane1_weights[BLOCK_MAX_TEXELS];\n- int plane2_weights[BLOCK_MAX_TEXELS];\n- unpack_weights(bsd, scb, di, is_dual_plane, bm.get_weight_quant_mode(), plane1_weights, plane2_weights);\n-\n- int plane2_component = is_dual_plane ? scb.plane2_component : -1;\n- vmask4 plane2_mask = vint4::lane_id() == vint4(plane2_component);\n+ unpack_weights(bsd, scb, di, false, bm.get_weight_quant_mode(), plane1_weights, nullptr);\nfloat summa = 0.0f;\n- for (int i = 0; i < partition_count; i++)\n+ for (unsigned int i = 0; i < partition_count; i++)\n{\n// Decode the color endpoints for this partition\nvint4 ep0;\n@@ -380,14 +462,12 @@ float compute_symbolic_block_difference(\nep0, ep1);\n// Unpack and compute error for each texel in the partition\n- int texel_count = pi.partition_texel_count[i];\n- for (int j = 0; j < texel_count; j++)\n+ unsigned int texel_count = pi.partition_texel_count[i];\n+ for (unsigned int j = 0; j < texel_count; j++)\n{\n- int tix = pi.texels_of_partition[i][j];\n- vint4 colori = lerp_color_int(config.profile,\n- ep0, ep1,\n- plane1_weights[tix],\n- plane2_weights[tix], plane2_mask);\n+ unsigned int tix = pi.texels_of_partition[i][j];\n+ vint4 colori = lerp_color_int(config.profile, ep0, ep1,\n+ vint4(plane1_weights[tix]));\nvfloat4 color = int_to_float(colori);\nvfloat4 oldColor = blk.texel(tix);\n@@ -434,4 +514,64 @@ float compute_symbolic_block_difference(\nreturn summa;\n}\n+/* See header for documentation. */\n+float compute_symbolic_block_difference_1plane_1partition(\n+ const astcenc_config& config,\n+ const block_size_descriptor& bsd,\n+ const symbolic_compressed_block& scb,\n+ const image_block& blk\n+) {\n+ // If we detected an error-block, blow up immediately.\n+ if (scb.block_type == SYM_BTYPE_ERROR)\n+ {\n+ return ERROR_CALC_DEFAULT;\n+ }\n+\n+ assert(scb.block_mode >= 0);\n+ assert(bsd.get_partition_info(scb.partition_count, scb.partition_index).partition_count == 1);\n+\n+ // Get the appropriate block descriptor\n+ const block_mode& bm = bsd.get_block_mode(scb.block_mode);\n+ const decimation_info& di = *(bsd.decimation_tables[bm.decimation_mode]);\n+\n+ // Unquantize and undecimate the weights\n+ int plane1_weights[BLOCK_MAX_TEXELS];\n+ unpack_weights(bsd, scb, di, false, bm.get_weight_quant_mode(), plane1_weights, nullptr);\n+\n+ // Decode the color endpoints for this partition\n+ vint4 ep0;\n+ vint4 ep1;\n+ bool rgb_lns;\n+ bool a_lns;\n+\n+ unpack_color_endpoints(config.profile,\n+ scb.color_formats[0],\n+ scb.get_color_quant_mode(),\n+ scb.color_values[0],\n+ rgb_lns, a_lns,\n+ ep0, ep1);\n+\n+ // Unpack and compute error for each texel in the partition\n+ float summa = 0.0f;\n+\n+ unsigned int texel_count = bsd.texel_count;\n+ for (unsigned int i = 0; i < texel_count; i++)\n+ {\n+ vint4 colori = lerp_color_int(config.profile, ep0, ep1,\n+ vint4(plane1_weights[i]));\n+\n+ vfloat4 color = int_to_float(colori);\n+ vfloat4 oldColor = blk.texel(i);\n+\n+ vfloat4 error = oldColor - color;\n+ error = min(abs(error), 1e15f);\n+ error = error * error;\n+\n+ float metric = dot_s(error, blk.channel_weight);\n+ summa += astc::min(metric, ERROR_CALC_DEFAULT);\n+ }\n+\n+ return summa;\n+}\n+\n#endif\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -2136,6 +2136,50 @@ void decompress_symbolic_block(\n/**\n* @brief Compute the error between a symbolic block and the original input data.\n*\n+ * This function is specialized for 2 plane and 1 partition search.\n+ *\n+ * In RGBM mode this will reject blocks that attempt to encode a zero M value.\n+ *\n+ * @param config The compressor config.\n+ * @param bsd The block size information.\n+ * @param scb The symbolic compressed encoding.\n+ * @param blk The original image block color data.\n+ *\n+ * @return Returns the computed error, or a negative value if the encoding\n+ * should be rejected for any reason.\n+ */\n+float compute_symbolic_block_difference_2plane(\n+ const astcenc_config& config,\n+ const block_size_descriptor& bsd,\n+ const symbolic_compressed_block& scb,\n+ const image_block& blk);\n+\n+/**\n+ * @brief Compute the error between a symbolic block and the original input data.\n+ *\n+ * This function is specialized for 1 plane and N partition search.\n+ *\n+ * In RGBM mode this will reject blocks that attempt to encode a zero M value.\n+ *\n+ * @param config The compressor config.\n+ * @param bsd The block size information.\n+ * @param scb The symbolic compressed encoding.\n+ * @param blk The original image block color data.\n+ *\n+ * @return Returns the computed error, or a negative value if the encoding\n+ * should be rejected for any reason.\n+ */\n+float compute_symbolic_block_difference_1plane(\n+ const astcenc_config& config,\n+ const block_size_descriptor& bsd,\n+ const symbolic_compressed_block& scb,\n+ const image_block& blk);\n+\n+/**\n+ * @brief Compute the error between a symbolic block and the original input data.\n+ *\n+ * This function is specialized for 1 plane and 1 partition search.\n+ *\n* In RGBM mode this will reject blocks that attempt to encode a zero M value.\n*\n* @param config The compressor config.\n@@ -2146,7 +2190,7 @@ void decompress_symbolic_block(\n* @return Returns the computed error, or a negative value if the encoding\n* should be rejected for any reason.\n*/\n-float compute_symbolic_block_difference(\n+float compute_symbolic_block_difference_1plane_1partition(\nconst astcenc_config& config,\nconst block_size_descriptor& bsd,\nconst symbolic_compressed_block& scb,\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Specialize compute_symbolic_block_difference
61,745
06.03.2022 19:38:49
0
c82485d49e532a5133360513ce299fb567d00bcb
Vectorize compute_symbolic_block_difference_1plane_1partition
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_decompress_symbolic.cpp", "new_path": "Source/astcenc_decompress_symbolic.cpp", "diff": "@@ -535,7 +535,7 @@ float compute_symbolic_block_difference_1plane_1partition(\nconst decimation_info& di = *(bsd.decimation_tables[bm.decimation_mode]);\n// Unquantize and undecimate the weights\n- int plane1_weights[BLOCK_MAX_TEXELS];\n+ alignas(ASTCENC_VECALIGN) int plane1_weights[BLOCK_MAX_TEXELS];\nunpack_weights(bsd, scb, di, false, bm.get_weight_quant_mode(), plane1_weights, nullptr);\n// Decode the color endpoints for this partition\n@@ -551,27 +551,79 @@ float compute_symbolic_block_difference_1plane_1partition(\nrgb_lns, a_lns,\nep0, ep1);\n- // Unpack and compute error for each texel in the partition\n- float summa = 0.0f;\n- unsigned int texel_count = bsd.texel_count;\n- for (unsigned int i = 0; i < texel_count; i++)\n+ // Pre-shift sRGB so things round correctly\n+ if (config.profile == ASTCENC_PRF_LDR_SRGB)\n{\n- vint4 colori = lerp_color_int(config.profile, ep0, ep1,\n- vint4(plane1_weights[i]));\n-\n- vfloat4 color = int_to_float(colori);\n- vfloat4 oldColor = blk.texel(i);\n+ ep0 = asr<8>(ep0);\n+ ep1 = asr<8>(ep1);\n+ }\n- vfloat4 error = oldColor - color;\n- error = min(abs(error), 1e15f);\n- error = error * error;\n+ // Unpack and compute error for each texel in the partition\n+ vfloat4 summav = vfloat4::zero();\n- float metric = dot_s(error, blk.channel_weight);\n- summa += astc::min(metric, ERROR_CALC_DEFAULT);\n- }\n+ vint lane_id = vint::lane_id();\n+ vint srgb_scale(config.profile == ASTCENC_PRF_LDR_SRGB ? 257 : 1);\n- return summa;\n+ unsigned int texel_count = bsd.texel_count;\n+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)\n+ {\n+ // Compute EP1 contribution\n+ vint weight1 = vint::loada(plane1_weights + i);\n+ vint ep1_r = vint(ep1.lane<0>()) * weight1;\n+ vint ep1_g = vint(ep1.lane<1>()) * weight1;\n+ vint ep1_b = vint(ep1.lane<2>()) * weight1;\n+ vint ep1_a = vint(ep1.lane<3>()) * weight1;\n+\n+ // Compute EP0 contribution\n+ vint weight0 = vint(64) - weight1;\n+ vint ep0_r = vint(ep0.lane<0>()) * weight0;\n+ vint ep0_g = vint(ep0.lane<1>()) * weight0;\n+ vint ep0_b = vint(ep0.lane<2>()) * weight0;\n+ vint ep0_a = vint(ep0.lane<3>()) * weight0;\n+\n+ // Shift so things round correctly\n+ vint colori_r = asr<6>(ep0_r + ep1_r + vint(32)) * srgb_scale;\n+ vint colori_g = asr<6>(ep0_g + ep1_g + vint(32)) * srgb_scale;\n+ vint colori_b = asr<6>(ep0_b + ep1_b + vint(32)) * srgb_scale;\n+ vint colori_a = asr<6>(ep0_a + ep1_a + vint(32)) * srgb_scale;\n+\n+ // Compute color diff\n+ vfloat color_r = int_to_float(colori_r);\n+ vfloat color_g = int_to_float(colori_g);\n+ vfloat color_b = int_to_float(colori_b);\n+ vfloat color_a = int_to_float(colori_a);\n+\n+ vfloat color_orig_r = loada(blk.data_r + i);\n+ vfloat color_orig_g = loada(blk.data_g + i);\n+ vfloat color_orig_b = loada(blk.data_b + i);\n+ vfloat color_orig_a = loada(blk.data_a + i);\n+\n+ vfloat color_error_r = min(abs(color_orig_r - color_r), vfloat(1e15f));\n+ vfloat color_error_g = min(abs(color_orig_g - color_g), vfloat(1e15f));\n+ vfloat color_error_b = min(abs(color_orig_b - color_b), vfloat(1e15f));\n+ vfloat color_error_a = min(abs(color_orig_a - color_a), vfloat(1e15f));\n+\n+ // Compute squared error metric\n+ color_error_r = color_error_r * color_error_r;\n+ color_error_g = color_error_g * color_error_g;\n+ color_error_b = color_error_b * color_error_b;\n+ color_error_a = color_error_a * color_error_a;\n+\n+ vfloat metric = color_error_r * blk.channel_weight.lane<0>()\n+ + color_error_g * blk.channel_weight.lane<1>()\n+ + color_error_b * blk.channel_weight.lane<2>()\n+ + color_error_a * blk.channel_weight.lane<3>();\n+\n+ // Mask off bad lanes\n+ vmask mask = lane_id < vint(texel_count);\n+ lane_id += vint(ASTCENC_SIMD_WIDTH);\n+ metric = select(vfloat::zero(), metric, mask);\n+\n+ haccumulate(summav, metric);\n+ }\n+\n+ return hadd_s(summav);\n}\n#endif\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_vecmathlib_avx2_8.h", "new_path": "Source/astcenc_vecmathlib_avx2_8.h", "diff": "@@ -963,6 +963,14 @@ ASTCENC_SIMD_INLINE vint8 float_to_int(vfloat8 a)\nreturn vint8(_mm256_cvttps_epi32(a.m));\n}\n+/**\n+ * @brief Return a float value for an integer vector.\n+ */\n+ASTCENC_SIMD_INLINE vfloat8 int_to_float(vint8 a)\n+{\n+ return vfloat8(_mm256_cvtepi32_ps(a.m));\n+}\n+\n/**\n* @brief Return a float value as an integer bit pattern (i.e. no conversion).\n*\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Vectorize compute_symbolic_block_difference_1plane_1partition
61,745
06.03.2022 21:04:08
0
5a105014d9f84d6cc65ed49027752dbdbc89a434
Realign_weights_generic now only used for decimated grids
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -194,7 +194,7 @@ static bool realign_weights_undecimated(\n* @param[out] dec_weights_quant_pvalue_plane1 The weights for plane 1.\n* @param[out] dec_weights_quant_pvalue_plane2 The weights for plane 2, or @c nullptr if 1 plane.\n*/\n-static bool realign_weights_generic(\n+static bool realign_weights_decimated(\nastcenc_profile decode_mode,\nconst block_size_descriptor& bsd,\nconst image_block& blk,\n@@ -214,7 +214,7 @@ static bool realign_weights_generic(\n// Get the decimation table\nconst decimation_info& di = bsd.get_decimation_info(bm.decimation_mode);\nunsigned int weight_count = di.weight_count;\n- bool is_decimated = weight_count != bsd.texel_count;\n+ assert(weight_count != bsd.texel_count);\nunsigned int max_plane = bm.is_dual_plane;\nint plane2_component = bm.is_dual_plane ? scb.plane2_component : -1;\n@@ -291,21 +291,15 @@ static bool realign_weights_generic(\n{\nunsigned int texel = di.weight_texel[te_idx][we_idx];\nfloat weight_base = uqwf;\n- float twf0 = 1.0f;\n- // Don't interpolate filtered weights for a 1:1 weight grid\n- if (is_decimated)\n- {\nconst uint8_t *texel_weights = di.texel_weights_texel[we_idx][te_idx];\nconst float *texel_weights_float = di.texel_weights_float_texel[we_idx][te_idx];\n- twf0 = texel_weights_float[0];\n+ float twf0 = texel_weights_float[0];\n- weight_base =\n- (uqwf * twf0\n+ weight_base = (uqwf * twf0\n+ uq_pl_weightsf[texel_weights[1]] * texel_weights_float[1])\n+ (uq_pl_weightsf[texel_weights[2]] * texel_weights_float[2]\n+ uq_pl_weightsf[texel_weights[3]] * texel_weights_float[3]);\n- }\nunsigned int partition = pi.partition_of_texel[texel];\n@@ -665,7 +659,7 @@ static float compress_symbolic_block_for_partition_1plane(\nbool adjustments;\nif (di.weight_count != bsd.texel_count)\n{\n- adjustments = realign_weights_generic(\n+ adjustments = realign_weights_decimated(\nconfig.profile, bsd, blk, workscb,\nworkscb.weights, nullptr);\n}\n@@ -1005,7 +999,7 @@ static float compress_symbolic_block_for_partition_2planes(\nbool adjustments;\nif (di.weight_count != bsd.texel_count)\n{\n- adjustments = realign_weights_generic(\n+ adjustments = realign_weights_decimated(\nconfig.profile, bsd, blk, workscb,\nworkscb.weights, workscb.weights + WEIGHTS_PLANE2_OFFSET);\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Realign_weights_generic now only used for decimated grids
61,745
06.03.2022 21:26:19
0
5b59767033e26ac486c62e2c9a94606b9db1691c
Inline declarations with first use
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_pick_best_endpoint_format.cpp", "new_path": "Source/astcenc_pick_best_endpoint_format.cpp", "diff": "@@ -299,17 +299,12 @@ static void compute_color_error_for_every_integer_count_and_quant_level(\n// It is possible to get endpoint colors significantly outside [0,upper-limit] even if the\n// input data are safely contained in [0,upper-limit]; we need to add an error term for this\n- vfloat4 ep0_range_error_high;\n- vfloat4 ep1_range_error_high;\n- vfloat4 ep0_range_error_low;\n- vfloat4 ep1_range_error_low;\n-\nvfloat4 offset(range_upper_limit_rgb, range_upper_limit_rgb, range_upper_limit_rgb, range_upper_limit_alpha);\n- ep0_range_error_high = max(ep0 - offset, 0.0f);\n- ep1_range_error_high = max(ep1 - offset, 0.0f);\n+ vfloat4 ep0_range_error_high = max(ep0 - offset, 0.0f);\n+ vfloat4 ep1_range_error_high = max(ep1 - offset, 0.0f);\n- ep0_range_error_low = min(ep0, 0.0f);\n- ep1_range_error_low = min(ep1, 0.0f);\n+ vfloat4 ep0_range_error_low = min(ep0, 0.0f);\n+ vfloat4 ep1_range_error_low = min(ep1, 0.0f);\nvfloat4 sum_range_error =\n(ep0_range_error_low * ep0_range_error_low) +\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Inline declarations with first use
61,745
07.03.2022 19:19:50
0
938db0faaaab230a8f45324435ad7c1cf77c2b2c
Remove ClangCL from name build instructions
[ { "change_type": "MODIFY", "old_path": "Docs/Building.md", "new_path": "Docs/Building.md", "diff": "@@ -25,7 +25,7 @@ cd build\n# Configure your build of choice, for example:\n# x86-64 using NMake\n-cmake -G \"NMake Makefiles\" -T ClangCL -DCMAKE_BUILD_TYPE=Release ^\n+cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release ^\n-DCMAKE_INSTALL_PREFIX=.\\ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n# x86-64 using Visual Studio solution\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove ClangCL from name build instructions
61,745
07.03.2022 19:51:13
0
57fe1360c739a6b4edd710bebc883d29a0a93d5d
Add static_casts in realign_weights
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -139,9 +139,9 @@ static bool realign_weights_undecimated(\n// Interpolate the colors to create the diffs\nunsigned int partition = pi.partition_of_texel[texel];\n- int plane_weight = uqw;\n- int plane_up_weight = next_wt_uq - uqw;\n- int plane_down_weight = prev_wt_uq - uqw;\n+ float plane_weight = static_cast<float>(uqw);\n+ float plane_up_weight = static_cast<float>(next_wt_uq - uqw);\n+ float plane_down_weight = static_cast<float>(prev_wt_uq - uqw);\nvfloat4 color_offset = offset[partition];\nvfloat4 color_base = endpnt0f[partition];\n@@ -271,7 +271,7 @@ static bool realign_weights_decimated(\nfor (unsigned int we_idx = 0; we_idx < weight_count; we_idx++)\n{\nunsigned int uqw = uq_pl_weights[we_idx];\n- unsigned int uqwf = uq_pl_weightsf[we_idx];\n+ float uqwf = uq_pl_weightsf[we_idx];\nuint32_t prev_and_next = qat->prev_next_values[uqw];\nunsigned int prev_wt_uq = prev_and_next & 0xFF;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add static_casts in realign_weights
61,745
07.03.2022 20:04:46
0
ce6ea8202e6957f18c87748149b0f8f3db3dd6d4
Avoid signed/unsigned mismatch
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -130,7 +130,7 @@ static bool realign_weights_undecimated(\npromise(bsd.texel_count > 0);\nfor (unsigned int texel = 0; texel < bsd.texel_count; texel++)\n{\n- unsigned int uqw = qat->unquantized_value[dec_weights_quant_pvalue[texel]];\n+ int uqw = qat->unquantized_value[dec_weights_quant_pvalue[texel]];\nuint32_t prev_and_next = qat->prev_next_values[uqw];\nint prev_wt_uq = prev_and_next & 0xFF;\n" }, { "change_type": "MODIFY", "old_path": "Source/cmake_core.cmake", "new_path": "Source/cmake_core.cmake", "diff": "@@ -133,6 +133,8 @@ macro(astcenc_set_properties NAME)\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-implicit-int-conversion>\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-shift-sign-overflow>\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-format-nonliteral>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-reserved-identifier>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-cast-function-type>\n$<$<CXX_COMPILER_ID:Clang>:-Wdocumentation>)\n@@ -256,6 +258,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES \"GNU|Clang\")\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-implicit-fallthrough>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-tautological-type-limit-compare>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-cast-qual>\"\n+ \" $<$<CXX_COMPILER_ID:Clang>: -Wno-reserved-identifier>\"\n\" $<$<CXX_COMPILER_ID:Clang>: -Wno-missing-prototypes>\")\nset_source_files_properties(astcenccli_image_external.cpp\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Avoid signed/unsigned mismatch
61,745
07.03.2022 21:03:30
0
065962868c87fdcfce39cb6adbc1ca52ec18f241
Ensure image_block.data_x is SIMD aligned
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -800,16 +800,16 @@ struct block_size_descriptor\nstruct image_block\n{\n/** @brief The input (compress) or output (decompress) data for the red color component. */\n- float data_r[BLOCK_MAX_TEXELS];\n+ alignas(ASTCENC_VECALIGN) float data_r[BLOCK_MAX_TEXELS];\n/** @brief The input (compress) or output (decompress) data for the green color component. */\n- float data_g[BLOCK_MAX_TEXELS];\n+ alignas(ASTCENC_VECALIGN) float data_g[BLOCK_MAX_TEXELS];\n/** @brief The input (compress) or output (decompress) data for the blue color component. */\n- float data_b[BLOCK_MAX_TEXELS];\n+ alignas(ASTCENC_VECALIGN) float data_b[BLOCK_MAX_TEXELS];\n/** @brief The input (compress) or output (decompress) data for the alpha color component. */\n- float data_a[BLOCK_MAX_TEXELS];\n+ alignas(ASTCENC_VECALIGN) float data_a[BLOCK_MAX_TEXELS];\n/** @brief The number of texels in the block. */\nuint8_t texel_count;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Ensure image_block.data_x is SIMD aligned
61,745
08.03.2022 09:36:39
0
973d08f58e9e596a4bd084270b5cdfd69e324258
Vectorize compute_error_squared_rgb_single_partition
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_pick_best_endpoint_format.cpp", "new_path": "Source/astcenc_pick_best_endpoint_format.cpp", "diff": "@@ -83,48 +83,132 @@ static void compute_error_squared_rgb_single_partition(\nfloat& l_err,\nfloat& a_drop_err\n) {\n- uncor_err = 0.0f;\n- samec_err = 0.0f;\n- rgbl_err = 0.0f;\n- l_err = 0.0f;\n- a_drop_err = 0.0f;\n+ vfloat4 ews = blk.channel_weight;\n+\n+ unsigned int texel_count = pi.partition_texel_count[partition_index];\n+ const uint8_t* texel_indexes = pi.texels_of_partition[partition_index];\n+ promise(texel_count > 0);\n+\n+ vfloat4 a_drop_errv = vfloat4::zero();\n+ vfloat default_a(blk.get_default_alpha());\n+\n+ vfloat4 uncor_errv = vfloat4::zero();\n+ vfloat uncor_bs0(uncor_pline.bs.lane<0>());\n+ vfloat uncor_bs1(uncor_pline.bs.lane<1>());\n+ vfloat uncor_bs2(uncor_pline.bs.lane<2>());\n+\n+ vfloat uncor_amod0(uncor_pline.amod.lane<0>());\n+ vfloat uncor_amod1(uncor_pline.amod.lane<1>());\n+ vfloat uncor_amod2(uncor_pline.amod.lane<2>());\n+\n+ vfloat4 samec_errv = vfloat4::zero();\n+ vfloat samec_bs0(samec_pline.bs.lane<0>());\n+ vfloat samec_bs1(samec_pline.bs.lane<1>());\n+ vfloat samec_bs2(samec_pline.bs.lane<2>());\n+\n+ vfloat4 rgbl_errv = vfloat4::zero();\n+ vfloat rgbl_bs0(rgbl_pline.bs.lane<0>());\n+ vfloat rgbl_bs1(rgbl_pline.bs.lane<1>());\n+ vfloat rgbl_bs2(rgbl_pline.bs.lane<2>());\n- int texels_in_partition = pi.partition_texel_count[partition_index];\n- promise(texels_in_partition > 0);\n+ vfloat rgbl_amod0(rgbl_pline.amod.lane<0>());\n+ vfloat rgbl_amod1(rgbl_pline.amod.lane<1>());\n+ vfloat rgbl_amod2(rgbl_pline.amod.lane<2>());\n- for (int i = 0; i < texels_in_partition; i++)\n+ vfloat4 l_errv = vfloat4::zero();\n+ vfloat l_bs0(l_pline.bs.lane<0>());\n+ vfloat l_bs1(l_pline.bs.lane<1>());\n+ vfloat l_bs2(l_pline.bs.lane<2>());\n+\n+ vint lane_ids = vint::lane_id();\n+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)\n{\n- int tix = pi.texels_of_partition[partition_index][i];\n- vfloat4 point = blk.texel(tix);\n- vfloat4 ews = blk.channel_weight;\n+ vint tix(texel_indexes + i);\n+\n+ vmask mask = lane_ids < vint(texel_count);\n+ lane_ids += vint(ASTCENC_SIMD_WIDTH);\n// Compute the error that arises from just ditching alpha\n- float default_alpha = blk.get_default_alpha();\n- float omalpha = point.lane<3>() - default_alpha;\n- a_drop_err += omalpha * omalpha * ews.lane<3>();\n-\n- float param1 = dot3_s(point, uncor_pline.bs);\n- vfloat4 rp1 = uncor_pline.amod + param1 * uncor_pline.bs;\n- vfloat4 dist1 = rp1 - point;\n- uncor_err += dot3_s(ews, dist1 * dist1);\n-\n- float param2 = dot3_s(point, samec_pline.bs);\n- // No samec amod - we know it's always zero\n- vfloat4 rp2 = param2 * samec_pline.bs;\n- vfloat4 dist2 = rp2 - point;\n- samec_err += dot3_s(ews, dist2 * dist2);\n-\n- float param3 = dot3_s(point, rgbl_pline.bs);\n- vfloat4 rp3 = rgbl_pline.amod + param3 * rgbl_pline.bs;\n- vfloat4 dist3 = rp3 - point;\n- rgbl_err += dot3_s(ews, dist3 * dist3);\n-\n- float param4 = dot3_s(point, l_pline.bs);\n- // No luma amod - we know it's always zero\n- vfloat4 rp4 = param4 * l_pline.bs;\n- vfloat4 dist4 = rp4 - point;\n- l_err += dot3_s(ews, dist4 * dist4);\n- }\n+ vfloat data_a = gatherf(blk.data_a, tix);\n+ vfloat alpha_diff = data_a - default_a;\n+ alpha_diff = alpha_diff * alpha_diff;\n+ alpha_diff = select(vfloat::zero(), alpha_diff, mask);\n+ haccumulate(a_drop_errv, alpha_diff);\n+\n+ vfloat data_r = gatherf(blk.data_r, tix);\n+ vfloat data_g = gatherf(blk.data_g, tix);\n+ vfloat data_b = gatherf(blk.data_b, tix);\n+\n+ // Compute uncorrelated error\n+ vfloat param = data_r * uncor_bs0\n+ + data_g * uncor_bs1\n+ + data_b * uncor_bs2;\n+\n+ vfloat dist0 = (uncor_amod0 + param * uncor_bs0) - data_r;\n+ vfloat dist1 = (uncor_amod1 + param * uncor_bs1) - data_g;\n+ vfloat dist2 = (uncor_amod2 + param * uncor_bs2) - data_b;\n+\n+ vfloat error = dist0 * dist0 * ews.lane<0>()\n+ + dist1 * dist1 * ews.lane<1>()\n+ + dist2 * dist2 * ews.lane<2>();\n+\n+ error = select(vfloat::zero(), error, mask);\n+ haccumulate(uncor_errv, error);\n+\n+ // Compute same chroma error - no \"amod\", its always zero\n+ param = data_r * samec_bs0\n+ + data_g * samec_bs1\n+ + data_b * samec_bs2;\n+\n+ dist0 = (param * samec_bs0) - data_r;\n+ dist1 = (param * samec_bs1) - data_g;\n+ dist2 = (param * samec_bs2) - data_b;\n+\n+ error = dist0 * dist0 * ews.lane<0>()\n+ + dist1 * dist1 * ews.lane<1>()\n+ + dist2 * dist2 * ews.lane<2>();\n+\n+ error = select(vfloat::zero(), error, mask);\n+ haccumulate(samec_errv, error);\n+\n+ // Compute rgbl error\n+ param = data_r * rgbl_bs0\n+ + data_g * rgbl_bs1\n+ + data_b * rgbl_bs2;\n+\n+ dist0 = (rgbl_amod0 + param * rgbl_bs0) - data_r;\n+ dist1 = (rgbl_amod1 + param * rgbl_bs1) - data_g;\n+ dist2 = (rgbl_amod2 + param * rgbl_bs2) - data_b;\n+\n+ error = dist0 * dist0 * ews.lane<0>()\n+ + dist1 * dist1 * ews.lane<1>()\n+ + dist2 * dist2 * ews.lane<2>();\n+\n+ error = select(vfloat::zero(), error, mask);\n+ haccumulate(rgbl_errv, error);\n+\n+ // Compute luma error - no \"amod\", its always zero\n+ param = data_r * l_bs0\n+ + data_g * l_bs1\n+ + data_b * l_bs2;\n+\n+ dist0 = (param * l_bs0) - data_r;\n+ dist1 = (param * l_bs1) - data_g;\n+ dist2 = (param * l_bs2) - data_b;\n+\n+ error = dist0 * dist0 * ews.lane<0>()\n+ + dist1 * dist1 * ews.lane<1>()\n+ + dist2 * dist2 * ews.lane<2>();\n+\n+ error = select(vfloat::zero(), error, mask);\n+ haccumulate(l_errv, error);\n+ }\n+\n+ a_drop_err = hadd_s(a_drop_errv * ews.lane<3>());\n+ uncor_err = hadd_s(uncor_errv);\n+ samec_err = hadd_s(samec_errv);\n+ rgbl_err = hadd_s(rgbl_errv);\n+ l_err = hadd_s(l_errv);\n}\n/**\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Vectorize compute_error_squared_rgb_single_partition
61,745
22.02.2022 14:50:47
0
16ca5c58eb22e3f928ab946cff5ab46e5015d289
Add ClangCL to CI pipeline
[ { "change_type": "MODIFY", "old_path": "Docs/Building.md", "new_path": "Docs/Building.md", "diff": "@@ -14,8 +14,8 @@ Builds for Windows are tested with CMake 3.17 and Visual Studio 2019.\n### Configuring the build\nTo use CMake you must first configure the build. Create a build directory\n-in the root of the astenc checkout, and then run `cmake` inside that directory\n-to generate the build system.\n+in the root of the `astenc` checkout, and then run `cmake` inside that\n+directory to generate the build system.\n```shell\n# Create a build directory\n@@ -29,16 +29,16 @@ cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release ^\n-DCMAKE_INSTALL_PREFIX=.\\ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n# x86-64 using Visual Studio solution\n-cmake -G \"Visual Studio 16 2019\" -T ClangCL -DCMAKE_INSTALL_PREFIX=.\\ ^\n- -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+cmake -G \"Visual Studio 16 2019\" -T ClangCL ^\n+ -DCMAKE_INSTALL_PREFIX=.\\ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n```\nThis example shows all SIMD variants being enabled. It is possible to build a\nsubset of the supported variants by enabling only the ones you require. At\nleast one variant must be enabled.\n-Using the Visual Studio Clang-cl LLVM toolchain (`-T ClangCL`) is optional but\n-produces signficantly faster binaries than the default toolchain. The C++ LLVM\n+Using the Visual Studio Clang-CL LLVM toolchain (`-T ClangCL`) is optional but\n+produces significantly faster binaries than the default toolchain. The C++ LLVM\ntoolchain component must be installed via the Visual Studio installer.\n### Building\n@@ -190,7 +190,7 @@ Windows packages will use the `.zip` format, other packages will use the\n## Integrating as a library into another project\n-The core codec of astcenc is built as a library, and so can be easily\n+The core codec of `astcenc` is built as a library, and so can be easily\nintegrated into other projects using CMake. An example of the CMake integration\nand the codec API usage can be found in the `./Utils/Example` directory in the\nrepository. See the [Example Readme](../Utils/Example/README.md) for more\n" }, { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-3x.md", "new_path": "Docs/ChangeLog-3x.md", "diff": "@@ -44,6 +44,9 @@ updated `astcenc.h` header.\nreturning the expected error color (magenta for LDR, NaN for HDR). Note\nthat astcenc determines the error color to use based on the output image\ndata type not the decoder profile.\n+* **Binary releases:**\n+ * **Improvement:** Windows binaries changed to use ClangCL 12.0, which gives\n+ up to 10% performance improvement.\n### Performance:\n" }, { "change_type": "MODIFY", "old_path": "jenkins/nightly.Jenkinsfile", "new_path": "jenkins/nightly.Jenkinsfile", "diff": "@@ -111,7 +111,7 @@ pipeline {\n}\n}\n/* Build for Windows on x86-64 using MSVC */\n- stage('Windows') {\n+ stage('Windows MSVC') {\nagent {\nlabel 'Windows'\n}\n@@ -127,7 +127,7 @@ pipeline {\ncall c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\nmkdir build_rel\ncd build_rel\n- cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DPACKAGE=x64 ..\n+ cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DPACKAGE=x64-cl ..\nnmake install package\n'''\n}\n@@ -146,7 +146,59 @@ pipeline {\nstage('Stash') {\nsteps {\ndir('build_rel') {\n- stash name: 'astcenc-windows-x64', includes: '*.zip'\n+ stash name: 'astcenc-windows-x64-cl', includes: '*.zip'\n+ }\n+ }\n+ }\n+ stage('Test') {\n+ steps {\n+ bat '''\n+ set Path=c:\\\\Python38;c:\\\\Python38\\\\Scripts;%Path%\n+ call python ./Test/astc_test_image.py --test-set Small --test-quality medium\n+ '''\n+ }\n+ }\n+ }\n+ }\n+ /* Build for Windows on x86-64 using MSVC + ClangCL */\n+ stage('Windows ClangCL') {\n+ agent {\n+ label 'Windows'\n+ }\n+ stages {\n+ stage('Clean') {\n+ steps {\n+ bat 'git clean -ffdx'\n+ }\n+ }\n+ stage('Build R') {\n+ steps {\n+ bat '''\n+ call c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n+ mkdir build_rel\n+ cd build_rel\n+ cmake -G \"Visual Studio 16 2019\" -T ClangCL -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DPACKAGE=x64-clangcl ..\n+ msbuild astcencoder.sln -property:Configuration=Release\n+ msbuild PACKAGE.vcxproj -property:Configuration=Release\n+ msbuild INSTALL.vcxproj -property:Configuration=Release\n+ '''\n+ }\n+ }\n+ stage('Build D') {\n+ steps {\n+ bat '''\n+ call c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n+ mkdir build_dbg\n+ cd build_dbg\n+ cmake -G \"Visual Studio 16 2019\" -T ClangCL -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+ msbuild astcencoder.sln -property:Configuration=Debug\n+ '''\n+ }\n+ }\n+ stage('Stash') {\n+ steps {\n+ dir('build_rel') {\n+ stash name: 'astcenc-windows-x64-clangcl', includes: '*.zip'\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "jenkins/release.Jenkinsfile", "new_path": "jenkins/release.Jenkinsfile", "diff": "@@ -167,7 +167,7 @@ spec:\n}\n}\n}\n- /* Build for Windows on x86-64 using MSVC */\n+ /* Build for Windows on x86-64 using MSVC ClangCL */\nstage('Windows') {\nagent {\nlabel 'Windows'\n@@ -184,8 +184,10 @@ spec:\ncall c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\nmkdir build_rel\ncd build_rel\n- cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DPACKAGE=x64 ..\n- nmake install package\n+ cmake -G \"Visual Studio 16 2019\" -T ClangCL -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DPACKAGE=x64 ..\n+ msbuild astcencoder.sln -property:Configuration=Release\n+ msbuild PACKAGE.vcxproj -property:Configuration=Release\n+ msbuild INSTALL.vcxproj -property:Configuration=Release\n'''\n}\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add ClangCL to CI pipeline
61,745
09.03.2022 14:14:29
0
d87993324b565f8109e2aa07437bac79d82f0e63
Update test reference for CI
[ { "change_type": "ADD", "old_path": null, "new_path": "Test/Images/Small/astc_reference-main-avx2_fast_results.csv", "diff": "+Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n+Small,4x4,hdr-rgb-00.hdr,33.6884,0.3442,0.0736,0.8906\n+Small,4x4,ldr-rgb-00.png,38.1103,0.0573,0.0375,1.7467\n+Small,4x4,ldr-rgb-01.png,39.8105,0.0524,0.0362,1.8112\n+Small,4x4,ldr-rgb-02.png,35.0374,0.0784,0.0589,1.1133\n+Small,4x4,ldr-rgb-03.png,45.9704,0.0323,0.0142,4.6113\n+Small,4x4,ldr-rgb-04.png,41.9106,0.0477,0.0293,2.2383\n+Small,4x4,ldr-rgb-05.png,37.2317,0.0727,0.0547,1.1973\n+Small,4x4,ldr-rgb-06.png,35.2059,0.0786,0.0580,1.1295\n+Small,4x4,ldr-rgb-07.png,38.0309,0.0848,0.0624,1.0499\n+Small,4x4,ldr-rgb-08.png,43.6358,0.0481,0.0226,2.9006\n+Small,4x4,ldr-rgb-09.png,41.8532,0.0619,0.0325,2.0180\n+Small,4x4,ldr-rgb-10.png,44.3464,0.0244,0.0090,1.8048\n+Small,4x4,ldr-rgba-00.png,35.5182,0.0968,0.0695,0.9434\n+Small,4x4,ldr-rgba-01.png,38.7956,0.0669,0.0410,1.5978\n+Small,4x4,ldr-rgba-02.png,34.8333,0.0891,0.0634,1.0332\n+Small,4x4,ldr-xy-00.png,37.5698,0.0603,0.0313,2.0911\n+Small,4x4,ldr-xy-01.png,44.1376,0.0641,0.0354,1.8496\n+Small,4x4,ldr-xy-02.png,48.1784,0.0550,0.0215,3.0499\n+Small,4x4,ldrs-rgba-00.png,35.5254,0.0879,0.0646,1.0148\n+Small,4x4,ldrs-rgba-01.png,38.8141,0.0623,0.0362,1.8127\n+Small,4x4,ldrs-rgba-02.png,34.8386,0.0890,0.0598,1.0966\n+Small,5x5,hdr-rgb-00.hdr,29.4686,0.5181,0.0994,0.6596\n+Small,5x5,ldr-rgb-00.png,34.3042,0.0895,0.0580,1.1306\n+Small,5x5,ldr-rgb-01.png,36.1808,0.0678,0.0375,1.7479\n+Small,5x5,ldr-rgb-02.png,31.0160,0.0875,0.0646,1.0138\n+Small,5x5,ldr-rgb-03.png,42.6231,0.0366,0.0150,4.3575\n+Small,5x5,ldr-rgb-04.png,37.2434,0.0513,0.0295,2.2229\n+Small,5x5,ldr-rgb-05.png,33.1823,0.0904,0.0674,0.9717\n+Small,5x5,ldr-rgb-06.png,31.0247,0.0788,0.0546,1.2009\n+Small,5x5,ldr-rgb-07.png,35.1883,0.0741,0.0514,1.2741\n+Small,5x5,ldr-rgb-08.png,40.0310,0.0487,0.0215,3.0478\n+Small,5x5,ldr-rgb-09.png,37.2810,0.0538,0.0323,2.0302\n+Small,5x5,ldr-rgb-10.png,40.1234,0.0242,0.0088,1.8513\n+Small,5x5,ldr-rgba-00.png,32.0072,0.0910,0.0669,0.9790\n+Small,5x5,ldr-rgba-01.png,35.1428,0.0635,0.0408,1.6075\n+Small,5x5,ldr-rgba-02.png,31.1062,0.0917,0.0686,0.9556\n+Small,5x5,ldr-xy-00.png,36.7256,0.0610,0.0256,2.5556\n+Small,5x5,ldr-xy-01.png,39.8637,0.0557,0.0289,2.2643\n+Small,5x5,ldr-xy-02.png,43.9148,0.0457,0.0178,3.6872\n+Small,5x5,ldrs-rgba-00.png,32.0096,0.0908,0.0678,0.9668\n+Small,5x5,ldrs-rgba-01.png,35.1497,0.0614,0.0385,1.7037\n+Small,5x5,ldrs-rgba-02.png,31.1070,0.0878,0.0619,1.0591\n+Small,6x6,hdr-rgb-00.hdr,26.9904,0.3733,0.1107,0.5920\n+Small,6x6,ldr-rgb-00.png,31.5938,0.0810,0.0577,1.1364\n+Small,6x6,ldr-rgb-01.png,32.8896,0.0627,0.0402,1.6321\n+Small,6x6,ldr-rgb-02.png,27.4079,0.0829,0.0622,1.0531\n+Small,6x6,ldr-rgb-03.png,40.4899,0.0333,0.0133,4.9124\n+Small,6x6,ldr-rgb-04.png,33.9065,0.0573,0.0352,1.8629\n+Small,6x6,ldr-rgb-05.png,29.9329,0.0932,0.0715,0.9166\n+Small,6x6,ldr-rgb-06.png,27.4651,0.0866,0.0638,1.0272\n+Small,6x6,ldr-rgb-07.png,32.8824,0.0771,0.0550,1.1916\n+Small,6x6,ldr-rgb-08.png,37.6380,0.0442,0.0227,2.8934\n+Small,6x6,ldr-rgb-09.png,33.4716,0.0557,0.0336,1.9534\n+Small,6x6,ldr-rgb-10.png,36.6590,0.0253,0.0098,1.6668\n+Small,6x6,ldr-rgba-00.png,29.4788,0.1124,0.0872,0.7516\n+Small,6x6,ldr-rgba-01.png,32.0575,0.0700,0.0468,1.3989\n+Small,6x6,ldr-rgba-02.png,27.8275,0.1009,0.0771,0.8499\n+Small,6x6,ldr-xy-00.png,35.6827,0.0576,0.0265,2.4728\n+Small,6x6,ldr-xy-01.png,37.1053,0.0634,0.0339,1.9341\n+Small,6x6,ldr-xy-02.png,41.9443,0.0443,0.0163,4.0157\n+Small,6x6,ldrs-rgba-00.png,29.4790,0.1146,0.0879,0.7459\n+Small,6x6,ldrs-rgba-01.png,32.0640,0.0627,0.0403,1.6252\n+Small,6x6,ldrs-rgba-02.png,27.8273,0.0918,0.0651,1.0068\n+Small,8x8,hdr-rgb-00.hdr,23.7216,0.4051,0.1266,0.5177\n+Small,8x8,ldr-rgb-00.png,27.9814,0.1065,0.0764,0.8577\n+Small,8x8,ldr-rgb-01.png,28.7458,0.0789,0.0505,1.2967\n+Small,8x8,ldr-rgb-02.png,23.0937,0.1224,0.0916,0.7152\n+Small,8x8,ldr-rgb-03.png,37.2544,0.0432,0.0134,4.8729\n+Small,8x8,ldr-rgb-04.png,29.3419,0.0763,0.0457,1.4346\n+Small,8x8,ldr-rgb-05.png,25.7747,0.1327,0.1005,0.6521\n+Small,8x8,ldr-rgb-06.png,23.1468,0.1159,0.0839,0.7811\n+Small,8x8,ldr-rgb-07.png,29.6508,0.0814,0.0460,1.4260\n+Small,8x8,ldr-rgb-08.png,34.2150,0.0540,0.0228,2.8785\n+Small,8x8,ldr-rgb-09.png,28.6635,0.0783,0.0502,1.3053\n+Small,8x8,ldr-rgb-10.png,31.9974,0.0355,0.0123,1.3205\n+Small,8x8,ldr-rgba-00.png,25.3599,0.1224,0.0900,0.7280\n+Small,8x8,ldr-rgba-01.png,28.2399,0.0829,0.0532,1.2316\n+Small,8x8,ldr-rgba-02.png,23.9241,0.1212,0.0918,0.7142\n+Small,8x8,ldr-xy-00.png,33.3965,0.0667,0.0291,2.2547\n+Small,8x8,ldr-xy-01.png,34.2472,0.0719,0.0376,1.7424\n+Small,8x8,ldr-xy-02.png,39.9005,0.0511,0.0112,5.8587\n+Small,8x8,ldrs-rgba-00.png,25.3610,0.1357,0.1037,0.6319\n+Small,8x8,ldrs-rgba-01.png,28.2419,0.1292,0.0981,0.6684\n+Small,8x8,ldrs-rgba-02.png,23.9237,0.1286,0.0975,0.6721\n+Small,12x12,hdr-rgb-00.hdr,20.5637,0.4305,0.1557,0.4209\n+Small,12x12,ldr-rgb-00.png,23.7825,0.0919,0.0473,1.3861\n+Small,12x12,ldr-rgb-01.png,24.7588,0.0700,0.0287,2.2820\n+Small,12x12,ldr-rgb-02.png,19.2226,0.1282,0.0871,0.7523\n+Small,12x12,ldr-rgb-03.png,33.2364,0.0529,0.0101,6.5165\n+Small,12x12,ldr-rgb-04.png,24.5606,0.0759,0.0300,2.1825\n+Small,12x12,ldr-rgb-05.png,21.4885,0.1229,0.0811,0.8080\n+Small,12x12,ldr-rgb-06.png,19.2097,0.1401,0.0958,0.6840\n+Small,12x12,ldr-rgb-07.png,25.3456,0.0746,0.0323,2.0312\n+Small,12x12,ldr-rgb-08.png,30.1535,0.0575,0.0138,4.7356\n+Small,12x12,ldr-rgb-09.png,23.7136,0.0850,0.0432,1.5177\n+Small,12x12,ldr-rgb-10.png,27.3052,0.0452,0.0090,1.8151\n+Small,12x12,ldr-rgba-00.png,21.3632,0.1227,0.0800,0.8190\n+Small,12x12,ldr-rgba-01.png,24.4867,0.0784,0.0347,1.8909\n+Small,12x12,ldr-rgba-02.png,20.1666,0.1627,0.1158,0.5659\n+Small,12x12,ldr-xy-00.png,29.0651,0.0752,0.0252,2.5969\n+Small,12x12,ldr-xy-01.png,30.4241,0.0667,0.0200,3.2757\n+Small,12x12,ldr-xy-02.png,37.9951,0.0556,0.0068,9.6236\n+Small,12x12,ldrs-rgba-00.png,21.3658,0.1345,0.0868,0.7551\n+Small,12x12,ldrs-rgba-01.png,24.4885,0.0850,0.0397,1.6501\n+Small,12x12,ldrs-rgba-02.png,20.1665,0.1755,0.1270,0.5160\n+Small,3x3x3,ldr-l-00-3.dds,50.7726,0.0705,0.0485,5.3996\n+Small,3x3x3,ldr-l-01-3.dds,53.8643,0.0376,0.0232,2.9664\n+Small,6x6x6,ldr-l-00-3.dds,32.5264,0.2148,0.1534,1.7092\n+Small,6x6x6,ldr-l-01-3.dds,40.7893,0.1064,0.0556,1.2397\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Images/Small/astc_reference-main-avx2_fastest_results.csv", "diff": "+Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n+Small,4x4,hdr-rgb-00.hdr,32.7345,0.2487,0.0345,1.8968\n+Small,4x4,ldr-rgb-00.png,36.8767,0.0399,0.0217,3.0187\n+Small,4x4,ldr-rgb-01.png,39.3937,0.0408,0.0239,2.7396\n+Small,4x4,ldr-rgb-02.png,34.6441,0.0451,0.0299,2.1939\n+Small,4x4,ldr-rgb-03.png,45.1793,0.0240,0.0095,6.8776\n+Small,4x4,ldr-rgb-04.png,41.6239,0.0345,0.0187,3.5065\n+Small,4x4,ldr-rgb-05.png,36.6738,0.0457,0.0298,2.1964\n+Small,4x4,ldr-rgb-06.png,34.6950,0.0486,0.0319,2.0554\n+Small,4x4,ldr-rgb-07.png,36.8879,0.0470,0.0282,2.3251\n+Small,4x4,ldr-rgb-08.png,42.5048,0.0314,0.0142,4.6117\n+Small,4x4,ldr-rgb-09.png,41.6361,0.0398,0.0204,3.2173\n+Small,4x4,ldr-rgb-10.png,43.8031,0.0225,0.0069,2.3418\n+Small,4x4,ldr-rgba-00.png,34.2697,0.0518,0.0295,2.2186\n+Small,4x4,ldr-rgba-01.png,38.4759,0.0446,0.0246,2.6682\n+Small,4x4,ldr-rgba-02.png,34.5094,0.0533,0.0338,1.9374\n+Small,4x4,ldr-xy-00.png,37.3660,0.0467,0.0197,3.3333\n+Small,4x4,ldr-xy-01.png,43.1201,0.0421,0.0200,3.2755\n+Small,4x4,ldr-xy-02.png,48.1748,0.0372,0.0123,5.3442\n+Small,4x4,ldrs-rgba-00.png,34.2744,0.0533,0.0319,2.0554\n+Small,4x4,ldrs-rgba-01.png,38.4927,0.0455,0.0260,2.5201\n+Small,4x4,ldrs-rgba-02.png,34.5128,0.0555,0.0341,1.9233\n+Small,5x5,hdr-rgb-00.hdr,28.8076,0.2989,0.0457,1.4325\n+Small,5x5,ldr-rgb-00.png,33.4478,0.0415,0.0230,2.8519\n+Small,5x5,ldr-rgb-01.png,35.9999,0.0415,0.0206,3.1791\n+Small,5x5,ldr-rgb-02.png,30.8748,0.0556,0.0355,1.8445\n+Small,5x5,ldr-rgb-03.png,42.2547,0.0271,0.0086,7.6444\n+Small,5x5,ldr-rgb-04.png,36.9224,0.0413,0.0230,2.8453\n+Small,5x5,ldr-rgb-05.png,32.6193,0.0560,0.0382,1.7149\n+Small,5x5,ldr-rgb-06.png,30.8711,0.0570,0.0368,1.7789\n+Small,5x5,ldr-rgb-07.png,34.2652,0.0516,0.0308,2.1257\n+Small,5x5,ldr-rgb-08.png,39.3139,0.0360,0.0160,4.0939\n+Small,5x5,ldr-rgb-09.png,36.9835,0.0410,0.0206,3.1826\n+Small,5x5,ldr-rgb-10.png,39.7373,0.0200,0.0062,2.6022\n+Small,5x5,ldr-rgba-00.png,30.7473,0.0539,0.0334,1.9643\n+Small,5x5,ldr-rgba-01.png,34.9846,0.0500,0.0249,2.6325\n+Small,5x5,ldr-rgba-02.png,31.0020,0.0671,0.0441,1.4868\n+Small,5x5,ldr-xy-00.png,36.5563,0.0490,0.0194,3.3745\n+Small,5x5,ldr-xy-01.png,38.8331,0.0436,0.0185,3.5383\n+Small,5x5,ldr-xy-02.png,43.7233,0.0416,0.0140,4.6825\n+Small,5x5,ldrs-rgba-00.png,30.7497,0.0519,0.0320,2.0482\n+Small,5x5,ldrs-rgba-01.png,34.9913,0.0461,0.0274,2.3908\n+Small,5x5,ldrs-rgba-02.png,31.0030,0.0585,0.0391,1.6752\n+Small,6x6,hdr-rgb-00.hdr,26.7122,0.3089,0.0532,1.2318\n+Small,6x6,ldr-rgb-00.png,31.1052,0.0484,0.0297,2.2082\n+Small,6x6,ldr-rgb-01.png,32.7949,0.0433,0.0241,2.7239\n+Small,6x6,ldr-rgb-02.png,27.3228,0.0643,0.0449,1.4612\n+Small,6x6,ldr-rgb-03.png,40.2037,0.0362,0.0123,5.3408\n+Small,6x6,ldr-rgb-04.png,33.7349,0.0957,0.0278,2.3555\n+Small,6x6,ldr-rgb-05.png,29.5304,0.0654,0.0426,1.5392\n+Small,6x6,ldr-rgb-06.png,27.3791,0.0704,0.0434,1.5089\n+Small,6x6,ldr-rgb-07.png,32.0586,0.0560,0.0320,2.0450\n+Small,6x6,ldr-rgb-08.png,37.0422,0.0356,0.0132,4.9536\n+Small,6x6,ldr-rgb-09.png,33.2804,0.0424,0.0202,3.2460\n+Small,6x6,ldr-rgb-10.png,36.4903,0.0219,0.0066,2.4642\n+Small,6x6,ldr-rgba-00.png,28.4787,0.0588,0.0365,1.7950\n+Small,6x6,ldr-rgba-01.png,31.9580,0.0521,0.0289,2.2692\n+Small,6x6,ldr-rgba-02.png,27.7571,0.0748,0.0496,1.3203\n+Small,6x6,ldr-xy-00.png,35.5281,0.0509,0.0185,3.5368\n+Small,6x6,ldr-xy-01.png,36.2504,0.0493,0.0225,2.9191\n+Small,6x6,ldr-xy-02.png,41.7325,0.0487,0.0162,4.0340\n+Small,6x6,ldrs-rgba-00.png,28.4800,0.0680,0.0442,1.4835\n+Small,6x6,ldrs-rgba-01.png,31.9643,0.0515,0.0296,2.2159\n+Small,6x6,ldrs-rgba-02.png,27.7547,0.0690,0.0441,1.4859\n+Small,8x8,hdr-rgb-00.hdr,23.5547,0.3404,0.0808,0.8110\n+Small,8x8,ldr-rgb-00.png,27.6188,0.0671,0.0398,1.6453\n+Small,8x8,ldr-rgb-01.png,28.6671,0.0600,0.0346,1.8937\n+Small,8x8,ldr-rgb-02.png,23.0179,0.0851,0.0589,1.1122\n+Small,8x8,ldr-rgb-03.png,37.0089,0.0449,0.0125,5.2626\n+Small,8x8,ldr-rgb-04.png,29.0953,0.0612,0.0314,2.0853\n+Small,8x8,ldr-rgb-05.png,25.5324,0.0966,0.0634,1.0342\n+Small,8x8,ldr-rgb-06.png,23.0523,0.0970,0.0619,1.0587\n+Small,8x8,ldr-rgb-07.png,29.3368,0.0664,0.0343,1.9096\n+Small,8x8,ldr-rgb-08.png,33.7665,0.0456,0.0169,3.8665\n+Small,8x8,ldr-rgb-09.png,28.4590,0.0619,0.0338,1.9403\n+Small,8x8,ldr-rgb-10.png,31.8847,0.0338,0.0104,1.5697\n+Small,8x8,ldr-rgba-00.png,24.9726,0.0799,0.0516,1.2706\n+Small,8x8,ldr-rgba-01.png,28.1236,0.0662,0.0372,1.7623\n+Small,8x8,ldr-rgba-02.png,23.8676,0.1023,0.0735,0.8918\n+Small,8x8,ldr-xy-00.png,33.2085,0.0571,0.0220,2.9826\n+Small,8x8,ldr-xy-01.png,33.9810,0.0674,0.0319,2.0513\n+Small,8x8,ldr-xy-02.png,39.7786,0.0485,0.0094,6.9646\n+Small,8x8,ldrs-rgba-00.png,24.9730,0.0851,0.0553,1.1841\n+Small,8x8,ldrs-rgba-01.png,28.1260,0.0695,0.0387,1.6921\n+Small,8x8,ldrs-rgba-02.png,23.8671,0.0978,0.0670,0.9780\n+Small,12x12,hdr-rgb-00.hdr,20.4789,0.3655,0.0923,0.7104\n+Small,12x12,ldr-rgb-00.png,23.6716,0.0687,0.0298,2.1960\n+Small,12x12,ldr-rgb-01.png,24.7037,0.0635,0.0240,2.7327\n+Small,12x12,ldr-rgb-02.png,19.1880,0.0952,0.0590,1.1104\n+Small,12x12,ldr-rgb-03.png,33.1400,0.0472,0.0088,7.4372\n+Small,12x12,ldr-rgb-04.png,24.3898,0.0614,0.0232,2.8193\n+Small,12x12,ldr-rgb-05.png,21.3701,0.0904,0.0502,1.3052\n+Small,12x12,ldr-rgb-06.png,19.1564,0.1143,0.0726,0.9022\n+Small,12x12,ldr-rgb-07.png,25.2598,0.0638,0.0232,2.8220\n+Small,12x12,ldr-rgb-08.png,29.9653,0.0545,0.0118,5.5567\n+Small,12x12,ldr-rgb-09.png,23.5968,0.0795,0.0313,2.0957\n+Small,12x12,ldr-rgb-10.png,27.2554,0.0436,0.0078,2.0751\n+Small,12x12,ldr-rgba-00.png,21.1828,0.0996,0.0566,1.1588\n+Small,12x12,ldr-rgba-01.png,24.4330,0.0725,0.0330,1.9864\n+Small,12x12,ldr-rgba-02.png,20.1371,0.1308,0.0873,0.7504\n+Small,12x12,ldr-xy-00.png,28.9405,0.0711,0.0205,3.1963\n+Small,12x12,ldr-xy-01.png,29.5972,0.0606,0.0166,3.9477\n+Small,12x12,ldr-xy-02.png,37.9716,0.0493,0.0048,13.6701\n+Small,12x12,ldrs-rgba-00.png,21.1836,0.0991,0.0544,1.2039\n+Small,12x12,ldrs-rgba-01.png,24.4339,0.0678,0.0269,2.4400\n+Small,12x12,ldrs-rgba-02.png,20.1367,0.1199,0.0785,0.8352\n+Small,3x3x3,ldr-l-00-3.dds,50.6527,0.0842,0.0470,5.5828\n+Small,3x3x3,ldr-l-01-3.dds,53.7952,0.0492,0.0219,3.1453\n+Small,6x6x6,ldr-l-00-3.dds,32.5074,0.2201,0.1543,1.6986\n+Small,6x6x6,ldr-l-01-3.dds,40.7826,0.1085,0.0547,1.2611\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Images/Small/astc_reference-main-avx2_medium_results.csv", "diff": "+Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n+Small,4x4,hdr-rgb-00.hdr,34.1340,0.3531,0.1162,0.5642\n+Small,4x4,ldr-rgb-00.png,38.7318,0.1392,0.1221,0.5366\n+Small,4x4,ldr-rgb-01.png,40.1460,0.1417,0.1251,0.5239\n+Small,4x4,ldr-rgb-02.png,35.2180,0.1412,0.1222,0.5363\n+Small,4x4,ldr-rgb-03.png,47.1925,0.0895,0.0719,0.9117\n+Small,4x4,ldr-rgb-04.png,42.1729,0.1273,0.1075,0.6099\n+Small,4x4,ldr-rgb-05.png,37.7672,0.1815,0.1580,0.4148\n+Small,4x4,ldr-rgb-06.png,35.3468,0.1482,0.1232,0.5321\n+Small,4x4,ldr-rgb-07.png,39.2465,0.2120,0.1875,0.3495\n+Small,4x4,ldr-rgb-08.png,45.1731,0.1085,0.0870,0.7533\n+Small,4x4,ldr-rgb-09.png,42.0914,0.1413,0.1178,0.5565\n+Small,4x4,ldr-rgb-10.png,44.8767,0.0342,0.0213,0.7649\n+Small,4x4,ldr-rgba-00.png,36.2349,0.1931,0.1658,0.3952\n+Small,4x4,ldr-rgba-01.png,38.8941,0.1213,0.0954,0.6869\n+Small,4x4,ldr-rgba-02.png,34.9204,0.1314,0.1018,0.6436\n+Small,4x4,ldr-xy-00.png,37.7447,0.1205,0.0852,0.7693\n+Small,4x4,ldr-xy-01.png,45.1472,0.1841,0.1504,0.4356\n+Small,4x4,ldr-xy-02.png,50.9223,0.1938,0.1643,0.3990\n+Small,4x4,ldrs-rgba-00.png,36.2418,0.2023,0.1756,0.3731\n+Small,4x4,ldrs-rgba-01.png,38.9101,0.1288,0.1051,0.6234\n+Small,4x4,ldrs-rgba-02.png,34.9259,0.1805,0.1535,0.4270\n+Small,5x5,hdr-rgb-00.hdr,29.8514,0.5994,0.2155,0.3042\n+Small,5x5,ldr-rgb-00.png,35.0732,0.2470,0.2198,0.2981\n+Small,5x5,ldr-rgb-01.png,36.3975,0.1790,0.1546,0.4240\n+Small,5x5,ldr-rgb-02.png,31.0670,0.1985,0.1702,0.3851\n+Small,5x5,ldr-rgb-03.png,43.9478,0.0802,0.0530,1.2365\n+Small,5x5,ldr-rgb-04.png,37.6668,0.1669,0.1391,0.4713\n+Small,5x5,ldr-rgb-05.png,33.5193,0.2619,0.2322,0.2822\n+Small,5x5,ldr-rgb-06.png,31.0773,0.1693,0.1427,0.4592\n+Small,5x5,ldr-rgb-07.png,36.2042,0.3035,0.2657,0.2466\n+Small,5x5,ldr-rgb-08.png,41.5462,0.1399,0.1079,0.6075\n+Small,5x5,ldr-rgb-09.png,37.5873,0.1785,0.1493,0.4389\n+Small,5x5,ldr-rgb-10.png,40.4902,0.0438,0.0238,0.6820\n+Small,5x5,ldr-rgba-00.png,32.7858,0.2834,0.2499,0.2622\n+Small,5x5,ldr-rgba-01.png,35.2722,0.1551,0.1207,0.5431\n+Small,5x5,ldr-rgba-02.png,31.1225,0.2116,0.1824,0.3594\n+Small,5x5,ldr-xy-00.png,37.0728,0.1256,0.0872,0.7513\n+Small,5x5,ldr-xy-01.png,40.7193,0.1683,0.1389,0.4719\n+Small,5x5,ldr-xy-02.png,49.0675,0.1355,0.0968,0.6768\n+Small,5x5,ldrs-rgba-00.png,32.7887,0.2847,0.2514,0.2607\n+Small,5x5,ldrs-rgba-01.png,35.2789,0.1546,0.1214,0.5399\n+Small,5x5,ldrs-rgba-02.png,31.1234,0.1925,0.1642,0.3991\n+Small,6x6,hdr-rgb-00.hdr,27.4769,0.5266,0.2284,0.2870\n+Small,6x6,ldr-rgb-00.png,32.3560,0.1933,0.1633,0.4014\n+Small,6x6,ldr-rgb-01.png,33.0687,0.1666,0.1361,0.4814\n+Small,6x6,ldr-rgb-02.png,27.4381,0.1779,0.1536,0.4265\n+Small,6x6,ldr-rgb-03.png,41.6538,0.0601,0.0345,1.8992\n+Small,6x6,ldr-rgb-04.png,34.2059,0.1383,0.1092,0.6000\n+Small,6x6,ldr-rgb-05.png,30.1377,0.2520,0.2255,0.2907\n+Small,6x6,ldr-rgb-06.png,27.5024,0.2283,0.1944,0.3371\n+Small,6x6,ldr-rgb-07.png,33.8577,0.2236,0.1937,0.3383\n+Small,6x6,ldr-rgb-08.png,39.0752,0.0767,0.0532,1.2329\n+Small,6x6,ldr-rgb-09.png,33.6699,0.1436,0.1155,0.5673\n+Small,6x6,ldr-rgb-10.png,36.9333,0.0481,0.0275,0.5917\n+Small,6x6,ldr-rgba-00.png,30.2558,0.2527,0.2172,0.3017\n+Small,6x6,ldr-rgba-01.png,32.1716,0.1362,0.1081,0.6063\n+Small,6x6,ldr-rgba-02.png,27.8426,0.1679,0.1342,0.4884\n+Small,6x6,ldr-xy-00.png,36.2518,0.1049,0.0669,0.9792\n+Small,6x6,ldr-xy-01.png,37.7329,0.1129,0.0817,0.8024\n+Small,6x6,ldr-xy-02.png,46.0639,0.0846,0.0542,1.2084\n+Small,6x6,ldrs-rgba-00.png,30.2570,0.2228,0.1957,0.3348\n+Small,6x6,ldrs-rgba-01.png,32.1777,0.1441,0.1146,0.5719\n+Small,6x6,ldrs-rgba-02.png,27.8427,0.1719,0.1413,0.4636\n+Small,8x8,hdr-rgb-00.hdr,24.1157,0.5471,0.2487,0.2635\n+Small,8x8,ldr-rgb-00.png,28.7123,0.2652,0.2272,0.2884\n+Small,8x8,ldr-rgb-01.png,28.9240,0.2028,0.1664,0.3938\n+Small,8x8,ldr-rgb-02.png,23.1517,0.2370,0.1998,0.3280\n+Small,8x8,ldr-rgb-03.png,38.4615,0.0784,0.0405,1.6170\n+Small,8x8,ldr-rgb-04.png,29.6546,0.2065,0.1629,0.4024\n+Small,8x8,ldr-rgb-05.png,25.9295,0.2645,0.2242,0.2923\n+Small,8x8,ldr-rgb-06.png,23.1918,0.2914,0.2531,0.2589\n+Small,8x8,ldr-rgb-07.png,30.5823,0.2629,0.2097,0.3125\n+Small,8x8,ldr-rgb-08.png,35.7745,0.1151,0.0652,1.0058\n+Small,8x8,ldr-rgb-09.png,29.0115,0.1880,0.1461,0.4485\n+Small,8x8,ldr-rgb-10.png,32.1619,0.0713,0.0378,0.4306\n+Small,8x8,ldr-rgba-00.png,26.3940,0.3195,0.2693,0.2433\n+Small,8x8,ldr-rgba-01.png,28.3383,0.1595,0.1214,0.5400\n+Small,8x8,ldr-rgba-02.png,23.9368,0.3570,0.3146,0.2083\n+Small,8x8,ldr-xy-00.png,34.0144,0.2179,0.1396,0.4694\n+Small,8x8,ldr-xy-01.png,34.9127,0.2257,0.1548,0.4233\n+Small,8x8,ldr-xy-02.png,41.7218,0.1642,0.0753,0.8707\n+Small,8x8,ldrs-rgba-00.png,26.3943,0.4317,0.3679,0.1781\n+Small,8x8,ldrs-rgba-01.png,28.3412,0.2004,0.1558,0.4207\n+Small,8x8,ldrs-rgba-02.png,23.9363,0.2732,0.2224,0.2947\n+Small,12x12,hdr-rgb-00.hdr,20.7645,0.9448,0.4272,0.1534\n+Small,12x12,ldr-rgb-00.png,24.6670,0.3884,0.3185,0.2058\n+Small,12x12,ldr-rgb-01.png,25.0227,0.3453,0.2567,0.2553\n+Small,12x12,ldr-rgb-02.png,19.2621,0.4927,0.3972,0.1650\n+Small,12x12,ldr-rgb-03.png,34.9308,0.1228,0.0420,1.5602\n+Small,12x12,ldr-rgb-04.png,24.9126,0.3189,0.2393,0.2739\n+Small,12x12,ldr-rgb-05.png,21.6505,0.5069,0.3960,0.1655\n+Small,12x12,ldr-rgb-06.png,19.2451,0.4366,0.3632,0.1804\n+Small,12x12,ldr-rgb-07.png,26.5693,0.2737,0.2122,0.3088\n+Small,12x12,ldr-rgb-08.png,31.4927,0.2637,0.1683,0.3895\n+Small,12x12,ldr-rgb-09.png,24.1078,0.3766,0.2630,0.2492\n+Small,12x12,ldr-rgb-10.png,27.9831,0.2057,0.1144,0.1421\n+Small,12x12,ldr-rgba-00.png,22.0878,0.4276,0.3456,0.1897\n+Small,12x12,ldr-rgba-01.png,24.6267,0.3875,0.2852,0.2298\n+Small,12x12,ldr-rgba-02.png,20.1804,0.4979,0.4180,0.1568\n+Small,12x12,ldr-xy-00.png,30.0722,0.2674,0.1780,0.3682\n+Small,12x12,ldr-xy-01.png,31.8391,0.2191,0.1415,0.4632\n+Small,12x12,ldr-xy-02.png,38.5216,0.1150,0.0251,2.6088\n+Small,12x12,ldrs-rgba-00.png,22.0882,0.4883,0.3883,0.1688\n+Small,12x12,ldrs-rgba-01.png,24.6285,0.2690,0.1887,0.3473\n+Small,12x12,ldrs-rgba-02.png,20.1803,0.3955,0.3315,0.1977\n+Small,3x3x3,ldr-l-00-3.dds,51.9676,0.1293,0.0944,2.7771\n+Small,3x3x3,ldr-l-01-3.dds,54.3363,0.0465,0.0256,2.6938\n+Small,6x6x6,ldr-l-00-3.dds,32.9641,0.3017,0.2351,1.1151\n+Small,6x6x6,ldr-l-01-3.dds,40.8871,0.1182,0.0612,1.1256\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/Images/Small/astc_reference-main-avx2_thorough_results.csv", "diff": "+Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n+Small,4x4,hdr-rgb-00.hdr,34.3787,0.6999,0.3807,0.1722\n+Small,4x4,ldr-rgb-00.png,39.1025,0.3125,0.2907,0.2254\n+Small,4x4,ldr-rgb-01.png,40.3344,0.3996,0.3774,0.1737\n+Small,4x4,ldr-rgb-02.png,35.3612,0.4127,0.3806,0.1722\n+Small,4x4,ldr-rgb-03.png,47.6672,0.4104,0.3785,0.1731\n+Small,4x4,ldr-rgb-04.png,42.3135,0.3647,0.3295,0.1989\n+Small,4x4,ldr-rgb-05.png,37.9467,0.4730,0.4417,0.1484\n+Small,4x4,ldr-rgb-06.png,35.4785,0.3321,0.3013,0.2175\n+Small,4x4,ldr-rgb-07.png,39.8676,0.4831,0.4542,0.1443\n+Small,4x4,ldr-rgb-08.png,45.7996,0.2785,0.2550,0.2570\n+Small,4x4,ldr-rgb-09.png,42.2360,0.3444,0.3210,0.2042\n+Small,4x4,ldr-rgb-10.png,44.9865,0.0495,0.0326,0.4982\n+Small,4x4,ldr-rgba-00.png,36.7343,0.3755,0.3500,0.1873\n+Small,4x4,ldr-rgba-01.png,39.0299,0.2963,0.2716,0.2413\n+Small,4x4,ldr-rgba-02.png,34.9857,0.2685,0.2433,0.2693\n+Small,4x4,ldr-xy-00.png,37.7553,0.3268,0.2911,0.2252\n+Small,4x4,ldr-xy-01.png,45.2161,0.3704,0.3419,0.1917\n+Small,4x4,ldr-xy-02.png,50.9985,0.4683,0.4333,0.1512\n+Small,4x4,ldrs-rgba-00.png,36.7417,0.3656,0.3352,0.1955\n+Small,4x4,ldrs-rgba-01.png,39.0514,0.3447,0.3163,0.2072\n+Small,4x4,ldrs-rgba-02.png,34.9915,0.2905,0.2607,0.2514\n+Small,5x5,hdr-rgb-00.hdr,30.2499,0.7212,0.3806,0.1722\n+Small,5x5,ldr-rgb-00.png,35.3184,0.4052,0.3813,0.1719\n+Small,5x5,ldr-rgb-01.png,36.4942,0.3959,0.3659,0.1791\n+Small,5x5,ldr-rgb-02.png,31.1169,0.4012,0.3690,0.1776\n+Small,5x5,ldr-rgb-03.png,44.4730,0.5269,0.4887,0.1341\n+Small,5x5,ldr-rgb-04.png,37.8146,0.6229,0.5784,0.1133\n+Small,5x5,ldr-rgb-05.png,33.6567,0.5092,0.4630,0.1415\n+Small,5x5,ldr-rgb-06.png,31.1197,0.4243,0.3868,0.1694\n+Small,5x5,ldr-rgb-07.png,36.7056,0.5275,0.4876,0.1344\n+Small,5x5,ldr-rgb-08.png,42.2683,0.4415,0.3953,0.1658\n+Small,5x5,ldr-rgb-09.png,37.6844,0.7931,0.7543,0.0869\n+Small,5x5,ldr-rgb-10.png,40.6793,0.1202,0.0811,0.2005\n+Small,5x5,ldr-rgba-00.png,33.1233,0.7282,0.6808,0.0963\n+Small,5x5,ldr-rgba-01.png,35.3456,0.3983,0.3558,0.1842\n+Small,5x5,ldr-rgba-02.png,31.1599,0.3856,0.3433,0.1909\n+Small,5x5,ldr-xy-00.png,37.2902,0.3626,0.3179,0.2062\n+Small,5x5,ldr-xy-01.png,41.5200,0.5857,0.5360,0.1223\n+Small,5x5,ldr-xy-02.png,49.2646,0.6619,0.6131,0.1069\n+Small,5x5,ldrs-rgba-00.png,33.1269,0.6518,0.5878,0.1115\n+Small,5x5,ldrs-rgba-01.png,35.3541,0.4713,0.4231,0.1549\n+Small,5x5,ldrs-rgba-02.png,31.1602,0.5452,0.4868,0.1346\n+Small,6x6,hdr-rgb-00.hdr,27.6566,1.1402,0.5549,0.1181\n+Small,6x6,ldr-rgb-00.png,32.6208,0.5123,0.4727,0.1386\n+Small,6x6,ldr-rgb-01.png,33.1469,0.4431,0.4060,0.1614\n+Small,6x6,ldr-rgb-02.png,27.4754,0.4202,0.3803,0.1723\n+Small,6x6,ldr-rgb-03.png,42.5226,0.3170,0.2776,0.2361\n+Small,6x6,ldr-rgb-04.png,34.3223,0.4314,0.3908,0.1677\n+Small,6x6,ldr-rgb-05.png,30.2576,0.5168,0.4835,0.1356\n+Small,6x6,ldr-rgb-06.png,27.5394,0.4669,0.4361,0.1503\n+Small,6x6,ldr-rgb-07.png,34.3854,0.5440,0.5077,0.1291\n+Small,6x6,ldr-rgb-08.png,39.8830,0.3837,0.3397,0.1929\n+Small,6x6,ldr-rgb-09.png,33.7955,0.4912,0.4436,0.1477\n+Small,6x6,ldr-rgb-10.png,37.1039,0.1089,0.0781,0.2080\n+Small,6x6,ldr-rgba-00.png,30.5063,0.5817,0.5360,0.1223\n+Small,6x6,ldr-rgba-01.png,32.2316,0.4465,0.4063,0.1613\n+Small,6x6,ldr-rgba-02.png,27.8753,0.4070,0.3769,0.1739\n+Small,6x6,ldr-xy-00.png,36.3838,0.4147,0.3696,0.1773\n+Small,6x6,ldr-xy-01.png,38.0646,0.7424,0.6768,0.0968\n+Small,6x6,ldr-xy-02.png,47.4735,0.6903,0.6198,0.1057\n+Small,6x6,ldrs-rgba-00.png,30.5081,0.5616,0.5156,0.1271\n+Small,6x6,ldrs-rgba-01.png,32.2377,0.4648,0.4018,0.1631\n+Small,6x6,ldrs-rgba-02.png,27.8745,0.4381,0.3960,0.1655\n+Small,8x8,hdr-rgb-00.hdr,24.3160,0.8934,0.5172,0.1267\n+Small,8x8,ldr-rgb-00.png,28.9377,0.4966,0.4556,0.1438\n+Small,8x8,ldr-rgb-01.png,28.9883,0.5058,0.4613,0.1421\n+Small,8x8,ldr-rgb-02.png,23.1866,0.8770,0.8007,0.0819\n+Small,8x8,ldr-rgb-03.png,39.3501,0.2668,0.1999,0.3279\n+Small,8x8,ldr-rgb-04.png,29.7749,0.5473,0.4942,0.1326\n+Small,8x8,ldr-rgb-05.png,26.0242,0.5839,0.5390,0.1216\n+Small,8x8,ldr-rgb-06.png,23.2335,0.7094,0.6503,0.1008\n+Small,8x8,ldr-rgb-07.png,31.1039,0.5437,0.4901,0.1337\n+Small,8x8,ldr-rgb-08.png,36.4625,0.3252,0.2836,0.2311\n+Small,8x8,ldr-rgb-09.png,29.1520,0.3667,0.3271,0.2004\n+Small,8x8,ldr-rgb-10.png,32.3031,0.1023,0.0702,0.2316\n+Small,8x8,ldr-rgba-00.png,26.6704,0.5386,0.5013,0.1307\n+Small,8x8,ldr-rgba-01.png,28.3932,0.5192,0.4773,0.1373\n+Small,8x8,ldr-rgba-02.png,23.9599,0.5931,0.5461,0.1200\n+Small,8x8,ldr-xy-00.png,34.3120,0.3586,0.3051,0.2148\n+Small,8x8,ldr-xy-01.png,35.2096,0.3343,0.2871,0.2283\n+Small,8x8,ldr-xy-02.png,44.5881,0.4868,0.4245,0.1544\n+Small,8x8,ldrs-rgba-00.png,26.6715,0.5829,0.5404,0.1213\n+Small,8x8,ldrs-rgba-01.png,28.3959,0.4607,0.4213,0.1556\n+Small,8x8,ldrs-rgba-02.png,23.9597,0.5707,0.5267,0.1244\n+Small,12x12,hdr-rgb-00.hdr,21.0019,0.9263,0.6102,0.1074\n+Small,12x12,ldr-rgb-00.png,25.0133,0.5908,0.5355,0.1224\n+Small,12x12,ldr-rgb-01.png,25.1167,0.5199,0.4575,0.1432\n+Small,12x12,ldr-rgb-02.png,19.2912,0.6457,0.5842,0.1122\n+Small,12x12,ldr-rgb-03.png,36.1206,0.1750,0.1166,0.5619\n+Small,12x12,ldr-rgb-04.png,25.0074,0.5846,0.5255,0.1247\n+Small,12x12,ldr-rgb-05.png,21.7140,0.6635,0.6009,0.1091\n+Small,12x12,ldr-rgb-06.png,19.2810,0.6365,0.5759,0.1138\n+Small,12x12,ldr-rgb-07.png,27.0419,0.5619,0.5013,0.1307\n+Small,12x12,ldr-rgb-08.png,32.3840,0.2415,0.1778,0.3686\n+Small,12x12,ldr-rgb-09.png,24.3053,0.4747,0.4166,0.1573\n+Small,12x12,ldr-rgb-10.png,28.1356,0.2045,0.1477,0.1100\n+Small,12x12,ldr-rgba-00.png,22.7010,0.7645,0.6962,0.0941\n+Small,12x12,ldr-rgba-01.png,24.7078,0.5873,0.5191,0.1263\n+Small,12x12,ldr-rgba-02.png,20.1958,0.7108,0.6459,0.1015\n+Small,12x12,ldr-xy-00.png,30.5742,0.3778,0.3142,0.2086\n+Small,12x12,ldr-xy-01.png,32.1255,0.2795,0.2177,0.3011\n+Small,12x12,ldr-xy-02.png,40.3053,0.1851,0.1189,0.5512\n+Small,12x12,ldrs-rgba-00.png,22.7006,0.7891,0.7298,0.0898\n+Small,12x12,ldrs-rgba-01.png,24.7093,0.5593,0.4953,0.1323\n+Small,12x12,ldrs-rgba-02.png,20.1960,0.6524,0.5907,0.1109\n+Small,3x3x3,ldr-l-00-3.dds,52.4153,0.2232,0.2024,1.2951\n+Small,3x3x3,ldr-l-01-3.dds,55.4037,0.0934,0.0732,0.9409\n+Small,6x6x6,ldr-l-00-3.dds,33.2725,0.4804,0.4035,0.6496\n+Small,6x6x6,ldr-l-01-3.dds,41.5751,0.1428,0.0772,0.8926\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_image.py", "new_path": "Test/astc_test_image.py", "diff": "@@ -310,7 +310,7 @@ def parse_command_line():\nparser.add_argument(\"--encoder\", dest=\"encoders\", default=\"avx2\",\nchoices=coders, help=\"test encoder variant\")\n- parser.add_argument(\"--reference\", dest=\"reference\", default=\"ref-3.4-avx2\",\n+ parser.add_argument(\"--reference\", dest=\"reference\", default=\"ref-main-avx2\",\nchoices=refcoders, help=\"reference encoder variant\")\nastcProfile = [\"ldr\", \"ldrs\", \"hdr\", \"all\"]\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update test reference for CI
61,745
09.03.2022 15:01:12
0
c82259f563a77c32c082602a25ce359508419d71
Stash ClangCL artefacts in CI
[ { "change_type": "MODIFY", "old_path": "jenkins/nightly.Jenkinsfile", "new_path": "jenkins/nightly.Jenkinsfile", "diff": "@@ -298,8 +298,11 @@ spec:\ndir('upload/linux-x64') {\nunstash 'astcenc-linux-x64'\n}\n- dir('upload/windows-x64') {\n- unstash 'astcenc-windows-x64'\n+ dir('upload/windows-x64-cl') {\n+ unstash 'astcenc-windows-x64-cl'\n+ }\n+ dir('upload/windows-x64-clangcl') {\n+ unstash 'astcenc-windows-x64-clangcl'\n}\ndir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Stash ClangCL artefacts in CI
61,745
10.03.2022 00:31:23
0
cdd6abbebf02b4c5fbcbf6fcb93a745e06d516d7
Implement basic ptable defragment This patch defragments the tables by dropping partitionings where not all active partitions contain texels. There will still be some dead entries caused by later dropping duplicates, which will be fixed in a follow-on patch.
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_find_best_partitioning.cpp", "new_path": "Source/astcenc_find_best_partitioning.cpp", "diff": "@@ -369,8 +369,9 @@ static void count_partition_mismatch_bits(\npartition_mismatch4\n};\n- for (unsigned int i = 0; i < BLOCK_MAX_PARTITIONINGS; i++)\n+ for (unsigned int i = 0; i < bsd.partitioning_count[partition_count - 1]; i++)\n{\n+ // TODO: Shouldn't need this once we squash out dupes ...\nint bitcount = 255;\nif (pt->partition_count == partition_count)\n{\n@@ -385,17 +386,19 @@ static void count_partition_mismatch_bits(\n/**\n* @brief Use counting sort on the mismatch array to sort partition candidates.\n*\n+ * @param partitioning_count The number of packed partitionings.\n* @param mismatch_count Partitioning mismatch counts, in index order.\n* @param[out] partition_ordering Partition index values, in mismatch order.\n*/\nstatic void get_partition_ordering_by_mismatch_bits(\n+ unsigned int partitioning_count,\nconst unsigned int mismatch_count[BLOCK_MAX_PARTITIONINGS],\nunsigned int partition_ordering[BLOCK_MAX_PARTITIONINGS]\n) {\nunsigned int mscount[256] { 0 };\n// Create the histogram of mismatch counts\n- for (unsigned int i = 0; i < BLOCK_MAX_PARTITIONINGS; i++)\n+ for (unsigned int i = 0; i < partitioning_count; i++)\n{\nmscount[mismatch_count[i]]++;\n}\n@@ -412,7 +415,7 @@ static void get_partition_ordering_by_mismatch_bits(\n// Use the running sum as the index, incrementing after read to allow\n// sequential entries with the same count\n- for (unsigned int i = 0; i < BLOCK_MAX_PARTITIONINGS; i++)\n+ for (unsigned int i = 0; i < partitioning_count; i++)\n{\nunsigned int idx = mscount[mismatch_count[i]]++;\npartition_ordering[idx] = i;\n@@ -466,7 +469,8 @@ static void compute_kmeans_partition_ordering(\ncount_partition_mismatch_bits(bsd, partition_count, bitmaps, mismatch_counts);\n// Sort the partitions based on the number of mismatched bits\n- get_partition_ordering_by_mismatch_bits(mismatch_counts, partition_ordering);\n+ get_partition_ordering_by_mismatch_bits(bsd.partitioning_count[partition_count - 1],\n+ mismatch_counts, partition_ordering);\n}\n/* See header for documentation. */\n@@ -501,6 +505,8 @@ void find_best_partition_candidates(\nunsigned int partition_sequence[BLOCK_MAX_PARTITIONINGS];\ncompute_kmeans_partition_ordering(bsd, blk, partition_count, partition_sequence);\n+ partition_search_limit = astc::min(partition_search_limit,\n+ bsd.partitioning_count[partition_count - 1]);\nbool uses_alpha = !blk.is_constant_channel(3);\n@@ -518,8 +524,9 @@ void find_best_partition_candidates(\nfor (unsigned int i = 0; i < partition_search_limit; i++)\n{\nunsigned int partition = partition_sequence[i];\n- const auto& pi = bsd.get_partition_info(partition_count, partition);\n+ const auto& pi = bsd.get_raw_partition_info(partition_count, partition);\n+ // TODO: This escape shouldn't be needed eventually ...\nunsigned int bk_partition_count = pi.partition_count;\nif (bk_partition_count < partition_count)\n{\n@@ -617,8 +624,9 @@ void find_best_partition_candidates(\nfor (unsigned int i = 0; i < partition_search_limit; i++)\n{\nunsigned int partition = partition_sequence[i];\n- const auto& pi = bsd.get_partition_info(partition_count, partition);\n+ const auto& pi = bsd.get_raw_partition_info(partition_count, partition);\n+ // TODO: This escape shouldn't be needed eventually ...\nunsigned int bk_partition_count = pi.partition_count;\nif (bk_partition_count < partition_count)\n{\n@@ -722,6 +730,10 @@ void find_best_partition_candidates(\nbest_partitions[0] = samec_best_partitions[0];\nbest_partitions[1] = uncor_best_partition;\n}\n+\n+ // Convert these back into canonical partition IDs for the rest of the codec\n+ best_partitions[0] = bsd.get_raw_partition_info(partition_count, best_partitions[0]).partition_index;\n+ best_partitions[1] = bsd.get_raw_partition_info(partition_count, best_partitions[1]).partition_index;\n}\n#endif\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_internal.h", "new_path": "Source/astcenc_internal.h", "diff": "@@ -100,6 +100,9 @@ static constexpr unsigned int BLOCK_MAX_WEIGHT_BITS { 96 };\n/** @brief The index indicating a bad (unused) block mode in the remap array. */\nstatic constexpr uint16_t BLOCK_BAD_BLOCK_MODE { 0xFFFFu };\n+/** @brief The index indicating a bad (unused) partitioning in the remap array. */\n+static constexpr uint16_t BLOCK_BAD_PARTITIONING { 0xFFFFu };\n+\n/** @brief The number of partition index bits supported by the ASTC format . */\nstatic constexpr unsigned int PARTITION_INDEX_BITS { 10 };\n@@ -504,7 +507,10 @@ struct partition_lines3\nstruct partition_info\n{\n/** @brief The number of partitions in this partitioning. */\n- unsigned int partition_count;\n+ uint16_t partition_count;\n+\n+ /** @brief The index (seed) of this partitioning. */\n+ uint16_t partition_index;\n/**\n* @brief The number of texels in each partition.\n@@ -681,6 +687,9 @@ struct block_size_descriptor\n/** @brief The number of stored block modes. */\nunsigned int block_mode_count;\n+ /** @brief The number of active partitionings for 1/2/3/4 partitionings. */\n+ unsigned int partitioning_count[BLOCK_MAX_PARTITIONS];\n+\n/**\n* @brief The number of stored block modes which are \"always\" modes.\n*\n@@ -700,8 +709,12 @@ struct block_size_descriptor\n/** @brief The active block modes, stored in low indices. */\nblock_mode block_modes[WEIGHTS_MAX_BLOCK_MODES];\n- /** @brief The partition tables for all of the possible partitions. */\n- partition_info partitions[(3 * BLOCK_MAX_PARTITIONINGS) + 1];\n+ /** @brief The active partition tables, stored in low indices per-count. */\n+ partition_info partitionings[(3 * BLOCK_MAX_PARTITIONINGS) + 1];\n+\n+ /** @brief The packed partition table array index, or @c BLOCK_BAD_PARTITIONING if not active. */\n+ // TODO: Index 0 in this contains nothing ...\n+ uint16_t partitioning_packed_index[4][BLOCK_MAX_PARTITIONINGS];\n/** @brief The active texels for k-means partition selection. */\nuint8_t kmeans_texels[BLOCK_MAX_KMEANS_TEXELS];\n@@ -721,7 +734,7 @@ struct block_size_descriptor\n{\nunsigned int packed_index = this->block_mode_packed_index[block_mode];\nassert(packed_index != BLOCK_BAD_BLOCK_MODE && packed_index < this->block_mode_count);\n- return block_modes[packed_index];\n+ return this->block_modes[packed_index];\n}\n/**\n@@ -770,7 +783,7 @@ struct block_size_descriptor\npartition_count = 5;\n}\nunsigned int index = (partition_count - 2) * BLOCK_MAX_PARTITIONINGS;\n- return this->partitions + index;\n+ return this->partitionings + index;\n}\n/**\n@@ -783,7 +796,26 @@ struct block_size_descriptor\n*/\nconst partition_info& get_partition_info(unsigned int partition_count, unsigned int index) const\n{\n- return get_partition_table(partition_count)[index];\n+ unsigned int packed_index = this->partitioning_packed_index[partition_count - 1][index];\n+ assert(packed_index != BLOCK_BAD_PARTITIONING && packed_index < this->partitioning_count[partition_count - 1]);\n+ auto& result = get_partition_table(partition_count)[packed_index];\n+ assert(index == result.partition_index);\n+ return result;\n+ }\n+\n+ /**\n+ * @brief Get the partition info structure for a given partition count and seed.\n+ *\n+ * @param partition_count The number of partitions we want the info for.\n+ * @param packed_index The raw array offset.\n+ *\n+ * @return The partition info structure.\n+ */\n+ const partition_info& get_raw_partition_info(unsigned int partition_count, unsigned int packed_index) const\n+ {\n+ assert(packed_index != BLOCK_BAD_PARTITIONING && packed_index < this->partitioning_count[partition_count - 1]);\n+ auto& result = get_partition_table(partition_count)[packed_index];\n+ return result;\n}\n};\n" }, { "change_type": "MODIFY", "old_path": "Source/astcenc_partition_tables.cpp", "new_path": "Source/astcenc_partition_tables.cpp", "diff": "@@ -282,11 +282,13 @@ static uint8_t select_partition(\n* @param partition_count The partition count of this partitioning.\n* @param partition_index The partition index / see of this partitioning.\n* @param[out] pi The partition info structure to populate.\n+ *\n+ * @return True if this is a useful partition index, False if we can skip it.\n*/\n-static void generate_one_partition_info_entry(\n+static bool generate_one_partition_info_entry(\nconst block_size_descriptor& bsd,\n- int partition_count,\n- int partition_index,\n+ unsigned int partition_count,\n+ unsigned int partition_index,\npartition_info& pi\n) {\nint texels_per_block = bsd.texel_count;\n@@ -311,7 +313,7 @@ static void generate_one_partition_info_entry(\n}\n// Fill loop tail so we can overfetch later\n- for (int i = 0; i < partition_count; i++)\n+ for (unsigned int i = 0; i < partition_count; i++)\n{\nint ptex_count = counts[i];\nint ptex_count_simd = round_up_to_simd_multiple_vla(ptex_count);\n@@ -354,24 +356,50 @@ static void generate_one_partition_info_entry(\nunsigned int idx = bsd.kmeans_texels[i];\npi.coverage_bitmaps[pi.partition_of_texel[idx]] |= 1ULL << i;\n}\n+\n+ pi.partition_index = partition_index;\n+ return pi.partition_count == partition_count;\n+}\n+\n+static void build_partition_table_for_one_partition_count(\n+ block_size_descriptor& bsd,\n+ unsigned int partition_count,\n+ partition_info* ptab\n+) {\n+ unsigned int next_index = 0;\n+ bsd.partitioning_count[partition_count - 1] = 0;\n+ for (unsigned int i = 0; i < BLOCK_MAX_PARTITIONINGS; i++)\n+ {\n+ bool keep = generate_one_partition_info_entry(bsd, partition_count, i, ptab[next_index]);\n+ if (keep)\n+ {\n+ bsd.partitioning_packed_index[partition_count - 1][i] = next_index;\n+ bsd.partitioning_count[partition_count - 1]++;\n+ next_index++;\n+ }\n+ else\n+ {\n+ bsd.partitioning_packed_index[partition_count - 1][i] = BLOCK_BAD_PARTITIONING;\n+ }\n+ }\n}\n/* See header for documentation. */\nvoid init_partition_tables(\nblock_size_descriptor& bsd\n) {\n- partition_info *par_tab2 = bsd.partitions;\n+ partition_info* par_tab2 = bsd.partitionings;\npartition_info* par_tab3 = par_tab2 + BLOCK_MAX_PARTITIONINGS;\npartition_info* par_tab4 = par_tab3 + BLOCK_MAX_PARTITIONINGS;\npartition_info* par_tab1 = par_tab4 + BLOCK_MAX_PARTITIONINGS;\ngenerate_one_partition_info_entry(bsd, 1, 0, *par_tab1);\n- for (int i = 0; i < 1024; i++)\n- {\n- generate_one_partition_info_entry(bsd, 2, i, par_tab2[i]);\n- generate_one_partition_info_entry(bsd, 3, i, par_tab3[i]);\n- generate_one_partition_info_entry(bsd, 4, i, par_tab4[i]);\n- }\n+ bsd.partitioning_count[0] = 1;\n+ bsd.partitioning_packed_index[0][0] = 0;\n+\n+ build_partition_table_for_one_partition_count(bsd, 2, par_tab2);\n+ build_partition_table_for_one_partition_count(bsd, 3, par_tab3);\n+ build_partition_table_for_one_partition_count(bsd, 4, par_tab4);\nuint64_t* bit_patterns = new uint64_t[BLOCK_MAX_PARTITIONINGS * 7];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Implement basic ptable defragment This patch defragments the tables by dropping partitionings where not all active partitions contain texels. There will still be some dead entries caused by later dropping duplicates, which will be fixed in a follow-on patch.