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 |
06.06.2022 07:07:05
| -3,600 |
1f5f2b74f46218640c5c7f025c397f3241b229d1
|
Fix bool cast warnings on VS2015
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_decompress_symbolic.cpp",
"new_path": "Source/astcenc_decompress_symbolic.cpp",
"diff": "@@ -278,7 +278,7 @@ void decompress_symbolic_block(\nconst auto& bm = bsd.get_block_mode(scb.block_mode);\nconst auto& di = bsd.get_decimation_info(bm.decimation_mode);\n- int is_dual_plane = bm.is_dual_plane;\n+ bool is_dual_plane = static_cast<bool>(bm.is_dual_plane);\n// Unquantize and undecimate the weights\nint plane1_weights[BLOCK_MAX_TEXELS];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -718,7 +718,7 @@ astcenc_error astcenc_context_alloc(\n}\nctx->bsd = aligned_malloc<block_size_descriptor>(sizeof(block_size_descriptor), ASTCENC_VECALIGN);\n- bool can_omit_modes = config.flags & ASTCENC_FLG_SELF_DECOMPRESS_ONLY;\n+ bool can_omit_modes = static_cast<bool>(config.flags & ASTCENC_FLG_SELF_DECOMPRESS_ONLY);\ninit_block_size_descriptor(config.block_x, config.block_y, config.block_z,\ncan_omit_modes,\nconfig.tune_partition_count_limit,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"new_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"diff": "@@ -1124,8 +1124,8 @@ unsigned int compute_ideal_endpoint_formats(\npromise(partition_count > 0);\n- int encode_hdr_rgb = blk.rgb_lns[0];\n- int encode_hdr_alpha = blk.alpha_lns[0];\n+ bool encode_hdr_rgb = static_cast<bool>(blk.rgb_lns[0]);\n+ bool encode_hdr_alpha = static_cast<bool>(blk.alpha_lns[0]);\n// Compute the errors that result from various encoding choices (such as using luminance instead\n// of RGB, discarding Alpha, using RGB-scale in place of two separate RGB endpoints and so on)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix bool cast warnings on VS2015
|
61,745 |
06.06.2022 08:37:32
| -3,600 |
1176aded91cbcff20e40dd77c810a793f4548813
|
Make it easier to minify tests on Windows
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_minify_test.sh",
"new_path": "Test/astc_minify_test.sh",
"diff": "#!/bin/bash\n-BLOCK_SIZE=6x6\n-QUALITY=-thorough\n+GOOD=astcenc-good.exe\n+BAD=astcenc-avx2.exe\n+BLOCK_SIZE=4x4\n+QUALITY=-fastest\n-./astcenc/astcenc-avx2-good -tl in.png out-good.png ${BLOCK_SIZE} ${QUALITY} -silent\n+./astcenc/${GOOD} -tl in.png out-good.png ${BLOCK_SIZE} ${QUALITY} -silent\n-./astcenc/astcenc-avx2 -tl in.png out-bad.png ${BLOCK_SIZE} ${QUALITY} -silent\n+./astcenc/${BAD} -tl in.png out-bad.png ${BLOCK_SIZE} ${QUALITY} -silent\ncompare out-good.png out-bad.png out-vs-out-diff.png\ncompare in.png out-bad.png out-vs-in-diff.png\n./astcenc/astc_test_autoextract ${BLOCK_SIZE} in.png out-good.png out-bad.png in-min.png\n-./astcenc/astcenc-avx2-good -tl in-min.png out-min-good.png ${BLOCK_SIZE} ${QUALITY} -silent\n+./astcenc/${GOOD} -tl in-min.png out-min-good.png ${BLOCK_SIZE} ${QUALITY} -silent\n-./astcenc/astcenc-avx2 -tl in-min.png out-min-bad.png ${BLOCK_SIZE} ${QUALITY} -silent\n+./astcenc/${BAD} -tl in-min.png out-min-bad.png ${BLOCK_SIZE} ${QUALITY} -silent\ncompare out-min-good.png out-min-bad.png out-min-diff.png\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Make it easier to minify tests on Windows
|
61,745 |
06.06.2022 09:11:26
| -3,600 |
532b85452f9bd74a205861d4b6ed835f1563261a
|
Skip newline translation on csv write
|
[
{
"change_type": "MODIFY",
"old_path": "Test/testlib/resultset.py",
"new_path": "Test/testlib/resultset.py",
"diff": "# SPDX-License-Identifier: Apache-2.0\n# -----------------------------------------------------------------------------\n-# Copyright 2020 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@@ -300,7 +300,7 @@ class ResultSet():\nif not os.path.exists(dirName):\nos.makedirs(dirName)\n- with open(filePath, \"w\") as csvfile:\n+ with open(filePath, \"w\", newline=\"\") as csvfile:\nwriter = csv.writer(csvfile)\nself._save_header(writer)\nfor record in self.records:\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Skip newline translation on csv write
|
61,745 |
06.06.2022 10:23:11
| -3,600 |
e4410c2014baad5486e794449af290ce0dfdb539
|
Re-add /fp:strict for MSVC builds
|
[
{
"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# MSVC compiler defines\n$<$<CXX_COMPILER_ID:MSVC>:/EHsc>\n+ $<$<CXX_COMPILER_ID:MSVC>:/fp:strict>\n$<$<CXX_COMPILER_ID:MSVC>:/wd4324>\n# G++ and Clang++ compiler defines\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Re-add /fp:strict for MSVC builds
|
61,745 |
06.06.2022 10:57:38
| -3,600 |
395564d49bfea616b8752bc75514cae24acd5ec8
|
Fix XCode internal error workaround
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_sse_4.h",
"new_path": "Source/astcenc_vecmathlib_sse_4.h",
"diff": "@@ -1167,7 +1167,7 @@ ASTCENC_SIMD_INLINE vint4 interleave_rgba8(vint4 r, vint4 g, vint4 b, vint4 a)\n{\n// Workaround an XCode compiler internal fault; note is slower than slli_epi32\n// so we should revert this when we get the opportunity\n-#if __APPLE__\n+#if defined(__APPLE__)\n__m128i value = r.m;\nvalue = _mm_add_epi32(value, _mm_bslli_si128(g.m, 1));\nvalue = _mm_add_epi32(value, _mm_bslli_si128(b.m, 2));\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix XCode internal error workaround
|
61,745 |
06.06.2022 20:49:43
| -3,600 |
69199337432d5601665b13b9d052ad8eb1f5331e
|
Update plot script for 4.x
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_result_plot.py",
"new_path": "Test/astc_test_result_plot.py",
"diff": "@@ -245,7 +245,6 @@ def main():\nReturns:\nint: The process return code.\n\"\"\"\n-\nabsXMin = 0\nabsXMax = 80\nabsXLimits = (absXMin, absXMax)\n@@ -254,23 +253,28 @@ def main():\nrelXMax = None\nrelXLimits = (relXMin, relXMax)\n+ last1x = \"1.7\"\n+ last2x = \"2.5\"\n+ last3x = \"3.7\"\n+ last4x = \"main\"\n+\ncharts = [\n# --------------------------------------------------------\n# Latest in stable series charts\n[\n# Relative scores\n[\"thorough\", \"medium\", \"fast\"],\n- [\"ref-2.5-avx2\", \"ref-3.7-avx2\"],\n+ [f\"ref-{last2x}-avx2\", f\"ref-{last3x}-avx2\", f\"ref-{last4x}-avx2\"],\n[\"4x4\", \"6x6\", \"8x8\"],\nTrue,\n- \"ref-1.7\",\n+ f\"ref-{last1x}\",\nNone,\n\"relative-stable-series.png\",\n(None, None)\n], [\n# Absolute scores\n[\"thorough\", \"medium\", \"fast\"],\n- [\"ref-1.7\", \"ref-2.5-avx2\", \"ref-3.7-avx2\"],\n+ [f\"ref-{last1x}\", f\"ref-{last2x}-avx2\", f\"ref-{last3x}-avx2\"],\n[\"4x4\", \"6x6\", \"8x8\"],\nFalse,\nNone,\n@@ -279,75 +283,88 @@ def main():\n(absXLimits, None)\n],\n# --------------------------------------------------------\n- # Latest 2.x vs 1.7 release charts\n+ # Latest 2.x vs 1.x release charts\n[\n# Relative scores\n[\"thorough\", \"medium\", \"fast\"],\n- [\"ref-2.5-avx2\"],\n+ [f\"ref-{last2x}-avx2\"],\n[\"4x4\", \"6x6\", \"8x8\"],\nTrue,\n- \"ref-1.7\",\n+ f\"ref-{last1x}\",\nNone,\n\"relative-2.x-vs-1.x.png\",\n(None, None)\n],\n# --------------------------------------------------------\n- # Latest 3.x vs 1.7 release charts\n+ # Latest 3.x vs 1.x release charts\n[\n# Relative scores\n[\"thorough\", \"medium\", \"fast\"],\n- [\"ref-3.7-avx2\"],\n+ [f\"ref-{last3x}-avx2\"],\n[\"4x4\", \"6x6\", \"8x8\"],\nTrue,\n- \"ref-1.7\",\n+ f\"ref-{last1x}\",\nNone,\n\"relative-3.x-vs-1.x.png\",\n(None, None)\n],\n# --------------------------------------------------------\n- # Latest 3.x vs 2.5 release charts\n+ # Latest 4.x vs 1.x release charts\n+ [\n+ # Relative scores\n+ [\"thorough\", \"medium\", \"fast\"],\n+ [f\"ref-{last4x}-avx2\"],\n+ [\"4x4\", \"6x6\", \"8x8\"],\n+ True,\n+ f\"ref-{last1x}\",\n+ None,\n+ \"relative-4.x-vs-1.x.png\",\n+ (None, None)\n+ ],\n+ # --------------------------------------------------------\n+ # Latest 3.x vs 2.x release charts\n[\n# Relative scores\n[\"thorough\", \"medium\", \"fast\", \"fastest\"],\n- [\"ref-3.7-avx2\"],\n+ [f\"ref-{last3x}-avx2\"],\n[\"4x4\", \"6x6\", \"8x8\"],\nTrue,\n- \"ref-2.5-avx2\",\n+ f\"ref-{last2x}-avx2\",\nNone,\n\"relative-3.x-vs-2.x.png\",\n(None, None)\n],\n# --------------------------------------------------------\n- # Latest 3.x vs 3.0 release charts\n+ # Latest 4.x vs 3.x release charts\n[\n# Relative scores\n[\"thorough\", \"medium\", \"fast\", \"fastest\"],\n- [\"ref-3.7-avx2\"],\n+ [f\"ref-{last4x}-avx2\"],\n[\"4x4\", \"6x6\", \"8x8\"],\nTrue,\n- \"ref-3.6-avx2\",\n+ f\"ref-{last3x}-avx2\",\nNone,\n- \"relative-3.x-vs-3.x.png\",\n+ \"relative-4.x-vs-3.x.png\",\n(relXLimits, None),\n], [\n# Relative ISAs of latest\n[\"thorough\", \"medium\", \"fast\", \"fastest\"],\n- [\"ref-3.7-sse4.1\", \"ref-3.7-avx2\"],\n+ [f\"ref-{last4x}-sse4.1\", f\"ref-{last4x}-avx2\"],\n[\"4x4\", \"6x6\", \"8x8\"],\nTrue,\n- \"ref-3.7-sse2\",\n+ f\"ref-{last4x}-sse2\",\nNone,\n- \"relative-3.x-isa.png\",\n+ \"relative-4.x-isa.png\",\n(None, None)\n], [\n# Relative quality of latest\n[\"medium\", \"fast\", \"fastest\"],\n- [\"ref-3.7-avx2\"],\n+ [f\"ref-{last4x}-avx2\"],\n[\"4x4\", \"6x6\", \"8x8\"],\nTrue,\nNone,\n\"thorough\",\n- \"relative-3.x-quality.png\",\n+ \"relative-4.x-quality.png\",\n(None, None)\n]\n]\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update plot script for 4.x
|
61,745 |
06.06.2022 23:33:56
| -3,600 |
edc06700445d76f7be710ab5da5e9adb62104c8c
|
Enable use of -mfma for NO_INVARIANCE builds
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/Building.md",
"new_path": "Docs/Building.md",
"diff": "@@ -147,7 +147,8 @@ All normal builds are designed to be invariant, so any build from the same git\nrevision will produce bit-identical results for all compilers and CPU\narchitectures. To achieve this we sacrifice some performance, so if this is\nnot required you can specify `-DNO_INVARIANCE=ON` to enable additional\n-optimizations.\n+optimizations. This has most benefit for AVX2 builds where we are able to\n+enable use of the FMA instruction set extensions.\n### No intrinsics builds\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -258,6 +258,19 @@ macro(astcenc_set_properties NAME)\n$<$<CXX_COMPILER_ID:MSVC>:/arch:AVX2>\n$<$<CXX_COMPILER_ID:AppleClang>:-Wno-unused-command-line-argument>)\n+ # Non-invariant builds enable us to loosen the compiler constraints on\n+ # floating point, but this is only worth doing on CPUs with AVX2 because\n+ # this implies we can also enable the FMA instruction set extensions\n+ # which significantly improve performance. Note that this DOES reduce\n+ # image quality by up to 0.2 dB (normally much less), but buys an\n+ # average of 10-15% performance improvement ...\n+ if(${NO_INVARIANCE})\n+ target_compile_options(${NAME}\n+ PRIVATE\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mfma>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-ffp-contract=fast>)\n+ endif()\n+\nendif()\nendmacro()\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Enable use of -mfma for NO_INVARIANCE builds
|
61,760 |
10.06.2022 12:05:38
| 25,200 |
7813c06845985a4aa516103acb0ba0d0b4079d81
|
Fix build failure on Windows arm64
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_neon_4.h",
"new_path": "Source/astcenc_vecmathlib_neon_4.h",
"diff": "@@ -204,7 +204,7 @@ struct vint4\n{\nuint32x2_t t8 {};\n// Cast is safe - NEON loads are allowed to be unaligned\n- t8 = vld1_lane_u32((const uint32_t*)p, t8, 0);\n+ t8 = vld1_lane_u32(reinterpret_cast<const uint32_t*>(p), t8, 0);\nuint16x4_t t16 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(t8)));\nm = vreinterpretq_s32_u32(vmovl_u16(t16));\n}\n@@ -346,6 +346,14 @@ struct vmask4\nm = vreinterpretq_u32_s32(ms);\n}\n+ /**\n+ * @brief Get the scalar from a single lane.\n+ */\n+ template <int32_t l> ASTCENC_SIMD_INLINE uint32_t lane() const\n+ {\n+ return vgetq_lane_s32(m, l);\n+ }\n+\n/**\n* @brief The vector ...\n*/\n@@ -582,7 +590,7 @@ ASTCENC_SIMD_INLINE void store(vint4 a, int* p)\n*/\nASTCENC_SIMD_INLINE void store_nbytes(vint4 a, uint8_t* p)\n{\n- vst1q_lane_s32((int32_t*)p, a.m, 0);\n+ vst1q_lane_s32(reinterpret_cast<int32_t*>(p), a.m, 0);\n}\n/**\n@@ -874,7 +882,7 @@ ASTCENC_SIMD_INLINE vint4 float_to_float16(vfloat4 a)\nstatic inline uint16_t float_to_float16(float a)\n{\nvfloat4 av(a);\n- return float_to_float16(av).lane<0>();\n+ return static_cast<uint16_t>(float_to_float16(av).lane<0>());\n}\n/**\n@@ -1017,22 +1025,22 @@ ASTCENC_SIMD_INLINE vint4 interleave_rgba8(vint4 r, vint4 g, vint4 b, vint4 a)\n*/\nASTCENC_SIMD_INLINE void store_lanes_masked(int* base, vint4 data, vmask4 mask)\n{\n- if (mask.m[3])\n+ if (mask.lane<3>())\n{\nstore(data, base);\n}\n- else if(mask.m[2])\n+ else if(mask.lane<2>())\n{\nbase[0] = data.lane<0>();\nbase[1] = data.lane<1>();\nbase[2] = data.lane<2>();\n}\n- else if(mask.m[1])\n+ else if(mask.lane<1>())\n{\nbase[0] = data.lane<0>();\nbase[1] = data.lane<1>();\n}\n- else if(mask.m[0])\n+ else if(mask.lane<0>())\n{\nbase[0] = data.lane<0>();\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix build failure on Windows arm64 (#342)
|
61,745 |
10.06.2022 20:12:28
| -3,600 |
c9424dcfc5c9684717a3f18166be64ab7baed3fa
|
Add /d2ssa-cfg-sink- workaround for MSVC NEON
|
[
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -204,6 +204,12 @@ macro(astcenc_set_properties NAME)\nASTCENC_F16C=0)\nendif()\n+ # Workaround MSVC codegen bug for NEON builds see:\n+ # https://developercommunity.visualstudio.com/t/inlining-turns-constant-into-register-operand-for/1394798\n+ target_compile_options(${NAME}\n+ PRIVATE\n+ $<$<CXX_COMPILER_ID:MSVC>:/d2ssa-cfg-sink->)\n+\nelseif((${ISA_SIMD} MATCHES \"sse2\") OR (${UNIVERSAL_BUILD} AND ${ISA_SSE2}))\nif(NOT ${UNIVERSAL_BUILD})\ntarget_compile_definitions(${NAME}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add /d2ssa-cfg-sink- workaround for MSVC NEON
|
61,745 |
11.06.2022 20:58:47
| -3,600 |
df0f8319eb8e2d1e6ce7e4b915d276ea8f62735c
|
Add ASTCENC_NO_INLINE for profiling
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib.h",
"new_path": "Source/astcenc_vecmathlib.h",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2019-2021 Arm Limited\n+// Copyright 2019-2022 Arm Limited\n// Copyright 2008 Jose Fonseca\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n#if !defined(__clang__) && defined(_MSC_VER)\n#define ASTCENC_SIMD_INLINE __forceinline\n+ #define ASTCENC_NO_INLINE\n#elif defined(__GNUC__) && !defined(__clang__)\n#define ASTCENC_SIMD_INLINE __attribute__((always_inline)) inline\n+ #define ASTCENC_NO_INLINE __attribute__ ((noinline))\n#else\n#define ASTCENC_SIMD_INLINE __attribute__((always_inline, nodebug)) inline\n+ #define ASTCENC_NO_INLINE __attribute__ ((noinline))\n#endif\n#if ASTCENC_AVX >= 2\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add ASTCENC_NO_INLINE for profiling
|
61,745 |
12.06.2022 09:38:31
| -3,600 |
aa3e6cf737a054dba51268b473c58ea86418a32c
|
Change blue contraction error estimate
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"new_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"diff": "@@ -289,25 +289,13 @@ static void compute_encoding_choice_errors(\nvmask4 endpt_can_offset = endpt_diff < vfloat4(0.12f * 65535.0f);\nbool can_offset_encode = (mask(endpt_can_offset) & 0x7) == 0x7;\n- // Determine if we can blue contract encode RGB lanes\n- vfloat4 endpt_diff_bc(\n- endpt0.lane<0>() + (endpt0.lane<0>() - endpt0.lane<2>()),\n- endpt1.lane<0>() + (endpt1.lane<0>() - endpt1.lane<2>()),\n- endpt0.lane<1>() + (endpt0.lane<1>() - endpt0.lane<2>()),\n- endpt1.lane<1>() + (endpt1.lane<1>() - endpt1.lane<2>())\n- );\n-\n- vmask4 endpt_can_bc_lo = endpt_diff_bc > vfloat4(0.01f * 65535.0f);\n- vmask4 endpt_can_bc_hi = endpt_diff_bc < vfloat4(0.99f * 65535.0f);\n- bool can_blue_contract = (mask(endpt_can_bc_lo & endpt_can_bc_hi) & 0x7) == 0x7;\n-\n// Store out the settings\neci[i].rgb_scale_error = (samechroma_rgb_error - uncorr_rgb_error) * 0.7f; // empirical\neci[i].rgb_luma_error = (rgb_luma_error - uncorr_rgb_error) * 1.5f; // wild guess\neci[i].luminance_error = (luminance_rgb_error - uncorr_rgb_error) * 3.0f; // empirical\neci[i].alpha_drop_error = alpha_drop_error * 3.0f;\neci[i].can_offset_encode = can_offset_encode;\n- eci[i].can_blue_contract = can_blue_contract;\n+ eci[i].can_blue_contract = !blk.is_luminance();\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Change blue contraction error estimate
|
61,745 |
12.06.2022 10:00:37
| -3,600 |
5a29899229c8fcffb738c2f6c73e284587076617
|
Cleanup percentil tables
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_percentile_tables.cpp",
"new_path": "Source/astcenc_percentile_tables.cpp",
"diff": "@@ -33,14 +33,19 @@ struct packed_percentile_table\n{\n/** The block X dimension. */\nuint8_t xdim;\n+\n/** The block Y dimension. */\nuint8_t ydim;\n+\n/** The number of packed items in the 1 and 2 plane data. */\n- uint16_t itemcounts[2];\n+ uint16_t item_count[2];\n+\n/** The accumulator divisor for 1 and 2 plane data. */\nuint16_t difscales[2];\n+\n/** The initial accumulator values for 1 and 2 plane data. */\nuint16_t initial_percs[2];\n+\n/** The packed data for the 1 and 2 plane data. */\nconst uint16_t *items[2];\n};\n@@ -1173,7 +1178,7 @@ const float *get_2d_percentile_table(\n// Populate the unpacked percentile values\nfor (int i = 0; i < 2; i++)\n{\n- unsigned int itemcount = apt->itemcounts[i];\n+ unsigned int itemcount = apt->item_count[i];\nunsigned int difscale = apt->difscales[i];\nunsigned int accum = apt->initial_percs[i];\nconst uint16_t *item_ptr = apt->items[i];\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Cleanup percentil tables
|
61,745 |
12.06.2022 11:25:09
| -3,600 |
dabe39e3e34b47190f214c96f8f1c8e8c385124e
|
Shrink best_ep_format type
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -496,7 +496,7 @@ static float compress_symbolic_block_for_partition_1plane(\n}\n// Decide the optimal combination of color endpoint encodings and weight encodings\n- int partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS];\n+ uint8_t partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS];\nint block_mode_index[TUNE_MAX_TRIAL_CANDIDATES];\nquant_method color_quant_level[TUNE_MAX_TRIAL_CANDIDATES];\n@@ -873,7 +873,7 @@ static float compress_symbolic_block_for_partition_2planes(\n}\n// Decide the optimal combination of color endpoint encodings and weight encodings\n- int partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS];\n+ uint8_t partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS];\nint block_mode_index[TUNE_MAX_TRIAL_CANDIDATES];\nquant_method color_quant_level[TUNE_MAX_TRIAL_CANDIDATES];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1185,7 +1185,7 @@ struct alignas(ASTCENC_VECALIGN) compression_working_buffers\nquant_method best_quant_levels_mod[WEIGHTS_MAX_BLOCK_MODES];\n/** @brief The best endpoint format for each partition. */\n- int best_ep_formats[WEIGHTS_MAX_BLOCK_MODES][BLOCK_MAX_PARTITIONS];\n+ uint8_t best_ep_formats[WEIGHTS_MAX_BLOCK_MODES][BLOCK_MAX_PARTITIONS];\n/** @brief The total bit storage needed for quantized weights for each block mode. */\nint qwt_bitcounts[WEIGHTS_MAX_BLOCK_MODES];\n@@ -2228,7 +2228,7 @@ unsigned int compute_ideal_endpoint_formats(\nunsigned int tune_candidate_limit,\nunsigned int start_block_mode,\nunsigned int end_block_mode,\n- int partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS],\n+ uint8_t 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],\nquant_method quant_level_mod[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": "@@ -321,7 +321,7 @@ static void compute_color_error_for_every_integer_count_and_quant_level(\nconst endpoints& ep,\nvfloat4 error_weight,\nfloat best_error[21][4],\n- int format_of_choice[21][4]\n+ uint8_t format_of_choice[21][4]\n) {\nint partition_size = pi.partition_texel_count[partition_index];\n@@ -675,10 +675,10 @@ static void compute_color_error_for_every_integer_count_and_quant_level(\n*/\nstatic float one_partition_find_best_combination_for_bitcount(\nconst float best_combined_error[21][4],\n- const int best_combined_format[21][4],\n+ const uint8_t best_combined_format[21][4],\nint bits_available,\nquant_method& best_quant_level,\n- int& best_format\n+ uint8_t& best_format\n) {\nint best_integer_count = 0;\nfloat best_integer_count_error = ERROR_CALC_DEFAULT;\n@@ -725,9 +725,9 @@ static float one_partition_find_best_combination_for_bitcount(\n*/\nstatic void two_partitions_find_best_combination_for_every_quantization_and_integer_count(\nconst float best_error[2][21][4], // indexed by (partition, quant-level, integer-pair-count-minus-1)\n- const int best_format[2][21][4],\n+ const uint8_t best_format[2][21][4],\nfloat best_combined_error[21][7], // indexed by (quant-level, integer-pair-count-minus-2)\n- int best_combined_format[21][7][2]\n+ uint8_t best_combined_format[21][7][2]\n) {\nfor (int i = QUANT_2; i <= QUANT_256; i++)\n{\n@@ -777,11 +777,11 @@ static void two_partitions_find_best_combination_for_every_quantization_and_inte\n*/\nstatic float two_partitions_find_best_combination_for_bitcount(\nfloat best_combined_error[21][7],\n- int best_combined_format[21][7][2],\n+ uint8_t best_combined_format[21][7][2],\nint bits_available,\nquant_method& best_quant_level,\nquant_method& best_quant_level_mod,\n- int* best_formats\n+ uint8_t* best_formats\n) {\nint best_integer_count = 0;\nfloat best_integer_count_error = ERROR_CALC_DEFAULT;\n@@ -839,9 +839,9 @@ static float two_partitions_find_best_combination_for_bitcount(\n*/\nstatic void three_partitions_find_best_combination_for_every_quantization_and_integer_count(\nconst float best_error[3][21][4], // indexed by (partition, quant-level, integer-count)\n- const int best_format[3][21][4],\n+ const uint8_t best_format[3][21][4],\nfloat best_combined_error[21][10],\n- int best_combined_format[21][10][3]\n+ uint8_t best_combined_format[21][10][3]\n) {\nfor (int i = QUANT_2; i <= QUANT_256; i++)\n{\n@@ -902,11 +902,11 @@ static void three_partitions_find_best_combination_for_every_quantization_and_in\n*/\nstatic float three_partitions_find_best_combination_for_bitcount(\nconst float best_combined_error[21][10],\n- const int best_combined_format[21][10][3],\n+ const uint8_t best_combined_format[21][10][3],\nint bits_available,\nquant_method& best_quant_level,\nquant_method& best_quant_level_mod,\n- int* best_formats\n+ uint8_t* best_formats\n) {\nint best_integer_count = 0;\nfloat best_integer_count_error = ERROR_CALC_DEFAULT;\n@@ -964,9 +964,9 @@ static float three_partitions_find_best_combination_for_bitcount(\n*/\nstatic void four_partitions_find_best_combination_for_every_quantization_and_integer_count(\nconst float best_error[4][21][4], // indexed by (partition, quant-level, integer-count)\n- const int best_format[4][21][4],\n+ const uint8_t best_format[4][21][4],\nfloat best_combined_error[21][13],\n- int best_combined_format[21][13][4]\n+ uint8_t best_combined_format[21][13][4]\n) {\nfor (int i = QUANT_2; i <= QUANT_256; i++)\n{\n@@ -1038,11 +1038,11 @@ static void four_partitions_find_best_combination_for_every_quantization_and_int\n*/\nstatic float four_partitions_find_best_combination_for_bitcount(\nconst float best_combined_error[21][13],\n- const int best_combined_format[21][13][4],\n+ const uint8_t best_combined_format[21][13][4],\nint bits_available,\nquant_method& best_quant_level,\nquant_method& best_quant_level_mod,\n- int* best_formats\n+ uint8_t* best_formats\n) {\nint best_integer_count = 0;\nfloat best_integer_count_error = ERROR_CALC_DEFAULT;\n@@ -1102,7 +1102,7 @@ unsigned int compute_ideal_endpoint_formats(\nunsigned int start_block_mode,\nunsigned int end_block_mode,\n// output data\n- int partition_format_specifiers[TUNE_MAX_TRIAL_CANDIDATES][BLOCK_MAX_PARTITIONS],\n+ uint8_t 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],\nquant_method quant_level_mod[TUNE_MAX_TRIAL_CANDIDATES],\n@@ -1121,7 +1121,7 @@ unsigned int compute_ideal_endpoint_formats(\ncompute_encoding_choice_errors(blk, pi, ep, eci);\nfloat best_error[BLOCK_MAX_PARTITIONS][21][4];\n- int format_of_choice[BLOCK_MAX_PARTITIONS][21][4];\n+ uint8_t format_of_choice[BLOCK_MAX_PARTITIONS][21][4];\nfor (int i = 0; i < partition_count; i++)\n{\ncompute_color_error_for_every_integer_count_and_quant_level(\n@@ -1133,7 +1133,7 @@ unsigned int compute_ideal_endpoint_formats(\nfloat* errors_of_best_combination = tmpbuf.errors_of_best_combination;\nquant_method* best_quant_levels = tmpbuf.best_quant_levels;\nquant_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+ uint8_t (&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@@ -1188,7 +1188,7 @@ unsigned int compute_ideal_endpoint_formats(\nelse if (partition_count == 2)\n{\nfloat combined_best_error[21][7];\n- int formats_of_choice[21][7][2];\n+ uint8_t formats_of_choice[21][7][2];\ntwo_partitions_find_best_combination_for_every_quantization_and_integer_count(\nbest_error, format_of_choice, combined_best_error, formats_of_choice);\n@@ -1221,7 +1221,7 @@ unsigned int compute_ideal_endpoint_formats(\nelse if (partition_count == 3)\n{\nfloat combined_best_error[21][10];\n- int formats_of_choice[21][10][3];\n+ uint8_t formats_of_choice[21][10][3];\nthree_partitions_find_best_combination_for_every_quantization_and_integer_count(\nbest_error, format_of_choice, combined_best_error, formats_of_choice);\n@@ -1255,7 +1255,7 @@ unsigned int compute_ideal_endpoint_formats(\n{\nassert(partition_count == 4);\nfloat combined_best_error[21][13];\n- int formats_of_choice[21][13][4];\n+ uint8_t formats_of_choice[21][13][4];\nfour_partitions_find_best_combination_for_every_quantization_and_integer_count(\nbest_error, format_of_choice, combined_best_error, formats_of_choice);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Shrink best_ep_format type
|
61,745 |
12.06.2022 11:35:02
| -3,600 |
b38bd4169553b5a43a4a6753492f41a7b95d504d
|
Shrink size of best_quant working buffers
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1173,16 +1173,16 @@ struct alignas(ASTCENC_VECALIGN) compression_working_buffers\n*\n* For two planes, second plane starts at @c WEIGHTS_PLANE2_OFFSET offsets.\n*/\n- alignas(ASTCENC_VECALIGN) uint8_t dec_weights_uquant[WEIGHTS_MAX_BLOCK_MODES * BLOCK_MAX_WEIGHTS];\n+ uint8_t dec_weights_uquant[WEIGHTS_MAX_BLOCK_MODES * BLOCK_MAX_WEIGHTS];\n/** @brief Error of the best encoding combination for each block mode. */\nalignas(ASTCENC_VECALIGN) float errors_of_best_combination[WEIGHTS_MAX_BLOCK_MODES];\n/** @brief The best color quant for each block mode. */\n- alignas(ASTCENC_VECALIGN) quant_method best_quant_levels[WEIGHTS_MAX_BLOCK_MODES];\n+ uint8_t best_quant_levels[WEIGHTS_MAX_BLOCK_MODES];\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+ uint8_t best_quant_levels_mod[WEIGHTS_MAX_BLOCK_MODES];\n/** @brief The best endpoint format for each partition. */\nuint8_t best_ep_formats[WEIGHTS_MAX_BLOCK_MODES][BLOCK_MAX_PARTITIONS];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"new_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"diff": "@@ -677,7 +677,7 @@ static float one_partition_find_best_combination_for_bitcount(\nconst float best_combined_error[21][4],\nconst uint8_t best_combined_format[21][4],\nint bits_available,\n- quant_method& best_quant_level,\n+ uint8_t& best_quant_level,\nuint8_t& best_format\n) {\nint best_integer_count = 0;\n@@ -704,7 +704,7 @@ static float one_partition_find_best_combination_for_bitcount(\nint ql = quant_mode_table[best_integer_count + 1][bits_available];\n- best_quant_level = static_cast<quant_method>(ql);\n+ best_quant_level = static_cast<uint8_t>(ql);\nbest_format = FMT_LUMINANCE;\nif (ql >= QUANT_6)\n@@ -779,8 +779,8 @@ static float two_partitions_find_best_combination_for_bitcount(\nfloat best_combined_error[21][7],\nuint8_t best_combined_format[21][7][2],\nint bits_available,\n- quant_method& best_quant_level,\n- quant_method& best_quant_level_mod,\n+ uint8_t& best_quant_level,\n+ uint8_t& best_quant_level_mod,\nuint8_t* best_formats\n) {\nint best_integer_count = 0;\n@@ -808,8 +808,8 @@ static float two_partitions_find_best_combination_for_bitcount(\nint ql = quant_mode_table[best_integer_count][bits_available];\nint ql_mod = quant_mode_table[best_integer_count][bits_available + 2];\n- best_quant_level = static_cast<quant_method>(ql);\n- best_quant_level_mod = static_cast<quant_method>(ql_mod);\n+ best_quant_level = static_cast<uint8_t>(ql);\n+ best_quant_level_mod = static_cast<uint8_t>(ql_mod);\nif (ql >= QUANT_6)\n{\n@@ -904,8 +904,8 @@ static float three_partitions_find_best_combination_for_bitcount(\nconst float best_combined_error[21][10],\nconst uint8_t best_combined_format[21][10][3],\nint bits_available,\n- quant_method& best_quant_level,\n- quant_method& best_quant_level_mod,\n+ uint8_t& best_quant_level,\n+ uint8_t& best_quant_level_mod,\nuint8_t* best_formats\n) {\nint best_integer_count = 0;\n@@ -933,8 +933,8 @@ static float three_partitions_find_best_combination_for_bitcount(\nint ql = quant_mode_table[best_integer_count][bits_available];\nint ql_mod = quant_mode_table[best_integer_count][bits_available + 5];\n- best_quant_level = static_cast<quant_method>(ql);\n- best_quant_level_mod = static_cast<quant_method>(ql_mod);\n+ best_quant_level = static_cast<uint8_t>(ql);\n+ best_quant_level_mod = static_cast<uint8_t>(ql_mod);\nif (ql >= QUANT_6)\n{\n@@ -1040,8 +1040,8 @@ static float four_partitions_find_best_combination_for_bitcount(\nconst float best_combined_error[21][13],\nconst uint8_t best_combined_format[21][13][4],\nint bits_available,\n- quant_method& best_quant_level,\n- quant_method& best_quant_level_mod,\n+ uint8_t& best_quant_level,\n+ uint8_t& best_quant_level_mod,\nuint8_t* best_formats\n) {\nint best_integer_count = 0;\n@@ -1069,8 +1069,8 @@ static float four_partitions_find_best_combination_for_bitcount(\nint ql = quant_mode_table[best_integer_count][bits_available];\nint ql_mod = quant_mode_table[best_integer_count][bits_available + 8];\n- best_quant_level = static_cast<quant_method>(ql);\n- best_quant_level_mod = static_cast<quant_method>(ql_mod);\n+ best_quant_level = static_cast<uint8_t>(ql);\n+ best_quant_level_mod = static_cast<uint8_t>(ql_mod);\nif (ql >= QUANT_6)\n{\n@@ -1131,8 +1131,8 @@ unsigned int compute_ideal_endpoint_formats(\n}\nfloat* 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+ uint8_t* best_quant_levels = tmpbuf.best_quant_levels;\n+ uint8_t* best_quant_levels_mod = tmpbuf.best_quant_levels_mod;\nuint8_t (&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@@ -1340,8 +1340,8 @@ unsigned int compute_ideal_endpoint_formats(\nblock_mode[i] = best_error_weights[i];\n- quant_level[i] = best_quant_levels[best_error_weights[i]];\n- quant_level_mod[i] = best_quant_levels_mod[best_error_weights[i]];\n+ quant_level[i] = static_cast<quant_method>(best_quant_levels[best_error_weights[i]]);\n+ quant_level_mod[i] = static_cast<quant_method>(best_quant_levels_mod[best_error_weights[i]]);\nassert(quant_level[i] >= QUANT_6 && quant_level[i] <= QUANT_256);\nassert(quant_level_mod[i] >= QUANT_6 && quant_level_mod[i] <= QUANT_256);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Shrink size of best_quant working buffers
|
61,745 |
12.06.2022 11:51:04
| -3,600 |
a4599df0e80742cbcd416ee3805bc98f239d5645
|
Shrink qwt_bitcounts
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -432,7 +432,7 @@ static float compress_symbolic_block_for_partition_1plane(\nfloat* weight_low_value = tmpbuf.weight_low_value1;\nfloat* weight_high_value = tmpbuf.weight_high_value1;\n- int* qwt_bitcounts = tmpbuf.qwt_bitcounts;\n+ int8_t* qwt_bitcounts = tmpbuf.qwt_bitcounts;\nfloat* qwt_errors = tmpbuf.qwt_errors;\n// For each mode (which specifies a decimation and a quantization):\n@@ -474,8 +474,7 @@ static float compress_symbolic_block_for_partition_1plane(\nint decimation_mode = bm.decimation_mode;\nconst auto& di = bsd.get_decimation_info(decimation_mode);\n- qwt_bitcounts[i] = bitcount;\n-\n+ qwt_bitcounts[i] = static_cast<int8_t>(bitcount);\nalignas(ASTCENC_VECALIGN) float dec_weights_uquantf[BLOCK_MAX_WEIGHTS];\n@@ -810,7 +809,7 @@ static float compress_symbolic_block_for_partition_2planes(\nfloat* weight_low_value2 = tmpbuf.weight_low_value2;\nfloat* weight_high_value2 = tmpbuf.weight_high_value2;\n- int* qwt_bitcounts = tmpbuf.qwt_bitcounts;\n+ int8_t* qwt_bitcounts = tmpbuf.qwt_bitcounts;\nfloat* qwt_errors = tmpbuf.qwt_errors;\nunsigned int start_2plane = bsd.block_mode_count_1plane_selected;\n@@ -827,7 +826,7 @@ static float compress_symbolic_block_for_partition_2planes(\ncontinue;\n}\n- qwt_bitcounts[i] = 109 - bm.weight_bits;\n+ qwt_bitcounts[i] = static_cast<int8_t>(109 - bm.weight_bits);\nif (weight_high_value1[i] > 1.02f * min_wt_cutoff1)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1188,7 +1188,7 @@ struct alignas(ASTCENC_VECALIGN) compression_working_buffers\nuint8_t best_ep_formats[WEIGHTS_MAX_BLOCK_MODES][BLOCK_MAX_PARTITIONS];\n/** @brief The total bit storage needed for quantized weights for each block mode. */\n- int qwt_bitcounts[WEIGHTS_MAX_BLOCK_MODES];\n+ int8_t qwt_bitcounts[WEIGHTS_MAX_BLOCK_MODES];\n/** @brief The cumulative error for quantized weights for each block mode. */\nfloat qwt_errors[WEIGHTS_MAX_BLOCK_MODES];\n@@ -2223,7 +2223,7 @@ unsigned int compute_ideal_endpoint_formats(\nconst partition_info& pi,\nconst image_block& blk,\nconst endpoints& ep,\n- const int* qwt_bitcounts,\n+ const int8_t* qwt_bitcounts,\nconst float* qwt_errors,\nunsigned int tune_candidate_limit,\nunsigned int start_block_mode,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"new_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"diff": "@@ -1096,7 +1096,7 @@ unsigned int compute_ideal_endpoint_formats(\nconst image_block& blk,\nconst endpoints& ep,\n// bitcounts and errors computed for the various quantization methods\n- const int* qwt_bitcounts,\n+ const int8_t* qwt_bitcounts,\nconst float* qwt_errors,\nunsigned int tune_candidate_limit,\nunsigned int start_block_mode,\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Shrink qwt_bitcounts
|
61,745 |
13.06.2022 10:27:53
| -3,600 |
b6363198c36828ed2243c520f51d7023ef07b814
|
Update normal map documentation
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/Encoding.md",
"new_path": "Docs/Encoding.md",
"diff": "@@ -46,40 +46,40 @@ also a weakness (it reduces quality when compressing correlated signals).\n# ASTC Format Mapping\nThe main question which arises with the mapping of another format on to ASTC\n-is how to handle cases where the input isn't a 4 channel RGBA input. ASTC is a\n-container format which always decompresses in to a 4 channel RGBA result.\n+is how to handle cases where the input isn't a 4 component RGBA input. ASTC is\n+a container format which always decompresses in to a 4 component RGBA result.\nHowever, the internal compressed representation is very flexible and can store\n-1-4 channels as needed on a per-block basis.\n+1-4 components as needed on a per-block basis.\nTo get the best quality for a given bitrate, or the lowest bitrate for a given\n-quality, it is important that as few channels as possible are stored in the\n+quality, it is important that as few components as possible are stored in the\ninternal representation to avoid wasting coding space.\nSpecific optimizations in the ASTC coding scheme exist for:\n-* Encoding the RGB channels as a single luminance channel, so only a single\n+* Encoding the RGB components as a single luminance component, so only a single\nvalue needs to be stored in the coding instead of three.\n-* Encoding the A channel as a constant 1.0 value, so the coding doesn't\n+* Encoding the A component as a constant 1.0 value, so the coding doesn't\nactually need to store a per-pixel alpha value at all.\n... so mapping your inputs given to the compressor to hit these paths is\nreally important if you want to get the best output quality for your chosen\nbitrate.\n-## Encoding 1-4 channel data\n+## Encoding 1-4 component data\n-The table below shows the recommended channel usage for data with different\n-numbers of color channels present in the data.\n+The table below shows the recommended component usage for data with different\n+numbers of color components present in the data.\nThe coding swizzle should be applied when compressing an image. This can be\nhandled by the compressor when reading an uncompressed input image by\nspecifying the swizzle using the `-esw` command line option.\nThe sampling swizzle is what your should use in your shader programs to read\n-the data from the compressed texture, assuming no additional API-level channel\n-swizzling is specified by the application.\n+the data from the compressed texture, assuming no additional API-level\n+component swizzling is specified by the application.\n-| Input Channels | ASTC Endpoint | Coding Swizzle | Sampling Swizzle |\n+| Input components | ASTC Endpoint | Coding Swizzle | Sampling Swizzle |\n| -------------- | ------------- | -------------- | ------------------ |\n| 1 | L + 1 | `rrr1` | `.g` <sup>1</sup> |\n| 2 | L + A | `rrrg` | `.ga` <sup>1</sup> |\n@@ -88,13 +88,13 @@ swizzling is specified by the application.\n**1:** Sampling from `g` is preferred to sampling from `r` because it allows a\nsingle shader to be compatible with ASTC, BC1, or ETC formats. BC1 and ETC1\n-store color endpoints as RGB565 data, so the `g` channel will have higher\n+store color endpoints as RGB565 data, so the `g` component will have higher\nprecision. For ASTC it doesn't actually make any difference; the same single\n-channel luminance will be returned for all three of the `.rgb` channels.\n+component luminance will be returned for all three of the `.rgb` components.\n## Equivalence with other formats\n-Based on these channel encoding requirements we can now derive the the ASTC\n+Based on these component encoding requirements we can now derive the the ASTC\ncoding equivalents for most of the other texture compression formats in common\nuse today.\n@@ -115,12 +115,13 @@ use today.\n| ETC2+EAC | `rgba` | `.rgba` | |\n**1:** ASTC has no equivalent of the 1-bit punch-through alpha encoding\n-supported by BC1 or ETC2; if alpha is present it will be a full alpha channel.\n+supported by BC1 or ETC2; if alpha is present it will be a full alpha\n+component.\n**2:** ASTC relies on using the L+A color endpoint type for coding efficiency\n-for two channel data. It therefore has no direct equivalent of a two-plane\n-format sampled though the `.rg` channels such as BC5 or EAC_RG11. This can\n-be emulated by setting texture channel swizzles in the runtime API - e.g. via\n+for two component data. It therefore has no direct equivalent of a two-plane\n+format sampled though the `.rg` components such as BC5 or EAC_RG11. This can\n+be emulated by setting texture component swizzles in the runtime API - e.g. via\n`glTexParameteri()` for OpenGL ES - although it has been noted that API\ncontrolled swizzles are not available in WebGL.\n@@ -129,24 +130,25 @@ controlled swizzles are not available in WebGL.\nThis section outlines some of the other things to consider when encoding\ntextures using ASTC.\n-## Encoding non-correlated channels\n+## Encoding non-correlated components\n-Most other texture compression formats have a static channel assignment in\n+Most other texture compression formats have a static component assignment in\nterms of the expected data correlation. For example, ETC2+EAC assumes that RGB\nare always correlated and that alpha is non-correlated. ASTC can automatically\n-encode data as either fully correlated across all 4 channels, or with any one\n-channel assigned to a separate non-correlated partition to the other three.\n+encode data as either fully correlated across all 4 components, or with any one\n+component assigned to a separate non-correlated partition to the other three.\n-The non-correlated channel can be changed on a block-by-block basis, so the\n+The non-correlated component can be changed on a block-by-block basis, so the\ncompressor can dynamically adjust the coding based on the data present in the\nimage. This means that there is no need for non-correlated data to be stored\n-in a specific channel in the input image.\n+in a specific component in the input image.\n-It is however worth noting that the alpha channel is treated differently to\n-the RGB color channels in some circumstances:\n+It is however worth noting that the alpha component is treated differently to\n+the RGB color components in some circumstances:\n-* When coding for sRGB the alpha channel will always be stored in linear space.\n-* When coding for HDR the alpha channel can optionally be kept as LDR data.\n+* When coding for sRGB the alpha component will always be stored in linear\n+ space.\n+* When coding for HDR the alpha component can optionally be kept as LDR data.\n## Encoding normal maps\n@@ -155,21 +157,21 @@ BC5; store the X and Y components of a unit-length normal. The Z component of\nthe normal can be reconstructed in shader code based on the knowledge that the\nvector is unit length.\n-To encode this we therefore want to store two input channels and should\n-therefore use the `rrrg` coding swizzle, and the `.ga` sampling swizzle. The\n-OpenGL ES shader code for reconstruction of the Z value is:\n+To encode this we need to store only two input components in the compressed\n+data, and therefore use the `rrrg` coding swizzle to align the data with the\n+ASTC lumiance+alpha endpoint. We can sample this in shader code using the `.ga`\n+sampling swizzle, and reconstruct the Z value with:\nvec3 nml;\nnml.xy = texture(...).ga; // Load normals (range 0 to 1)\nnml.xy = nml.xy * 2.0 - 1.0; // Unpack normals (range -1 to +1)\nnml.z = sqrt(1 - dot(nml.xy, nml.xy)); // Compute Z, given unit length\n-In addition to this it is useful to optimize for angular error in the resulting\n-vector rather than for absolute color error in the data, which improves the\n-perceptual quality of the image.\n-\n-Both the encoding swizzle and the angular error function are enabled by using\n-the `-normal` command line option.\n+The encoding swizzle and appropriate component weighting is enabled by using\n+the `-normal` command line option. If you wish to use a different pair of\n+components you can specify a custom swizzle after setting the `-normal`\n+parameter. For example, to match BC5n component ordering use\n+`-normal -esw gggr` for compression and `-normmal -dsw arz1` for decompression.\n## Encoding sRGB data\n@@ -182,8 +184,8 @@ For color data it is nearly always a perceptual quality win to use sRGB input\nsource textures that are then compressed using the ASTC sRGB compression mode\n(compress using the `-cs` command line option rather than the `-cl` command\nline option). Note that sRGB gamma correction is only applied to the RGB\n-channels during decode; the alpha channel is always treated as linear encoded\n-data.\n+components during decode; the alpha component is always treated as linear\n+encoded data.\n*Important:* The uncompressed input texture provided on the command line must\nbe stored in the sRGB color space for `-cs` to function correctly.\n@@ -191,16 +193,16 @@ be stored in the sRGB color space for `-cs` to function correctly.\n## Encoding HDR data\nHDR data can be encoded just like LDR data, but with some caveats around\n-handling the alpha channel.\n+handling the alpha component.\n-For many use cases the alpha channel is an actual alpha opacity channel and is\n-therefore used for storing an LDR value between 0 and 1. For these cases use\n-the `-ch` compressor option which will treat the RGB channels as HDR, but the\n-A channel as LDR.\n+For many use cases the alpha component is an actual alpha opacity component and\n+is therefore used for storing an LDR value between 0 and 1. For these cases use\n+the `-ch` compressor option which will treat the RGB components as HDR, but the\n+A component as LDR.\n-For other use cases the alpha channel is simply a fourth data channel which is\n-also storing an HDR value. For these cases use the `-cH` compressor option\n-which will treat all channels as HDR data.\n+For other use cases the alpha component is simply a fourth data component which\n+is also storing an HDR value. For these cases use the `-cH` compressor option\n+which will treat all components as HDR data.\n- - -\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "@@ -175,6 +175,9 @@ COMPRESSION\nnml.xy = nml.xy * 2.0 - 1.0; // Unpack to [-1,1]\nnml.z = sqrt(1 - dot(nml.xy, nml.xy)); // Compute Z\n+ Alternative component swizzles can be set with -esw and -dsw\n+ parameters.\n+\n-rgbm <max>\nThe input texture is an RGBM encoded texture, storing values HDR\nvalues between 0 and <max> in an LDR container format with a\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update normal map documentation
|
61,745 |
20.06.2022 08:45:54
| -3,600 |
4e1e3009a48eff0bb366949666bded296a45e3fb
|
Remove NONE builds from release bundles
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -133,7 +133,7 @@ spec:\nexport CXX=clang++-9\nmkdir build_rel\ncd build_rel\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON -DPACKAGE=x64 ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DPACKAGE=x64 ..\nmake install package -j4\n'''\n}\n@@ -144,7 +144,7 @@ spec:\nexport CXX=clang++-9\nmkdir build_reldec\ncd build_reldec\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON -DDECOMPRESSOR=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DDECOMPRESSOR=ON ..\nmake -j4\n'''\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove NONE builds from release bundles
|
61,745 |
20.06.2022 14:30:52
| -3,600 |
7cb323e257c1b79b3e0c1d8becaf79ee98f64c3c
|
Change root directory so cmake can install into /usr/local/bin/
|
[
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "@@ -12,6 +12,7 @@ Scratch\nProto\n# Precompiled reference binaries for comparison tests\n+bin\nBinaries\n# Build artifacts\n"
},
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -30,7 +30,6 @@ set(CMAKE_CXX_STANDARD 14)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\nset(CMAKE_CXX_EXTENSIONS OFF)\nset(CMAKE_EXPORT_COMPILE_COMMANDS 1)\n-set(PACKAGE_ROOT astcenc)\ninclude(CTest)\n"
},
{
"change_type": "MODIFY",
"old_path": "Docs/Building.md",
"new_path": "Docs/Building.md",
"diff": "@@ -49,7 +49,7 @@ Once you have configured the build you can use NMake to compile the project\nfrom your build dir, and install to your target install directory.\n```shell\n-# Run a build and install build outputs in `${CMAKE_INSTALL_PREFIX}/astcenc/`\n+# Run a build and install build outputs in `${CMAKE_INSTALL_PREFIX}/bin/`\ncd build\nnmake install\n```\n@@ -109,7 +109,7 @@ Once you have configured the build you can use Make to compile the project from\nyour build dir, and install to your target install directory.\n```shell\n-# Run a build and install build outputs in `${CMAKE_INSTALL_PREFIX}/astcenc/`\n+# Run a build and install build outputs in `${CMAKE_INSTALL_PREFIX}/bin/`\ncd build\nmake install -j16\n```\n@@ -194,6 +194,11 @@ the CMake command line when configuring.\nWe support building a release bundle of all enabled binary configurations in\nthe current CMake configuration using the `package` build target\n+Configure CMake with:\n+\n+* `-DPACAKGE=<arch>` to set the package architecture/variant name used to name\n+ the package archive (not set by default).\n+\n```shell\n# Run a build and package build outputs in `./astcenc-<ver>-<os>-<arch>.<fmt>`\ncd build\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_image_sweep.py",
"new_path": "Test/astc_image_sweep.py",
"diff": "#!/usr/bin/env python3\n# SPDX-License-Identifier: Apache-2.0\n# -----------------------------------------------------------------------------\n-# Copyright 2021 Arm Limited\n+# Copyright 2021-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# under the License.\n# -----------------------------------------------------------------------------\n\"\"\"\n-A benchmarking sweep helper, which can genrate a performance-vs-quality sweep\n+A benchmarking sweep helper, which can generate a performance-vs-quality sweep\nfor a single input images. Like other test functionality, this uses structured\nimage directory layouts for determining image settings to pass to the codec.\n\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_minify_test.sh",
"new_path": "Test/astc_minify_test.sh",
"diff": "@@ -5,17 +5,17 @@ BAD=astcenc-avx2.exe\nBLOCK_SIZE=4x4\nQUALITY=-fastest\n-./astcenc/${GOOD} -tl in.png out-good.png ${BLOCK_SIZE} ${QUALITY} -silent\n+./bin/${GOOD} -tl in.png out-good.png ${BLOCK_SIZE} ${QUALITY} -silent\n-./astcenc/${BAD} -tl in.png out-bad.png ${BLOCK_SIZE} ${QUALITY} -silent\n+./bin/${BAD} -tl in.png out-bad.png ${BLOCK_SIZE} ${QUALITY} -silent\ncompare out-good.png out-bad.png out-vs-out-diff.png\ncompare in.png out-bad.png out-vs-in-diff.png\n-./astcenc/astc_test_autoextract ${BLOCK_SIZE} in.png out-good.png out-bad.png in-min.png\n+./bin/astc_test_autoextract ${BLOCK_SIZE} in.png out-good.png out-bad.png in-min.png\n-./astcenc/${GOOD} -tl in-min.png out-min-good.png ${BLOCK_SIZE} ${QUALITY} -silent\n+./bin/${GOOD} -tl in-min.png out-min-good.png ${BLOCK_SIZE} ${QUALITY} -silent\n-./astcenc/${BAD} -tl in-min.png out-min-bad.png ${BLOCK_SIZE} ${QUALITY} -silent\n+./bin/${BAD} -tl in-min.png out-min-bad.png ${BLOCK_SIZE} ${QUALITY} -silent\ncompare out-min-good.png out-min-bad.png out-min-diff.png\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_profile_valgrind.py",
"new_path": "Test/astc_profile_valgrind.py",
"diff": "@@ -110,7 +110,7 @@ def run_pass(image, noStartup, encoder, blocksize, quality):\nRaises:\nCalledProcessException: Any subprocess failed.\n\"\"\"\n- binary = \"./astcenc/astcenc-%s\" % encoder\n+ binary = \"./bin/astcenc-%s\" % encoder\nargs = [\"valgrind\", \"--tool=callgrind\", \"--callgrind-out-file=callgrind.txt\",\nbinary, \"-cl\", image, \"out.astc\", blocksize, quality, \"-j\", \"1\"]\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_quality_test.py",
"new_path": "Test/astc_quality_test.py",
"diff": "#!/usr/bin/env python3\n# SPDX-License-Identifier: Apache-2.0\n# -----------------------------------------------------------------------------\n-# Copyright 2021 Arm Limited\n+# Copyright 2021-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@@ -100,7 +100,7 @@ def main():\nfor _ in range(0, repeats):\ncommand = [\n- \"./astcenc/astcenc-avx2\",\n+ \"./bin/astcenc-avx2\",\n\"-tl\",\n\"./Test/Images/Kodak/LDR-RGB/ldr-rgb-kodak23.png\",\n\"/dev/null\",\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_competitive.py",
"new_path": "Test/astc_test_competitive.py",
"diff": "@@ -30,7 +30,7 @@ LOG_PATTERN = re.compile(r\"\\s*Coding rate:\\s*(.*)\\s*MT/s\")\nISPC_BIN = \"./Binaries/ISPC/ispc_astc.exe\"\nISPC_QUALITY = [\"rgba\", \"rgb\"]\n-ASTC_BIN = \"./astcenc/astcenc-avx2\"\n+ASTC_BIN = \"./bin/astcenc-avx2\"\nASTC_QUALITY = [\"0\", \"8\", \"10\", \"20\", \"30\", \"40\", \"50\", \"60\"]\nTEST_BLOCK_SIZES = [\"4x4\", \"6x6\", \"8x8\"]\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_update_ref.sh",
"new_path": "Test/astc_update_ref.sh",
"diff": "@@ -8,7 +8,7 @@ fi\necho \"Generating new ref-$1 results\"\nif [ \"$1\" = \"main\" ]; then\n- echo \"Using binary from ./astcenc/${1}/\"\n+ echo \"Using binary from ./bin/${1}/\"\nelse\necho \"Using binary from ./Binaries/${1}/\"\nfi\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/encoder.py",
"new_path": "Test/testlib/encoder.py",
"diff": "@@ -253,9 +253,9 @@ class Encoder2x(EncoderBase):\nname = \"astcenc-%s-%s\" % (variant, self.VERSION)\nif binary is None:\nif os.name == 'nt':\n- binary = \"./astcenc/astcenc-%s.exe\" % variant\n+ binary = \"./bin/astcenc-%s.exe\" % variant\nelse:\n- binary = \"./astcenc/astcenc-%s\" % variant\n+ binary = \"./bin/astcenc-%s\" % variant\nsuper().__init__(name, variant, binary)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Change root directory so cmake can install into /usr/local/bin/ (#347)
|
61,745 |
21.06.2022 19:51:35
| -3,600 |
6691d276c7ff3a160ca1cc4958957685b836946a
|
Change -array to -zdim
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -16,6 +16,8 @@ of larger changes to the heuristics used in the codec to find a more effective\ncost:quality trade off.\n* **General:**\n+ * **Change:** The `-array` option for specifying the number of volumetric\n+ image planes for ASTC 3D block compression been renamed to `-zdim`.\n* **Feature:** The `-a` alpha weighting option has been re-enabled in the\nbackend, and now again applies alpha scaling to the RGB error metrics when\nencoding. This is based on the maximum alpha in each block, not the\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -986,20 +986,20 @@ static int edit_astcenc_config(\nreturn 1;\n}\n}\n- // Option: Encode a 3D image from an array of 2D images.\n- else if (!strcmp(argv[argidx], \"-array\"))\n+ // Option: Encode a 3D image from a sequence of 2D images.\n+ else if (!strcmp(argv[argidx], \"-zdim\"))\n{\n// Only supports compressing\nif (!(operation & ASTCENC_STAGE_COMPRESS))\n{\n- printf(\"ERROR: -array switch is only valid for compression\\n\");\n+ printf(\"ERROR: -zdim switch is only valid for compression\\n\");\nreturn 1;\n}\n// Image depth must be specified.\nif (argidx + 2 > argc)\n{\n- printf(\"ERROR: -array switch with no argument\\n\");\n+ printf(\"ERROR: -zdim switch with no argument\\n\");\nreturn 1;\n}\nargidx++;\n@@ -1007,13 +1007,13 @@ static int edit_astcenc_config(\n// Read array size (image depth).\nif (!sscanf(argv[argidx], \"%u\", &cli_config.array_size) || cli_config.array_size == 0)\n{\n- printf(\"ERROR: -array size '%s' is invalid\\n\", argv[argidx]);\n+ printf(\"ERROR: -zdim size '%s' is invalid\\n\", argv[argidx]);\nreturn 1;\n}\nif ((cli_config.array_size > 1) && (config.block_z == 1))\n{\n- printf(\"ERROR: -array with 3D input data for a 2D output format\\n\");\n+ printf(\"ERROR: -zdim with 3D input data for a 2D output format\\n\");\nreturn 1;\n}\nargidx++;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "@@ -196,8 +196,8 @@ COMPRESSION\ntypically lowers the measured PSNR score. Perceptual methods are\ncurrently only available for normal maps and RGB color data.\n- -array <size>\n- Loads an array of <size> 2D image slices to use as a 3D image.\n+ -zdim <zdim>\n+ Load a sequence of <zdim> 2D image slices to use as a 3D image.\nThe input filename given is used is decorated with the postfix\n\"_<slice>\" to find the file to load. For example, an input named\n\"input.png\" would load as input_0.png, input_1.png, etc.\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1437,7 +1437,7 @@ class CLINTest(CLITestBase):\nself.binary, \"-cl\",\n\"./Test/Data/Tiles/ldr.png\",\nself.get_tmp_image_path(\"LDR\", \"comp\"),\n- \"3x3x3\", \"-fast\", \"-array\", \"3\"]\n+ \"3x3x3\", \"-fast\", \"-zdim\", \"3\"]\nself.exec(command)\n@@ -1550,7 +1550,7 @@ class CLINTest(CLITestBase):\nself.binary, \"-cl\",\n\"./Test/Data/Tiles/ldr.png\",\nself.get_tmp_image_path(\"LDR\", \"comp\"),\n- \"4x4\", \"-fast\", \"-array\", \"2\"]\n+ \"4x4\", \"-fast\", \"-zdim\", \"2\"]\nself.exec(command)\n@@ -1563,7 +1563,7 @@ class CLINTest(CLITestBase):\nself.binary, \"-cl\",\n\"./Test/Data/Tiles/ldr.png\",\nself.get_tmp_image_path(\"LDR\", \"comp\"),\n- \"4x4x4\", \"-fast\", \"-array\", \"2\"]\n+ \"4x4x4\", \"-fast\", \"-zdim\", \"2\"]\n# Run the command, incrementally omitting arguments\nself.exec_with_omit(command, 7)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Change -array to -zdim
|
61,745 |
21.06.2022 20:16:28
| -3,600 |
b2731fbc3dde0a8128368178ab7aac47b541531b
|
Document build dir change in ChangeLog
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -18,6 +18,9 @@ cost:quality trade off.\n* **General:**\n* **Change:** The `-array` option for specifying the number of volumetric\nimage planes for ASTC 3D block compression been renamed to `-zdim`.\n+ * **Change:** The build root package directory is now `bin` instead of\n+ `astcenc`, allowing the CMake install step to write binaries into\n+ `/usr/local/bin` if the user wishes to do so.\n* **Feature:** The `-a` alpha weighting option has been re-enabled in the\nbackend, and now again applies alpha scaling to the RGB error metrics when\nencoding. This is based on the maximum alpha in each block, not the\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Document build dir change in ChangeLog
|
61,745 |
21.06.2022 20:37:56
| -3,600 |
4182777bf3a2fe3d921967ac82856f7fb495bc9b
|
Add -ssw sampling swizzle
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -21,6 +21,13 @@ cost:quality trade off.\n* **Change:** The build root package directory is now `bin` instead of\n`astcenc`, allowing the CMake install step to write binaries into\n`/usr/local/bin` if the user wishes to do so.\n+ * **Feature:** A new `-ssw` option for specifying the shader sampling swizzle\n+ has been added as convenience alternative to the `-cw` option. This is\n+ needed to correct error weighting during compression if not all components\n+ are read in the shader. For example, to extract and compress two components\n+ from an RGBA input image, weighting the two components equally when\n+ sampling through .ra in the shader, use `-esw ggga -ssw ra`. In this\n+ example `-ssw ra` is equivalent to the alternative `-cw 1 0 0 1` encoding.\n* **Feature:** The `-a` alpha weighting option has been re-enabled in the\nbackend, and now again applies alpha scaling to the RGB error metrics when\nencoding. This is based on the maximum alpha in each block, not the\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -729,6 +729,60 @@ static int edit_astcenc_config(\ncli_config.swz_encode.b = swizzle_components[2];\ncli_config.swz_encode.a = swizzle_components[3];\n}\n+ else if (!strcmp(argv[argidx], \"-ssw\"))\n+ {\n+ argidx += 2;\n+ if (argidx > argc)\n+ {\n+ printf(\"ERROR: -ssw switch with no argument\\n\");\n+ return 1;\n+ }\n+\n+ int char_count = strlen(argv[argidx - 1]);\n+ if (char_count == 0)\n+ {\n+ printf(\"ERROR: -ssw pattern contains no characters\\n\");\n+ return 1;\n+ }\n+\n+ if (char_count > 4)\n+ {\n+ printf(\"ERROR: -ssw pattern contains more than 4 characters\\n\");\n+ return 1;\n+ }\n+\n+ bool found_r = false;\n+ bool found_g = false;\n+ bool found_b = false;\n+ bool found_a = false;\n+\n+ for (int i = 0; i < char_count; i++)\n+ {\n+ switch (argv[argidx - 1][i])\n+ {\n+ case 'r':\n+ found_r = true;\n+ break;\n+ case 'g':\n+ found_g = true;\n+ break;\n+ case 'b':\n+ found_b = true;\n+ break;\n+ case 'a':\n+ found_a = true;\n+ break;\n+ default:\n+ printf(\"ERROR: -ssw component '%c' is not valid\\n\", argv[argidx - 1][i]);\n+ return 1;\n+ }\n+ }\n+\n+ config.cw_r_weight = found_r ? 1.0f : 0.0f;\n+ config.cw_g_weight = found_g ? 1.0f : 0.0f;\n+ config.cw_b_weight = found_b ? 1.0f : 0.0f;\n+ config.cw_a_weight = found_a ? 1.0f : 0.0f;\n+ }\nelse if (!strcmp(argv[argidx], \"-dsw\"))\n{\nargidx += 2;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "@@ -385,33 +385,43 @@ ADVANCED COMPRESSION\n-------------\n-esw <swizzle>\n- Swizzle the color components before compression. The swizzle is\n- specified using a 4-character string, which defines the output\n- format ordering. The characters may be taken from the set\n- [rgba01], selecting either input color components or a literal\n- zero or one. For example to swap the RG components, and replace\n- alpha with 1, the swizzle 'grb1' should be used.\n+ Specify an encoding swizzle to reorder the color components\n+ before compression. The swizzle is specified using a four\n+ character string, which defines the format ordering used by\n+ the compressor.\n- The input swizzle takes place before any compression, and all\n- error weighting applied using the -cw option is applied to the\n- post-swizzle component ordering.\n+ The characters may be taken from the set [rgba01], selecting\n+ either input color components or a literal zero or one. For\n+ example to swap the RG components, and replace alpha with 1,\n+ the swizzle 'grb1' should be used.\nBy default all 4 post-swizzle components are included in the\n- error metrics during compression. When using -esw to map two\n+ compression error metrics. When using -esw to map two\ncomponent data to the L+A endpoint (e.g. -esw rrrg) the\nluminance data stored in the RGB components will be weighted 3\ntimes more strongly than the alpha component. This can be\n- corrected using the -cw option to zero the weights of unused\n- components; e.g. using -cw 1 0 0 1.\n+ corrected using the -ssw option to specify which components\n+ will be sampled at runtime e.g. -ssw ra.\n+\n+ -ssw <swizzle>\n+ Specify a sampling swizzle to identify which color components\n+ are actually read by the application shader program. For example,\n+ using -ssw ra tells the compressor that the green and blue error\n+ does not matter because the data is not actually read.\n+\n+ The sampling swizzle is based on the channel ordering after the\n+ -esw transform has been applied. Note -ssw exposes the same\n+ functionality as -cw, but in a more user-friendly form.\n-dsw <swizzle>\n- Swizzle the color components after decompression. The swizzle is\n- specified using the same method as the -esw option, with support\n- for an additional \"z\" character. This is used to specify that\n- the compressed data stores an X+Y normal map, and that the Z\n- output component should be reconstructed from the two components\n- stored in the data. For the typical ASTC normal encoding, which\n- uses an 'rrrg' compression swizzle, you should specify an 'raz1'\n+ Specify a decompression swizzle used to reorder the color\n+ components after decompression. The swizzle is specified using\n+ the same method as the -esw option, with support for an extra\n+ \"z\" character. This is used to specify that the compressed data\n+ stores an X+Y normal map, and that the Z output component\n+ should be reconstructed from the two components stored in the\n+ data. For the typical ASTC normal encoding, which uses an\n+ 'rrrg' compression swizzle, you should specify an 'raz1'\nswizzle for decompression.\n-yflip\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1885,6 +1885,50 @@ class CLINTest(CLITestBase):\ncommand[blockIndex] = badSwizzle\nself.exec(command)\n+ def test_cl_ssw_missing_args(self):\n+ \"\"\"\n+ Test -cl with -ssw and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-ssw\", \"rgba\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_ssw_invalid_swizzle(self):\n+ \"\"\"\n+ Test -cl with -ssw and invalid swizzles.\n+ \"\"\"\n+ badSwizzles = [\n+ \"\", # Short swizzles\n+ \"rrrrr\", # Long swizzles\n+ ]\n+\n+ # Create swizzles with all invalid printable ascii codes\n+ good = [\"r\", \"g\", \"b\", \"a\"]\n+ for channel in string.printable:\n+ if channel not in good:\n+ badSwizzles.append(channel * 4)\n+\n+ # Build a valid base command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-ssw\", \"rgba\"]\n+\n+ blockIndex = command.index(\"rgba\")\n+ for badSwizzle in badSwizzles:\n+ with self.subTest(swizzle=badSwizzle):\n+ command[blockIndex] = badSwizzle\n+ self.exec(command)\n+\ndef test_dl_dsw_missing_args(self):\n\"\"\"\nTest -dl with -dsw and missing arguments.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add -ssw sampling swizzle
|
61,745 |
27.06.2022 11:37:41
| -3,600 |
ac3d10c18597569c809c49f8288600bc73e9a8da
|
Use size_t for strlen result
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -738,7 +738,7 @@ static int edit_astcenc_config(\nreturn 1;\n}\n- int char_count = strlen(argv[argidx - 1]);\n+ size_t char_count = strlen(argv[argidx - 1]);\nif (char_count == 0)\n{\nprintf(\"ERROR: -ssw pattern contains no characters\\n\");\n@@ -756,7 +756,7 @@ static int edit_astcenc_config(\nbool found_b = false;\nbool found_a = false;\n- for (int i = 0; i < char_count; i++)\n+ for (size_t i = 0; i < char_count; i++)\n{\nswitch (argv[argidx - 1][i])\n{\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use size_t for strlen result
|
61,745 |
27.06.2022 13:25:48
| -3,600 |
f9d40db31c89c02fa691aabaf8ea931a6ca2fd5d
|
Remove astcenc-none from release test list
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_image.py",
"new_path": "Test/astc_test_image.py",
"diff": "@@ -294,8 +294,8 @@ def parse_command_line():\n# All test encoders\ntestcoders = [\"none\", \"neon\", \"sse2\", \"sse4.1\", \"avx2\", \"native\"]\n- testcodersAArch64 = [\"none\", \"neon\"]\n- testcodersX86 = [\"none\", \"sse2\", \"sse4.1\", \"avx2\"]\n+ testcodersAArch64 = [\"neon\"]\n+ testcodersX86 = [\"sse2\", \"sse4.1\", \"avx2\"]\ncoders = refcoders + testcoders + [\"all-aarch64\", \"all-x86\"]\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/nightly.Jenkinsfile",
"new_path": "jenkins/nightly.Jenkinsfile",
"diff": "@@ -101,6 +101,7 @@ pipeline {\npython3 ./Test/astc_test_functional.py --encoder=sse2\npython3 ./Test/astc_test_functional.py --encoder=sse4.1\npython3 ./Test/astc_test_functional.py --encoder=avx2\n+ python3 ./Test/astc_test_image.py --encoder=none --test-set Small --test-quality medium\npython3 ./Test/astc_test_image.py --encoder=all-x86 --test-set Small --test-quality medium\n'''\ndir('build_rel') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove astcenc-none from release test list
|
61,745 |
16.07.2022 00:09:52
| -3,600 |
bea3f861272fb1a1faa86ff10d49aa7c8323d6a4
|
Enable fp-contract=fast for all NO_INVARIANCE builds
|
[
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -167,6 +167,10 @@ macro(astcenc_set_properties NAME)\ntarget_compile_definitions(${NAME}\nPRIVATE\nASTCENC_NO_INVARIANCE=1)\n+\n+ target_compile_options(${NAME}\n+ PRIVATE\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-ffp-contract=fast>)\nendif()\nif(${CLI})\n@@ -273,8 +277,7 @@ macro(astcenc_set_properties NAME)\nif(${NO_INVARIANCE})\ntarget_compile_options(${NAME}\nPRIVATE\n- $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mfma>\n- $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-ffp-contract=fast>)\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mfma>)\nendif()\nendif()\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Enable fp-contract=fast for all NO_INVARIANCE builds
|
61,745 |
16.07.2022 00:15:54
| -3,600 |
f2a5e781f798d2c2c77367bc7ae828f46f33d481
|
Update NO_INVARIANCE change log entry
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -40,9 +40,10 @@ cost:quality trade off.\n`cl.exe` and `clangcl.exe` compilers.\n* **Feature:** The core codec now supports arm64 for both MSVC `cl.exe` and\n`clangcl.exe` compilers.\n- * **Feature:** `NO_INVARIANCE` builds with AVX2 will enable `-mfma` and\n- `-ffp-contract=fast` when using Clang or GCC. This reduces image quality\n- by up to 0.2dB (normally much less), but improves performance by 10-15%.\n+ * **Feature:** `NO_INVARIANCE` builds will enable the `-ffp-contract=fast`\n+ option for all targets when using Clang or GCC. In addition AVX2 targets\n+ will also set the `-mfma` option. This reduces image quality by up to 0.2dB\n+ (normally much less), but improves performance by up to 5-20%.\n* **Optimization:** Angular endpoint min/max weight selection is restricted\nto weight `QUANT_11` or lower. Higher quantization levels assume default\n0-1 range, which is less accurate but much faster.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update NO_INVARIANCE change log entry
|
61,745 |
17.07.2022 09:45:32
| -3,600 |
4dc54929cfa8d01859e619c3d66ad83f91d25f72
|
Typo fix in build files
|
[
{
"change_type": "MODIFY",
"old_path": "Source/CMakeLists.txt",
"new_path": "Source/CMakeLists.txt",
"diff": "@@ -37,13 +37,13 @@ if(${UNIVERSAL_BUILD})\nendif()\ninclude(cmake_core.cmake)\nelse()\n- set(ARTEFACTS native none neon avx2 sse4.1 sse2)\n+ set(ARTIFACTS native none neon avx2 sse4.1 sse2)\nset(CONFIGS ${ISA_NATIVE} ${ISA_NONE} ${ISA_NEON} ${ISA_AVX2} ${ISA_SSE41} ${ISA_SSE2})\n- list(LENGTH ARTEFACTS ARTEFACTS_LEN)\n- math(EXPR ARTEFACTS_LEN \"${ARTEFACTS_LEN} - 1\")\n+ list(LENGTH ARTIFACTS ARTIFACTS_LEN)\n+ math(EXPR ARTIFACTS_LEN \"${ARTIFACTS_LEN} - 1\")\n- foreach(INDEX RANGE ${ARTEFACTS_LEN})\n- list(GET ARTEFACTS ${INDEX} ARTEFACT)\n+ foreach(INDEX RANGE ${ARTIFACTS_LEN})\n+ list(GET ARTIFACTS ${INDEX} ARTEFACT)\nlist(GET CONFIGS ${INDEX} CONFIG)\nif(${CONFIG})\nset(ISA_SIMD ${ARTEFACT})\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/UnitTest/CMakeLists.txt",
"new_path": "Source/UnitTest/CMakeLists.txt",
"diff": "@@ -25,13 +25,13 @@ if(${UNIVERSAL_BUILD})\nendif()\ninclude(cmake_core.cmake)\nelse()\n- set(ARTEFACTS native none neon avx2 sse4.1 sse2)\n+ set(ARTIFACTS native none neon avx2 sse4.1 sse2)\nset(CONFIGS ${ISA_NATIVE} ${ISA_NONE} ${ISA_NEON} ${ISA_AVX2} ${ISA_SSE41} ${ISA_SSE2})\n- list(LENGTH ARTEFACTS ARTEFACTS_LEN)\n- math(EXPR ARTEFACTS_LEN \"${ARTEFACTS_LEN} - 1\")\n+ list(LENGTH ARTIFACTS ARTIFACTS_LEN)\n+ math(EXPR ARTIFACTS_LEN \"${ARTIFACTS_LEN} - 1\")\n- foreach(INDEX RANGE ${ARTEFACTS_LEN})\n- list(GET ARTEFACTS ${INDEX} ARTEFACT)\n+ foreach(INDEX RANGE ${ARTIFACTS_LEN})\n+ list(GET ARTIFACTS ${INDEX} ARTEFACT)\nlist(GET CONFIGS ${INDEX} CONFIG)\nif(${CONFIG})\nset(ISA_SIMD ${ARTEFACT})\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Typo fix in build files
|
61,745 |
17.07.2022 10:00:38
| -3,600 |
cdb7b5886c4efa7148359f8d2aefa815d203d105
|
Typo fixes in Markdown
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/Encoding.md",
"new_path": "Docs/Encoding.md",
"diff": "@@ -159,8 +159,8 @@ vector is unit length.\nTo encode this we need to store only two input components in the compressed\ndata, and therefore use the `rrrg` coding swizzle to align the data with the\n-ASTC lumiance+alpha endpoint. We can sample this in shader code using the `.ga`\n-sampling swizzle, and reconstruct the Z value with:\n+ASTC luminance+alpha endpoint. We can sample this in shader code using the\n+`.ga` sampling swizzle, and reconstruct the Z value with:\nvec3 nml;\nnml.xy = texture(...).ga; // Load normals (range 0 to 1)\n@@ -171,7 +171,7 @@ The encoding swizzle and appropriate component weighting is enabled by using\nthe `-normal` command line option. If you wish to use a different pair of\ncomponents you can specify a custom swizzle after setting the `-normal`\nparameter. For example, to match BC5n component ordering use\n-`-normal -esw gggr` for compression and `-normmal -dsw arz1` for decompression.\n+`-normal -esw gggr` for compression and `-normal -dsw arz1` for decompression.\n## Encoding sRGB data\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Typo fixes in Markdown
|
61,745 |
17.07.2022 10:12:50
| -3,600 |
3247ee08f19a8c96b62953a216916c7728f8a804
|
Remove redundant block_mode setting
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -1423,8 +1423,6 @@ END_OF_TESTS:\n#endif\nscb.block_type = SYM_BTYPE_CONST_U16;\n- // TODO: Replace these block modes with symbolic values\n- scb.block_mode = static_cast<uint16_t>(-2);\nvfloat4 color_f32 = clamp(0.0f, 1.0f, blk.origin_texel) * 65535.0f;\nvint4 color_u16 = float_to_int_rtn(color_f32);\nstore(color_u16, scb.constant_color);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove redundant block_mode setting
|
61,745 |
17.07.2022 10:30:01
| -3,600 |
93879d3071dd8c8a84d84dfc51d8c723aa1cdec8
|
Minimize zeroed memory range
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"new_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"diff": "@@ -1135,18 +1135,17 @@ unsigned int compute_ideal_endpoint_formats(\nuint8_t* best_quant_levels_mod = tmpbuf.best_quant_levels_mod;\nuint8_t (&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- const unsigned int packed_end_block_mode = round_up_to_simd_multiple_vla(end_block_mode);\n-\n- // TODO: Can we avoid this?\n- for (unsigned int i = 0; i < start_block_mode; i++)\n+ // Ensure that the first iteration understep contains data that will never be picked\n+ unsigned int packed_start_block_mode = round_down_to_simd_multiple_vla(start_block_mode);\n+ for (unsigned int i = packed_start_block_mode; i < start_block_mode; i++)\n{\nerrors_of_best_combination[i] = ERROR_CALC_DEFAULT;\nbest_quant_levels[i] = QUANT_2;\nbest_quant_levels_mod[i] = QUANT_2;\n}\n+ // Ensure that last iteration overstep contains data that will never be picked\n+ const unsigned int packed_end_block_mode = round_up_to_simd_multiple_vla(end_block_mode);\nfor (unsigned int i = end_block_mode; i < packed_end_block_mode; i++)\n{\nerrors_of_best_combination[i] = ERROR_CALC_DEFAULT;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Minimize zeroed memory range
|
61,745 |
19.07.2022 21:59:29
| -3,600 |
a87b1f2dfe8e7b3c4b3d8b266f095c2255ee7ed8
|
Remove unused scalar bilinear_infill
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1973,48 +1973,6 @@ void compute_quantized_weights_for_decimation(\nuint8_t* dec_weight_uquant,\nquant_method quant_level);\n-/**\n- * @brief Compute the infilled weight for a texel index in a decimated grid.\n- *\n- * @param di The weight grid decimation to use.\n- * @param weights The decimated weight values to use.\n- * @param index The texel index to interpolate.\n- *\n- * @return The interpolated weight for the given texel.\n- */\n-static inline float bilinear_infill(\n- const decimation_info& di,\n- const float* weights,\n- unsigned int index\n-) {\n- return (weights[di.texel_weights_4t[0][index]] * di.texel_weights_float_4t[0][index] +\n- weights[di.texel_weights_4t[1][index]] * di.texel_weights_float_4t[1][index]) +\n- (weights[di.texel_weights_4t[2][index]] * di.texel_weights_float_4t[2][index] +\n- weights[di.texel_weights_4t[3][index]] * di.texel_weights_float_4t[3][index]);\n-}\n-\n-/**\n- * @brief Compute the infilled weight for a texel index in a decimated grid.\n- *\n- * This is specialized version which computes only two weights per texel for\n- * encodings that are only decimated in a single axis.\n- *\n- * @param di The weight grid decimation to use.\n- * @param weights The decimated weight values to use.\n- * @param index The texel index to interpolate.\n- *\n- * @return The interpolated weight for the given texel.\n- */\n-static inline float bilinear_infill_2(\n- const decimation_info& di,\n- const float* weights,\n- unsigned int index\n-) {\n- return (weights[di.texel_weights_4t[0][index]] * di.texel_weights_float_4t[0][index] +\n- weights[di.texel_weights_4t[1][index]] * di.texel_weights_float_4t[1][index]);\n-}\n-\n-\n/**\n* @brief Compute the infilled weight for N texel indices in a decimated grid.\n*\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove unused scalar bilinear_infill
|
61,745 |
19.07.2022 22:03:02
| -3,600 |
3100e241602f007d791b27a7ffac8050e6da0147
|
Move bilinear infill out of header
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "#include \"astcenc_internal.h\"\n#include \"astcenc_vecmathlib.h\"\n+/**\n+ * @brief Compute the infilled weight for N texel indices in a decimated grid.\n+ *\n+ * @param di The weight grid decimation to use.\n+ * @param weights The decimated weight values to use.\n+ * @param index The first texel index to interpolate.\n+ *\n+ * @return The interpolated weight for the given set of SIMD_WIDTH texels.\n+ */\n+static vfloat bilinear_infill_vla(\n+ const decimation_info& di,\n+ const float* weights,\n+ unsigned int index\n+) {\n+ // Load the bilinear filter texel weight indexes in the decimated grid\n+ vint weight_idx0 = vint(di.texel_weights_4t[0] + index);\n+ vint weight_idx1 = vint(di.texel_weights_4t[1] + index);\n+ vint weight_idx2 = vint(di.texel_weights_4t[2] + index);\n+ vint weight_idx3 = vint(di.texel_weights_4t[3] + index);\n+\n+ // Load the bilinear filter weights from the decimated grid\n+ vfloat weight_val0 = gatherf(weights, weight_idx0);\n+ vfloat weight_val1 = gatherf(weights, weight_idx1);\n+ vfloat weight_val2 = gatherf(weights, weight_idx2);\n+ vfloat weight_val3 = gatherf(weights, weight_idx3);\n+\n+ // Load the weight contribution factors for each decimated weight\n+ vfloat tex_weight_float0 = loada(di.texel_weights_float_4t[0] + index);\n+ vfloat tex_weight_float1 = loada(di.texel_weights_float_4t[1] + index);\n+ vfloat tex_weight_float2 = loada(di.texel_weights_float_4t[2] + index);\n+ vfloat tex_weight_float3 = loada(di.texel_weights_float_4t[3] + index);\n+\n+ // Compute the bilinear interpolation to generate the per-texel weight\n+ return (weight_val0 * tex_weight_float0 + weight_val1 * tex_weight_float1) +\n+ (weight_val2 * tex_weight_float2 + weight_val3 * tex_weight_float3);\n+}\n+\n+/**\n+ * @brief Compute the infilled weight for N texel indices in a decimated grid.\n+ *\n+ * This is specialized version which computes only two weights per texel for\n+ * encodings that are only decimated in a single axis.\n+ *\n+ * @param di The weight grid decimation to use.\n+ * @param weights The decimated weight values to use.\n+ * @param index The first texel index to interpolate.\n+ *\n+ * @return The interpolated weight for the given set of SIMD_WIDTH texels.\n+ */\n+static vfloat bilinear_infill_vla_2(\n+ const decimation_info& di,\n+ const float* weights,\n+ unsigned int index\n+) {\n+ // Load the bilinear filter texel weight indexes in the decimated grid\n+ vint weight_idx0 = vint(di.texel_weights_4t[0] + index);\n+ vint weight_idx1 = vint(di.texel_weights_4t[1] + index);\n+\n+ // Load the bilinear filter weights from the decimated grid\n+ vfloat weight_val0 = gatherf(weights, weight_idx0);\n+ vfloat weight_val1 = gatherf(weights, weight_idx1);\n+\n+ // Load the weight contribution factors for each decimated weight\n+ vfloat tex_weight_float0 = loada(di.texel_weights_float_4t[0] + index);\n+ vfloat tex_weight_float1 = loada(di.texel_weights_float_4t[1] + index);\n+\n+ // Compute the bilinear interpolation to generate the per-texel weight\n+ return (weight_val0 * tex_weight_float0 + weight_val1 * tex_weight_float1);\n+}\n+\n/**\n* @brief Compute the ideal endpoints and weights for 1 color component.\n*\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1973,76 +1973,6 @@ void compute_quantized_weights_for_decimation(\nuint8_t* dec_weight_uquant,\nquant_method quant_level);\n-/**\n- * @brief Compute the infilled weight for N texel indices in a decimated grid.\n- *\n- * @param di The weight grid decimation to use.\n- * @param weights The decimated weight values to use.\n- * @param index The first texel index to interpolate.\n- *\n- * @return The interpolated weight for the given set of SIMD_WIDTH texels.\n- */\n-static inline vfloat bilinear_infill_vla(\n- const decimation_info& di,\n- const float* weights,\n- unsigned int index\n-) {\n- // Load the bilinear filter texel weight indexes in the decimated grid\n- vint weight_idx0 = vint(di.texel_weights_4t[0] + index);\n- vint weight_idx1 = vint(di.texel_weights_4t[1] + index);\n- vint weight_idx2 = vint(di.texel_weights_4t[2] + index);\n- vint weight_idx3 = vint(di.texel_weights_4t[3] + index);\n-\n- // Load the bilinear filter weights from the decimated grid\n- vfloat weight_val0 = gatherf(weights, weight_idx0);\n- vfloat weight_val1 = gatherf(weights, weight_idx1);\n- vfloat weight_val2 = gatherf(weights, weight_idx2);\n- vfloat weight_val3 = gatherf(weights, weight_idx3);\n-\n- // Load the weight contribution factors for each decimated weight\n- vfloat tex_weight_float0 = loada(di.texel_weights_float_4t[0] + index);\n- vfloat tex_weight_float1 = loada(di.texel_weights_float_4t[1] + index);\n- vfloat tex_weight_float2 = loada(di.texel_weights_float_4t[2] + index);\n- vfloat tex_weight_float3 = loada(di.texel_weights_float_4t[3] + index);\n-\n- // Compute the bilinear interpolation to generate the per-texel weight\n- return (weight_val0 * tex_weight_float0 + weight_val1 * tex_weight_float1) +\n- (weight_val2 * tex_weight_float2 + weight_val3 * tex_weight_float3);\n-}\n-\n-/**\n- * @brief Compute the infilled weight for N texel indices in a decimated grid.\n- *\n- * This is specialized version which computes only two weights per texel for\n- * encodings that are only decimated in a single axis.\n- *\n- * @param di The weight grid decimation to use.\n- * @param weights The decimated weight values to use.\n- * @param index The first texel index to interpolate.\n- *\n- * @return The interpolated weight for the given set of SIMD_WIDTH texels.\n- */\n-static inline vfloat bilinear_infill_vla_2(\n- const decimation_info& di,\n- const float* weights,\n- unsigned int index\n-) {\n- // Load the bilinear filter texel weight indexes in the decimated grid\n- vint weight_idx0 = vint(di.texel_weights_4t[0] + index);\n- vint weight_idx1 = vint(di.texel_weights_4t[1] + index);\n-\n- // Load the bilinear filter weights from the decimated grid\n- vfloat weight_val0 = gatherf(weights, weight_idx0);\n- vfloat weight_val1 = gatherf(weights, weight_idx1);\n-\n- // Load the weight contribution factors for each decimated weight\n- vfloat tex_weight_float0 = loada(di.texel_weights_float_4t[0] + index);\n- vfloat tex_weight_float1 = loada(di.texel_weights_float_4t[1] + index);\n-\n- // Compute the bilinear interpolation to generate the per-texel weight\n- return (weight_val0 * tex_weight_float0 + weight_val1 * tex_weight_float1);\n-}\n-\n/**\n* @brief Compute the error of a decimated weight set for 1 plane.\n*\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Move bilinear infill out of header
|
61,745 |
19.07.2022 22:07:11
| -3,600 |
8a047db178c4e1a66092ce1220b97f89a89844d6
|
Defensive avoid NaN
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -160,7 +160,7 @@ static void compute_ideal_colors_and_weights_1_comp(\nhighvalue = astc::max(value, highvalue);\n}\n- if (highvalue < lowvalue)\n+ if (highvalue <= lowvalue)\n{\nlowvalue = 0.0f;\nhighvalue = 1e-7f;\n@@ -292,7 +292,7 @@ static void compute_ideal_colors_and_weights_2_comp(\n// It is possible for a uniform-color partition to produce length=0;\n// this causes NaN issues so set to small value to avoid this problem\n- if (highparam < lowparam)\n+ if (highparam <= lowparam)\n{\nlowparam = 0.0f;\nhighparam = 1e-7f;\n@@ -441,7 +441,7 @@ static void compute_ideal_colors_and_weights_3_comp(\n// It is possible for a uniform-color partition to produce length=0;\n// this causes NaN issues so set to small value to avoid this problem\n- if (highparam < lowparam)\n+ if (highparam <= lowparam)\n{\nlowparam = 0.0f;\nhighparam = 1e-7f;\n@@ -563,7 +563,7 @@ static void compute_ideal_colors_and_weights_4_comp(\n// It is possible for a uniform-color partition to produce length=0;\n// this causes NaN issues so set to small value to avoid this problem\n- if (highparam < lowparam)\n+ if (highparam <= lowparam)\n{\nlowparam = 0.0f;\nhighparam = 1e-7f;\n@@ -1001,7 +1001,7 @@ void compute_quantized_weights_for_decimation(\n// Quantize the weight set using both the specified low/high bounds and standard 0..1 bounds\n// TODO: Oddity to investigate; triggered by test in issue #265.\n- if (high_bound < low_bound)\n+ if (high_bound <= low_bound)\n{\nlow_bound = 0.0f;\nhigh_bound = 1.0f;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Defensive avoid NaN
|
61,745 |
22.07.2022 09:11:07
| -3,600 |
a3c300694cbd94d2b71be9944d1bd6b70d901e31
|
Update README.md for 4.0 release
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -58,7 +58,7 @@ from 0.89 bits/pixel up to 8 bits/pixel.\nRelease build binaries for the `astcenc` stable releases are provided in the\n[GitHub Releases page][3].\n-**Latest 4.x stable release:** TBD\n+**Latest 4.x stable release:** 4.0\n* Change log: [4.x series](./Docs/ChangeLog-4x.md)\n**Latest 3.x stable release:** 3.7\n@@ -90,7 +90,8 @@ For Apple silicon macOS devices we provide:\nThe `main` branch is an active development branch for the compressor. It aims\nto be a stable branch for the latest major release series, but as it is used\n-for ongoing development expect it to have some volatility.\n+for ongoing development expect it to have some volatility. We recommend using\n+the latest stable release tag for production development.\nThe `2.x` and `3.x` branches are a stable branches for the 2.x and 3.x release\nseries. They are no longer under active development, but are supported branches\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update README.md for 4.0 release
|
61,745 |
22.07.2022 09:17:30
| -3,600 |
f6236cf158a877b3279a2090dbea5e9a4c105d64
|
Update changelog for 4.0
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-3x.md",
"new_path": "Docs/ChangeLog-3x.md",
"diff": "@@ -299,10 +299,6 @@ Key for charts:\n* Color = block size (see legend).\n* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).\n-**Absolute performance vs 2.5 release:**\n-\n-\n-\n**Relative performance vs 2.5 release:**\n\n"
},
{
"change_type": "DELETE",
"old_path": "Docs/ChangeLogImg/absolute-1.7-to-2.0.png",
"new_path": "Docs/ChangeLogImg/absolute-1.7-to-2.0.png",
"diff": "Binary files a/Docs/ChangeLogImg/absolute-1.7-to-2.0.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Docs/ChangeLogImg/absolute-2.0-to-2.1.png",
"new_path": "Docs/ChangeLogImg/absolute-2.0-to-2.1.png",
"diff": "Binary files a/Docs/ChangeLogImg/absolute-2.0-to-2.1.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Docs/ChangeLogImg/absolute-2.1-to-2.2.png",
"new_path": "Docs/ChangeLogImg/absolute-2.1-to-2.2.png",
"diff": "Binary files a/Docs/ChangeLogImg/absolute-2.1-to-2.2.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Docs/ChangeLogImg/absolute-2.2-to-2.3.png",
"new_path": "Docs/ChangeLogImg/absolute-2.2-to-2.3.png",
"diff": "Binary files a/Docs/ChangeLogImg/absolute-2.2-to-2.3.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Docs/ChangeLogImg/absolute-2.5-to-3.0.png",
"new_path": "Docs/ChangeLogImg/absolute-2.5-to-3.0.png",
"diff": "Binary files a/Docs/ChangeLogImg/absolute-2.5-to-3.0.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Docs/ChangeLogImg/relative-1.7-to-2.0.png",
"new_path": "Docs/ChangeLogImg/relative-1.7-to-2.0.png",
"diff": "Binary files a/Docs/ChangeLogImg/relative-1.7-to-2.0.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Docs/ChangeLogImg/relative-2.0-to-2.1.png",
"new_path": "Docs/ChangeLogImg/relative-2.0-to-2.1.png",
"diff": "Binary files a/Docs/ChangeLogImg/relative-2.0-to-2.1.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Docs/ChangeLogImg/relative-2.1-to-2.2.png",
"new_path": "Docs/ChangeLogImg/relative-2.1-to-2.2.png",
"diff": "Binary files a/Docs/ChangeLogImg/relative-2.1-to-2.2.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Docs/ChangeLogImg/relative-2.2-to-2.3.png",
"new_path": "Docs/ChangeLogImg/relative-2.2-to-2.3.png",
"diff": "Binary files a/Docs/ChangeLogImg/relative-2.2-to-2.3.png and /dev/null differ\n"
},
{
"change_type": "ADD",
"old_path": "Docs/ChangeLogImg/relative-3.7-to-4.0.png",
"new_path": "Docs/ChangeLogImg/relative-3.7-to-4.0.png",
"diff": "Binary files /dev/null and b/Docs/ChangeLogImg/relative-3.7-to-4.0.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -64,9 +64,6 @@ Release build binaries for the `astcenc` stable releases are provided in the\n**Latest 3.x stable release:** 3.7\n* Change log: [3.x series](./Docs/ChangeLog-3x.md)\n-**Latest 2.x stable release:** 2.5\n-* Change log: [2.x series](./Docs/ChangeLog-2x.md)\n-\nBinaries are provided for 64-bit builds on Windows, macOS, and Linux. The\nbuilds of the astcenc are provided as multiple binaries, each tuned for a\nspecific SIMD instruction set.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update changelog for 4.0
|
61,745 |
22.07.2022 10:00:43
| -3,600 |
9cfb30b44d6265d1c363852733d4632ffa79931e
|
Use full semver in package name
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -219,9 +219,7 @@ if(PACKAGE)\nstring(TOLOWER ${CMAKE_SYSTEM_NAME} PKG_OS)\nendif()\n- set(PKG_VER ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR})\n-\n- set(CPACK_PACKAGE_FILE_NAME \"astcenc-${PKG_VER}-${PKG_OS}-${PACKAGE}\")\n+ set(CPACK_PACKAGE_FILE_NAME \"astcenc-${CMAKE_PROJECT_VERSION}-${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
|
Use full semver in package name
|
61,745 |
27.07.2022 21:40:38
| -3,600 |
7369734d159045dbce0cd5bbcfae9fbb561aa51c
|
Update 4.0 changelog image
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -77,7 +77,7 @@ Key for charts:\n* Color = block size (see legend).\n* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).\n-**Relative performance vs 3.5 release:**\n+**Relative performance vs 3.7 release:**\n\n"
},
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLogImg/relative-3.7-to-4.0.png",
"new_path": "Docs/ChangeLogImg/relative-3.7-to-4.0.png",
"diff": "Binary files a/Docs/ChangeLogImg/relative-3.7-to-4.0.png and b/Docs/ChangeLogImg/relative-3.7-to-4.0.png differ\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update 4.0 changelog image
|
61,745 |
02.08.2022 17:38:22
| -3,600 |
058ccaa583171eb06f528dc477c1fd4b01438a07
|
Use standard copyright message
|
[
{
"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 =\nR\"(astcenc v%s, %u-bit %s%s%s\n-Copyright 2011-%s Arm Limited, all rights reserved\n+Copyright (c) 2011-%s Arm Limited. All rights reserved.\n)\";\n/** @brief The short-form help text. */\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use standard copyright message
|
61,745 |
03.08.2022 16:00:57
| -3,600 |
ec3ac5d473775cad692725536bd1cf60326ef4e9
|
Add Android build instructions
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/Building.md",
"new_path": "Docs/Building.md",
"diff": "@@ -189,6 +189,43 @@ We support building with ASAN on Linux and macOS when using a compiler that\nsupports it. To build binaries with ASAN checking enabled add `-DASAN=ON` to\nthe CMake command line when configuring.\n+### Android builds\n+\n+Builds of the command line utility for Android are not officially supported, but can be a useful\n+development build for testing on e.g. different Arm CPU microarchitectures.\n+\n+The build script below shows one possible route to building the command line tool for Android. Once\n+built the application can be pushed to e.g. `/data/local/tmp` and executed from an Android shell\n+terminal over `adb`.\n+\n+```shell\n+ANDROID_ABI=arm64-v8a\n+ANDROID_NDK=/work/tools/android/ndk/22.1.7171670\n+\n+BUILD_TYPE=RelWithDebInfo\n+\n+BUILD_DIR=build\n+\n+mkdir -p ${BUILD_DIR}\n+cd ${BUILD_DIR}\n+\n+cmake \\\n+ -DCMAKE_INSTALL_PREFIX=./ \\\n+ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \\\n+ -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \\\n+ -DANDROID_ABI=${ANDROID_ABI} \\\n+ -DANDROID_ARM_NEON=ON \\\n+ -DANDROID_PLATFORM=android-21 \\\n+ -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \\\n+ -DANDROID_TOOLCHAIN=clang \\\n+ -DANDROID_STL=c++_static \\\n+ -DARCH=aarch64 \\\n+ -DISA_NEON=ON \\\n+ ..\n+\n+make -j16\n+```\n+\n## Packaging a release bundle\nWe support building a release bundle of all enabled binary configurations in\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add Android build instructions
|
61,745 |
05.08.2022 20:16:32
| -3,600 |
c88f7d3457c2987e69b95b0754ba78b00d0070c9
|
Fix g++ 9.4 aarch64 compiler warnings
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -6,6 +6,16 @@ release of the 4.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+## 4.1.0\n+\n+**Status:** TBD\n+\n+The 4.1.0 release is a maintenance release.\n+\n+* **General:**\n+ * **Bug-fix:** Fixed GCC9 compiler warnings on Arm aarch64.\n+\n<!-- ---------------------------------------------------------------------- -->\n## 4.0.0\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_neon_4.h",
"new_path": "Source/astcenc_vecmathlib_neon_4.h",
"diff": "@@ -351,7 +351,7 @@ struct vmask4\n*/\ntemplate <int32_t l> ASTCENC_SIMD_INLINE uint32_t lane() const\n{\n- return vgetq_lane_s32(m, l);\n+ return vgetq_lane_u32(m, l);\n}\n/**\n@@ -968,13 +968,15 @@ ASTCENC_SIMD_INLINE void vtable_prepare(\n*/\nASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 idx)\n{\n- int8x16_t table { t0.m };\n+ int8x16_t table {\n+ vreinterpretq_s8_s32(t0.m)\n+ };\n- // Set index byte MSB to 1 for unused bytes so shuffle returns zero\n+ // Set index byte above max index for unused bytes so table lookup returns zero\nint32x4_t idx_masked = vorrq_s32(idx.m, vdupq_n_s32(0xFFFFFF00));\n- int8x16_t idx_bytes = vreinterpretq_u8_s32(idx_masked);\n+ uint8x16_t idx_bytes = vreinterpretq_u8_s32(idx_masked);\n- return vint4(vqtbl1q_s8(table, idx_bytes));\n+ return vint4(vreinterpretq_s32_s8(vqtbl1q_s8(table, idx_bytes)));\n}\n/**\n@@ -982,13 +984,16 @@ ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 idx)\n*/\nASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 idx)\n{\n- int8x16x2_t table { t0.m, t1.m };\n+ int8x16x2_t table {\n+ vreinterpretq_s8_s32(t0.m),\n+ vreinterpretq_s8_s32(t1.m)\n+ };\n- // Set index byte MSB to 1 for unused bytes so shuffle returns zero\n+ // Set index byte above max index for unused bytes so table lookup returns zero\nint32x4_t idx_masked = vorrq_s32(idx.m, vdupq_n_s32(0xFFFFFF00));\n- int8x16_t idx_bytes = vreinterpretq_u8_s32(idx_masked);\n+ uint8x16_t idx_bytes = vreinterpretq_u8_s32(idx_masked);\n- return vint4(vqtbl2q_s8(table, idx_bytes));\n+ return vint4(vreinterpretq_s32_s8(vqtbl2q_s8(table, idx_bytes)));\n}\n/**\n@@ -996,13 +1001,18 @@ ASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 idx)\n*/\nASTCENC_SIMD_INLINE vint4 vtable_8bt_32bi(vint4 t0, vint4 t1, vint4 t2, vint4 t3, vint4 idx)\n{\n- int8x16x4_t table { t0.m, t1.m, t2.m, t3.m };\n+ int8x16x4_t table {\n+ vreinterpretq_s8_s32(t0.m),\n+ vreinterpretq_s8_s32(t1.m),\n+ vreinterpretq_s8_s32(t2.m),\n+ vreinterpretq_s8_s32(t3.m)\n+ };\n- // Set index byte MSB to 1 for unused bytes so shuffle returns zero\n+ // Set index byte above max index for unused bytes so table lookup returns zero\nint32x4_t idx_masked = vorrq_s32(idx.m, vdupq_n_s32(0xFFFFFF00));\n- int8x16_t idx_bytes = vreinterpretq_u8_s32(idx_masked);\n+ uint8x16_t idx_bytes = vreinterpretq_u8_s32(idx_masked);\n- return vint4(vqtbl4q_s8(table, idx_bytes));\n+ return vint4(vreinterpretq_s32_s8(vqtbl4q_s8(table, idx_bytes)));\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/wuffs-v0.3.c",
"new_path": "Source/wuffs-v0.3.c",
"diff": "@@ -21987,15 +21987,25 @@ wuffs_adler32__hasher__up_arm_neon(\n}\nv_p.len = 0;\n}\n+\n+ static const uint16x4_t table_0 {32, 31, 30, 29};\n+ static const uint16x4_t table_1 {28, 27, 26, 25};\n+ static const uint16x4_t table_2 {24, 23, 22, 21};\n+ static const uint16x4_t table_3 {20, 19, 18, 17};\n+ static const uint16x4_t table_4 {16, 15, 14, 13};\n+ static const uint16x4_t table_5 {12, 11, 10, 9};\n+ static const uint16x4_t table_6 { 8, 7, 6, 5};\n+ static const uint16x4_t table_7 { 4, 3, 2, 1};\n+\nv_v2 = vshlq_n_u32(v_v2, 5);\n- v_v2 = vmlal_u16(v_v2, vget_low_u16(v_col0), ((uint16x4_t){32, 31, 30, 29}));\n- v_v2 = vmlal_u16(v_v2, vget_high_u16(v_col0), ((uint16x4_t){28, 27, 26, 25}));\n- v_v2 = vmlal_u16(v_v2, vget_low_u16(v_col1), ((uint16x4_t){24, 23, 22, 21}));\n- v_v2 = vmlal_u16(v_v2, vget_high_u16(v_col1), ((uint16x4_t){20, 19, 18, 17}));\n- v_v2 = vmlal_u16(v_v2, vget_low_u16(v_col2), ((uint16x4_t){16, 15, 14, 13}));\n- v_v2 = vmlal_u16(v_v2, vget_high_u16(v_col2), ((uint16x4_t){12, 11, 10, 9}));\n- v_v2 = vmlal_u16(v_v2, vget_low_u16(v_col3), ((uint16x4_t){8, 7, 6, 5}));\n- v_v2 = vmlal_u16(v_v2, vget_high_u16(v_col3), ((uint16x4_t){4, 3, 2, 1}));\n+ v_v2 = vmlal_u16(v_v2, vget_low_u16(v_col0), table_0);\n+ v_v2 = vmlal_u16(v_v2, vget_high_u16(v_col0), table_1);\n+ v_v2 = vmlal_u16(v_v2, vget_low_u16(v_col1), table_2);\n+ v_v2 = vmlal_u16(v_v2, vget_high_u16(v_col1), table_3);\n+ v_v2 = vmlal_u16(v_v2, vget_low_u16(v_col2), table_4);\n+ v_v2 = vmlal_u16(v_v2, vget_high_u16(v_col2), table_5);\n+ v_v2 = vmlal_u16(v_v2, vget_low_u16(v_col3), table_6);\n+ v_v2 = vmlal_u16(v_v2, vget_high_u16(v_col3), table_7);\nv_sum1 = vpadd_u32(vget_low_u32(v_v1), vget_high_u32(v_v1));\nv_sum2 = vpadd_u32(vget_low_u32(v_v2), vget_high_u32(v_v2));\nv_sum12 = vpadd_u32(v_sum1, v_sum2);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix g++ 9.4 aarch64 compiler warnings (#356)
|
61,745 |
10.08.2022 08:10:36
| -3,600 |
ab77e7513ef66cbd6b333220cb22d4b86cb33ff3
|
Fix DDS and KTX loader is_hdr detection
Fix
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_image_load_store.cpp",
"new_path": "Source/astcenccli_image_load_store.cpp",
"diff": "@@ -1155,7 +1155,7 @@ static astcenc_image* load_ktx_uncompressed_image(\n}\ndelete[] buf;\n- is_hdr = bitness == 32;\n+ is_hdr = bitness => 16;\ncomponent_count = components;\nreturn astc_img;\n}\n@@ -1915,7 +1915,7 @@ static astcenc_image* load_dds_uncompressed_image(\n}\ndelete[] buf;\n- is_hdr = bitness == 16;\n+ is_hdr = bitness >= 16;\ncomponent_count = components;\nreturn astc_img;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix DDS and KTX loader is_hdr detection
Fix #358
|
61,745 |
10.08.2022 11:00:42
| -3,600 |
c1c7fecc847e49ffd03ae04e833028dc15bdfe2a
|
Fix DDS and KTX loader is_hdr detection
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_image_load_store.cpp",
"new_path": "Source/astcenccli_image_load_store.cpp",
"diff": "@@ -1155,7 +1155,7 @@ static astcenc_image* load_ktx_uncompressed_image(\n}\ndelete[] buf;\n- is_hdr = bitness => 16;\n+ is_hdr = bitness >= 16;\ncomponent_count = components;\nreturn astc_img;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix DDS and KTX loader is_hdr detection
|
61,745 |
10.08.2022 11:21:53
| -3,600 |
dab7dce26810cd086ab7901cc2fdd09c345d1a70
|
Update Jenkins agent for macOS
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/nightly.Jenkinsfile",
"new_path": "jenkins/nightly.Jenkinsfile",
"diff": "@@ -216,7 +216,7 @@ pipeline {\n/* Build for macOS on x86-64 using Clang */\nstage('macOS') {\nagent {\n- label 'mac'\n+ label 'mac && x86_64'\n}\nstages {\nstage('Clean') {\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -212,7 +212,7 @@ spec:\n/* Build for macOS on x86-64 using Clang */\nstage('macOS') {\nagent {\n- label 'mac && notarizer'\n+ label 'mac && x86_64 && notarizer'\n}\nstages {\nstage('Clean') {\n@@ -267,7 +267,7 @@ spec:\n/* Build for macOS on x86-64 using Clang */\nstage('macOS arm64') {\nagent {\n- label 'mac && notarizer'\n+ label 'mac && x86_64 && notarizer'\n}\nstages {\nstage('Clean') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update Jenkins agent for macOS
|
61,745 |
10.08.2022 20:03:09
| -3,600 |
4bf2bdef73fd936ab201e0cc3101bedc550593b9
|
Remove /dssa-cfg-sink- on VS 2022 17.3 onwards
|
[
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -83,16 +83,6 @@ macro(astcenc_set_properties NAME)\n# MSVC defines\n$<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>)\n- # Work around compiler bug in MSVC when targeting arm64\n- # https://developercommunity.visualstudio.com/t/inlining-turns-constant-into-register-operand-for/1394798\n- # https://github.com/microsoft/vcpkg/pull/24869\n- if(CMAKE_CXX_COMPILER_ID MATCHES \"MSVC\")\n- if(CPU_ARCHITECTURE STREQUAL armv8 OR CPU_ARCHITECTURE STREQUAL arm64)\n- set(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS} /d2ssa-cfg-sink-\")\n- set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} /d2ssa-cfg-sink-\")\n- endif()\n- endif()\n-\nif(${DECOMPRESSOR})\ntarget_compile_definitions(${NAME}\nPRIVATE\n@@ -208,11 +198,13 @@ macro(astcenc_set_properties NAME)\nASTCENC_F16C=0)\nendif()\n- # Workaround MSVC codegen bug for NEON builds see:\n+ # Workaround MSVC codegen bug for NEON builds on VS 2022 17.2 or older\n# https://developercommunity.visualstudio.com/t/inlining-turns-constant-into-register-operand-for/1394798\n+ if(CMAKE_CXX_COMPILER_ID MATCHES \"MSVC\" AND MSVC_VERSION LESS 1933)\ntarget_compile_options(${NAME}\nPRIVATE\n$<$<CXX_COMPILER_ID:MSVC>:/d2ssa-cfg-sink->)\n+ endif()\nelseif((${ISA_SIMD} MATCHES \"sse2\") OR (${UNIVERSAL_BUILD} AND ${ISA_SSE2}))\nif(NOT ${UNIVERSAL_BUILD})\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove /dssa-cfg-sink- on VS 2022 17.3 onwards
|
61,745 |
17.08.2022 18:13:29
| -3,600 |
4d30d12b422621afb1730ded6d03b1a0f1b9a0f9
|
Remove use of __mm_maskmoveu_si128
SSE masked stores do not guarantee fault masking, so we can get errors if the final store in an image spans a page boundary even if the overspill lanes are correctly masked.
Fixes
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -18,6 +18,8 @@ The 4.1.0 release is a maintenance release.\n`GL_LUMINANCE` or `GL_LUMINANCE_ALPHA` format enums when writing KTX\noutput files. Luminance textures now use the `GL_RED` format and\nluminance_alpha textures now use the `GL_RG` format.\n+ * **Bug-fix:** Library decompressor builds for SSE no longer use masked store\n+ `maskmovdqu` instructions, as they can generate faults on masked lanes.\n* **Bug-fix:** Command line decompressor now correctly uses sized type enums\nfor the internal format when writing output KTX files.\n* **Bug-fix:** Command line compressor now correctly loads 32-bit per\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"new_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"diff": "@@ -517,7 +517,7 @@ static void compute_color_error_for_every_integer_count_and_quant_level(\nbest_error[i][1] = ERROR_CALC_DEFAULT;\nbest_error[i][0] = ERROR_CALC_DEFAULT;\n- format_of_choice[i][3] = encode_hdr_alpha ? FMT_HDR_RGBA : FMT_HDR_RGB_LDR_ALPHA;\n+ format_of_choice[i][3] = static_cast<uint8_t>(encode_hdr_alpha ? FMT_HDR_RGBA : FMT_HDR_RGB_LDR_ALPHA);\nformat_of_choice[i][2] = FMT_HDR_RGB;\nformat_of_choice[i][1] = FMT_HDR_RGB_SCALE;\nformat_of_choice[i][0] = FMT_HDR_LUMINANCE_LARGE_RANGE;\n@@ -537,7 +537,7 @@ static void compute_color_error_for_every_integer_count_and_quant_level(\nfloat full_hdr_rgba_error = rgba_quantization_error + rgb_range_error + alpha_range_error;\nbest_error[i][3] = full_hdr_rgba_error;\n- format_of_choice[i][3] = encode_hdr_alpha ? FMT_HDR_RGBA : FMT_HDR_RGB_LDR_ALPHA;\n+ format_of_choice[i][3] = static_cast<uint8_t>(encode_hdr_alpha ? FMT_HDR_RGBA : FMT_HDR_RGB_LDR_ALPHA);\n// For 6 integers, we have one HDR-RGB encoding\nfloat full_hdr_rgb_error = (rgb_quantization_error * mode11mult) + rgb_range_error + eci.alpha_drop_error;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_sse_4.h",
"new_path": "Source/astcenc_vecmathlib_sse_4.h",
"diff": "@@ -363,6 +363,14 @@ struct vmask4\nm = _mm_castsi128_ps(mask.m);\n}\n+ /**\n+ * @brief Get the scalar value of a single lane.\n+ */\n+ template <int l> ASTCENC_SIMD_INLINE float lane() const\n+ {\n+ return _mm_cvtss_f32(_mm_shuffle_ps(m, m, l));\n+ }\n+\n/**\n* @brief The vector ...\n*/\n@@ -1192,7 +1200,27 @@ ASTCENC_SIMD_INLINE void store_lanes_masked(int* base, vint4 data, vmask4 mask)\n#if ASTCENC_AVX >= 2\n_mm_maskstore_epi32(base, _mm_castps_si128(mask.m), data.m);\n#else\n- _mm_maskmoveu_si128(data.m, _mm_castps_si128(mask.m), reinterpret_cast<char*>(base));\n+ // Note - we cannot use _mm_maskmoveu_si128 as the underlying hardware doesn't guarantee\n+ // fault suppression on masked lanes so we can get page faults at the end of an image.\n+ if (mask.lane<3>() != 0.0f)\n+ {\n+ store(data, base);\n+ }\n+ else if(mask.lane<2>() != 0.0f)\n+ {\n+ base[0] = data.lane<0>();\n+ base[1] = data.lane<1>();\n+ base[2] = data.lane<2>();\n+ }\n+ else if(mask.lane<1>() != 0.0f)\n+ {\n+ base[0] = data.lane<0>();\n+ base[1] = data.lane<1>();\n+ }\n+ else if(mask.lane<0>() != 0.0f)\n+ {\n+ base[0] = data.lane<0>();\n+ }\n#endif\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove use of __mm_maskmoveu_si128 (#371)
SSE masked stores do not guarantee fault masking, so we can get errors if the final store in an image spans a page boundary even if the overspill lanes are correctly masked.
Fixes #370
|
61,745 |
17.08.2022 19:29:21
| -3,600 |
242e86684d1a83fc30f88f702fa9717353ecc328
|
Bump version for 4.1.0 release
|
[
{
"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 4.0.0)\n+project(astcencoder VERSION 4.1.0)\nset(CMAKE_CXX_STANDARD 14)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n"
},
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -9,9 +9,10 @@ clocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.\n<!-- ---------------------------------------------------------------------- -->\n## 4.1.0\n-**Status:** TBD\n+**Status:** August 2022\n-The 4.1.0 release is a maintenance release.\n+The 4.1.0 release is a maintenance release. There is no performance or image\n+quality change in this release.\n* **General:**\n* **Change:** Command line decompressor no longer uses the legacy\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Bump version for 4.1.0 release
|
61,745 |
17.08.2022 21:27:48
| -3,600 |
247fce72b6fee4a7fe830ec2450c82968ae39056
|
Add option to generate diagnostic images
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -19,6 +19,10 @@ quality change in this release.\n`GL_LUMINANCE` or `GL_LUMINANCE_ALPHA` format enums when writing KTX\noutput files. Luminance textures now use the `GL_RED` format and\nluminance_alpha textures now use the `GL_RG` format.\n+ * **Change:** Command line tool gains a new `-dimage` option to generate\n+ diagnostic images showing aspects of the compression encoding. The output\n+ file name with its extension stripped is used as the stem of the diagnostic\n+ image file names.\n* **Bug-fix:** Library decompressor builds for SSE no longer use masked store\n`maskmovdqu` instructions, as they can generate faults on masked lanes.\n* **Bug-fix:** Command line decompressor now correctly uses sized type enums\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_internal.h",
"new_path": "Source/astcenccli_internal.h",
"diff": "@@ -80,6 +80,9 @@ struct cli_config_options\n/** @brief @c true if the images should be y-flipped. */\nbool y_flip;\n+ /** @brief @c true if diagnostic images should be stored. */\n+ bool diagnostic_images;\n+\n/** @brief The low exposure fstop for error computation. */\nint low_fstop;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "#include <cassert>\n#include <cstring>\n+#include <functional>\n#include <string>\n#include <sstream>\n#include <vector>\n+#include <memory>\n/* ============================================================================\nData structure definitions\n@@ -1073,18 +1075,23 @@ static int edit_astcenc_config(\nargidx++;\n}\n#if defined(ASTCENC_DIAGNOSTICS)\n- else if (!strcmp(argv[argidx], \"-dtrace-out\"))\n+ else if (!strcmp(argv[argidx], \"-dtrace\"))\n{\nargidx += 2;\nif (argidx > argc)\n{\n- printf(\"ERROR: -dtrace-out switch with no argument\\n\");\n+ printf(\"ERROR: -dtrace switch with no argument\\n\");\nreturn 1;\n}\nconfig.trace_file_path = argv[argidx - 1];\n}\n#endif\n+ else if (!strcmp(argv[argidx], \"-dimage\"))\n+ {\n+ argidx += 1;\n+ cli_config.diagnostic_images = true;\n+ }\nelse // check others as well\n{\nprintf(\"ERROR: Argument '%s' not recognized\\n\", argv[argidx]);\n@@ -1103,7 +1110,7 @@ static int edit_astcenc_config(\nif (!config.trace_file_path)\n{\n- printf(\"ERROR: Diagnostics builds must set -dtrace-out\\n\");\n+ printf(\"ERROR: Diagnostics builds must set -dtrace\\n\");\nreturn 1;\n}\n#endif\n@@ -1270,6 +1277,30 @@ static void image_set_pixel(\ndata[(4 * img.dim_x * y) + (4 * x + 3)] = pixel.lane<3>();\n}\n+/**\n+ * @brief Set the value of a single pixel in an image.\n+ *\n+ * @param[out] img The output image; must use F32 texture components.\n+ * @param x The pixel x coordinate.\n+ * @param y The pixel y coordinate.\n+ * @param pixel The pixel color value to write.\n+ */\n+static void image_set_pixel_u8(\n+ astcenc_image& img,\n+ size_t x,\n+ size_t y,\n+ vint4 pixel\n+) {\n+ // We should never escape bounds\n+ assert(x < img.dim_x);\n+ assert(y < img.dim_y);\n+ assert(img.data_type == ASTCENC_TYPE_U8);\n+\n+ uint8_t* data = static_cast<uint8_t*>(img.data[0]);\n+ pixel = pack_low_bytes(pixel);\n+ store_nbytes(pixel, data + (4 * img.dim_x * y) + (4 * x ));\n+}\n+\n/**\n* @brief Create a copy of @c input with forced unit-length normal vectors.\n*\n@@ -1399,6 +1430,365 @@ static void image_preprocess_premultiply(\n}\n}\n+/**\n+ * @brief Populate a single diagnostic image showing aspects of the encoding.\n+ *\n+ * @param context The context to use.\n+ * @param image The compressed image to analyze.\n+ * @param diag_image The output visualization image to populate.\n+ * @param texel_func The per-texel callback used to determine output color.\n+ */\n+static void print_diagnostic_image(\n+ astcenc_context* context,\n+ const astc_compressed_image& image,\n+ astcenc_image& diag_image,\n+ std::function<vint4(astcenc_block_info&, size_t, size_t)> texel_func\n+) {\n+ size_t block_cols = (image.dim_x + image.block_x - 1) / image.block_x;\n+ size_t block_rows = (image.dim_y + image.block_y - 1) / image.block_y;\n+\n+ uint8_t* data = image.data;\n+ for (size_t block_y = 0; block_y < block_rows; block_y++)\n+ {\n+ for (size_t block_x = 0; block_x < block_cols; block_x++)\n+ {\n+ astcenc_block_info block_info;\n+ astcenc_get_block_info(context, data, &block_info);\n+ data += 16;\n+\n+ size_t start_row = block_y * image.block_y;\n+ size_t start_col = block_x * image.block_x;\n+\n+ size_t end_row = astc::min(start_row + image.block_y, static_cast<size_t>(image.dim_y));\n+ size_t end_col = astc::min(start_col + image.block_x, static_cast<size_t>(image.dim_x));\n+\n+ for (size_t texel_y = start_row; texel_y < end_row; texel_y++)\n+ {\n+ for (size_t texel_x = start_col; texel_x < end_col; texel_x++)\n+ {\n+ vint4 color = texel_func(block_info, texel_x - start_col, texel_y - start_row);\n+ image_set_pixel_u8(diag_image, texel_x, texel_y, color);\n+ }\n+ }\n+ }\n+ }\n+}\n+\n+/**\n+ * @brief Print a set of diagnostic images showing aspects of the encoding.\n+ *\n+ * @param context The context to use.\n+ * @param image The compressed image to analyze.\n+ * @param output_file The output file name to use as a stem for new names.\n+ */\n+static void print_diagnostic_images(\n+ astcenc_context* context,\n+ const astc_compressed_image& image,\n+ const std::string& output_file\n+) {\n+ if (image.dim_z != 1)\n+ {\n+ return;\n+ }\n+\n+ // Try to find a file extension we know about\n+ size_t index = output_file.find_last_of(\".\");\n+ std::string stem = output_file;\n+ if (index != std::string::npos)\n+ {\n+ stem = stem.substr(0, index);\n+ }\n+\n+ auto diag_image = alloc_image(8, image.dim_x, image.dim_y, image.dim_z);\n+\n+ // ---- ---- ---- ---- Partitioning ---- ---- ---- ----\n+ auto partition_func = [](astcenc_block_info& info, size_t texel_x, size_t texel_y) {\n+ const vint4 colors[] {\n+ vint4( 0, 0, 0, 255),\n+ vint4(255, 0, 0, 255),\n+ vint4( 0, 255, 0, 255),\n+ vint4( 0, 0, 255, 255),\n+ vint4(255, 255, 255, 255)\n+ };\n+\n+ size_t texel_index = texel_y * info.block_x + texel_x;\n+\n+ int partition { 0 };\n+ if (!info.is_constant_block)\n+ {\n+ partition = info.partition_assignment[texel_index] + 1;\n+ }\n+\n+ return colors[partition];\n+ };\n+\n+ print_diagnostic_image(context, image, *diag_image, partition_func);\n+ std::string fname = stem + \"_diag_partitioning.png\";\n+ store_ncimage(diag_image, fname.c_str(), false);\n+\n+ // ---- ---- ---- ---- Weight planes ---- ---- ---- ----\n+ auto texel_func1 = [](astcenc_block_info& info, size_t texel_x, size_t texel_y) {\n+ (void)texel_x;\n+ (void)texel_y;\n+\n+ const vint4 colors[] {\n+ vint4( 0, 0, 0, 255),\n+ vint4(255, 0, 0, 255),\n+ vint4( 0, 255, 0, 255),\n+ vint4( 0, 0, 255, 255),\n+ vint4(255, 255, 255, 255)\n+ };\n+\n+ int component { 0 };\n+ if (info.is_dual_plane_block)\n+ {\n+ component = info.dual_plane_component + 1;\n+ }\n+\n+ return colors[component];\n+ };\n+\n+ print_diagnostic_image(context, image, *diag_image, texel_func1);\n+ fname = stem + \"_diag_weight_plane2.png\";\n+ store_ncimage(diag_image, fname.c_str(), false);\n+\n+ // ---- ---- ---- ---- Weight density ---- ---- ---- ----\n+ auto texel_func2 = [](astcenc_block_info& info, size_t texel_x, size_t texel_y) {\n+ (void)texel_x;\n+ (void)texel_y;\n+\n+ float density = 0.0f;\n+ if (!info.is_constant_block)\n+ {\n+ float texel_count = static_cast<float>(info.block_x * info.block_y);\n+ float weight_count = static_cast<float>(info.weight_x * info.weight_y);\n+ density = weight_count / texel_count;\n+ }\n+\n+ int densityi = static_cast<int>(255.0f * density);\n+ return vint4(densityi, densityi, densityi, 255);\n+ };\n+\n+ print_diagnostic_image(context, image, *diag_image, texel_func2);\n+ fname = stem + \"_diag_weight_density.png\";\n+ store_ncimage(diag_image, fname.c_str(), false);\n+\n+ // ---- ---- ---- ---- Weight quant ---- ---- ---- ----\n+ auto texel_func3 = [](astcenc_block_info& info, size_t texel_x, size_t texel_y) {\n+ (void)texel_x;\n+ (void)texel_y;\n+\n+ int quant { 0 };\n+ if (!info.is_constant_block)\n+ {\n+ quant = info.weight_level_count - 1;\n+ }\n+\n+ return vint4(quant, quant, quant, 255);\n+ };\n+\n+ print_diagnostic_image(context, image, *diag_image, texel_func3);\n+ fname = stem + \"_diag_weight_quant.png\";\n+ store_ncimage(diag_image, fname.c_str(), false);\n+\n+ // ---- ---- ---- ---- Color quant ---- ---- ---- ----\n+ auto texel_func4 = [](astcenc_block_info& info, size_t texel_x, size_t texel_y) {\n+ (void)texel_x;\n+ (void)texel_y;\n+\n+ int quant { 0 };\n+ if (!info.is_constant_block)\n+ {\n+ quant = info.color_level_count - 1;\n+ }\n+\n+ return vint4(quant, quant, quant, 255);\n+ };\n+\n+ print_diagnostic_image(context, image, *diag_image, texel_func4);\n+ fname = stem + \"_diag_color_quant.png\";\n+ store_ncimage(diag_image, fname.c_str(), false);\n+\n+ // ---- ---- ---- ---- Color endpoint mode: Index ---- ---- ---- ----\n+ auto texel_func5 = [](astcenc_block_info& info, size_t texel_x, size_t texel_y) {\n+ (void)texel_x;\n+ (void)texel_y;\n+\n+ size_t texel_index = texel_y * info.block_x + texel_x;\n+\n+ int cem { 255 };\n+ if (!info.is_constant_block)\n+ {\n+ uint8_t partition = info.partition_assignment[texel_index];\n+ cem = info.color_endpoint_modes[partition] * 16;\n+ }\n+\n+ return vint4(cem, cem, cem, 255);\n+ };\n+\n+ print_diagnostic_image(context, image, *diag_image, texel_func5);\n+ fname = stem + \"_diag_cem_index.png\";\n+ store_ncimage(diag_image, fname.c_str(), false);\n+\n+ // ---- ---- ---- ---- Color endpoint mode: Components ---- ---- ---- ----\n+ auto texel_func6 = [](astcenc_block_info& info, size_t texel_x, size_t texel_y) {\n+ (void)texel_x;\n+ (void)texel_y;\n+\n+ const vint4 colors[] {\n+ vint4( 0, 0, 0, 255),\n+ vint4(255, 0, 0, 255),\n+ vint4( 0, 255, 0, 255),\n+ vint4( 0, 0, 255, 255),\n+ vint4(255, 255, 255, 255)\n+ };\n+\n+ size_t texel_index = texel_y * info.block_x + texel_x;\n+\n+ int components { 0 };\n+ if (!info.is_constant_block)\n+ {\n+ uint8_t partition = info.partition_assignment[texel_index];\n+ uint8_t cem = info.color_endpoint_modes[partition];\n+\n+ switch (cem)\n+ {\n+ case 0:\n+ case 1:\n+ case 2:\n+ case 3:\n+ components = 1;\n+ break;\n+ case 4:\n+ case 5:\n+ components = 2;\n+ break;\n+ case 6:\n+ case 7:\n+ case 8:\n+ case 9:\n+ case 11:\n+ components = 3;\n+ break;\n+ default:\n+ components = 4;\n+ break;\n+ }\n+ }\n+\n+ return colors[components];\n+ };\n+\n+ print_diagnostic_image(context, image, *diag_image, texel_func6);\n+ fname = stem + \"_diag_cem_components.png\";\n+ store_ncimage(diag_image, fname.c_str(), false);\n+\n+ // ---- ---- ---- ---- Color endpoint mode: Style ---- ---- ---- ----\n+ auto texel_func7 = [](astcenc_block_info& info, size_t texel_x, size_t texel_y) {\n+ (void)texel_x;\n+ (void)texel_y;\n+\n+ const vint4 colors[] {\n+ vint4( 0, 0, 0, 255),\n+ vint4(255, 0, 0, 255),\n+ vint4( 0, 255, 0, 255),\n+ vint4( 0, 0, 255, 255),\n+ };\n+\n+ size_t texel_index = texel_y * info.block_x + texel_x;\n+\n+ int style { 0 };\n+ if (!info.is_constant_block)\n+ {\n+ uint8_t partition = info.partition_assignment[texel_index];\n+ uint8_t cem = info.color_endpoint_modes[partition];\n+\n+ switch (cem)\n+ {\n+ // Direct - two absolute endpoints\n+ case 0:\n+ case 1:\n+ case 2:\n+ case 3:\n+ case 4:\n+ case 8:\n+ case 11:\n+ case 12:\n+ case 14:\n+ case 15:\n+ style = 1;\n+ break;\n+ // Offset - one absolute plus delta\n+ case 5:\n+ case 9:\n+ case 13:\n+ style = 2;\n+ break;\n+ // Scale - one absolute plus scale\n+ case 6:\n+ case 7:\n+ case 10:\n+ style = 3;\n+ break;\n+ // Shouldn't happen ...\n+ default:\n+ style = 0;\n+ break;\n+ }\n+ }\n+\n+ return colors[style];\n+ };\n+\n+ print_diagnostic_image(context, image, *diag_image, texel_func7);\n+ fname = stem + \"_diag_cem_style.png\";\n+ store_ncimage(diag_image, fname.c_str(), false);\n+\n+ // ---- ---- ---- ---- Color endpoint mode: Style ---- ---- ---- ----\n+ auto texel_func8 = [](astcenc_block_info& info, size_t texel_x, size_t texel_y) {\n+ (void)texel_x;\n+ (void)texel_y;\n+\n+ size_t texel_index = texel_y * info.block_x + texel_x;\n+\n+ int style { 0 };\n+ if (!info.is_constant_block)\n+ {\n+ uint8_t partition = info.partition_assignment[texel_index];\n+ uint8_t cem = info.color_endpoint_modes[partition];\n+\n+ switch (cem)\n+ {\n+ // LDR blocks\n+ case 0:\n+ case 1:\n+ case 4:\n+ case 5:\n+ case 6:\n+ case 8:\n+ case 9:\n+ case 10:\n+ case 12:\n+ case 13:\n+ style = 128;\n+ break;\n+ // HDR blocks\n+ default:\n+ style = 155;\n+ break;\n+ }\n+ }\n+\n+ return vint4(style, style, style, 255);\n+ };\n+\n+ print_diagnostic_image(context, image, *diag_image, texel_func8);\n+ fname = stem + \"_diag_cem_hdr.png\";\n+ store_ncimage(diag_image, fname.c_str(), false);\n+\n+ free_image(diag_image);\n+}\n+\n/**\n* @brief The main entry point.\n*\n@@ -1504,7 +1894,7 @@ int main(\n}\n// Initialize cli_config_options with default values\n- cli_config_options cli_config { 0, 1, 1, false, false, -10, 10,\n+ cli_config_options cli_config { 0, 1, 1, false, false, false, -10, 10,\n{ ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCENC_SWZ_B, ASTCENC_SWZ_A },\n{ ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCENC_SWZ_B, ASTCENC_SWZ_A } };\n@@ -1753,6 +2143,12 @@ int main(\n}\n}\n+#if defined(_WIN32)\n+ bool is_null = output_filename == \"NUL\" || output_filename == \"nul\";\n+#else\n+ bool is_null = output_filename == \"/dev/null\";\n+#endif\n+\n// Print metrics in comparison mode\nif (operation & ASTCENC_STAGE_COMPARE)\n{\n@@ -1787,11 +2183,6 @@ int main(\n}\nelse\n{\n-#if defined(_WIN32)\n- bool is_null = output_filename == \"NUL\" || output_filename == \"nul\";\n-#else\n- bool is_null = output_filename == \"/dev/null\";\n-#endif\nif (!is_null)\n{\nprintf(\"ERROR: Unknown compressed output file type\\n\");\n@@ -1803,12 +2194,6 @@ int main(\n// Store decompressed image\nif (operation & ASTCENC_STAGE_ST_NCOMP)\n{\n-#if defined(_WIN32)\n- bool is_null = output_filename == \"NUL\" || output_filename == \"nul\";\n-#else\n- bool is_null = output_filename == \"/dev/null\";\n-#endif\n-\nif (!is_null)\n{\nbool store_result = store_ncimage(image_decomp_out, output_filename.c_str(),\n@@ -1821,6 +2206,12 @@ int main(\n}\n}\n+ // Store diagnostic images\n+ if (cli_config.diagnostic_images && !is_null)\n+ {\n+ print_diagnostic_images(codec_context, image_comp, output_filename);\n+ }\n+\nfree_image(image_uncomp_in);\nfree_image(image_decomp_out);\nastcenc_context_free(codec_context);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add option to generate diagnostic images (#372)
|
61,745 |
05.09.2022 23:28:00
| -3,600 |
460815560caf3eb56f9ca7a254a67a20277df038
|
Update astcenc.h comment
Add missing full stop in comment.
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc.h",
"new_path": "Source/astcenc.h",
"diff": "*\n* The codec supports compressing single images, which can be either 2D images or volumetric 3D\n* images. Calling code is responsible for any handling of aggregate types, such as mipmap chains,\n- * texture arrays, or sliced 3D textures\n+ * texture arrays, or sliced 3D textures.\n*\n* Images are passed in as an astcenc_image structure. Inputs can be either 8-bit unorm, 16-bit\n* half-float, or 32-bit float, as indicated by the data_type field.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update astcenc.h comment (#375)
Add missing full stop in comment.
|
61,745 |
16.09.2022 20:20:33
| -3,600 |
aafc417109d2037e9cdee7141d8a3af4668cfe5f
|
Add half-pixel filtering
|
[
{
"change_type": "MODIFY",
"old_path": "Utils/astc_blend_test.cpp",
"new_path": "Utils/astc_blend_test.cpp",
"diff": "@@ -64,9 +64,9 @@ static float linear_to_srgb(\nint main(int argc, char **argv)\n{\n// Parse command line\n- if (argc != 5)\n+ if (argc != 6)\n{\n- printf(\"Usage: astc_blend_test <source> <dest> <format> <blend_mode>\\n\");\n+ printf(\"Usage: astc_blend_test <source> <dest> <format> <blend_mode> <filter>\\n\");\nexit(1);\n}\n@@ -103,6 +103,21 @@ int main(int argc, char **argv)\nexit(1);\n}\n+ bool use_filter = false;\n+ if (!strcmp(argv[5], \"on\"))\n+ {\n+ use_filter = true;\n+ }\n+ else if (!strcmp(argv[5], \"off\"))\n+ {\n+ use_filter == false;\n+ }\n+ else\n+ {\n+ printf(\"<filter> must be either 'on' or 'off'\\n\");\n+ exit(1);\n+ }\n+\n// Load the input image\nint dim_x;\nint dim_y;\n@@ -122,6 +137,8 @@ int main(int argc, char **argv)\n}\n// For each pixel apply RGBM encoding\n+ if (!use_filter)\n+ {\nfor (int y = 0; y < dim_y; y++)\n{\nconst uint8_t* row_in = data_in + (4 * dim_x * y);\n@@ -188,9 +205,94 @@ int main(int argc, char **argv)\npixel_out[3] = (uint8_t)(a_out * 255.0f);\n}\n}\n+ }\n+ else\n+ {\n+ for (int y = 0; y < dim_y - 1; y++)\n+ {\n+ const uint8_t* row_in_0 = data_in + (4 * dim_x * y);\n+ const uint8_t* row_in_1 = data_in + (4 * dim_x * (y + 1));\n+\n+ uint8_t* row_out = data_out + (4 * (dim_x - 1) * y);\n+\n+ for (int x = 0; x < dim_x - 1; x++)\n+ {\n+ const uint8_t* pixel_in_00 = row_in_0 + 4 * x;\n+ const uint8_t* pixel_in_01 = row_in_0 + 4 * (x + 1);\n+ const uint8_t* pixel_in_10 = row_in_1 + 4 * x;\n+ const uint8_t* pixel_in_11 = row_in_1 + 4 * (x + 1);\n+\n+ uint8_t* pixel_out = row_out + 4 * x;\n+\n+ // Bilinear filter with a half-pixel offset\n+ float r_src = static_cast<float>(pixel_in_00[0] + pixel_in_01[0] + pixel_in_10[0] + pixel_in_11[0]) / (255.0f * 4.0f);\n+ float g_src = static_cast<float>(pixel_in_00[1] + pixel_in_01[1] + pixel_in_10[1] + pixel_in_11[2]) / (255.0f * 4.0f);\n+ float b_src = static_cast<float>(pixel_in_00[2] + pixel_in_01[2] + pixel_in_10[2] + pixel_in_11[3]) / (255.0f * 4.0f);\n+ float a_src = static_cast<float>(pixel_in_00[3] + pixel_in_01[3] + pixel_in_10[3] + pixel_in_11[4]) / (255.0f * 4.0f);\n+\n+ if (use_linear == false)\n+ {\n+ r_src = srgb_to_linear(r_src);\n+ g_src = srgb_to_linear(g_src);\n+ b_src = srgb_to_linear(b_src);\n+ }\n+\n+ float r_dst = 0.8f;\n+ float g_dst = 1.0f;\n+ float b_dst = 0.8f;\n+\n+ float r_out;\n+ float g_out;\n+ float b_out;\n+ float a_out;\n+\n+ // Post-multiply blending\n+ if (use_post_blend)\n+ {\n+ r_out = (r_dst * (1.0f - a_src)) + (r_src * a_src);\n+ g_out = (g_dst * (1.0f - a_src)) + (g_src * a_src);\n+ b_out = (b_dst * (1.0f - a_src)) + (b_src * a_src);\n+ a_out = 1.0f;\n+ }\n+ // Pre-multiply blending\n+ else\n+ {\n+ r_out = (r_dst * (1.0f - a_src)) + (r_src * 1.0f);\n+ g_out = (g_dst * (1.0f - a_src)) + (g_src * 1.0f);\n+ b_out = (b_dst * (1.0f - a_src)) + (b_src * 1.0f);\n+ a_out = 1.0f;\n+ }\n+\n+ // Clamp color between 0 and 1.0f\n+ r_out = astc::min(r_out, 1.0f);\n+ g_out = astc::min(g_out, 1.0f);\n+ b_out = astc::min(b_out, 1.0f);\n+\n+ if (use_linear == false)\n+ {\n+ r_out = linear_to_srgb(r_out);\n+ g_out = linear_to_srgb(g_out);\n+ b_out = linear_to_srgb(b_out);\n+ }\n+\n+ pixel_out[0] = (uint8_t)(r_out * 255.0f);\n+ pixel_out[1] = (uint8_t)(g_out * 255.0f);\n+ pixel_out[2] = (uint8_t)(b_out * 255.0f);\n+ pixel_out[3] = (uint8_t)(a_out * 255.0f);\n+ }\n+ }\n+ }\n// Write out the result\n+ if (!use_filter)\n+ {\nstbi_write_png(dst_file, dim_x, dim_y, 4, data_out, 4 * dim_x);\n+ }\n+ else\n+ {\n+ stbi_write_png(dst_file, dim_x - 1, dim_y - 1, 4, data_out, 4 * (dim_x - 1));\n+ }\n+\nreturn 0;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add half-pixel filtering
|
61,745 |
16.09.2022 20:32:15
| -3,600 |
43d5f57babf0904f9e4222dc3644790d8e41aab4
|
Fix filtering in blend test util
|
[
{
"change_type": "MODIFY",
"old_path": "Utils/astc_blend_test.cpp",
"new_path": "Utils/astc_blend_test.cpp",
"diff": "@@ -226,9 +226,9 @@ int main(int argc, char **argv)\n// Bilinear filter with a half-pixel offset\nfloat r_src = static_cast<float>(pixel_in_00[0] + pixel_in_01[0] + pixel_in_10[0] + pixel_in_11[0]) / (255.0f * 4.0f);\n- float g_src = static_cast<float>(pixel_in_00[1] + pixel_in_01[1] + pixel_in_10[1] + pixel_in_11[2]) / (255.0f * 4.0f);\n- float b_src = static_cast<float>(pixel_in_00[2] + pixel_in_01[2] + pixel_in_10[2] + pixel_in_11[3]) / (255.0f * 4.0f);\n- float a_src = static_cast<float>(pixel_in_00[3] + pixel_in_01[3] + pixel_in_10[3] + pixel_in_11[4]) / (255.0f * 4.0f);\n+ float g_src = static_cast<float>(pixel_in_00[1] + pixel_in_01[1] + pixel_in_10[1] + pixel_in_11[1]) / (255.0f * 4.0f);\n+ float b_src = static_cast<float>(pixel_in_00[2] + pixel_in_01[2] + pixel_in_10[2] + pixel_in_11[2]) / (255.0f * 4.0f);\n+ float a_src = static_cast<float>(pixel_in_00[3] + pixel_in_01[3] + pixel_in_10[3] + pixel_in_11[3]) / (255.0f * 4.0f);\nif (use_linear == false)\n{\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix filtering in blend test util
|
61,745 |
12.10.2022 20:40:22
| -3,600 |
2c3675a20c72a921ef7ffeb7d4bbadf77bca9c89
|
Update profiling script for latest callgrind
Now supports Ubuntu 22.04 vresion of callgrind_annotate
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_dump_binary.py",
"new_path": "Test/astc_dump_binary.py",
"diff": "#!/usr/bin/env python3\n# SPDX-License-Identifier: Apache-2.0\n# -----------------------------------------------------------------------------\n-# Copyright 2021 Arm Limited\n+# Copyright 2021-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@@ -56,7 +56,7 @@ def run_objdump(binary, symbol):\nresult = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\ncheck=True, universal_newlines=True)\n- funcPattern = re.compile(r\"^[0-9a-f]{16} <(.*)\\(.*\\)>:$\")\n+ funcPattern = re.compile(r\"^[0-9a-f]{16} <(.*?)\\(.*\\)>:$\")\nfuncLines = []\nfuncActive = False\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_profile_valgrind.py",
"new_path": "Test/astc_profile_valgrind.py",
"diff": "@@ -33,23 +33,22 @@ import re\nimport subprocess as sp\nimport sys\n-def postprocess_cga(logfile, outfile):\n+def postprocess_cga(lines, outfile):\n\"\"\"\nPostprocess the output of callgrind_annotate.\nArgs:\n- logfile (str): The output of callgrind_annotate.\n+ lines ([str]): The output of callgrind_annotate.\noutfile (str): The output file path to write.\n\"\"\"\n- pattern = re.compile(\"^\\s*([0-9,]+)\\s+Source/(\\S+):(\\S+)\\(.*\\).*$\")\n-\n- lines = logfile.splitlines()\n+ pattern = re.compile(\"^\\s*([0-9,]+)\\s+\\([ 0-9.]+%\\)\\s+Source/(\\S+):(\\S+)\\(.*\\).*$\")\ntotalCost = 0.0\nfunctionTable = []\nfunctionMap = {}\nfor line in lines:\n+ line = line.strip()\nmatch = pattern.match(line)\nif not match:\ncontinue\n@@ -118,7 +117,11 @@ def run_pass(image, noStartup, encoder, blocksize, quality):\nargs = [\"callgrind_annotate\", \"callgrind.txt\"]\nret = sp.run(args, stdout=sp.PIPE, check=True, encoding=\"utf-8\")\n- postprocess_cga(ret.stdout, \"perf_%s.txt\" % quality.replace(\"-\", \"\"))\n+ lines = ret.stdout.splitlines()\n+ with open(\"perf_%s_cga.txt\" % quality.replace(\"-\", \"\"), \"w\") as handle:\n+ handle.write(\"\\n\".join(lines))\n+\n+ postprocess_cga(lines, \"perf_%s.txt\" % quality.replace(\"-\", \"\"))\nif noStartup:\nargs = [\"gprof2dot\", \"--format=callgrind\", \"--output=out.dot\", \"callgrind.txt\",\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update profiling script for latest callgrind
Now supports Ubuntu 22.04 vresion of callgrind_annotate
|
61,745 |
18.10.2022 22:48:06
| -3,600 |
2d16287fe7a340994f6679dc427b7ba75377ef7f
|
Remove partition validity sentinels
These are no longer needed, as the valid partitions are now
stored tightly packed and so can be iterated without touching
invalid holes in the partition listing.
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_find_best_partitioning.cpp",
"new_path": "Source/astcenc_find_best_partitioning.cpp",
"diff": "@@ -367,24 +367,21 @@ static void count_partition_mismatch_bits(\n{\nfor (unsigned int i = 0; i < active_count; i++)\n{\n- int bitcount = partition_mismatch2(bitmaps, bsd.coverage_bitmaps_2[i]);\n- mismatch_counts[i] = astc::max(bitcount, static_cast<int>(bsd.partitioning_valid_2[i]));\n+ mismatch_counts[i] = partition_mismatch2(bitmaps, bsd.coverage_bitmaps_2[i]);\n}\n}\nelse if (partition_count == 3)\n{\nfor (unsigned int i = 0; i < active_count; i++)\n{\n- int bitcount = partition_mismatch3(bitmaps, bsd.coverage_bitmaps_3[i]);\n- mismatch_counts[i] = astc::max(bitcount, static_cast<int>(bsd.partitioning_valid_3[i]));\n+ mismatch_counts[i] = partition_mismatch3(bitmaps, bsd.coverage_bitmaps_3[i]);\n}\n}\nelse\n{\nfor (unsigned int i = 0; i < active_count; i++)\n{\n- int bitcount = partition_mismatch4(bitmaps, bsd.coverage_bitmaps_4[i]);\n- mismatch_counts[i] = astc::max(bitcount, static_cast<int>(bsd.partitioning_valid_4[i]));\n+ mismatch_counts[i] = partition_mismatch4(bitmaps, bsd.coverage_bitmaps_4[i]);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -579,13 +579,6 @@ struct block_size_descriptor\n/** @brief The active texels for k-means partition selection. */\nuint8_t kmeans_texels[BLOCK_MAX_KMEANS_TEXELS];\n- /**\n- * @brief Is 0 if this 2-partition is valid for compression 255 otherwise.\n- *\n- * Indexed by remapped index, not physical index.\n- */\n- uint8_t partitioning_valid_2[BLOCK_MAX_PARTITIONINGS];\n-\n/**\n* @brief The canonical 2-partition coverage pattern used during block partition search.\n*\n@@ -593,13 +586,6 @@ struct block_size_descriptor\n*/\nuint64_t coverage_bitmaps_2[BLOCK_MAX_PARTITIONINGS][2];\n- /**\n- * @brief Is 0 if this 3-partition is valid for compression 255 otherwise.\n- *\n- * Indexed by remapped index, not physical index.\n- */\n- uint8_t partitioning_valid_3[BLOCK_MAX_PARTITIONINGS];\n-\n/**\n* @brief The canonical 3-partition coverage pattern used during block partition search.\n*\n@@ -607,13 +593,6 @@ struct block_size_descriptor\n*/\nuint64_t coverage_bitmaps_3[BLOCK_MAX_PARTITIONINGS][3];\n- /**\n- * @brief Is 0 if this 4-partition is valid for compression 255 otherwise.\n- *\n- * Indexed by remapped index, not physical index.\n- */\n- uint8_t partitioning_valid_4[BLOCK_MAX_PARTITIONINGS];\n-\n/**\n* @brief The canonical 4-partition coverage pattern used during block partition search.\n*\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_partition_tables.cpp",
"new_path": "Source/astcenc_partition_tables.cpp",
"diff": "@@ -320,21 +320,17 @@ static bool generate_one_partition_info_entry(\n// Populate the coverage bitmaps for 2/3/4 partitions\nuint64_t* bitmaps { nullptr };\n- uint8_t* valids { nullptr };\nif (partition_count == 2)\n{\nbitmaps = bsd.coverage_bitmaps_2[partition_remap_index];\n- valids = bsd.partitioning_valid_2;\n}\nelse if (partition_count == 3)\n{\nbitmaps = bsd.coverage_bitmaps_3[partition_remap_index];\n- valids = bsd.partitioning_valid_3;\n}\nelse if (partition_count == 4)\n{\nbitmaps = bsd.coverage_bitmaps_4[partition_remap_index];\n- valids = bsd.partitioning_valid_4;\n}\nfor (unsigned int i = 0; i < BLOCK_MAX_PARTITIONS; i++)\n@@ -347,9 +343,7 @@ static bool generate_one_partition_info_entry(\nif (bitmaps)\n{\n- // Populate the bitmap validity mask\n- valids[partition_remap_index] = valid ? 0 : 255;\n-\n+ // Populate the partition coverage bitmap\nfor (unsigned int i = 0; i < partition_count; i++)\n{\nbitmaps[i] = 0ULL;\n@@ -374,12 +368,6 @@ static void build_partition_table_for_one_partition_count(\npartition_info* ptab,\nuint64_t* canonical_patterns\n) {\n- uint8_t* partitioning_valid[3] {\n- bsd.partitioning_valid_2,\n- bsd.partitioning_valid_3,\n- bsd.partitioning_valid_4\n- };\n-\nunsigned int next_index = 0;\nbsd.partitioning_count_selected[partition_count - 1] = 0;\nbsd.partitioning_count_all[partition_count - 1] = 0;\n@@ -442,7 +430,6 @@ static void build_partition_table_for_one_partition_count(\n{\nbsd.partitioning_packed_index[partition_count - 2][i] = static_cast<uint16_t>(next_index);\nbsd.partitioning_count_all[partition_count - 1]++;\n- partitioning_valid[partition_count - 2][next_index] = 255;\nnext_index++;\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove partition validity sentinels (#378)
These are no longer needed, as the valid partitions are now
stored tightly packed and so can be iterated without touching
invalid holes in the partition listing.
|
61,745 |
19.10.2022 22:15:40
| -3,600 |
d0185710937ff9da03638769111af57737460b22
|
Remove the channel weight from avgs_and_dirs calculation
Identical scaling was applied to all channels, and so could never
alter the direction of the returned partition direction vector, only
its magnitude. Later use normalizes the vector so this is redundant.
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_averages_and_directions.cpp",
"new_path": "Source/astcenc_averages_and_directions.cpp",
"diff": "@@ -390,8 +390,6 @@ void compute_avgs_and_dirs_4_comp(\nconst image_block& blk,\npartition_metrics pm[BLOCK_MAX_PARTITIONS]\n) {\n- float texel_weight = hadd_s(blk.channel_weight) / 4.0f;\n-\nint partition_count = pi.partition_count;\npromise(partition_count > 0);\n@@ -434,11 +432,6 @@ void compute_avgs_and_dirs_4_comp(\nsum_wp += select(zero, texel_datum, tdm3);\n}\n- sum_xp = sum_xp * texel_weight;\n- sum_yp = sum_yp * texel_weight;\n- sum_zp = sum_zp * texel_weight;\n- sum_wp = sum_wp * texel_weight;\n-\nvfloat4 prod_xp = dot(sum_xp, sum_xp);\nvfloat4 prod_yp = dot(sum_yp, sum_yp);\nvfloat4 prod_zp = dot(sum_zp, sum_zp);\n@@ -473,8 +466,6 @@ void compute_avgs_and_dirs_3_comp(\nvfloat4 partition_averages[BLOCK_MAX_PARTITIONS];\ncompute_partition_averages_rgba(pi, blk, partition_averages);\n- float texel_weight = hadd_s(blk.channel_weight.swz<0, 1, 2>());\n-\nconst float* data_vr = blk.data_r;\nconst float* data_vg = blk.data_g;\nconst float* data_vb = blk.data_b;\n@@ -482,8 +473,6 @@ void compute_avgs_and_dirs_3_comp(\n// TODO: Data-driven permute would be useful to avoid this ...\nif (omitted_component == 0)\n{\n- texel_weight = hadd_s(blk.channel_weight.swz<1, 2, 3>());\n-\npartition_averages[0] = partition_averages[0].swz<1, 2, 3>();\npartition_averages[1] = partition_averages[1].swz<1, 2, 3>();\npartition_averages[2] = partition_averages[2].swz<1, 2, 3>();\n@@ -495,8 +484,6 @@ void compute_avgs_and_dirs_3_comp(\n}\nelse if (omitted_component == 1)\n{\n- texel_weight = hadd_s(blk.channel_weight.swz<0, 2, 3>());\n-\npartition_averages[0] = partition_averages[0].swz<0, 2, 3>();\npartition_averages[1] = partition_averages[1].swz<0, 2, 3>();\npartition_averages[2] = partition_averages[2].swz<0, 2, 3>();\n@@ -507,8 +494,6 @@ void compute_avgs_and_dirs_3_comp(\n}\nelse if (omitted_component == 2)\n{\n- texel_weight = hadd_s(blk.channel_weight.swz<0, 1, 3>());\n-\npartition_averages[0] = partition_averages[0].swz<0, 1, 3>();\npartition_averages[1] = partition_averages[1].swz<0, 1, 3>();\npartition_averages[2] = partition_averages[2].swz<0, 1, 3>();\n@@ -524,8 +509,6 @@ void compute_avgs_and_dirs_3_comp(\npartition_averages[3] = partition_averages[3].swz<0, 1, 2>();\n}\n- texel_weight = texel_weight * (1.0f / 3.0f);\n-\nunsigned int partition_count = pi.partition_count;\npromise(partition_count > 0);\n@@ -563,10 +546,6 @@ void compute_avgs_and_dirs_3_comp(\nsum_zp += select(zero, texel_datum, tdm2);\n}\n- sum_xp = sum_xp * texel_weight;\n- sum_yp = sum_yp * texel_weight;\n- sum_zp = sum_zp * texel_weight;\n-\nvfloat4 prod_xp = dot(sum_xp, sum_xp);\nvfloat4 prod_yp = dot(sum_yp, sum_yp);\nvfloat4 prod_zp = dot(sum_zp, sum_zp);\n@@ -591,8 +570,6 @@ void compute_avgs_and_dirs_3_comp_rgb(\nconst image_block& blk,\npartition_metrics pm[BLOCK_MAX_PARTITIONS]\n) {\n- float texel_weight = hadd_s(blk.channel_weight.swz<0, 1, 2>()) * (1.0f / 3.0f);\n-\nunsigned int partition_count = pi.partition_count;\npromise(partition_count > 0);\n@@ -632,10 +609,6 @@ void compute_avgs_and_dirs_3_comp_rgb(\nsum_zp += select(zero, texel_datum, tdm2);\n}\n- sum_xp = sum_xp * texel_weight;\n- sum_yp = sum_yp * texel_weight;\n- sum_zp = sum_zp * texel_weight;\n-\nvfloat4 prod_xp = dot(sum_xp, sum_xp);\nvfloat4 prod_yp = dot(sum_yp, sum_yp);\nvfloat4 prod_zp = dot(sum_zp, sum_zp);\n@@ -662,7 +635,6 @@ void compute_avgs_and_dirs_2_comp(\nunsigned int component2,\npartition_metrics pm[BLOCK_MAX_PARTITIONS]\n) {\n- float texel_weight;\nvfloat4 average;\nconst float* data_vr = nullptr;\n@@ -670,7 +642,6 @@ void compute_avgs_and_dirs_2_comp(\nif (component1 == 0 && component2 == 1)\n{\n- texel_weight = hadd_s(blk.channel_weight.swz<0, 1>()) / 2.0f;\naverage = blk.data_mean.swz<0, 1>();\ndata_vr = blk.data_r;\n@@ -678,7 +649,6 @@ void compute_avgs_and_dirs_2_comp(\n}\nelse if (component1 == 0 && component2 == 2)\n{\n- texel_weight = hadd_s(blk.channel_weight.swz<0, 2>()) / 2.0f;\naverage = blk.data_mean.swz<0, 2>();\ndata_vr = blk.data_r;\n@@ -688,7 +658,6 @@ void compute_avgs_and_dirs_2_comp(\n{\nassert(component1 == 1 && component2 == 2);\n- texel_weight = hadd_s(blk.channel_weight.swz<1, 2>()) / 2.0f;\naverage = blk.data_mean.swz<1, 2>();\ndata_vr = blk.data_g;\n@@ -737,9 +706,6 @@ void compute_avgs_and_dirs_2_comp(\nsum_yp += select(zero, texel_datum, tdm1);\n}\n- sum_xp = sum_xp * texel_weight;\n- sum_yp = sum_yp * texel_weight;\n-\nvfloat4 prod_xp = dot(sum_xp, sum_xp);\nvfloat4 prod_yp = dot(sum_yp, sum_yp);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove the channel weight from avgs_and_dirs calculation
Identical scaling was applied to all channels, and so could never
alter the direction of the returned partition direction vector, only
its magnitude. Later use normalizes the vector so this is redundant.
|
61,745 |
19.10.2022 22:33:46
| -3,600 |
1753835c15b3ea3eb61f22857d1ef19e91f7b8ed
|
Use direct division
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_averages_and_directions.cpp",
"new_path": "Source/astcenc_averages_and_directions.cpp",
"diff": "@@ -683,7 +683,7 @@ void compute_avgs_and_dirs_2_comp(\naverage += vfloat2(data_vr[iwt], data_vg[iwt]);\n}\n- average = average * (1.0f / static_cast<float>(texel_count));\n+ average = average / static_cast<float>(texel_count);\n}\npm[partition].avg = average;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -1292,7 +1292,7 @@ void recompute_ideal_colors_1plane(\ncolor_vec_y = color_vec_y * color_weight;\n// Initialize the luminance and scale vectors with a reasonable default\n- float scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\n+ float scalediv = scale_min / astc::max(scale_max, 1e-10f);\nscalediv = astc::clamp1f(scalediv);\nvfloat4 sds = scale_dir * scale_max;\n@@ -1344,7 +1344,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{\n- float scalediv2 = scale_ep0 * (1.0f / scale_ep1);\n+ float scalediv2 = scale_ep0 / scale_ep1;\nvfloat4 sdsm = scale_dir * scale_ep1;\nrgbs_vectors[i] = vfloat4(sdsm.lane<0>(), sdsm.lane<1>(), sdsm.lane<2>(), scalediv2);\n}\n@@ -1535,7 +1535,7 @@ void recompute_ideal_colors_2planes(\ncolor_vec_y = color_vec_y * color_weight;\n// Initialize the luminance and scale vectors with a reasonable default\n- float scalediv = scale_min * (1.0f / astc::max(scale_max, 1e-10f));\n+ float scalediv = scale_min / astc::max(scale_max, 1e-10f);\nscalediv = astc::clamp1f(scalediv);\nvfloat4 sds = scale_dir * scale_max;\n@@ -1591,7 +1591,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{\n- float scalediv2 = scale_ep0 * (1.0f / scale_ep1);\n+ float scalediv2 = scale_ep0 / scale_ep1;\nvfloat4 sdsm = scale_dir * scale_ep1;\nrgbs_vector = vfloat4(sdsm.lane<0>(), sdsm.lane<1>(), sdsm.lane<2>(), scalediv2);\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use direct division
|
61,745 |
20.10.2022 22:46:03
| -3,600 |
5f8439a4d740607452b2f587188d84a96c21c444
|
Remove unneeded vector swizzles
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_find_best_partitioning.cpp",
"new_path": "Source/astcenc_find_best_partitioning.cpp",
"diff": "@@ -642,10 +642,10 @@ void find_best_partition_candidates(\npartition_lines3& pl = plines[j];\npl.uncor_line.a = pm.avg;\n- pl.uncor_line.b = normalize_safe(pm.dir.swz<0, 1, 2>(), unit3());\n+ pl.uncor_line.b = normalize_safe(pm.dir, unit3());\npl.samec_line.a = vfloat4::zero();\n- pl.samec_line.b = normalize_safe(pm.avg.swz<0, 1, 2>(), unit3());\n+ pl.samec_line.b = normalize_safe(pm.avg, unit3());\npl.uncor_pline.amod = pl.uncor_line.a - pl.uncor_line.b * dot3(pl.uncor_line.a, pl.uncor_line.b);\npl.uncor_pline.bs = pl.uncor_line.b;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -268,13 +268,13 @@ static void compute_ideal_colors_and_weights_2_comp(\nfor (unsigned int i = 0; i < partition_count; i++)\n{\n- vfloat4 dir = pms[i].dir.swz<0, 1>();\n+ vfloat4 dir = pms[i].dir;\nif (hadd_s(dir) < 0.0f)\n{\ndir = vfloat4::zero() - dir;\n}\n- line2 line { pms[i].avg.swz<0, 1>(), normalize_safe(dir, unit2()) };\n+ line2 line { pms[i].avg, normalize_safe(dir, unit2()) };\nfloat lowparam { 1e10f };\nfloat highparam { -1e10f };\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove unneeded vector swizzles
|
61,745 |
21.10.2022 00:04:45
| -3,600 |
e0f12340e1abc6cc27097d51587021a178eb105b
|
Use vector compares for vmask generation
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_weight_align.cpp",
"new_path": "Source/astcenc_weight_align.cpp",
"diff": "@@ -287,25 +287,25 @@ static void compute_angular_endpoints_for_quant_levels(\n// Check best error against record N\nvfloat4 best_result = best_results[idx_span];\nvfloat4 new_result = vfloat4(error[i], i_flt, 0.0f, 0.0f);\n- vmask4 mask1(best_result.lane<0>() > error[i]);\n- best_results[idx_span] = select(best_result, new_result, mask1);\n+ vmask4 mask = vfloat4(best_result.lane<0>()) > vfloat4(error[i]);\n+ best_results[idx_span] = select(best_result, new_result, mask);\n// Check best error against record N-1 with either cut low or cut high\nbest_result = best_results[idx_span - 1];\nnew_result = vfloat4(error_cut_low, i_flt, 1.0f, 0.0f);\n- vmask4 mask2(best_result.lane<0>() > error_cut_low);\n- best_result = select(best_result, new_result, mask2);\n+ mask = vfloat4(best_result.lane<0>()) > vfloat4(error_cut_low);\n+ best_result = select(best_result, new_result, mask);\nnew_result = vfloat4(error_cut_high, i_flt, 0.0f, 0.0f);\n- vmask4 mask3(best_result.lane<0>() > error_cut_high);\n- best_results[idx_span - 1] = select(best_result, new_result, mask3);\n+ mask = vfloat4(best_result.lane<0>()) > vfloat4(error_cut_high);\n+ best_results[idx_span - 1] = select(best_result, new_result, mask);\n// Check best error against record N-2 with both cut low and high\nbest_result = best_results[idx_span - 2];\nnew_result = vfloat4(error_cut_low_high, i_flt, 1.0f, 0.0f);\n- vmask4 mask4(best_result.lane<0>() > error_cut_low_high);\n- best_results[idx_span - 2] = select(best_result, new_result, mask4);\n+ mask = vfloat4(best_result.lane<0>()) > vfloat4(error_cut_low_high);\n+ best_results[idx_span - 2] = select(best_result, new_result, mask);\n}\nfor (unsigned int i = 0; i <= max_quant_level; i++)\n@@ -451,7 +451,7 @@ static void compute_angular_endpoints_for_quant_levels_lwc(\n// Check best error against record N\nvfloat4 current_best = best_results[idx_span];\nvfloat4 candidate = vfloat4(error[i], static_cast<float>(i), 0.0f, 0.0f);\n- vmask4 mask(current_best.lane<0>() > error[i]);\n+ vmask4 mask = vfloat4(current_best.lane<0>()) > vfloat4(error[i]);\nbest_results[idx_span] = select(current_best, candidate, mask);\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use vector compares for vmask generation
|
61,745 |
27.10.2022 22:09:28
| -3,600 |
14bfa39c0238209c0659b95ba56fe76c63062041
|
Tune to recover quality losses
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -68,10 +68,10 @@ static const std::array<astcenc_preset_config, 5> preset_configs_high {{\n3, 14, 55, 3, 3, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.65f, 20\n}, {\nASTCENC_PRE_MEDIUM,\n- 4, 30, 76, 3, 3, 95.0f, 70.0f, 2.5f, 2.5f, 1.1f, 1.05f, 0.85f, 16\n+ 4, 31, 77, 3, 3, 95.0f, 70.0f, 2.5f, 2.5f, 1.1f, 1.05f, 0.85f, 16\n}, {\nASTCENC_PRE_THOROUGH,\n- 4, 76, 93, 4, 4, 105.0f, 77.0f, 10.0f, 10.0f, 1.3f, 1.1f, 0.95f, 12\n+ 4, 78, 94, 4, 4, 105.0f, 77.0f, 10.0f, 10.0f, 1.3f, 1.1f, 0.95f, 12\n}, {\nASTCENC_PRE_EXHAUSTIVE,\n4, 1024, 100, 4, 4, 200.0f, 200.0f, 10.0f, 10.0f, 10.0f, 10.0f, 0.99f, 0\n@@ -91,10 +91,10 @@ static const std::array<astcenc_preset_config, 5> preset_configs_mid {{\n3, 15, 55, 3, 3, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f, 16\n}, {\nASTCENC_PRE_MEDIUM,\n- 4, 32, 76, 3, 3, 95.0f, 70.0f, 3.0f, 3.0f, 1.1f, 1.05f, 0.75f, 14\n+ 4, 33, 77, 3, 3, 95.0f, 70.0f, 3.0f, 3.0f, 1.1f, 1.05f, 0.75f, 14\n}, {\nASTCENC_PRE_THOROUGH,\n- 4, 76, 93, 4, 4, 105.0f, 77.0f, 10.0f, 10.0f, 1.3f, 1.15f, 0.95f, 10\n+ 4, 78, 94, 4, 4, 105.0f, 77.0f, 10.0f, 10.0f, 1.3f, 1.15f, 0.95f, 10\n}, {\nASTCENC_PRE_EXHAUSTIVE,\n4, 1024, 100, 4, 4, 200.0f, 200.0f, 10.0f, 10.0f, 10.0f, 10.0f, 0.99f, 0\n@@ -114,10 +114,10 @@ static const std::array<astcenc_preset_config, 5> preset_configs_low {{\n2, 15, 55, 3, 3, 85.0f, 63.0f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f, 16\n}, {\nASTCENC_PRE_MEDIUM,\n- 3, 32, 76, 3, 3, 95.0f, 70.0f, 3.5f, 3.5f, 1.1f, 1.05f, 0.65f, 12\n+ 3, 33, 77, 3, 3, 95.0f, 70.0f, 3.5f, 3.5f, 1.1f, 1.05f, 0.65f, 12\n}, {\nASTCENC_PRE_THOROUGH,\n- 4, 75, 92, 4, 4, 105.0f, 77.0f, 10.0f, 10.0f, 1.2f, 1.1f, 0.85f, 10\n+ 4, 77, 93, 4, 4, 105.0f, 77.0f, 10.0f, 10.0f, 1.2f, 1.1f, 0.85f, 10\n}, {\nASTCENC_PRE_EXHAUSTIVE,\n4, 1024, 100, 4, 4, 200.0f, 200.0f, 10.0f, 10.0f, 10.0f, 10.0f, 0.99f, 0\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Tune to recover quality losses
|
61,745 |
04.11.2022 19:51:18
| 0 |
440b2fd138ed331e1e353eb210eb2c31f3df4e6b
|
Fix encoder base+offset delta encoding
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_color_quantize.cpp",
"new_path": "Source/astcenc_color_quantize.cpp",
"diff": "@@ -334,13 +334,13 @@ static bool try_quantize_rgb_delta(\nint g0be = quant_color(quant_level, g0b);\nint b0be = quant_color(quant_level, b0b);\n- r0b = unquant_color(quant_level, r0be);\n- g0b = unquant_color(quant_level, g0be);\n- b0b = unquant_color(quant_level, b0be);\n+ int r0bu = unquant_color(quant_level, r0be);\n+ int g0bu = unquant_color(quant_level, g0be);\n+ int b0bu = unquant_color(quant_level, b0be);\n- r0b |= r0a & 0x100;\n- g0b |= g0a & 0x100;\n- b0b |= b0a & 0x100;\n+ r0b = r0bu | (r0a & 0x100);\n+ g0b = g0bu | (g0a & 0x100);\n+ b0b = b0bu | (b0a & 0x100);\n// Get hold of the second value\nint r1d = astc::flt2int_rtn(r1);\n@@ -386,36 +386,18 @@ static bool try_quantize_rgb_delta(\nreturn false;\n}\n- // Check that the sum of the encoded offsets is nonnegative, else encoding fails\n- r1du &= 0x7f;\n- g1du &= 0x7f;\n- b1du &= 0x7f;\n-\n- if (r1du & 0x40)\n- {\n- r1du -= 0x80;\n- }\n-\n- if (g1du & 0x40)\n- {\n- g1du -= 0x80;\n- }\n-\n- if (b1du & 0x40)\n- {\n- b1du -= 0x80;\n- }\n-\n- if (r1du + g1du + b1du < 0)\n+ // If the sum of offsets triggers blue-contraction then encoding fails\n+ vint4 ep0(r0bu, g0bu, b0bu, 0);\n+ vint4 ep1(r1du, g1du, b1du, 0);\n+ bit_transfer_signed(ep1, ep0);\n+ if (hadd_rgb_s(ep1) < 0)\n{\nreturn false;\n}\n// Check that the offsets produce legitimate sums as well\n- r1du += r0b;\n- g1du += g0b;\n- b1du += b0b;\n- if (r1du < 0 || r1du > 0x1FF || g1du < 0 || g1du > 0x1FF || b1du < 0 || b1du > 0x1FF)\n+ ep0 = ep0 + ep1;\n+ if (any((ep0 < vint4(0)) | (ep0 > vint4(0xFF))))\n{\nreturn false;\n}\n@@ -477,13 +459,13 @@ static bool try_quantize_rgb_delta_blue_contract(\nint g0be = quant_color(quant_level, g0b);\nint b0be = quant_color(quant_level, b0b);\n- r0b = unquant_color(quant_level, r0be);\n- g0b = unquant_color(quant_level, g0be);\n- b0b = unquant_color(quant_level, b0be);\n+ int r0bu = unquant_color(quant_level, r0be);\n+ int g0bu = unquant_color(quant_level, g0be);\n+ int b0bu = unquant_color(quant_level, b0be);\n- r0b |= r0a & 0x100;\n- g0b |= g0a & 0x100;\n- b0b |= b0a & 0x100;\n+ r0b = r0bu | (r0a & 0x100);\n+ g0b = g0bu | (g0a & 0x100);\n+ b0b = b0bu | (b0a & 0x100);\n// Get hold of the second value\nint r1d = astc::flt2int_rtn(r1);\n@@ -530,38 +512,18 @@ static bool try_quantize_rgb_delta_blue_contract(\nreturn false;\n}\n- // Check that the sum of the encoded offsets is negative, else encoding fails\n- // Note that this is inverse of the test for non-blue-contracted RGB.\n- r1du &= 0x7f;\n- g1du &= 0x7f;\n- b1du &= 0x7f;\n-\n- if (r1du & 0x40)\n- {\n- r1du -= 0x80;\n- }\n-\n- if (g1du & 0x40)\n- {\n- g1du -= 0x80;\n- }\n-\n- if (b1du & 0x40)\n- {\n- b1du -= 0x80;\n- }\n-\n- if (r1du + g1du + b1du >= 0)\n+ // If the sum of offsets does not trigger blue-contraction then encoding fails\n+ vint4 ep0(r0bu, g0bu, b0bu, 0);\n+ vint4 ep1(r1du, g1du, b1du, 0);\n+ bit_transfer_signed(ep1, ep0);\n+ if (hadd_rgb_s(ep1) >= 0)\n{\nreturn false;\n}\n// Check that the offsets produce legitimate sums as well\n- r1du += r0b;\n- g1du += g0b;\n- b1du += b0b;\n-\n- if (r1du < 0 || r1du > 0x1FF || g1du < 0 || g1du > 0x1FF || b1du < 0 || b1du > 0x1FF)\n+ ep0 = ep0 + ep1;\n+ if (any((ep0 < vint4(0)) | (ep0 > vint4(0xFF))))\n{\nreturn false;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_color_unquantize.cpp",
"new_path": "Source/astcenc_color_unquantize.cpp",
"diff": "@@ -97,15 +97,8 @@ static void rgba_delta_unpack(\nvint4 input0 = unquant_color(quant_level, input0q);\nvint4 input1 = unquant_color(quant_level, input1q);\n- // Perform bit-transfer\n- input0 = input0 | lsl<1>(input1 & 0x80);\n- input1 = input1 & 0x7F;\n- vmask4 mask = (input1 & 0x40) != vint4::zero();\n- input1 = select(input1, input1 - 0x80, mask);\n-\n- // Scale\n- input0 = asr<1>(input0);\n- input1 = asr<1>(input1);\n+ // Apply bit transfer\n+ bit_transfer_signed(input1, input0);\n// Apply blue-uncontraction if needed\nint rgb_sum = hadd_rgb_s(input1);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_common_4.h",
"new_path": "Source/astcenc_vecmathlib_common_4.h",
"diff": "@@ -361,6 +361,23 @@ static inline int popcount(uint64_t v)\n#endif\n+/**\n+ * @brief Apply signed bit transfer.\n+ *\n+ * @param input0 The first encoded endpoint.\n+ * @param input1 The second encoded endpoint.\n+ */\n+static ASTCENC_SIMD_INLINE void bit_transfer_signed(\n+ vint4& input0,\n+ vint4& input1\n+) {\n+ input1 = lsr<1>(input1) | (input0 & 0x80);\n+ input0 = lsr<1>(input0) & 0x3F;\n+\n+ vmask4 mask = (input0 & 0x20) != vint4::zero();\n+ input0 = select(input0, input0 - 0x40, mask);\n+}\n+\n/**\n* @brief Debug function to print a vector of ints.\n*/\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix encoder base+offset delta encoding (#383)
|
61,745 |
03.11.2022 20:24:23
| 0 |
63d30070a0700126bdcbe3c7c88d6c5e66717703
|
Remove the low-weight count tuning optimization
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc.h",
"new_path": "Source/astcenc.h",
"diff": "@@ -555,11 +555,6 @@ struct astcenc_config\n*/\nfloat tune_2_plane_early_out_limit_correlation;\n- /**\n- * @brief The threshold below which (inclusive) we stop testing low/high/low+high cutoffs.\n- */\n- unsigned int tune_low_weight_count_limit;\n-\n#if defined(ASTCENC_DIAGNOSTICS)\n/**\n* @brief The path to save the diagnostic trace data to.\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -424,11 +424,7 @@ static float compress_symbolic_block_for_partition_1plane(\n// For each mode, use the angular method to compute a shift\ncompute_angular_endpoints_1plane(\n- config.tune_low_weight_count_limit,\n- only_always, bsd,\n- dec_weights_ideal,\n- max_weight_quant,\n- tmpbuf);\n+ only_always, bsd, dec_weights_ideal, max_weight_quant, tmpbuf);\nfloat* weight_low_value = tmpbuf.weight_low_value1;\nfloat* weight_high_value = tmpbuf.weight_high_value1;\n@@ -795,9 +791,7 @@ static float compress_symbolic_block_for_partition_2planes(\nfloat min_wt_cutoff2 = hmin_s(select(err_max, min_ep2, err_mask));\ncompute_angular_endpoints_2planes(\n- config.tune_low_weight_count_limit,\n- bsd, dec_weights_ideal, max_weight_quant,\n- tmpbuf);\n+ bsd, dec_weights_ideal, max_weight_quant, tmpbuf);\n// For each mode (which specifies a decimation and a quantization):\n// * Compute number of bits needed for the quantized weights\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -56,7 +56,6 @@ struct astcenc_preset_config\nfloat tune_2_partition_early_out_limit_factor;\nfloat tune_3_partition_early_out_limit_factor;\nfloat tune_2_plane_early_out_limit_correlation;\n- unsigned int tune_low_weight_count_limit;\n};\n@@ -67,22 +66,22 @@ struct astcenc_preset_config\nstatic const std::array<astcenc_preset_config, 6> preset_configs_high {{\n{\nASTCENC_PRE_FASTEST,\n- 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f, 25\n+ 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f\n}, {\nASTCENC_PRE_FAST,\n- 3, 18, 10, 8, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.65f, 20\n+ 3, 18, 10, 8, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.65f\n}, {\nASTCENC_PRE_MEDIUM,\n- 4, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 2.5f, 2.5f, 1.1f, 1.05f, 0.85f, 16\n+ 4, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 2.5f, 2.5f, 1.1f, 1.05f, 0.85f\n}, {\nASTCENC_PRE_THOROUGH,\n- 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 10.0f, 1.35f, 1.15f, 0.95f, 12\n+ 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 10.0f, 1.35f, 1.15f, 0.95f\n}, {\nASTCENC_PRE_VERYTHOROUGH,\n- 4, 256, 128, 64, 98, 4, 6, 20, 14, 8, 200.0f, 200.0f, 10.0f, 10.0f, 1.6f, 1.4f, 0.98f, 4\n+ 4, 256, 128, 64, 98, 4, 6, 20, 14, 8, 200.0f, 200.0f, 10.0f, 10.0f, 1.6f, 1.4f, 0.98f\n}, {\nASTCENC_PRE_EXHAUSTIVE,\n- 4, 512, 512, 512, 100, 4, 8, 32, 32, 32, 200.0f, 200.0f, 10.0f, 10.0f, 2.0f, 2.0f, 0.99f, 0\n+ 4, 512, 512, 512, 100, 4, 8, 32, 32, 32, 200.0f, 200.0f, 10.0f, 10.0f, 2.0f, 2.0f, 0.99f\n}\n}};\n@@ -93,22 +92,22 @@ static const std::array<astcenc_preset_config, 6> preset_configs_high {{\nstatic const std::array<astcenc_preset_config, 6> preset_configs_mid {{\n{\nASTCENC_PRE_FASTEST,\n- 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f, 20\n+ 2, 10, 6, 4, 43, 2, 2, 2, 2, 2, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f\n}, {\nASTCENC_PRE_FAST,\n- 3, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f, 16\n+ 3, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.2f, 63.2f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f\n}, {\nASTCENC_PRE_MEDIUM,\n- 4, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.0f, 3.0f, 1.1f, 1.05f, 0.75f, 14\n+ 4, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.0f, 3.0f, 1.1f, 1.05f, 0.75f\n}, {\nASTCENC_PRE_THOROUGH,\n- 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 10.0f, 1.4f, 1.2f, 0.95f, 10\n+ 4, 82, 60, 30, 94, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 10.0f, 1.4f, 1.2f, 0.95f\n}, {\nASTCENC_PRE_VERYTHOROUGH,\n- 4, 256, 128, 64, 98, 4, 6, 12, 8, 3, 200.0f, 200.0f, 10.0f, 10.0f, 1.6f, 1.4f, 0.98f, 4\n+ 4, 256, 128, 64, 98, 4, 6, 12, 8, 3, 200.0f, 200.0f, 10.0f, 10.0f, 1.6f, 1.4f, 0.98f\n}, {\nASTCENC_PRE_EXHAUSTIVE,\n- 4, 256, 256, 256, 100, 4, 8, 32, 32, 32, 200.0f, 200.0f, 10.0f, 10.0f, 2.0f, 2.0f, 0.99f, 0\n+ 4, 256, 256, 256, 100, 4, 8, 32, 32, 32, 200.0f, 200.0f, 10.0f, 10.0f, 2.0f, 2.0f, 0.99f\n}\n}};\n@@ -119,22 +118,22 @@ static const std::array<astcenc_preset_config, 6> preset_configs_mid {{\nstatic const std::array<astcenc_preset_config, 6> preset_configs_low {{\n{\nASTCENC_PRE_FASTEST,\n- 2, 10, 6, 4, 40, 2, 2, 2, 2, 2, 85.0f, 63.0f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f, 20\n+ 2, 10, 6, 4, 40, 2, 2, 2, 2, 2, 85.0f, 63.0f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f\n}, {\nASTCENC_PRE_FAST,\n- 2, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.0f, 63.0f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f, 16\n+ 2, 18, 12, 10, 55, 3, 3, 2, 2, 2, 85.0f, 63.0f, 3.5f, 3.5f, 1.0f, 1.0f, 0.5f\n}, {\nASTCENC_PRE_MEDIUM,\n- 3, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.5f, 3.5f, 1.1f, 1.05f, 0.65f, 12\n+ 3, 34, 28, 16, 77, 3, 3, 2, 2, 2, 95.0f, 70.0f, 3.5f, 3.5f, 1.1f, 1.05f, 0.65f\n}, {\nASTCENC_PRE_THOROUGH,\n- 4, 82, 60, 30, 93, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 10.0f, 1.3f, 1.2f, 0.85f, 10\n+ 4, 82, 60, 30, 93, 4, 4, 3, 2, 2, 105.0f, 77.0f, 10.0f, 10.0f, 1.3f, 1.2f, 0.85f\n}, {\nASTCENC_PRE_VERYTHOROUGH,\n- 4, 256, 128, 64, 98, 4, 6, 9, 5, 2, 200.0f, 200.0f, 10.0f, 10.0f, 1.6f, 1.4f, 0.98f, 4\n+ 4, 256, 128, 64, 98, 4, 6, 9, 5, 2, 200.0f, 200.0f, 10.0f, 10.0f, 1.6f, 1.4f, 0.98f\n}, {\nASTCENC_PRE_EXHAUSTIVE,\n- 4, 256, 256, 256, 100, 4, 8, 32, 32, 32, 200.0f, 200.0f, 10.0f, 10.0f, 2.0f, 2.0f, 0.99f, 0\n+ 4, 256, 256, 256, 100, 4, 8, 32, 32, 32, 200.0f, 200.0f, 10.0f, 10.0f, 2.0f, 2.0f, 0.99f\n}\n}};\n@@ -561,7 +560,6 @@ astcenc_error astcenc_config_init(\nconfig.tune_2_partition_early_out_limit_factor = (*preset_configs)[start].tune_2_partition_early_out_limit_factor;\nconfig.tune_3_partition_early_out_limit_factor =(*preset_configs)[start].tune_3_partition_early_out_limit_factor;\nconfig.tune_2_plane_early_out_limit_correlation = (*preset_configs)[start].tune_2_plane_early_out_limit_correlation;\n- config.tune_low_weight_count_limit = (*preset_configs)[start].tune_low_weight_count_limit;\n}\n// Start and end node are not the same - so interpolate between them\nelse\n@@ -605,7 +603,6 @@ astcenc_error astcenc_config_init(\nconfig.tune_2_partition_early_out_limit_factor = LERP(tune_2_partition_early_out_limit_factor);\nconfig.tune_3_partition_early_out_limit_factor = LERP(tune_3_partition_early_out_limit_factor);\nconfig.tune_2_plane_early_out_limit_correlation = LERP(tune_2_plane_early_out_limit_correlation);\n- config.tune_low_weight_count_limit = LERPI(tune_low_weight_count_limit);\n#undef LERP\n#undef LERPI\n#undef LERPUI\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1937,7 +1937,6 @@ void prepare_angular_tables();\n/**\n* @brief Compute the angular endpoints for one plane for each block mode.\n*\n- * @param tune_low_weight_limit Weight count cutoff below which we use simpler searches.\n* @param only_always Only consider block modes that are always enabled.\n* @param bsd The block size descriptor for the current trial.\n* @param dec_weight_ideal_value The ideal decimated unquantized weight values.\n@@ -1945,7 +1944,6 @@ void prepare_angular_tables();\n* @param[out] tmpbuf Preallocated scratch buffers for the compressor.\n*/\nvoid compute_angular_endpoints_1plane(\n- unsigned int tune_low_weight_limit,\nbool only_always,\nconst block_size_descriptor& bsd,\nconst float* dec_weight_ideal_value,\n@@ -1955,14 +1953,12 @@ void compute_angular_endpoints_1plane(\n/**\n* @brief Compute the angular endpoints for two planes for each block mode.\n*\n- * @param tune_low_weight_limit Weight count cutoff below which we use simpler searches.\n* @param bsd The block size descriptor for the current trial.\n* @param dec_weight_ideal_value The ideal decimated unquantized weight values.\n* @param max_weight_quant The maximum block mode weight quantization allowed.\n* @param[out] tmpbuf Preallocated scratch buffers for the compressor.\n*/\nvoid compute_angular_endpoints_2planes(\n- unsigned int tune_low_weight_limit,\nconst block_size_descriptor& bsd,\nconst float* dec_weight_ideal_value,\nunsigned int max_weight_quant,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_weight_align.cpp",
"new_path": "Source/astcenc_weight_align.cpp",
"diff": "@@ -333,156 +333,8 @@ static void compute_angular_endpoints_for_quant_levels(\n}\n}\n-/**\n- * @brief For a given step size compute the lowest and highest weight, variant for low weight count.\n- *\n- * Compute the lowest and highest weight that results from quantizing using the given stepsize and\n- * offset, and then compute the resulting error. The cut errors indicate the error that results from\n- * forcing samples that should have had one weight value one step up or down.\n- *\n- * @param weight_count The number of (decimated) weights.\n- * @param dec_weight_quant_uvalue The decimated and quantized weight values.\n- * @param max_angular_steps The maximum number of steps to be tested.\n- * @param max_quant_steps The maximum quantization level to be tested.\n- * @param offsets The angular offsets array.\n- * @param[out] lowest_weight Per angular step, the lowest weight.\n- * @param[out] weight_span Per angular step, the span between lowest and highest weight.\n- * @param[out] error Per angular step, the error.\n- */\n-static void compute_lowest_and_highest_weight_lwc(\n- unsigned int weight_count,\n- const float* dec_weight_quant_uvalue,\n- unsigned int max_angular_steps,\n- unsigned int max_quant_steps,\n- const float* offsets,\n- float* lowest_weight,\n- int* weight_span,\n- float* error\n-) {\n- promise(weight_count > 0);\n- promise(max_angular_steps > 0);\n-\n- vfloat rcp_stepsize = vfloat::lane_id() + vfloat(1.0f);\n-\n- // Arrays are ANGULAR_STEPS long, so always safe to run full vectors\n- for (unsigned int sp = 0; sp < max_angular_steps; sp += ASTCENC_SIMD_WIDTH)\n- {\n- vfloat minidx(128.0f);\n- vfloat maxidx(-128.0f);\n- vfloat errval = vfloat::zero();\n- vfloat offset = loada(offsets + sp);\n-\n- for (unsigned int j = 0; j < weight_count; j++)\n- {\n- vfloat sval = load1(dec_weight_quant_uvalue + j) * rcp_stepsize - offset;\n- vfloat svalrte = round(sval);\n- vfloat diff = sval - svalrte;\n- errval += diff * diff;\n-\n- // Compute min and max quantized weight spans for each step\n- minidx = min(minidx, svalrte);\n- maxidx = max(maxidx, svalrte);\n- }\n-\n- // Write out min weight and weight span; clamp span to a usable range\n- vint span = float_to_int(maxidx - minidx + vfloat(1.0f));\n- span = min(span, vint(max_quant_steps + 3));\n- span = max(span, vint(2));\n- storea(minidx, lowest_weight + sp);\n- storea(span, weight_span + sp);\n-\n- vfloat ssize = 1.0f / rcp_stepsize;\n- vfloat errscale = ssize * ssize;\n- storea(errval * errscale, error + sp);\n-\n- rcp_stepsize = rcp_stepsize + vfloat(ASTCENC_SIMD_WIDTH);\n- }\n-}\n-\n-/**\n- * @brief The main function for the angular algorithm, variant for low weight count.\n- *\n- * @param weight_count The number of (decimated) weights.\n- * @param dec_weight_ideal_value The ideal decimated unquantized weight values.\n- * @param max_quant_level The maximum quantization level to be tested.\n- * @param[out] low_value Per angular step, the lowest weight value.\n- * @param[out] high_value Per angular step, the highest weight value.\n- */\n-static void compute_angular_endpoints_for_quant_levels_lwc(\n- unsigned int weight_count,\n- const float* dec_weight_ideal_value,\n- unsigned int max_quant_level,\n- float low_value[TUNE_MAX_ANGULAR_QUANT + 1],\n- float high_value[TUNE_MAX_ANGULAR_QUANT + 1]\n-) {\n- unsigned int max_quant_steps = steps_for_quant_level[max_quant_level];\n- unsigned int max_angular_steps = steps_for_quant_level[max_quant_level];\n-\n- alignas(ASTCENC_VECALIGN) float angular_offsets[ANGULAR_STEPS];\n- alignas(ASTCENC_VECALIGN) float lowest_weight[ANGULAR_STEPS];\n- alignas(ASTCENC_VECALIGN) int32_t weight_span[ANGULAR_STEPS];\n- alignas(ASTCENC_VECALIGN) float error[ANGULAR_STEPS];\n-\n- compute_angular_offsets(weight_count, dec_weight_ideal_value,\n- max_angular_steps, angular_offsets);\n-\n-\n- compute_lowest_and_highest_weight_lwc(weight_count, dec_weight_ideal_value,\n- max_angular_steps, max_quant_steps,\n- angular_offsets, lowest_weight, weight_span, error);\n-\n- // For each quantization level, find the best error terms. Use packed vectors so data-dependent\n- // branches can become selects. This involves some integer to float casts, but the values are\n- // small enough so they never round the wrong way.\n- vfloat4 best_results[36];\n-\n- // Initialize the array to some safe defaults\n- promise(max_quant_steps > 0);\n- for (unsigned int i = 0; i < (max_quant_steps + 4); i++)\n- {\n- best_results[i] = vfloat4(ERROR_CALC_DEFAULT, -1.0f, 0.0f, 0.0f);\n- }\n-\n- promise(max_angular_steps > 0);\n- for (unsigned int i = 0; i < max_angular_steps; i++)\n- {\n- int idx_span = weight_span[i];\n-\n- // Check best error against record N\n- vfloat4 current_best = best_results[idx_span];\n- vfloat4 candidate = vfloat4(error[i], static_cast<float>(i), 0.0f, 0.0f);\n- vmask4 mask = vfloat4(current_best.lane<0>()) > vfloat4(error[i]);\n- best_results[idx_span] = select(current_best, candidate, mask);\n- }\n-\n- for (unsigned int i = 0; i <= max_quant_level; i++)\n- {\n- unsigned int q = steps_for_quant_level[i];\n- int bsi = static_cast<int>(best_results[q].lane<1>());\n-\n- // Did we find anything?\n-#if defined(ASTCENC_DIAGNOSTICS)\n- if ((bsi < 0) && print_once)\n- {\n- print_once = false;\n- printf(\"INFO: Unable to find low weight encoding within search error limit.\\n\\n\");\n- }\n-#endif\n-\n- bsi = astc::max(0, bsi);\n-\n- float lwi = lowest_weight[bsi];\n- float hwi = lwi + static_cast<float>(q) - 1.0f;\n-\n- float stepsize = 1.0f / (1.0f + static_cast<float>(bsi));\n- low_value[i] = (angular_offsets[bsi] + lwi) * stepsize;\n- high_value[i] = (angular_offsets[bsi] + hwi) * stepsize;\n- }\n-}\n-\n/* See header for documentation. */\nvoid compute_angular_endpoints_1plane(\n- unsigned int tune_low_weight_limit,\nbool only_always,\nconst block_size_descriptor& bsd,\nconst float* dec_weight_ideal_value,\n@@ -519,21 +371,11 @@ void compute_angular_endpoints_1plane(\nmax_precision = max_weight_quant;\n}\n- if (weight_count < tune_low_weight_limit)\n- {\n- compute_angular_endpoints_for_quant_levels_lwc(\n- weight_count,\n- dec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS,\n- max_precision, low_values[i], high_values[i]);\n- }\n- else\n- {\ncompute_angular_endpoints_for_quant_levels(\nweight_count,\ndec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS,\nmax_precision, low_values[i], high_values[i]);\n}\n- }\nunsigned int max_block_modes = only_always ? bsd.block_mode_count_1plane_always\n: bsd.block_mode_count_1plane_selected;\n@@ -561,7 +403,6 @@ void compute_angular_endpoints_1plane(\n/* See header for documentation. */\nvoid compute_angular_endpoints_2planes(\n- unsigned int tune_low_weight_limit,\nconst block_size_descriptor& bsd,\nconst float* dec_weight_ideal_value,\nunsigned int max_weight_quant,\n@@ -599,20 +440,6 @@ void compute_angular_endpoints_2planes(\nmax_precision = max_weight_quant;\n}\n- if (weight_count < tune_low_weight_limit)\n- {\n- compute_angular_endpoints_for_quant_levels_lwc(\n- weight_count,\n- dec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS,\n- max_precision, low_values1[i], high_values1[i]);\n-\n- compute_angular_endpoints_for_quant_levels_lwc(\n- weight_count,\n- dec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS + WEIGHTS_PLANE2_OFFSET,\n- max_precision, low_values2[i], high_values2[i]);\n- }\n- else\n- {\ncompute_angular_endpoints_for_quant_levels(\nweight_count,\ndec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS,\n@@ -623,7 +450,6 @@ void compute_angular_endpoints_2planes(\ndec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS + WEIGHTS_PLANE2_OFFSET,\nmax_precision, low_values2[i], high_values2[i]);\n}\n- }\nunsigned int start = bsd.block_mode_count_1plane_selected;\nunsigned int end = bsd.block_mode_count_1plane_2plane_selected;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -1019,17 +1019,6 @@ static int edit_astcenc_config(\nconfig.tune_2_plane_early_out_limit_correlation = static_cast<float>(atof(argv[argidx - 1]));\n}\n- else if (!strcmp(argv[argidx], \"-lowweightmodelimit\"))\n- {\n- argidx += 2;\n- if (argidx > argc)\n- {\n- printf(\"ERROR: -lowweightmodelimit switch with no argument\\n\");\n- return 1;\n- }\n-\n- config.tune_low_weight_count_limit = atoi(argv[argidx - 1]);\n- }\nelse if (!strcmp(argv[argidx], \"-refinementlimit\"))\n{\nargidx += 2;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "@@ -379,17 +379,7 @@ ADVANCED COMPRESSION\n-thorough : 0.95\n-verythorough : 0.98\n-exhaustive : 0.99\n-\n- -lowweightmodelimit <weight count>\n- Use a simpler weight search for weight counts less than or\n- equal to this threshold. Preset defaults are bitrate dependent:\n-\n- -fastest : 25\n- -fast : 20\n- -medium : 16\n- -thorough : 12\n- -verythorough : 4\n- -exhaustive : 0)\"\n+)\"\n// This split in the literals is needed for Visual Studio; the compiler\n// will concatenate these two strings together ...\nR\"(\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove the low-weight count tuning optimization
|
61,745 |
09.11.2022 17:14:11
| 0 |
4398ce015b311730540d48e5d7f03d7478ce1b23
|
Remove -gdwarf-4 from CMake
|
[
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -105,7 +105,6 @@ macro(astcenc_set_properties NAME)\nPRIVATE\n# Use pthreads on Linux/macOS\n$<$<PLATFORM_ID:Linux,Darwin>:-pthread>\n- -gdwarf-4\n# MSVC compiler defines\n$<$<CXX_COMPILER_ID:MSVC>:/EHsc>\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove -gdwarf-4 from CMake
|
61,745 |
09.11.2022 17:23:47
| 0 |
97724e328815157deab2158e421e24bd42b31574
|
Add 2/3/4 partition index functional tests
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1064,7 +1064,7 @@ class CLIPTest(CLITestBase):\n# RMSE should get worse (higher) if we reduce search space\nself.assertGreater(testRMSE, refRMSE)\n- def test_partition_index_limit(self):\n+ def test_2partition_index_limit(self):\n\"\"\"\nTest partition index limit.\n\"\"\"\n@@ -1079,7 +1079,51 @@ class CLIPTest(CLITestBase):\nself.exec(command)\nrefRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n- command += [\"-partitionindexlimit\", \"1\"]\n+ command += [\"-2partitionindexlimit\", \"1\"]\n+ self.exec(command)\n+ testRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ # RMSE should get worse (higher) if we reduce search space\n+ self.assertGreater(testRMSE, refRMSE)\n+\n+ def test_3partition_index_limit(self):\n+ \"\"\"\n+ Test partition index limit.\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\"]\n+\n+ self.exec(command)\n+ refRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ command += [\"-3partitionindexlimit\", \"1\"]\n+ self.exec(command)\n+ testRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ # RMSE should get worse (higher) if we reduce search space\n+ self.assertGreater(testRMSE, refRMSE)\n+\n+ def test_4partition_index_limit(self):\n+ \"\"\"\n+ Test partition index limit.\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\"]\n+\n+ self.exec(command)\n+ refRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ command += [\"-4partitionindexlimit\", \"1\"]\nself.exec(command)\ntestRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add 2/3/4 partition index functional tests
|
61,745 |
09.11.2022 17:25:21
| 0 |
c516c82d969e645351fe447d866365cc14ecbcc6
|
Add 2/3/4 parition index negative tests
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1777,9 +1777,9 @@ class CLINTest(CLITestBase):\n# Run the command, incrementally omitting arguments\nself.exec_with_omit(command, 7)\n- def test_cl_partitionlimit_missing_args(self):\n+ def test_cl_2partitionlimit_missing_args(self):\n\"\"\"\n- Test -cl with -partitionindexlimit and missing arguments.\n+ Test -cl with -2partitionindexlimit and missing arguments.\n\"\"\"\n# Build a valid command\ncommand = [\n@@ -1787,7 +1787,37 @@ class CLINTest(CLITestBase):\nself.get_ref_image_path(\"LDR\", \"input\", \"A\"),\nself.get_tmp_image_path(\"LDR\", \"comp\"),\n\"4x4\", \"-fast\",\n- \"-partitionindexlimit\", \"3\"]\n+ \"-2partitionindexlimit\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_3partitionlimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -3partitionindexlimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-3partitionindexlimit\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_4partitionlimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -4partitionindexlimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-4partitionindexlimit\", \"3\"]\n# Run the command, incrementally omitting arguments\nself.exec_with_omit(command, 7)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add 2/3/4 parition index negative tests
|
61,745 |
09.11.2022 20:25:40
| 0 |
ef5d561d8a697b3d23099df97211b017b8327844
|
Use -auto-orient rather than -flip
|
[
{
"change_type": "MODIFY",
"old_path": "Test/testlib/image.py",
"new_path": "Test/testlib/image.py",
"diff": "@@ -39,36 +39,6 @@ import testlib.misc as misc\nCONVERT_BINARY = [\"convert\"]\n-g_ConvertVersion = None\n-\n-\n-def get_convert_version():\n- \"\"\"\n- Get the major/minor version of ImageMagick on the system.\n- \"\"\"\n- global g_ConvertVersion\n-\n- if g_ConvertVersion is None:\n- command = list(CONVERT_BINARY)\n- command += [\"--version\"]\n- result = sp.run(command, stdout=sp.PIPE, stderr=sp.PIPE,\n- check=True, encoding=\"utf-8\")\n-\n- # Version is top row\n- version = result.stdout.splitlines()[0]\n- # ... third token\n- version = re.split(\" \", version)[2]\n- # ... major/minor/patch/subpatch\n- version = re.split(\"\\\\.|-\", version)\n-\n- numericVersion = float(version[0])\n- numericVersion += float(version[1]) / 10.0\n-\n- g_ConvertVersion = numericVersion\n-\n- return g_ConvertVersion\n-\n-\nclass ImageException(Exception):\n\"\"\"\nException thrown for bad image specification.\n@@ -262,14 +232,6 @@ class Image():\nArgs:\nfilePath (str): The path to the image on disk.\n\"\"\"\n- convert = get_convert_version()\n-\n- # ImageMagick 7 started to use .tga file origin information. By default\n- # TGA files store data from bottom up, and define the origin as bottom\n- # left. We want our color samples to always use a top left origin, even\n- # if the data is stored in alternative layout.\n- self.invertYCoords = (convert >= 7.0) and filePath.endswith(\".tga\")\n-\nself.filePath = filePath\nself.proxyPath = None\n@@ -301,9 +263,8 @@ class Image():\ncommand = list(CONVERT_BINARY)\ncommand += [self.filePath]\n- # Invert coordinates if the format needs it\n- if self.invertYCoords:\n- command += [\"-flip\"]\n+ # Ensure convert factors in format origin if needed\n+ command += [\"-auto-orient\"]\ncommand += [\n\"-format\", \"%%[pixel:p{%u,%u}]\" % (x, y),\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use -auto-orient rather than -flip
|
61,745 |
09.11.2022 20:56:40
| 0 |
395a1225b9b408f9b31e4e5b01120910c2bf07cb
|
Note that 2.x branch is no longer getting fixes
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -90,12 +90,12 @@ to be a stable branch for the latest major release series, but as it is used\nfor ongoing development expect it to have some volatility. We recommend using\nthe latest stable release tag for production development.\n-The `2.x` and `3.x` branches are a stable branches for the 2.x and 3.x release\n-series. They are no longer under active development, but are supported branches\n-that will continue to get backported bug fixes.\n+The `3.x` branch is a stable branch for the 3.x release series. It is no longer\n+under active development, but is a supported branch that continues to get\n+backported bug fixes.\n-The `1.x` branch is a stable branch for the 1.x release series. It is no longer\n-under active development or getting bug fixes.\n+The `1.x` and `2.x` branches are stable branches for older releases. They are\n+no longer under active development or getting bug fixes.\nAny other branches you might find are development branches for new features or\noptimizations, so might be interesting to play with but should be considered\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Note that 2.x branch is no longer getting fixes
|
61,745 |
09.11.2022 21:01:20
| 0 |
ed412ec7d7fc3af86a7feb25d6a1ccd5b734caff
|
Add note on lack of signed equivalent of BC6
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/Encoding.md",
"new_path": "Docs/Encoding.md",
"diff": "@@ -25,7 +25,7 @@ their compressed bitrate are shown in the table below.\n| BC3nm | G+R | 8 | BC1 G + BC4 R |\n| BC4 | R | 4 | L8 |\n| BC5 | R+G | 8 | BC1 R + BC1 G |\n-| BC6 | RGB (HDR) | 8 | |\n+| BC6H | RGB (HDR) | 8 | |\n| BC7 | RGB / RGBA | 8 | |\n| EAC_R11 | R | 4 | R11 |\n| EAC_RG11 | RG | 8 | RG11 |\n@@ -105,7 +105,7 @@ use today.\n| BC3nm | `gggr` | `.ag` | |\n| BC4 | `rrr1` | `.r` | |\n| BC5 | `rrrg` | `.ra` <sup>2</sup> | |\n-| BC6 | `rgb1` | `.rgb` | HDR profile only |\n+| BC6H | `rgb1` | `.rgb` <sup>3</sup> | HDR profile only |\n| BC7 | `rgba` | `.rgba` | |\n| EAC_R11 | `rrr1` | `.r` | |\n| EAC_RG11 | `rrrg` | `.ra` <sup>2</sup> | |\n@@ -125,6 +125,9 @@ be emulated by setting texture component swizzles in the runtime API - e.g. via\n`glTexParameteri()` for OpenGL ES - although it has been noted that API\ncontrolled swizzles are not available in WebGL.\n+**3:** ASTC can only store unsigned values, and has no equivalent of the BC6\n+signed endpoint mode.\n+\n# Other Considerations\nThis section outlines some of the other things to consider when encoding\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add note on lack of signed equivalent of BC6
|
61,745 |
10.11.2022 07:58:12
| 0 |
462e74e584f5a7bea98795db6aa14b2399ab505b
|
Check ISA compat in config_init()
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -481,9 +481,23 @@ astcenc_error astcenc_config_init(\nastcenc_config* configp\n) {\nastcenc_error status;\n- astcenc_config& config = *configp;\n+\n+ // Check basic library compatibility options here so they are checked early. Note, these checks\n+ // are repeated in context_alloc for cases where callers use a manually defined config struct\n+ status = validate_cpu_float();\n+ if (status != ASTCENC_SUCCESS)\n+ {\n+ return status;\n+ }\n+\n+ status = validate_cpu_isa();\n+ if (status != ASTCENC_SUCCESS)\n+ {\n+ return status;\n+ }\n// Zero init all config fields; although most of will be over written\n+ astcenc_config& config = *configp;\nstd::memset(&config, 0, sizeof(config));\n// Process the block size\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Check ISA compat in config_init()
|
61,745 |
10.11.2022 09:24:19
| 0 |
5628c6f10fa88f7d46e9f0b647c2b5ce6badbcaf
|
Swap order of FP and ISA checks
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -484,13 +484,13 @@ astcenc_error astcenc_config_init(\n// Check basic library compatibility options here so they are checked early. Note, these checks\n// are repeated in context_alloc for cases where callers use a manually defined config struct\n- status = validate_cpu_float();\n+ status = validate_cpu_isa();\nif (status != ASTCENC_SUCCESS)\n{\nreturn status;\n}\n- status = validate_cpu_isa();\n+ status = validate_cpu_float();\nif (status != ASTCENC_SUCCESS)\n{\nreturn status;\n@@ -717,13 +717,13 @@ astcenc_error astcenc_context_alloc(\nastcenc_error status;\nconst astcenc_config& config = *configp;\n- status = validate_cpu_float();\n+ status = validate_cpu_isa();\nif (status != ASTCENC_SUCCESS)\n{\nreturn status;\n}\n- status = validate_cpu_isa();\n+ status = validate_cpu_float();\nif (status != ASTCENC_SUCCESS)\n{\nreturn status;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Swap order of FP and ISA checks
|
61,745 |
10.11.2022 09:46:26
| 0 |
9e9da0da51c4695b4c47e2e3e06c5910abbb7f31
|
Add -verythorough CLI test
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -649,7 +649,8 @@ class CLIPTest(CLITestBase):\n\"\"\"\nTest all valid presets are accepted\n\"\"\"\n- presets = [\"-fastest\", \"-fast\", \"-medium\", \"-thorough\", \"-exhaustive\"]\n+ presets = [\"-fastest\", \"-fast\", \"-medium\",\n+ \"-thorough\", \"-verythorough\", \"-exhaustive\"]\nimIn = self.get_ref_image_path(\"LDR\", \"input\", \"A\")\nimOut = self.get_tmp_image_path(\"LDR\", \"decomp\")\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add -verythorough CLI test
|
61,745 |
10.11.2022 09:46:58
| 0 |
3103c70ccf6194e3796467c466f5adb047deac7f
|
Try another TGA workaround
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -681,6 +681,19 @@ class CLIPTest(CLITestBase):\nif tli.Image.is_format_supported(imgFormat):\ncolIn = tli.Image(imIn).get_colors((7, 7))\ncolOut = tli.Image(imOut).get_colors((7, 7))\n+\n+ # Catch exception and add fallback for tga handling\n+ # having unstable origin in ImageMagick\n+ try:\n+ self.assertColorSame(colIn, colOut)\n+ continue\n+ except AssertionError as ex:\n+ if imgFormat != \"tga\":\n+ raise ex\n+\n+ # Try yflipped TGA image\n+ colIn = tli.Image(imIn).get_colors((7, 7))\n+ colOut = tli.Image(imOut).get_colors((7, 1))\nself.assertColorSame(colIn, colOut)\ndef test_valid_uncomp_ldr_output_formats(self):\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Try another TGA workaround
|
61,745 |
12.11.2022 08:25:59
| 0 |
313c5e62a7325b50e660a32969ca728bbc374215
|
Fix mismatched array parameter size
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_find_best_partitioning.cpp",
"new_path": "Source/astcenc_find_best_partitioning.cpp",
"diff": "@@ -536,7 +536,7 @@ unsigned int find_best_partition_candidates(\nconst image_block& blk,\nunsigned int partition_count,\nunsigned int partition_search_limit,\n- unsigned int best_partitions[BLOCK_MAX_PARTITIONINGS],\n+ unsigned int best_partitions[TUNE_MAX_PARTITIIONING_CANDIDATES],\nunsigned int requested_candidates\n) {\n// Constant used to estimate quantization error for a given partitioning; the optimal value for\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix mismatched array parameter size
|
61,745 |
28.11.2022 22:36:22
| 0 |
ec7ccf2e69d19b38340cdf84be2a0d65d080f98f
|
Remove unneeded round_up_to_simd() call
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -861,8 +861,7 @@ void compute_ideal_weights_for_decimation(\n// zero-initialized SIMD over-fetch region\nif (is_direct)\n{\n- unsigned int texel_count_simd = round_up_to_simd_multiple_vla(texel_count);\n- for (unsigned int i = 0; i < texel_count_simd; i += ASTCENC_SIMD_WIDTH)\n+ for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)\n{\nvfloat weight(ei.weights + i);\nstorea(weight, dec_weight_ideal_value + i);\n@@ -970,7 +969,7 @@ void compute_ideal_weights_for_decimation(\nvfloat step = (error_change1 * chd_scale) / error_change0;\nstep = clamp(-stepsize, stepsize, step);\n- // Update the weight; note this can store negative values.\n+ // Update the weight; note this can store negative values\nstorea(weight_val + step, dec_weight_ideal_value + i);\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove unneeded round_up_to_simd() call
|
61,745 |
29.11.2022 22:28:14
| 0 |
aa2d0b10e9d8b1162913ddd16ec8d5fd3934df9c
|
Force DWARF4 for Valgrind
|
[
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -136,6 +136,8 @@ macro(astcenc_set_properties NAME)\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-reserved-identifier>\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-cast-function-type>\n+ # Force DWARF4 for Valgrind profiling\n+ $<$<CXX_COMPILER_ID:Clang>:-gdwarf-4>\n$<$<CXX_COMPILER_ID:Clang>:-Wdocumentation>)\ntarget_link_options(${NAME}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Force DWARF4 for Valgrind
|
61,745 |
29.11.2022 22:35:43
| 0 |
aa8250ebbcbecf2f4184189ec191ffae685df211
|
Remove unused method field from quant_and_transfer_table
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1008,9 +1008,6 @@ struct dt_init_working_buffers\n*/\nstruct quant_and_transfer_table\n{\n- /** @brief The quantization level used. */\n- quant_method method;\n-\n/** @brief The unscrambled unquantized value. */\nint8_t quant_to_unquant[32];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_weight_quant_xfer_tables.cpp",
"new_path": "Source/astcenc_weight_quant_xfer_tables.cpp",
"diff": "#define _ 0 // Using _ to indicate an entry that will not be used.\nconst quant_and_transfer_table quant_and_xfer_tables[12] {\n- // Quantization method 0, range 0..1\n+ // QUANT2, range 0..1\n{\n- QUANT_2,\n{0, 64},\n{0, 1},\n{0, 64},\n@@ -34,9 +33,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,\n0x4000}\n},\n- // Quantization method 1, range 0..2\n+ // QUANT_3, range 0..2\n{\n- QUANT_3,\n{0, 32, 64},\n{0, 1, 2},\n{0, 32, 64},\n@@ -44,9 +42,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n_,_,0x4000,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,\n_,_,_,_,0x4020}\n},\n- // Quantization method 2, range 0..3\n+ // QUANT_4, range 0..3\n{\n- QUANT_4,\n{0, 21, 43, 64},\n{0, 1, 2, 3},\n{0, 21, 43, 64},\n@@ -54,9 +51,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x4015,_,_,_,_,_,_,_,_,_,_,_,_,\n_,_,_,_,_,_,_,_,0x402b}\n},\n- // Quantization method 3, range 0..4\n+ //QUANT_5, range 0..4\n{\n- QUANT_5,\n{0, 16, 32, 48, 64},\n{0, 1, 2, 3, 4},\n{0, 16, 32, 48, 64},\n@@ -64,9 +60,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n_,_,_,_,_,_,0x3010,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0x4020,_,_,_,\n_,_,_,_,_,_,_,_,_,_,_,_,0x4030}\n},\n- // Quantization method 4, range 0..5\n+ // QUANT_6, range 0..5\n{\n- QUANT_6,\n{0, 12, 25, 39, 52, 64},\n{0, 2, 4, 5, 3, 1},\n{0, 64, 12, 52, 25, 39},\n@@ -74,9 +69,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n0x270c,_,_,_,_,_,_,_,_,_,_,_,_,_,0x3419,_,_,_,_,_,_,_,_,_,_,\n_,_,0x4027,_,_,_,_,_,_,_,_,_,_,_,0x4034}\n},\n- // Quantization method 5, range 0..7\n+ // QUANT_8, range 0..7\n{\n- QUANT_8,\n{0, 9, 18, 27, 37, 46, 55, 64},\n{0, 1, 2, 3, 4, 5, 6, 7},\n{0, 9, 18, 27, 37, 46, 55, 64},\n@@ -84,9 +78,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n_,_,_,_,_,_,0x2512,_,_,_,_,_,_,_,_,_,0x2e1b,_,_,_,_,_,_,_,_,\n0x3725,_,_,_,_,_,_,_,_,0x402e,_,_,_,_,_,_,_,_,0x4037}\n},\n- // Quantization method 6, range 0..9\n+ // QUANT_10, range 0..9\n{\n- QUANT_10,\n{0, 7, 14, 21, 28, 36, 43, 50, 57, 64},\n{0, 2, 4, 6, 8, 9, 7, 5, 3, 1},\n{0, 64, 7, 57, 14, 50, 21, 43, 28, 36},\n@@ -95,9 +88,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n_,0x3224,_,_,_,_,_,_,0x392b,_,_,_,_,_,_,0x4032,_,_,_,_,_,\n_,0x4039}\n},\n- // Quantization method 7, range 0..11\n+ // QUANT_12, range 0..11\n{\n- QUANT_12,\n{0, 5, 11, 17, 23, 28, 36, 41, 47, 53, 59, 64},\n{0, 4, 8, 2, 6, 10, 11, 7, 3, 9, 5, 1},\n{0, 64, 17, 47, 5, 59, 23, 41, 11, 53, 28, 36},\n@@ -106,9 +98,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n0x291c,_,_,_,_,0x2f24,_,_,_,_,_,0x3529,_,_,_,_,_,\n0x3b2f,_,_,_,_,_,0x4035,_,_,_,_,0x403b}\n},\n- // Quantization method 8, range 0..15\n+ // QUANT_16, range 0..15\n{\n- QUANT_16,\n{0, 4, 8, 12, 17, 21, 25, 29, 35, 39, 43, 47, 52, 56, 60, 64},\n{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},\n{0, 4, 8, 12, 17, 21, 25, 29, 35, 39, 43, 47, 52, 56, 60, 64},\n@@ -117,9 +108,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n_,0x271d,_,_,_,0x2b23,_,_,_,0x2f27,_,_,_,0x342b,_,_,_,\n_,0x382f,_,_,_,0x3c34,_,_,_,0x4038,_,_,_,0x403c}\n},\n- // Quantization method 9, range 0..19\n+ // QUANT_20, range 0..19\n{\n- QUANT_20,\n{0, 3, 6, 9, 13, 16, 19, 23, 26, 29, 35, 38, 41, 45, 48, 51, 55, 58, 61, 64},\n{0, 4, 8, 12, 16, 2, 6, 10, 14, 18, 19, 15, 11, 7, 3, 17, 13, 9, 5, 1},\n{0, 64, 16, 48, 3, 61, 19, 45, 6, 58, 23, 41, 9, 55, 26, 38, 13, 51, 29, 35},\n@@ -129,9 +119,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n0x2d26,_,_,_,0x3029,_,_,0x332d,_,_,0x3730,_,_,_,\n0x3a33,_,_,0x3d37,_,_,0x403a,_,_,0x403d}\n},\n- // Quantization method 10, range 0..23\n+ // QUANT_24, range 0..23\n{\n- QUANT_24,\n{0, 2, 5, 8, 11, 13, 16, 19, 22, 24, 27, 30, 34, 37, 40, 42, 45, 48, 51, 53, 56, 59, 62, 64},\n{0, 8, 16, 2, 10, 18, 4, 12, 20, 6, 14, 22, 23, 15, 7, 21, 13, 5, 19, 11, 3, 17, 9, 1},\n{0, 64, 8, 56, 16, 48, 24, 40, 2, 62, 11, 53, 19, 45, 27, 37, 5, 59, 13, 51, 22, 42, 30, 34},\n@@ -142,9 +131,8 @@ const quant_and_transfer_table quant_and_xfer_tables[12] {\n_,_,0x3530,_,0x3833,_,_,0x3b35,_,_,0x3e38,_,_,\n0x403b,_,0x403e}\n},\n- // Quantization method 11, range 0..31\n+ // QUANT_32, range 0..31\n{\n- QUANT_32,\n{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64},\n{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31},\n{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64},\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove unused method field from quant_and_transfer_table
|
61,745 |
29.11.2022 23:45:02
| 0 |
efdecc6a99c2dc23fabceffea9aded2ab040184d
|
Use symbolic constant
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_percentile_tables.cpp",
"new_path": "Source/astcenc_percentile_tables.cpp",
"diff": "@@ -1166,11 +1166,11 @@ const float *get_2d_percentile_table(\nunsigned int xdim,\nunsigned int ydim\n) {\n- float* unpacked_table = new float[2048];\n+ float* unpacked_table = new float[WEIGHTS_MAX_BLOCK_MODES];\nconst packed_percentile_table *apt = get_packed_table(xdim, ydim);\n// Set the default percentile\n- for (unsigned int i = 0; i < 2048; i++)\n+ for (unsigned int i = 0; i < WEIGHTS_MAX_BLOCK_MODES; i++)\n{\nunpacked_table[i] = 1.0f;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use symbolic constant
|
61,745 |
29.11.2022 23:52:14
| 0 |
6aa17d963613347a82ce156c969bff4dc06fc05d
|
Remove unused quant field from btq_counts
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_integer_sequence.cpp",
"new_path": "Source/astcenc_integer_sequence.cpp",
"diff": "@@ -334,9 +334,6 @@ static const uint8_t integer_of_trits[3][3][3][3][3] {\n*/\nstruct btq_count\n{\n- /** @brief The quantization level. */\n- uint8_t quant;\n-\n/** @brief The number of bits. */\nuint8_t bits;\n@@ -351,27 +348,27 @@ struct btq_count\n* @brief The table of bits, trits, and quints needed for a quant encode.\n*/\nstatic const std::array<btq_count, 21> btq_counts {{\n- { QUANT_2, 1, 0, 0 },\n- { QUANT_3, 0, 1, 0 },\n- { QUANT_4, 2, 0, 0 },\n- { QUANT_5, 0, 0, 1 },\n- { QUANT_6, 1, 1, 0 },\n- { QUANT_8, 3, 0, 0 },\n- { QUANT_10, 1, 0, 1 },\n- { QUANT_12, 2, 1, 0 },\n- { QUANT_16, 4, 0, 0 },\n- { QUANT_20, 2, 0, 1 },\n- { QUANT_24, 3, 1, 0 },\n- { QUANT_32, 5, 0, 0 },\n- { QUANT_40, 3, 0, 1 },\n- { QUANT_48, 4, 1, 0 },\n- { QUANT_64, 6, 0, 0 },\n- { QUANT_80, 4, 0, 1 },\n- { QUANT_96, 5, 1, 0 },\n- { QUANT_128, 7, 0, 0 },\n- { QUANT_160, 5, 0, 1 },\n- { QUANT_192, 6, 1, 0 },\n- { QUANT_256, 8, 0, 0 }\n+ { 1, 0, 0 }, // QUANT_2\n+ { 0, 1, 0 }, // QUANT_3\n+ { 2, 0, 0 }, // QUANT_4\n+ { 0, 0, 1 }, // QUANT_5\n+ { 1, 1, 0 }, // QUANT_6\n+ { 3, 0, 0 }, // QUANT_8\n+ { 1, 0, 1 }, // QUANT_10\n+ { 2, 1, 0 }, // QUANT_12\n+ { 4, 0, 0 }, // QUANT_16\n+ { 2, 0, 1 }, // QUANT_20\n+ { 3, 1, 0 }, // QUANT_24\n+ { 5, 0, 0 }, // QUANT_32\n+ { 3, 0, 1 }, // QUANT_40\n+ { 4, 1, 0 }, // QUANT_48\n+ { 6, 0, 0 }, // QUANT_64\n+ { 4, 0, 1 }, // QUANT_80\n+ { 5, 1, 0 }, // QUANT_96\n+ { 7, 0, 0 }, // QUANT_128\n+ { 5, 0, 1 }, // QUANT_160\n+ { 6, 1, 0 }, // QUANT_192\n+ { 8, 0, 0 } // QUANT_256\n}};\n/**\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove unused quant field from btq_counts
|
61,745 |
29.11.2022 23:54:18
| 0 |
5adac484d34013ba432b412c631cd570d278baff
|
Remove unused quant field from ise_size
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_integer_sequence.cpp",
"new_path": "Source/astcenc_integer_sequence.cpp",
"diff": "@@ -379,9 +379,6 @@ static const std::array<btq_count, 21> btq_counts {{\n*/\nstruct ise_size\n{\n- /** @brief The quantization level. */\n- uint8_t quant;\n-\n/** @brief The scaling parameter. */\nuint8_t scale;\n@@ -396,27 +393,27 @@ struct ise_size\n* @brief The table of scale, round, and divisors needed for quant sizing.\n*/\nstatic const std::array<ise_size, 21> ise_sizes {{\n- { QUANT_2, 1, 0, 1 },\n- { QUANT_3, 8, 4, 5 },\n- { QUANT_4, 2, 0, 1 },\n- { QUANT_5, 7, 2, 3 },\n- { QUANT_6, 13, 4, 5 },\n- { QUANT_8, 3, 0, 1 },\n- { QUANT_10, 10, 2, 3 },\n- { QUANT_12, 18, 4, 5 },\n- { QUANT_16, 4, 0, 1 },\n- { QUANT_20, 13, 2, 3 },\n- { QUANT_24, 23, 4, 5 },\n- { QUANT_32, 5, 0, 1 },\n- { QUANT_40, 16, 2, 3 },\n- { QUANT_48, 28, 4, 5 },\n- { QUANT_64, 6, 0, 1 },\n- { QUANT_80, 19, 2, 3 },\n- { QUANT_96, 33, 4, 5 },\n- { QUANT_128, 7, 0, 1 },\n- { QUANT_160, 22, 2, 3 },\n- { QUANT_192, 38, 4, 5 },\n- { QUANT_256, 8, 0, 1 }\n+ { 1, 0, 1 }, // QUANT_2\n+ { 8, 4, 5 }, // QUANT_3\n+ { 2, 0, 1 }, // QUANT_4\n+ { 7, 2, 3 }, // QUANT_5\n+ { 13, 4, 5 }, // QUANT_6\n+ { 3, 0, 1 }, // QUANT_8\n+ { 10, 2, 3 }, // QUANT_10\n+ { 18, 4, 5 }, // QUANT_12\n+ { 4, 0, 1 }, // QUANT_16\n+ { 13, 2, 3 }, // QUANT_20\n+ { 23, 4, 5 }, // QUANT_24\n+ { 5, 0, 1 }, // QUANT_32\n+ { 16, 2, 3 }, // QUANT_40\n+ { 28, 4, 5 }, // QUANT_48\n+ { 6, 0, 1 }, // QUANT_64\n+ { 19, 2, 3 }, // QUANT_80\n+ { 33, 4, 5 }, // QUANT_96\n+ { 7, 0, 1 }, // QUANT_128\n+ { 22, 2, 3 }, // QUANT_160\n+ { 38, 4, 5 }, // QUANT_192\n+ { 8, 0, 1 } // QUANT_256\n}};\n/* See header for documentation. */\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove unused quant field from ise_size
|
61,745 |
29.11.2022 23:56:49
| 0 |
5f60c594fd54ee3da3fd33b905fdda1ddcaf59de
|
Remove redundant round field from ise_size
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_integer_sequence.cpp",
"new_path": "Source/astcenc_integer_sequence.cpp",
"diff": "@@ -382,9 +382,6 @@ struct ise_size\n/** @brief The scaling parameter. */\nuint8_t scale;\n- /** @brief The rounding parameter. */\n- uint8_t round;\n-\n/** @brief The divisor parameter. */\nuint8_t divisor;\n};\n@@ -393,27 +390,27 @@ struct ise_size\n* @brief The table of scale, round, and divisors needed for quant sizing.\n*/\nstatic const std::array<ise_size, 21> ise_sizes {{\n- { 1, 0, 1 }, // QUANT_2\n- { 8, 4, 5 }, // QUANT_3\n- { 2, 0, 1 }, // QUANT_4\n- { 7, 2, 3 }, // QUANT_5\n- { 13, 4, 5 }, // QUANT_6\n- { 3, 0, 1 }, // QUANT_8\n- { 10, 2, 3 }, // QUANT_10\n- { 18, 4, 5 }, // QUANT_12\n- { 4, 0, 1 }, // QUANT_16\n- { 13, 2, 3 }, // QUANT_20\n- { 23, 4, 5 }, // QUANT_24\n- { 5, 0, 1 }, // QUANT_32\n- { 16, 2, 3 }, // QUANT_40\n- { 28, 4, 5 }, // QUANT_48\n- { 6, 0, 1 }, // QUANT_64\n- { 19, 2, 3 }, // QUANT_80\n- { 33, 4, 5 }, // QUANT_96\n- { 7, 0, 1 }, // QUANT_128\n- { 22, 2, 3 }, // QUANT_160\n- { 38, 4, 5 }, // QUANT_192\n- { 8, 0, 1 } // QUANT_256\n+ { 1, 1 }, // QUANT_2\n+ { 8, 5 }, // QUANT_3\n+ { 2, 1 }, // QUANT_4\n+ { 7, 3 }, // QUANT_5\n+ { 13, 5 }, // QUANT_6\n+ { 3, 1 }, // QUANT_8\n+ { 10, 3 }, // QUANT_10\n+ { 18, 5 }, // QUANT_12\n+ { 4, 1 }, // QUANT_16\n+ { 13, 3 }, // QUANT_20\n+ { 23, 5 }, // QUANT_24\n+ { 5, 1 }, // QUANT_32\n+ { 16, 3 }, // QUANT_40\n+ { 28, 5 }, // QUANT_48\n+ { 6, 1 }, // QUANT_64\n+ { 19, 3 }, // QUANT_80\n+ { 33, 5 }, // QUANT_96\n+ { 7, 1 }, // QUANT_128\n+ { 22, 3 }, // QUANT_160\n+ { 38, 5 }, // QUANT_192\n+ { 8, 1 } // QUANT_256\n}};\n/* See header for documentation. */\n@@ -429,7 +426,7 @@ unsigned int get_ise_sequence_bitcount(\n}\nauto& entry = ise_sizes[quant_level];\n- return (entry.scale * character_count + entry.round) / entry.divisor;\n+ return (entry.scale * character_count + entry.divisor - 1) / entry.divisor;\n}\n/**\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove redundant round field from ise_size
|
61,745 |
01.12.2022 20:20:15
| 0 |
0bb18de69fd73572c6a0472079855d2e67aa9262
|
Remove unused entries in baseline_quant_error
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"new_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"diff": "@@ -325,11 +325,7 @@ static void compute_color_error_for_every_integer_count_and_quant_level(\n) {\nint partition_size = pi.partition_texel_count[partition_index];\n- static const float baseline_quant_error[21] {\n- (65536.0f * 65536.0f / 18.0f), // 2 values, 1 step\n- (65536.0f * 65536.0f / 18.0f) / (2 * 2), // 3 values, 2 steps\n- (65536.0f * 65536.0f / 18.0f) / (3 * 3), // 4 values, 3 steps\n- (65536.0f * 65536.0f / 18.0f) / (4 * 4), // 5 values\n+ static const float baseline_quant_error[21 - QUANT_6] {\n(65536.0f * 65536.0f / 18.0f) / (5 * 5),\n(65536.0f * 65536.0f / 18.0f) / (7 * 7),\n(65536.0f * 65536.0f / 18.0f) / (9 * 9),\n@@ -528,7 +524,7 @@ static void compute_color_error_for_every_integer_count_and_quant_level(\n// The base_quant_error should depend on the scale-factor that would be used during\n// actual encode of the color value\n- float base_quant_error = baseline_quant_error[i] * static_cast<float>(partition_size);\n+ float base_quant_error = baseline_quant_error[i - QUANT_6] * static_cast<float>(partition_size);\nfloat rgb_quantization_error = error_weight_rgbsum * base_quant_error * 2.0f;\nfloat alpha_quantization_error = error_weight.lane<3>() * base_quant_error * 2.0f;\nfloat rgba_quantization_error = rgb_quantization_error + alpha_quantization_error;\n@@ -591,7 +587,7 @@ static void compute_color_error_for_every_integer_count_and_quant_level(\nerror_scale_oe_rgb = 1.0f;\n}\n- float base_quant_error = baseline_quant_error[i];\n+ float base_quant_error = baseline_quant_error[i - QUANT_6];\nfloat quant_error_rgb = base_quant_error_rgb * base_quant_error;\nfloat quant_error_rgba = base_quant_error_rgba * base_quant_error;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove unused entries in baseline_quant_error
|
61,765 |
02.12.2022 00:11:21
| 28,800 |
5a3075be3671371c1225b8119c98d9df887161d1
|
Disable blue contraction at quant level 256
This change causes a minor IQ improvement for 4x4 encodings, and can
give a minor performance boost on some images.
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_color_quantize.cpp",
"new_path": "Source/astcenc_color_quantize.cpp",
"diff": "@@ -1960,7 +1960,7 @@ uint8_t pack_color_endpoints(\nswitch (format)\n{\ncase FMT_RGB:\n- if (quant_level <= 18)\n+ if (quant_level <= QUANT_160)\n{\nif (try_quantize_rgb_delta_blue_contract(color0, color1, output, quant_level))\n{\n@@ -1973,7 +1973,7 @@ uint8_t pack_color_endpoints(\nbreak;\n}\n}\n- if (try_quantize_rgb_blue_contract(color0, color1, output, quant_level))\n+ if (quant_level < QUANT_256 && try_quantize_rgb_blue_contract(color0, color1, output, quant_level))\n{\nretval = FMT_RGB;\nbreak;\n@@ -1983,7 +1983,7 @@ uint8_t pack_color_endpoints(\nbreak;\ncase FMT_RGBA:\n- if (quant_level <= 18)\n+ if (quant_level <= QUANT_160)\n{\nif (try_quantize_rgba_delta_blue_contract(color0, color1, output, quant_level))\n{\n@@ -1996,7 +1996,7 @@ uint8_t pack_color_endpoints(\nbreak;\n}\n}\n- if (try_quantize_rgba_blue_contract(color0, color1, output, quant_level))\n+ if (quant_level < QUANT_256 && try_quantize_rgba_blue_contract(color0, color1, output, quant_level))\n{\nretval = FMT_RGBA;\nbreak;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Disable blue contraction at quant level 256 (#388)
This change causes a minor IQ improvement for 4x4 encodings, and can
give a minor performance boost on some images.
|
61,745 |
03.12.2022 15:45:27
| 0 |
b5120e68c01df534a3a8d475bc0559050deafc40
|
Skip RGBO calculation for LDR-only encodings
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -1214,7 +1214,7 @@ void recompute_ideal_colors_1plane(\n// Only compute a partition mean if more than one partition\nif (partition_count > 1)\n{\n- rgba_sum = vfloat4(1e-17f);\n+ rgba_sum = vfloat4::zero();\npromise(texel_count > 0);\nfor (unsigned int j = 0; j < texel_count; j++)\n{\n@@ -1250,7 +1250,6 @@ void recompute_ideal_colors_1plane(\nfor (unsigned int j = 0; j < texel_count; j++)\n{\nunsigned int tix = texel_indexes[j];\n-\nvfloat4 rgba = blk.texel(tix);\nfloat idx0 = undec_weight_ref[tix];\n@@ -1283,9 +1282,6 @@ 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- vfloat4 weight_weight_sum = vfloat4(weight_weight_sum_s) * color_weight;\n- float psum = right_sum_s * hadd_rgb_s(color_weight);\n-\ncolor_vec_x = color_vec_x * color_weight;\ncolor_vec_y = color_vec_y * color_weight;\n@@ -1348,7 +1344,12 @@ void recompute_ideal_colors_1plane(\n}\n}\n- // Calculations specific to mode #7, the HDR RGB-scale mode\n+ // Calculations specific to mode #7, the HDR RGB-scale mode - skip if known LDR\n+ if (blk.rgb_lns[0] || blk.alpha_lns[0])\n+ {\n+ vfloat4 weight_weight_sum = vfloat4(weight_weight_sum_s) * color_weight;\n+ float psum = right_sum_s * hadd_rgb_s(color_weight);\n+\nvfloat4 rgbq_sum = color_vec_x + color_vec_y;\nrgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));\n@@ -1371,6 +1372,7 @@ void recompute_ideal_colors_1plane(\n}\n}\n}\n+}\n/* See header for documentation. */\nvoid recompute_ideal_colors_2planes(\n@@ -1515,7 +1517,7 @@ void recompute_ideal_colors_2planes(\ncolor_vec_x += cwprod - cwiprod;\nscale_vec += vfloat2(om_idx0, idx0) * (ls_weight * scale);\n- weight_weight_sum += (color_weight * color_idx);\n+ weight_weight_sum += color_idx;\n}\nvfloat4 left1_sum = vfloat4(left1_sum_s) * color_weight;\n@@ -1527,8 +1529,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- float psum = dot3_s(select(right1_sum, right2_sum, p2_mask), color_weight);\n-\ncolor_vec_x = color_vec_x * color_weight;\ncolor_vec_y = color_vec_y * color_weight;\n@@ -1629,7 +1629,12 @@ void recompute_ideal_colors_2planes(\nep.endpt1[0] = select(ep.endpt1[0], ep1, full_mask);\n}\n- // Calculations specific to mode #7, the HDR RGB-scale mode\n+ // Calculations specific to mode #7, the HDR RGB-scale mode - skip if known LDR\n+ if (blk.rgb_lns[0] || blk.alpha_lns[0])\n+ {\n+ weight_weight_sum = weight_weight_sum * color_weight;\n+ float psum = dot3_s(select(right1_sum, right2_sum, p2_mask), color_weight);\n+\nvfloat4 rgbq_sum = color_vec_x + color_vec_y;\nrgbq_sum.set_lane<3>(hadd_rgb_s(color_vec_y));\n@@ -1651,5 +1656,6 @@ void recompute_ideal_colors_2planes(\nrgbo_vector = vfloat4(ep0.lane<0>(), ep0.lane<1>(), ep0.lane<2>(), avgdif);\n}\n}\n+}\n#endif\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Skip RGBO calculation for LDR-only encodings
|
61,745 |
08.12.2022 20:19:25
| 0 |
edae56f8d780f707d719066605760abd83063e30
|
Simplify NEON implementation
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_neon_4.h",
"new_path": "Source/astcenc_vecmathlib_neon_4.h",
"diff": "@@ -106,7 +106,7 @@ struct vfloat4\n*/\ntemplate <int l> ASTCENC_SIMD_INLINE void set_lane(float a)\n{\n- m = vld1q_lane_f32(&a, m, l);\n+ m = vsetq_lane_f32(a, m, l);\n}\n/**\n@@ -122,7 +122,7 @@ struct vfloat4\n*/\nstatic ASTCENC_SIMD_INLINE vfloat4 load1(const float* p)\n{\n- return vfloat4(vdupq_n_f32(*p));\n+ return vfloat4(vld1q_dup_f32(p));\n}\n/**\n@@ -202,9 +202,8 @@ struct vint4\n*/\nASTCENC_SIMD_INLINE explicit vint4(const uint8_t *p)\n{\n- uint32x2_t t8 {};\n// Cast is safe - NEON loads are allowed to be unaligned\n- t8 = vld1_lane_u32(reinterpret_cast<const uint32_t*>(p), t8, 0);\n+ uint32x2_t t8 = vld1_dup_u32(reinterpret_cast<const uint32_t*>(p));\nuint16x4_t t16 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(t8)));\nm = vreinterpretq_s32_u32(vmovl_u16(t16));\n}\n@@ -251,7 +250,7 @@ struct vint4\n*/\ntemplate <int l> ASTCENC_SIMD_INLINE void set_lane(int a)\n{\n- m = vld1q_lane_s32(&a, m, l);\n+ m = vsetq_lane_s32(a, m, l);\n}\n/**\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Simplify NEON implementation
|
61,745 |
08.12.2022 21:51:39
| 0 |
2f713ff9d71cdb796524c18d241506cf72a11014
|
Add more promises
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -692,6 +692,7 @@ float compute_error_of_weight_set_1plane(\n) {\nvfloatacc error_summav = vfloatacc::zero();\nunsigned int texel_count = di.texel_count;\n+ promise(texel_count > 0);\n// Process SIMD-width chunks, safe to over-fetch - the extra space is zero initialized\nif (di.max_texel_weight_count > 2)\n@@ -757,6 +758,7 @@ float compute_error_of_weight_set_2planes(\n) {\nvfloatacc error_summav = vfloatacc::zero();\nunsigned int texel_count = di.texel_count;\n+ promise(texel_count > 0);\n// Process SIMD-width chunks, safe to over-fetch - the extra space is zero initialized\nif (di.max_texel_weight_count > 2)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_integer_sequence.cpp",
"new_path": "Source/astcenc_integer_sequence.cpp",
"diff": "@@ -639,7 +639,6 @@ void encode_ise(\n// Write out just bits\nelse\n{\n- promise(character_count > 0);\nfor (unsigned int i = 0; i < character_count; i++)\n{\nwrite_bits(input_data[i], bits, bit_offset, output_data);\n@@ -708,6 +707,7 @@ void decode_ise(\nif (trits)\n{\nunsigned int trit_blocks = (character_count + 4) / 5;\n+ promise(trit_blocks > 0);\nfor (unsigned int i = 0; i < trit_blocks; i++)\n{\nconst uint8_t *tritptr = trits_of_integer[tq_blocks[i]];\n@@ -722,6 +722,7 @@ void decode_ise(\nif (quints)\n{\nunsigned int quint_blocks = (character_count + 2) / 3;\n+ promise(quint_blocks > 0);\nfor (unsigned int i = 0; i < quint_blocks; i++)\n{\nconst uint8_t *quintptr = quints_of_integer[tq_blocks[i]];\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add more promises
|
61,745 |
08.12.2022 22:32:19
| 0 |
592ef328bcec46f828c1a828abd6c3cdcb94903d
|
Use scb.plane2_component = -1 for single plane blocks
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -82,7 +82,7 @@ static bool realign_weights_undecimated(\nconst quant_and_transfer_table& qat = quant_and_xfer_tables[weight_quant_level];\nunsigned int max_plane = bm.is_dual_plane;\n- int plane2_component = bm.is_dual_plane ? scb.plane2_component : -1;\n+ int plane2_component = scb.plane2_component;\nvmask4 plane_mask = vint4::lane_id() == vint4(plane2_component);\n// Decode the color endpoints\n@@ -206,7 +206,7 @@ static bool realign_weights_decimated(\nassert(weight_count != bsd.texel_count);\nunsigned int max_plane = bm.is_dual_plane;\n- int plane2_component = bm.is_dual_plane ? scb.plane2_component : -1;\n+ int plane2_component = scb.plane2_component;\nvmask4 plane_mask = vint4::lane_id() == vint4(plane2_component);\n// Decode the color endpoints\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_decompress_symbolic.cpp",
"new_path": "Source/astcenc_decompress_symbolic.cpp",
"diff": "@@ -286,7 +286,7 @@ void decompress_symbolic_block(\nunpack_weights(bsd, scb, di, is_dual_plane, plane1_weights, plane2_weights);\n// Now that we have endpoint colors and weights, we can unpack texel colors\n- int plane2_component = is_dual_plane ? scb.plane2_component : -1;\n+ int plane2_component = scb.plane2_component;\nvmask4 plane2_mask = vint4::lane_id() == vint4(plane2_component);\nfor (int i = 0; i < partition_count; i++)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_symbolic_physical.cpp",
"new_path": "Source/astcenc_symbolic_physical.cpp",
"diff": "@@ -371,12 +371,15 @@ void physical_to_symbolic(\nconst auto& di = bsd.get_decimation_info(bm.decimation_mode);\nint weight_count = di.weight_count;\n+ promise(weight_count > 0);\n+\nquant_method weight_quant_method = static_cast<quant_method>(bm.quant_mode);\nint is_dual_plane = bm.is_dual_plane;\nint real_weight_count = is_dual_plane ? 2 * weight_count : weight_count;\nint partition_count = read_bits(2, 11, pcb.data) + 1;\n+ promise(partition_count > 0);\nscb.block_mode = static_cast<uint16_t>(block_mode);\nscb.partition_count = static_cast<uint8_t>(partition_count);\n@@ -523,6 +526,7 @@ void physical_to_symbolic(\n}\n// Fetch component for second-plane in the case of dual plane of weights.\n+ scb.plane2_component = -1;\nif (is_dual_plane)\n{\nscb.plane2_component = static_cast<int8_t>(read_bits(2, below_weights_pos - 2, pcb.data));\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use scb.plane2_component = -1 for single plane blocks
|
61,745 |
08.12.2022 22:49:57
| 0 |
39fdb7d96d3c5dfc871844c1094a9e79bae1d3f5
|
Use branchless tail clear
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"new_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"diff": "@@ -1132,22 +1132,19 @@ unsigned int compute_ideal_endpoint_formats(\nuint8_t (&best_ep_formats)[WEIGHTS_MAX_BLOCK_MODES][BLOCK_MAX_PARTITIONS] = tmpbuf.best_ep_formats;\n// Ensure that the first iteration understep contains data that will never be picked\n+ vfloat clear_error(ERROR_CALC_DEFAULT);\n+ vint clear_quant(0);\n+\nunsigned int packed_start_block_mode = round_down_to_simd_multiple_vla(start_block_mode);\n- for (unsigned int i = packed_start_block_mode; i < start_block_mode; i++)\n- {\n- errors_of_best_combination[i] = ERROR_CALC_DEFAULT;\n- best_quant_levels[i] = QUANT_2;\n- best_quant_levels_mod[i] = QUANT_2;\n- }\n+ storea(clear_error, errors_of_best_combination + packed_start_block_mode);\n+ store_nbytes(clear_quant, best_quant_levels + packed_start_block_mode);\n+ store_nbytes(clear_quant, best_quant_levels_mod + packed_start_block_mode);\n// Ensure that last iteration overstep contains data that will never be picked\n- const unsigned int packed_end_block_mode = round_up_to_simd_multiple_vla(end_block_mode);\n- for (unsigned int i = end_block_mode; i < packed_end_block_mode; i++)\n- {\n- errors_of_best_combination[i] = ERROR_CALC_DEFAULT;\n- best_quant_levels[i] = QUANT_2;\n- best_quant_levels_mod[i] = QUANT_2;\n- }\n+ unsigned int packed_end_block_mode = round_down_to_simd_multiple_vla(end_block_mode - 1);\n+ storea(clear_error, errors_of_best_combination + packed_end_block_mode);\n+ store_nbytes(clear_quant, best_quant_levels + packed_end_block_mode);\n+ store_nbytes(clear_quant, best_quant_levels_mod + packed_end_block_mode);\n// Track a scalar best to avoid expensive search at least once ...\nfloat error_of_best_combination = ERROR_CALC_DEFAULT;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use branchless tail clear
|
61,745 |
08.12.2022 22:54:36
| 0 |
cc7eb29787530c8dca779e27525e391fdef85f4f
|
Improve promises
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_find_best_partitioning.cpp",
"new_path": "Source/astcenc_find_best_partitioning.cpp",
"diff": "@@ -362,6 +362,7 @@ static void count_partition_mismatch_bits(\nunsigned int mismatch_counts[BLOCK_MAX_PARTITIONINGS]\n) {\nunsigned int active_count = bsd.partitioning_count_selected[partition_count - 1];\n+ promise(active_count > 0);\nif (partition_count == 2)\n{\n@@ -400,6 +401,7 @@ static unsigned int get_partition_ordering_by_mismatch_bits(\nconst unsigned int mismatch_count[BLOCK_MAX_PARTITIONINGS],\nunsigned int partition_ordering[BLOCK_MAX_PARTITIONINGS]\n) {\n+ promise(partitioning_count > 0);\nunsigned int mscount[256] { 0 };\n// Create the histogram of mismatch counts\n@@ -488,7 +490,7 @@ static unsigned int compute_kmeans_partition_ordering(\n/**\n* @brief Insert a partitioning into an order list of results, sorted by error.\n*\n- * @param max_values The max number of entries in the best result arrays/\n+ * @param max_values The max number of entries in the best result arrays.\n* @param this_error The error of the new entry.\n* @param this_partition The partition ID of the new entry.\n* @param[out] best_errors The array of best error values.\n@@ -501,6 +503,8 @@ static void insert_result(\nfloat* best_errors,\nunsigned int* best_partitions)\n{\n+ promise(max_values > 0);\n+\n// Don't bother searching if the current worst error beats the new error\nif (this_error >= best_errors[max_values - 1])\n{\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Improve promises
|
61,745 |
23.12.2022 09:56:20
| 0 |
f758d218fe91970f28b8a1416a2ec52810ac5fdf
|
Use lower-case windows.h for compat with MinGW
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_platform_isa_detection.cpp",
"new_path": "Source/astcenc_platform_isa_detection.cpp",
"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@@ -47,7 +47,7 @@ static bool g_cpu_has_f16c { false };\n============================================================================ */\n#if !defined(__clang__) && defined(_MSC_VER)\n#define WIN32_LEAN_AND_MEAN\n-#include <Windows.h>\n+#include <windows.h>\n#include <intrin.h>\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_platform_dependents.cpp",
"new_path": "Source/astcenccli_platform_dependents.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#if defined(_WIN32) && !defined(__CYGWIN__)\n#define WIN32_LEAN_AND_MEAN\n-#include <Windows.h>\n+#include <windows.h>\n/** @brief Alias pthread_t to one of the internal Windows types. */\ntypedef HANDLE pthread_t;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use lower-case windows.h for compat with MinGW
|
61,745 |
02.01.2023 13:35:41
| 0 |
c0bba1bab2cf79783d7f983ccaf41ae54ec66df0
|
Update Changelog with some smaller optimizations
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -17,6 +17,8 @@ and image quality improvements in this release.\n* **General:**\n* **Optimization:** Always skip blue-contraction for `QUANT_256` encodings.\nThis gives a small image quality improvement for the 4x4 block size.\n+ * **Optimization:** Always skip RGBO vector calculation for LDR encodings.\n+ * **Optimization:** Defer color packing and scrambling to physical layer.\n* **Optimization:** Remove folded `decimation_info` lookup tables. This\nreduces compressor memory footprint and improves context creation time.\nImpact increases with the active block size.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update Changelog with some smaller optimizations
|
61,745 |
02.01.2023 14:26:30
| 0 |
6f782ad0f8bc2fbd8e2070caf746d94dec5233ed
|
Update Changelog with MinGW compat change
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -22,6 +22,7 @@ and image quality improvements in this release.\n* **Optimization:** Remove folded `decimation_info` lookup tables. This\nreduces compressor memory footprint and improves context creation time.\nImpact increases with the active block size.\n+ * **Bug-fix:** Use lower case `windows.h` include for MinGW compatibility.\n<!-- ---------------------------------------------------------------------- -->\n## 4.2.0\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update Changelog with MinGW compat change
|
61,745 |
02.01.2023 15:22:05
| 0 |
aa80ce7d828b1e043d70e05e82e387160b887c4d
|
Use tighter bounds to skip trials
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -1353,7 +1353,7 @@ void compress_block(\n// If attempting two planes is much worse than the best one plane result\n// then further two plane searches are unlikely to help so move on ...\n- if (errorval > (best_errorvals_for_pcount[0] * 2.0f))\n+ if (errorval > (best_errorvals_for_pcount[0] * 1.75f))\n{\nbreak;\n}\n@@ -1399,10 +1399,9 @@ void compress_block(\n// If using N partitions doesn't improve much over using N-1 partitions then skip trying\n// N+1. Error can dramatically improve if the data is correlated or non-correlated and\n// aligns with a partitioning that suits that encoding, so for this inner loop check add\n- // a large error scale because the \"other\" trial could be a lot better. In total the\n- // error must be at least 2x worse than the best existing error to early-out.\n+ // a large error scale because the \"other\" trial could be a lot better.\nfloat best_error = best_errorvals_for_pcount[partition_count - 1];\n- float best_error_scale = exit_thresholds_for_pcount[partition_count - 1] * 2.0f;\n+ float best_error_scale = exit_thresholds_for_pcount[partition_count - 1] * 1.75f;\nif (best_error > (best_error_in_prev * best_error_scale))\n{\ntrace_add_data(\"skip\", \"tune_partition_early_out_limit_factor\");\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use tighter bounds to skip trials
|
61,745 |
02.01.2023 15:32:58
| 0 |
baf3be60206ce111b02061d5adefc498d39f7441
|
Use tighter bounds to skip refinement
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -22,6 +22,8 @@ and image quality improvements in this release.\n* **Optimization:** Remove folded `decimation_info` lookup tables. This\nreduces compressor memory footprint and improves context creation time.\nImpact increases with the active block size.\n+ * **Optimization:** Increased trial and refinement pruning by using stricter\n+ target errors when determining whether to skip iterations.\n* **Bug-fix:** Use lower case `windows.h` include for MinGW compatibility.\n<!-- ---------------------------------------------------------------------- -->\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -619,12 +619,12 @@ static float compress_symbolic_block_for_partition_1plane(\ntrace_add_data(\"error_prerealign\", errorval);\nbest_errorval_in_mode = astc::min(errorval, best_errorval_in_mode);\n- // Average refinement improvement is 3.5% per iteration (allow 5%), but the first\n- // iteration can help more so we give it a extra 10% leeway. Use this knowledge to\n+ // Average refinement improvement is 3.5% per iteration (allow 4.5%), but the first\n+ // iteration can help more so we give it a extra 8% leeway. Use this knowledge to\n// drive a heuristic to skip blocks that are unlikely to catch up with the best\n// block we have already.\nunsigned int iters_remaining = config.tune_refinement_limit - l;\n- float threshold = (0.05f * static_cast<float>(iters_remaining)) + 1.1f;\n+ float threshold = (0.045f * static_cast<float>(iters_remaining)) + 1.08f;\nif (errorval > (threshold * best_errorval_in_scb))\n{\nbreak;\n@@ -669,10 +669,10 @@ static float compress_symbolic_block_for_partition_1plane(\nbest_errorval_in_mode = astc::min(errorval, best_errorval_in_mode);\n// Average refinement improvement is 3.5% per iteration, so skip blocks that are\n- // unlikely to catch up with the best block we have already. Assume a 5% per step to\n+ // unlikely to catch up with the best block we have already. Assume a 4.5% per step to\n// give benefit of the doubt ...\nunsigned int iters_remaining = config.tune_refinement_limit - 1 - l;\n- float threshold = (0.05f * static_cast<float>(iters_remaining)) + 1.0f;\n+ float threshold = (0.045f * static_cast<float>(iters_remaining)) + 1.0f;\nif (errorval > (threshold * best_errorval_in_scb))\n{\nbreak;\n@@ -953,12 +953,12 @@ static float compress_symbolic_block_for_partition_2planes(\ntrace_add_data(\"error_prerealign\", errorval);\nbest_errorval_in_mode = astc::min(errorval, best_errorval_in_mode);\n- // Average refinement improvement is 3.5% per iteration (allow 5%), but the first\n- // iteration can help more so we give it a extra 10% leeway. Use this knowledge to\n+ // Average refinement improvement is 3.5% per iteration (allow 4.5%), but the first\n+ // iteration can help more so we give it a extra 8% leeway. Use this knowledge to\n// drive a heuristic to skip blocks that are unlikely to catch up with the best\n// block we have already.\nunsigned int iters_remaining = config.tune_refinement_limit - l;\n- float threshold = (0.05f * static_cast<float>(iters_remaining)) + 1.1f;\n+ float threshold = (0.045f * static_cast<float>(iters_remaining)) + 1.08f;\nif (errorval > (threshold * best_errorval_in_scb))\n{\nbreak;\n@@ -1004,10 +1004,10 @@ static float compress_symbolic_block_for_partition_2planes(\nbest_errorval_in_mode = astc::min(errorval, best_errorval_in_mode);\n// Average refinement improvement is 3.5% per iteration, so skip blocks that are\n- // unlikely to catch up with the best block we have already. Assume a 5% per step to\n+ // unlikely to catch up with the best block we have already. Assume a 4.5% per step to\n// give benefit of the doubt ...\nunsigned int iters_remaining = config.tune_refinement_limit - 1 - l;\n- float threshold = (0.05f * static_cast<float>(iters_remaining)) + 1.0f;\n+ float threshold = (0.045f * static_cast<float>(iters_remaining)) + 1.0f;\nif (errorval > (threshold * best_errorval_in_scb))\n{\nbreak;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use tighter bounds to skip refinement
|
61,745 |
02.01.2023 20:10:09
| 0 |
464450e5352ede646c8c158efaceeb9730e8ca24
|
Improve decimation_info member naming
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_block_sizes.cpp",
"new_path": "Source/astcenc_block_sizes.cpp",
"diff": "@@ -330,17 +330,17 @@ static void init_decimation_info_2d(\nfor (unsigned int j = 0; j < wb.weight_count_of_texel[i]; j++)\n{\n- di.texel_weights_int_4t[j][i] = wb.weights_of_texel[i][j];\n- di.texel_weights_float_4t[j][i] = static_cast<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+ di.texel_weight_contribs_int_tr[j][i] = wb.weights_of_texel[i][j];\n+ di.texel_weight_contribs_float_tr[j][i] = static_cast<float>(wb.weights_of_texel[i][j]) * (1.0f / WEIGHTS_TEXEL_SUM);\n+ di.texel_weights_tr[j][i] = wb.grid_weights_of_texel[i][j];\n}\n// Init all 4 entries so we can rely on zeros for vectorization\nfor (unsigned int j = wb.weight_count_of_texel[i]; j < 4; j++)\n{\n- di.texel_weights_int_4t[j][i] = 0;\n- di.texel_weights_float_4t[j][i] = 0.0f;\n- di.texel_weights_4t[j][i] = 0;\n+ di.texel_weight_contribs_int_tr[j][i] = 0;\n+ di.texel_weight_contribs_float_tr[j][i] = 0.0f;\n+ di.texel_weights_tr[j][i] = 0;\n}\n}\n@@ -356,18 +356,18 @@ static void init_decimation_info_2d(\nuint8_t texel = wb.texels_of_weight[i][j];\n// Create transposed versions of these for better vectorization\n- di.weight_texel[j][i] = texel;\n- di.weights_flt[j][i] = static_cast<float>(wb.texel_weights_of_weight[i][j]);\n+ di.weight_texels_tr[j][i] = texel;\n+ di.weights_texel_contribs_tr[j][i] = static_cast<float>(wb.texel_weights_of_weight[i][j]);\n// Store the per-texel contribution of this weight for each texel it contributes to\n- di.texel_weight_for_weight[i][j] = 0.0f;\n+ di.texel_contrib_for_weight[j][i] = 0.0f;\nfor (unsigned int k = 0; k < 4; k++)\n{\n- uint8_t dttw = di.texel_weights_4t[k][texel];\n- float dttwf = di.texel_weights_float_4t[k][texel];\n+ uint8_t dttw = di.texel_weights_tr[k][texel];\n+ float dttwf = di.texel_weight_contribs_float_tr[k][texel];\nif (dttw == i && dttwf != 0.0f)\n{\n- di.texel_weight_for_weight[i][j] = di.texel_weights_float_4t[k][texel];\n+ di.texel_contrib_for_weight[j][i] = di.texel_weight_contribs_float_tr[k][texel];\nbreak;\n}\n}\n@@ -375,11 +375,11 @@ 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- uint8_t last_texel = di.weight_texel[texel_count_wt - 1][i];\n+ uint8_t last_texel = di.weight_texels_tr[texel_count_wt - 1][i];\nfor (unsigned int j = texel_count_wt; j < max_texel_count_of_weight; j++)\n{\n- di.weight_texel[j][i] = last_texel;\n- di.weights_flt[j][i] = 0.0f;\n+ di.weight_texels_tr[j][i] = last_texel;\n+ di.weights_texel_contribs_tr[j][i] = 0.0f;\n}\n}\n@@ -391,16 +391,16 @@ static void init_decimation_info_2d(\nfor (unsigned int j = 0; j < 4; j++)\n{\n- di.texel_weights_float_4t[j][i] = 0;\n- di.texel_weights_4t[j][i] = 0;\n- di.texel_weights_int_4t[j][i] = 0;\n+ di.texel_weight_contribs_float_tr[j][i] = 0;\n+ di.texel_weights_tr[j][i] = 0;\n+ di.texel_weight_contribs_int_tr[j][i] = 0;\n}\n}\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\nunsigned int last_texel_count_wt = wb.texel_count_of_weight[weights_per_block - 1];\n- uint8_t last_texel = di.weight_texel[last_texel_count_wt - 1][weights_per_block - 1];\n+ uint8_t last_texel = di.weight_texels_tr[last_texel_count_wt - 1][weights_per_block - 1];\nunsigned int weights_per_block_simd = round_up_to_simd_multiple_vla(weights_per_block);\nfor (unsigned int i = weights_per_block; i < weights_per_block_simd; i++)\n@@ -409,8 +409,8 @@ static void init_decimation_info_2d(\nfor (unsigned int j = 0; j < max_texel_count_of_weight; j++)\n{\n- di.weight_texel[j][i] = last_texel;\n- di.weights_flt[j][i] = 0.0f;\n+ di.weight_texels_tr[j][i] = last_texel;\n+ di.weights_texel_contribs_tr[j][i] = 0.0f;\n}\n}\n@@ -587,16 +587,16 @@ static void init_decimation_info_3d(\n// Init all 4 entries so we can rely on zeros for vectorization\nfor (unsigned int j = 0; j < 4; j++)\n{\n- di.texel_weights_int_4t[j][i] = 0;\n- di.texel_weights_float_4t[j][i] = 0.0f;\n- di.texel_weights_4t[j][i] = 0;\n+ di.texel_weight_contribs_int_tr[j][i] = 0;\n+ di.texel_weight_contribs_float_tr[j][i] = 0.0f;\n+ di.texel_weights_tr[j][i] = 0;\n}\nfor (unsigned int j = 0; j < wb.weight_count_of_texel[i]; j++)\n{\n- di.texel_weights_int_4t[j][i] = wb.weights_of_texel[i][j];\n- di.texel_weights_float_4t[j][i] = static_cast<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+ di.texel_weight_contribs_int_tr[j][i] = wb.weights_of_texel[i][j];\n+ di.texel_weight_contribs_float_tr[j][i] = static_cast<float>(wb.weights_of_texel[i][j]) * (1.0f / WEIGHTS_TEXEL_SUM);\n+ di.texel_weights_tr[j][i] = wb.grid_weights_of_texel[i][j];\n}\n}\n@@ -612,18 +612,18 @@ static void init_decimation_info_3d(\nunsigned int texel = wb.texels_of_weight[i][j];\n// Create transposed versions of these for better vectorization\n- di.weight_texel[j][i] = static_cast<uint8_t>(texel);\n- di.weights_flt[j][i] = static_cast<float>(wb.texel_weights_of_weight[i][j]);\n+ di.weight_texels_tr[j][i] = static_cast<uint8_t>(texel);\n+ di.weights_texel_contribs_tr[j][i] = static_cast<float>(wb.texel_weights_of_weight[i][j]);\n// Store the per-texel contribution of this weight for each texel it contributes to\n- di.texel_weight_for_weight[i][j] = 0.0f;\n+ di.texel_contrib_for_weight[j][i] = 0.0f;\nfor (unsigned int k = 0; k < 4; k++)\n{\n- uint8_t dttw = di.texel_weights_4t[k][texel];\n- float dttwf = di.texel_weights_float_4t[k][texel];\n+ uint8_t dttw = di.texel_weights_tr[k][texel];\n+ float dttwf = di.texel_weight_contribs_float_tr[k][texel];\nif (dttw == i && dttwf != 0.0f)\n{\n- di.texel_weight_for_weight[i][j] = di.texel_weights_float_4t[k][texel];\n+ di.texel_contrib_for_weight[j][i] = di.texel_weight_contribs_float_tr[k][texel];\nbreak;\n}\n}\n@@ -631,11 +631,11 @@ 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- uint8_t last_texel = di.weight_texel[texel_count_wt - 1][i];\n+ uint8_t last_texel = di.weight_texels_tr[texel_count_wt - 1][i];\nfor (unsigned int j = texel_count_wt; j < max_texel_count_of_weight; j++)\n{\n- di.weight_texel[j][i] = last_texel;\n- di.weights_flt[j][i] = 0.0f;\n+ di.weight_texels_tr[j][i] = last_texel;\n+ di.weights_texel_contribs_tr[j][i] = 0.0f;\n}\n}\n@@ -647,16 +647,16 @@ static void init_decimation_info_3d(\nfor (unsigned int j = 0; j < 4; j++)\n{\n- di.texel_weights_float_4t[j][i] = 0;\n- di.texel_weights_4t[j][i] = 0;\n- di.texel_weights_int_4t[j][i] = 0;\n+ di.texel_weight_contribs_float_tr[j][i] = 0;\n+ di.texel_weights_tr[j][i] = 0;\n+ di.texel_weight_contribs_int_tr[j][i] = 0;\n}\n}\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\nint last_texel_count_wt = wb.texel_count_of_weight[weights_per_block - 1];\n- uint8_t last_texel = di.weight_texel[last_texel_count_wt - 1][weights_per_block - 1];\n+ uint8_t last_texel = di.weight_texels_tr[last_texel_count_wt - 1][weights_per_block - 1];\nunsigned int weights_per_block_simd = round_up_to_simd_multiple_vla(weights_per_block);\nfor (unsigned int i = weights_per_block; i < weights_per_block_simd; i++)\n@@ -665,8 +665,8 @@ static void init_decimation_info_3d(\nfor (int j = 0; j < max_texel_count_of_weight; j++)\n{\n- di.weight_texel[j][i] = last_texel;\n- di.weights_flt[j][i] = 0.0f;\n+ di.weight_texels_tr[j][i] = last_texel;\n+ di.weights_texel_contribs_tr[j][i] = 0.0f;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -277,14 +277,14 @@ static bool realign_weights_decimated(\npromise(texels_to_evaluate > 0);\nfor (unsigned int te_idx = 0; te_idx < texels_to_evaluate; te_idx++)\n{\n- unsigned int texel = di.weight_texel[te_idx][we_idx];\n+ unsigned int texel = di.weight_texels_tr[te_idx][we_idx];\n- float tw_base = di.texel_weight_for_weight[we_idx][te_idx];\n+ float tw_base = di.texel_contrib_for_weight[te_idx][we_idx];\n- float weight_base = (uq_weightsf[di.texel_weights_4t[0][texel]] * di.texel_weights_float_4t[0][texel]\n- + uq_weightsf[di.texel_weights_4t[1][texel]] * di.texel_weights_float_4t[1][texel])\n- + (uq_weightsf[di.texel_weights_4t[2][texel]] * di.texel_weights_float_4t[2][texel]\n- + uq_weightsf[di.texel_weights_4t[3][texel]] * di.texel_weights_float_4t[3][texel]);\n+ float weight_base = (uq_weightsf[di.texel_weights_tr[0][texel]] * di.texel_weight_contribs_float_tr[0][texel]\n+ + uq_weightsf[di.texel_weights_tr[1][texel]] * di.texel_weight_contribs_float_tr[1][texel])\n+ + (uq_weightsf[di.texel_weights_tr[2][texel]] * di.texel_weight_contribs_float_tr[2][texel]\n+ + uq_weightsf[di.texel_weights_tr[3][texel]] * di.texel_weight_contribs_float_tr[3][texel]);\n// Ideally this is integer rounded, but IQ gain it isn't worth the overhead\n// float weight = astc::flt_rd(weight_base + 0.5f);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_decompress_symbolic.cpp",
"new_path": "Source/astcenc_decompress_symbolic.cpp",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2022 Arm Limited\n+// Copyright 2011-2023 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@@ -121,8 +121,8 @@ void unpack_weights(\npromise(max_weight_count > 0);\nfor (int j = 0; j < max_weight_count; j++)\n{\n- vint texel_weights(di.texel_weights_4t[j] + i);\n- vint texel_weights_int(di.texel_weights_int_4t[j] + i);\n+ vint texel_weights(di.texel_weights_tr[j] + i);\n+ vint texel_weights_int(di.texel_weight_contribs_int_tr[j] + i);\nsummed_value += vtable_8bt_32bi(tab0p, tab1p, tab2p, tab3p, texel_weights) * texel_weights_int;\n}\n@@ -156,8 +156,8 @@ void unpack_weights(\npromise(max_weight_count > 0);\nfor (int j = 0; j < max_weight_count; j++)\n{\n- vint texel_weights(di.texel_weights_4t[j] + i);\n- vint texel_weights_int(di.texel_weights_int_4t[j] + i);\n+ vint texel_weights(di.texel_weights_tr[j] + i);\n+ vint texel_weights_int(di.texel_weight_contribs_int_tr[j] + i);\nsum_plane1 += vtable_8bt_32bi(tab0_plane1p, tab1_plane1p, texel_weights) * texel_weights_int;\nsum_plane2 += vtable_8bt_32bi(tab0_plane2p, tab1_plane2p, texel_weights) * texel_weights_int;\n"
},
{
"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-2022 Arm Limited\n+// Copyright 2011-2023 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@@ -41,10 +41,10 @@ static vfloat bilinear_infill_vla(\nunsigned int index\n) {\n// Load the bilinear filter texel weight indexes in the decimated grid\n- vint weight_idx0 = vint(di.texel_weights_4t[0] + index);\n- vint weight_idx1 = vint(di.texel_weights_4t[1] + index);\n- vint weight_idx2 = vint(di.texel_weights_4t[2] + index);\n- vint weight_idx3 = vint(di.texel_weights_4t[3] + index);\n+ vint weight_idx0 = vint(di.texel_weights_tr[0] + index);\n+ vint weight_idx1 = vint(di.texel_weights_tr[1] + index);\n+ vint weight_idx2 = vint(di.texel_weights_tr[2] + index);\n+ vint weight_idx3 = vint(di.texel_weights_tr[3] + index);\n// Load the bilinear filter weights from the decimated grid\nvfloat weight_val0 = gatherf(weights, weight_idx0);\n@@ -53,10 +53,10 @@ static vfloat bilinear_infill_vla(\nvfloat weight_val3 = gatherf(weights, weight_idx3);\n// Load the weight contribution factors for each decimated weight\n- vfloat tex_weight_float0 = loada(di.texel_weights_float_4t[0] + index);\n- vfloat tex_weight_float1 = loada(di.texel_weights_float_4t[1] + index);\n- vfloat tex_weight_float2 = loada(di.texel_weights_float_4t[2] + index);\n- vfloat tex_weight_float3 = loada(di.texel_weights_float_4t[3] + index);\n+ vfloat tex_weight_float0 = loada(di.texel_weight_contribs_float_tr[0] + index);\n+ vfloat tex_weight_float1 = loada(di.texel_weight_contribs_float_tr[1] + index);\n+ vfloat tex_weight_float2 = loada(di.texel_weight_contribs_float_tr[2] + index);\n+ vfloat tex_weight_float3 = loada(di.texel_weight_contribs_float_tr[3] + index);\n// Compute the bilinear interpolation to generate the per-texel weight\nreturn (weight_val0 * tex_weight_float0 + weight_val1 * tex_weight_float1) +\n@@ -81,16 +81,16 @@ static vfloat bilinear_infill_vla_2(\nunsigned int index\n) {\n// Load the bilinear filter texel weight indexes in the decimated grid\n- vint weight_idx0 = vint(di.texel_weights_4t[0] + index);\n- vint weight_idx1 = vint(di.texel_weights_4t[1] + index);\n+ vint weight_idx0 = vint(di.texel_weights_tr[0] + index);\n+ vint weight_idx1 = vint(di.texel_weights_tr[1] + index);\n// Load the bilinear filter weights from the decimated grid\nvfloat weight_val0 = gatherf(weights, weight_idx0);\nvfloat weight_val1 = gatherf(weights, weight_idx1);\n// Load the weight contribution factors for each decimated weight\n- vfloat tex_weight_float0 = loada(di.texel_weights_float_4t[0] + index);\n- vfloat tex_weight_float1 = loada(di.texel_weights_float_4t[1] + index);\n+ vfloat tex_weight_float0 = loada(di.texel_weight_contribs_float_tr[0] + index);\n+ vfloat tex_weight_float1 = loada(di.texel_weight_contribs_float_tr[1] + index);\n// Compute the bilinear interpolation to generate the per-texel weight\nreturn (weight_val0 * tex_weight_float0 + weight_val1 * tex_weight_float1);\n@@ -894,8 +894,8 @@ void compute_ideal_weights_for_decimation(\nfor (unsigned int j = 0; j < max_texel_count; j++)\n{\n- vint texel(di.weight_texel[j] + i);\n- vfloat weight = loada(di.weights_flt[j] + i);\n+ vint texel(di.weight_texels_tr[j] + i);\n+ vfloat weight = loada(di.weights_texel_contribs_tr[j] + i);\nif (!constant_wes)\n{\n@@ -952,8 +952,8 @@ void compute_ideal_weights_for_decimation(\nfor (unsigned int j = 0; j < max_texel_count; j++)\n{\n- vint texel(di.weight_texel[j] + i);\n- vfloat contrib_weight = loada(di.weights_flt[j] + i);\n+ vint texel(di.weight_texels_tr[j] + i);\n+ vfloat contrib_weight = loada(di.weights_texel_contribs_tr[j] + i);\nif (!constant_wes)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -360,29 +360,50 @@ struct decimation_info\n/** @brief The number of stored weights in the Z dimension. */\nuint8_t weight_z;\n- /** @brief The number of stored weights that contribute to each texel, between 1 and 4. */\n+ /**\n+ * @brief The number of weights that contribute to each texel.\n+ * Value is between 1 and 4.\n+ */\nuint8_t texel_weight_count[BLOCK_MAX_TEXELS];\n- /** @brief The weight index of the N weights that need to be interpolated for each texel. */\n- uint8_t texel_weights_4t[4][BLOCK_MAX_TEXELS];\n+ /**\n+ * @brief The weight index of the N weights that are interpolated for each texel.\n+ * Stored transposed to improve vectorization.\n+ */\n+ uint8_t texel_weights_tr[4][BLOCK_MAX_TEXELS];\n- /** @brief The bilinear interpolation weighting of the N input weights for each texel, between 0 and 16. */\n- uint8_t texel_weights_int_4t[4][BLOCK_MAX_TEXELS];\n+ /**\n+ * @brief The bilinear contribution of the N weights that are interpolated for each texel.\n+ * Value is between 0 and 16, stored transposed to improve vectorization.\n+ */\n+ uint8_t texel_weight_contribs_int_tr[4][BLOCK_MAX_TEXELS];\n- /** @brief The bilinear interpolation weighting of the N input weights for each texel, between 0 and 1. */\n- alignas(ASTCENC_VECALIGN) float texel_weights_float_4t[4][BLOCK_MAX_TEXELS];\n+ /**\n+ * @brief The bilinear contribution of the N weights that are interpolated for each texel.\n+ * Value is between 0 and 1, stored transposed to improve vectorization.\n+ */\n+ alignas(ASTCENC_VECALIGN) float texel_weight_contribs_float_tr[4][BLOCK_MAX_TEXELS];\n/** @brief The number of texels that each stored weight contributes to. */\nuint8_t weight_texel_count[BLOCK_MAX_WEIGHTS];\n- /** @brief The list of weights that contribute to each texel. */\n- uint8_t weight_texel[BLOCK_MAX_TEXELS][BLOCK_MAX_WEIGHTS];\n+ /**\n+ * @brief The list of texels that use a specific weight index.\n+ * Stored transposed to improve vectorization.\n+ */\n+ uint8_t weight_texels_tr[BLOCK_MAX_TEXELS][BLOCK_MAX_WEIGHTS];\n- /** @brief The list of weight indices that contribute to each texel. */\n- alignas(ASTCENC_VECALIGN) float weights_flt[BLOCK_MAX_TEXELS][BLOCK_MAX_WEIGHTS];\n+ /**\n+ * @brief The bilinear contribution to the N texels that use each weight.\n+ * Value is between 0 and 1, stored transposed to improve vectorization.\n+ */\n+ alignas(ASTCENC_VECALIGN) float weights_texel_contribs_tr[BLOCK_MAX_TEXELS][BLOCK_MAX_WEIGHTS];\n- /** @brief The weight contribution to the total texel weighting for each weight and texel. */\n- float texel_weight_for_weight[BLOCK_MAX_WEIGHTS][BLOCK_MAX_TEXELS];\n+ /**\n+ * @brief The bilinear contribution to the Nth texel that uses each weight.\n+ * Value is between 0 and 1, stored transposed to improve vectorization.\n+ */\n+ float texel_contrib_for_weight[BLOCK_MAX_TEXELS][BLOCK_MAX_WEIGHTS];\n};\n/**\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Improve decimation_info member naming
|
61,745 |
03.01.2023 15:20:57
| 0 |
fa0a814be240da57764d7c4f559f73a9e3ca73dc
|
Avoid -gdwarf-4 on Windows with ClangCL
|
[
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -137,7 +137,8 @@ macro(astcenc_set_properties NAME)\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-cast-function-type>\n# Force DWARF4 for Valgrind profiling\n- $<$<CXX_COMPILER_ID:Clang>:-gdwarf-4>\n+ $<$<AND:$<PLATFORM_ID:Linux,Darwin>,$<CXX_COMPILER_ID:Clang>>:-gdwarf-4>\n+\n$<$<CXX_COMPILER_ID:Clang>:-Wdocumentation>)\ntarget_link_options(${NAME}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Avoid -gdwarf-4 on Windows with ClangCL
|
61,745 |
03.01.2023 15:34:27
| 0 |
7bddd8d251d7051f2013a65e1360798a82826377
|
Disable nonportable system include paths for Windows + Clang
|
[
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -139,6 +139,9 @@ macro(astcenc_set_properties NAME)\n# Force DWARF4 for Valgrind profiling\n$<$<AND:$<PLATFORM_ID:Linux,Darwin>,$<CXX_COMPILER_ID:Clang>>:-gdwarf-4>\n+ # Disable non-portable Windows.h warning (fixing it fails builds on MinGW)\n+ $<$<AND:$<PLATFORM_ID:Windows>,$<CXX_COMPILER_ID:Clang>>:-Wno-nonportable-system-include-path>\n+\n$<$<CXX_COMPILER_ID:Clang>:-Wdocumentation>)\ntarget_link_options(${NAME}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Disable nonportable system include paths for Windows + Clang
|
61,745 |
03.01.2023 15:34:47
| 0 |
99c64d940a114da45a9ff3c399b392d04edb1607
|
Switch to main test reference
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_image.py",
"new_path": "Test/astc_test_image.py",
"diff": "@@ -302,7 +302,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-4.2-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
|
Switch to main test reference
|
61,745 |
03.01.2023 20:24:05
| 0 |
2e4e2122f61c0f971238efd00614d99d685f1896
|
Use symbolic value rather than repeated literal
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_partition_tables.cpp",
"new_path": "Source/astcenc_partition_tables.cpp",
"diff": "#include \"astcenc_internal.h\"\n+/** @brief The number of 64-bit words needed to represent a canonical partition bit pattern. */\n+static const int BIT_PATTERN_WORDS { (BLOCK_MAX_TEXELS + 63) / 32 };\n+\n/**\n* @brief Generate a canonical representation of a partition pattern.\n*\nstatic void generate_canonical_partitioning(\nunsigned int texel_count,\nconst uint8_t* partition_of_texel,\n- uint64_t bit_pattern[7]\n+ uint64_t bit_pattern[BIT_PATTERN_WORDS]\n) {\n// Clear the pattern\n- for (unsigned int i = 0; i < 7; i++)\n+ for (unsigned int i = 0; i < BIT_PATTERN_WORDS; i++)\n{\nbit_pattern[i] = 0;\n}\n@@ -76,8 +79,8 @@ static void generate_canonical_partitioning(\n* @return @c true if the patterns are the same, @c false otherwise.\n*/\nstatic bool compare_canonical_partitionings(\n- const uint64_t part1[7],\n- const uint64_t part2[7]\n+ const uint64_t part1[BIT_PATTERN_WORDS],\n+ const uint64_t part2[BIT_PATTERN_WORDS]\n) {\nreturn (part1[0] == part2[0]) && (part1[1] == part2[1]) &&\n(part1[2] == part2[2]) && (part1[3] == part2[3]) &&\n@@ -401,11 +404,11 @@ static void build_partition_table_for_one_partition_count(\ncontinue;\n}\n- generate_canonical_partitioning(bsd.texel_count, ptab[next_index].partition_of_texel, canonical_patterns + next_index * 7);\n+ generate_canonical_partitioning(bsd.texel_count, ptab[next_index].partition_of_texel, canonical_patterns + next_index * BIT_PATTERN_WORDS);\nbool keep_canonical = true;\nfor (unsigned int j = 0; j < next_index; j++)\n{\n- bool match = compare_canonical_partitionings(canonical_patterns + 7 * next_index, canonical_patterns + 7 * j);\n+ bool match = compare_canonical_partitionings(canonical_patterns + next_index * BIT_PATTERN_WORDS, canonical_patterns + j * BIT_PATTERN_WORDS);\nif (match)\n{\nkeep_canonical = false;\n@@ -452,7 +455,8 @@ void init_partition_tables(\nbsd.partitioning_count_selected[0] = 1;\nbsd.partitioning_count_all[0] = 1;\n- uint64_t* canonical_patterns = new uint64_t[BLOCK_MAX_PARTITIONINGS * 7];\n+ uint64_t* canonical_patterns = new uint64_t[BLOCK_MAX_PARTITIONINGS * BIT_PATTERN_WORDS];\n+\nbuild_partition_table_for_one_partition_count(bsd, can_omit_partitionings, partition_count_cutoff, 2, par_tab2, canonical_patterns);\nbuild_partition_table_for_one_partition_count(bsd, can_omit_partitionings, partition_count_cutoff, 3, par_tab3, canonical_patterns);\nbuild_partition_table_for_one_partition_count(bsd, can_omit_partitionings, partition_count_cutoff, 4, par_tab4, canonical_patterns);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use symbolic value rather than repeated literal
|
61,745 |
13.01.2023 22:20:10
| 0 |
92279e01a0da531309a94f2db0d1a9cea07ef2d8
|
Allow compile-time reduction in max texel count
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -154,10 +154,12 @@ static constexpr unsigned int TUNE_MAX_PARTITIIONING_CANDIDATES { 32 };\n*/\nstatic constexpr unsigned int TUNE_MAX_ANGULAR_QUANT { 7 }; /* QUANT_12 */\n-\nstatic_assert((BLOCK_MAX_TEXELS % ASTCENC_SIMD_WIDTH) == 0,\n\"BLOCK_MAX_TEXELS must be multiple of ASTCENC_SIMD_WIDTH\");\n+static_assert(BLOCK_MAX_TEXELS <= 216,\n+ \"BLOCK_MAX_TEXELS must not be greater than 216\");\n+\nstatic_assert((BLOCK_MAX_WEIGHTS % ASTCENC_SIMD_WIDTH) == 0,\n\"BLOCK_MAX_WEIGHTS must be multiple of ASTCENC_SIMD_WIDTH\");\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_partition_tables.cpp",
"new_path": "Source/astcenc_partition_tables.cpp",
"diff": "@@ -82,10 +82,26 @@ static bool compare_canonical_partitionings(\nconst uint64_t part1[BIT_PATTERN_WORDS],\nconst uint64_t part2[BIT_PATTERN_WORDS]\n) {\n- return (part1[0] == part2[0]) && (part1[1] == part2[1]) &&\n- (part1[2] == part2[2]) && (part1[3] == part2[3]) &&\n- (part1[4] == part2[4]) && (part1[5] == part2[5]) &&\n- (part1[6] == part2[6]);\n+ return (part1[0] == part2[0])\n+#if BIT_PATTERN_WORDS > 1\n+ && (part1[1] == part2[1])\n+#endif\n+#if BIT_PATTERN_WORDS > 2\n+ && (part1[2] == part2[2])\n+#endif\n+#if BIT_PATTERN_WORDS > 3\n+ && (part1[3] == part2[3])\n+#endif\n+#if BIT_PATTERN_WORDS > 4\n+ && (part1[4] == part2[4])\n+#endif\n+#if BIT_PATTERN_WORDS > 5\n+ && (part1[5] == part2[5])\n+#endif\n+#if BIT_PATTERN_WORDS > 6\n+ && (part1[6] == part2[6])\n+#endif\n+ ;\n}\n/**\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Allow compile-time reduction in max texel count
|
61,745 |
13.01.2023 22:23:30
| 0 |
8af2ad2a184a40fa35f2ea579da4d1999f5e9c19
|
Typo fix in #define name
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc.h",
"new_path": "Source/astcenc.h",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2020-2022 Arm Limited\n+// Copyright 2020-2023 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@@ -488,21 +488,21 @@ struct astcenc_config\n/**\n* @brief The number of trial partitionings per search (-2partitioncandidatelimit).\n*\n- * Valid values are between 1 and TUNE_MAX_PARTITIIONING_CANDIDATES.\n+ * Valid values are between 1 and TUNE_MAX_PARTITIONING_CANDIDATES.\n*/\nunsigned int tune_2partitioning_candidate_limit;\n/**\n* @brief The number of trial partitionings per search (-3partitioncandidatelimit).\n*\n- * Valid values are between 1 and TUNE_MAX_PARTITIIONING_CANDIDATES.\n+ * Valid values are between 1 and TUNE_MAX_PARTITIONING_CANDIDATES.\n*/\nunsigned int tune_3partitioning_candidate_limit;\n/**\n* @brief The number of trial partitionings per search (-4partitioncandidatelimit).\n*\n- * Valid values are between 1 and TUNE_MAX_PARTITIIONING_CANDIDATES.\n+ * Valid values are between 1 and TUNE_MAX_PARTITIONING_CANDIDATES.\n*/\nunsigned int tune_4partitioning_candidate_limit;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -1368,7 +1368,7 @@ 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[TUNE_MAX_PARTITIIONING_CANDIDATES];\n+ unsigned int partition_indices[TUNE_MAX_PARTITIONING_CANDIDATES];\nunsigned int requested_indices = requested_partition_indices[partition_count - 2];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2022 Arm Limited\n+// Copyright 2011-2023 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@@ -435,9 +435,9 @@ static astcenc_error validate_config(\nconfig.tune_block_mode_limit = astc::clamp(config.tune_block_mode_limit, 1u, 100u);\nconfig.tune_refinement_limit = astc::max(config.tune_refinement_limit, 1u);\nconfig.tune_candidate_limit = astc::clamp(config.tune_candidate_limit, 1u, TUNE_MAX_TRIAL_CANDIDATES);\n- config.tune_2partitioning_candidate_limit = astc::clamp(config.tune_2partitioning_candidate_limit, 1u, TUNE_MAX_PARTITIIONING_CANDIDATES);\n- config.tune_3partitioning_candidate_limit = astc::clamp(config.tune_3partitioning_candidate_limit, 1u, TUNE_MAX_PARTITIIONING_CANDIDATES);\n- config.tune_4partitioning_candidate_limit = astc::clamp(config.tune_4partitioning_candidate_limit, 1u, TUNE_MAX_PARTITIIONING_CANDIDATES);\n+ config.tune_2partitioning_candidate_limit = astc::clamp(config.tune_2partitioning_candidate_limit, 1u, TUNE_MAX_PARTITIONING_CANDIDATES);\n+ config.tune_3partitioning_candidate_limit = astc::clamp(config.tune_3partitioning_candidate_limit, 1u, TUNE_MAX_PARTITIONING_CANDIDATES);\n+ config.tune_4partitioning_candidate_limit = astc::clamp(config.tune_4partitioning_candidate_limit, 1u, TUNE_MAX_PARTITIONING_CANDIDATES);\nconfig.tune_db_limit = astc::max(config.tune_db_limit, 0.0f);\nconfig.tune_mse_overshoot = astc::max(config.tune_mse_overshoot, 1.0f);\nconfig.tune_2_partition_early_out_limit_factor = astc::max(config.tune_2_partition_early_out_limit_factor, 0.0f);\n@@ -556,9 +556,9 @@ astcenc_error astcenc_config_init(\nconfig.tune_block_mode_limit = (*preset_configs)[start].tune_block_mode_limit;\nconfig.tune_refinement_limit = (*preset_configs)[start].tune_refinement_limit;\nconfig.tune_candidate_limit = astc::min((*preset_configs)[start].tune_candidate_limit, TUNE_MAX_TRIAL_CANDIDATES);\n- config.tune_2partitioning_candidate_limit = astc::min((*preset_configs)[start].tune_2partitioning_candidate_limit, TUNE_MAX_PARTITIIONING_CANDIDATES);\n- config.tune_3partitioning_candidate_limit = astc::min((*preset_configs)[start].tune_3partitioning_candidate_limit, TUNE_MAX_PARTITIIONING_CANDIDATES);\n- config.tune_4partitioning_candidate_limit = astc::min((*preset_configs)[start].tune_4partitioning_candidate_limit, TUNE_MAX_PARTITIIONING_CANDIDATES);\n+ config.tune_2partitioning_candidate_limit = astc::min((*preset_configs)[start].tune_2partitioning_candidate_limit, TUNE_MAX_PARTITIONING_CANDIDATES);\n+ config.tune_3partitioning_candidate_limit = astc::min((*preset_configs)[start].tune_3partitioning_candidate_limit, TUNE_MAX_PARTITIONING_CANDIDATES);\n+ config.tune_4partitioning_candidate_limit = astc::min((*preset_configs)[start].tune_4partitioning_candidate_limit, TUNE_MAX_PARTITIONING_CANDIDATES);\nconfig.tune_db_limit = astc::max((*preset_configs)[start].tune_db_limit_a_base - 35 * ltexels,\n(*preset_configs)[start].tune_db_limit_b_base - 19 * ltexels);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_find_best_partitioning.cpp",
"new_path": "Source/astcenc_find_best_partitioning.cpp",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2022 Arm Limited\n+// Copyright 2011-2023 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@@ -540,7 +540,7 @@ unsigned int find_best_partition_candidates(\nconst image_block& blk,\nunsigned int partition_count,\nunsigned int partition_search_limit,\n- unsigned int best_partitions[TUNE_MAX_PARTITIIONING_CANDIDATES],\n+ unsigned int best_partitions[TUNE_MAX_PARTITIONING_CANDIDATES],\nunsigned int requested_candidates\n) {\n// Constant used to estimate quantization error for a given partitioning; the optimal value for\n@@ -573,12 +573,12 @@ unsigned int find_best_partition_candidates(\nbool uses_alpha = !blk.is_constant_channel(3);\n// Partitioning errors assuming uncorrelated-chrominance endpoints\n- float uncor_best_errors[TUNE_MAX_PARTITIIONING_CANDIDATES];\n- unsigned int uncor_best_partitions[TUNE_MAX_PARTITIIONING_CANDIDATES];\n+ float uncor_best_errors[TUNE_MAX_PARTITIONING_CANDIDATES];\n+ unsigned int uncor_best_partitions[TUNE_MAX_PARTITIONING_CANDIDATES];\n// Partitioning errors assuming same-chrominance endpoints\n- float samec_best_errors[TUNE_MAX_PARTITIIONING_CANDIDATES];\n- unsigned int samec_best_partitions[TUNE_MAX_PARTITIIONING_CANDIDATES];\n+ float samec_best_errors[TUNE_MAX_PARTITIONING_CANDIDATES];\n+ unsigned int samec_best_partitions[TUNE_MAX_PARTITIONING_CANDIDATES];\nfor (unsigned int i = 0; i < requested_candidates; i++)\n{\n@@ -733,7 +733,7 @@ unsigned int find_best_partition_candidates(\nbool best_is_uncor = uncor_best_partitions[0] > samec_best_partitions[0];\n- unsigned int interleave[2 * TUNE_MAX_PARTITIIONING_CANDIDATES];\n+ unsigned int interleave[2 * TUNE_MAX_PARTITIONING_CANDIDATES];\nfor (unsigned int i = 0; i < requested_candidates; i++)\n{\nif (best_is_uncor)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -137,7 +137,7 @@ static constexpr unsigned int TUNE_MAX_TRIAL_CANDIDATES { 8 };\n*\n* This can be dynamically reduced by the compression quality preset.\n*/\n-static constexpr unsigned int TUNE_MAX_PARTITIIONING_CANDIDATES { 32 };\n+static constexpr unsigned int TUNE_MAX_PARTITIONING_CANDIDATES { 32 };\n/**\n* @brief The maximum quant level using full angular endpoint search method.\n@@ -1565,7 +1565,7 @@ unsigned int find_best_partition_candidates(\nconst image_block& blk,\nunsigned int partition_count,\nunsigned int partition_search_limit,\n- unsigned int best_partitions[TUNE_MAX_PARTITIIONING_CANDIDATES],\n+ unsigned int best_partitions[TUNE_MAX_PARTITIONING_CANDIDATES],\nunsigned int requested_candidates);\n/* ============================================================================\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Typo fix in #define name
|
61,745 |
13.01.2023 22:34:45
| 0 |
232b735b43e6d4a93e3e8456f7c708cd0b7ec6f3
|
Set project version to 4.3.0
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "# SPDX-License-Identifier: Apache-2.0\n# ----------------------------------------------------------------------------\n-# Copyright 2020-2022 Arm Limited\n+# Copyright 2020-2023 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@@ -24,7 +24,7 @@ if(MSVC)\nadd_compile_options(\"/wd4324\") # Disable structure was padded due to alignment specifier\nendif()\n-project(astcencoder VERSION 4.2.0)\n+project(astcencoder VERSION 4.3.0)\nset(CMAKE_CXX_STANDARD 14)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Set project version to 4.3.0
|
61,745 |
13.01.2023 23:12:57
| 0 |
1d3e3f85dc3e7246aa1f1f83b7001f27e6bc8205
|
Allow compile-time reduction in max texel count - fix
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_partition_tables.cpp",
"new_path": "Source/astcenc_partition_tables.cpp",
"diff": "#include \"astcenc_internal.h\"\n/** @brief The number of 64-bit words needed to represent a canonical partition bit pattern. */\n-static const int BIT_PATTERN_WORDS { (BLOCK_MAX_TEXELS + 63) / 32 };\n+#define BIT_PATTERN_WORDS (((ASTCENC_BLOCK_MAX_TEXELS * 2) + 63) / 64)\n/**\n* @brief Generate a canonical representation of a partition pattern.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Allow compile-time reduction in max texel count - fix
|
61,745 |
17.01.2023 19:02:10
| 0 |
dae59c10aee99997f795053a1b3c7672a1d0800e
|
Remove -mask option and MAP_MASK flag
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog-4x.md",
"new_path": "Docs/ChangeLog-4x.md",
"diff": "@@ -14,7 +14,14 @@ clocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.\nThe 4.3.0 release is an optimization release. There are minor performance\nand image quality improvements in this release.\n+Reminder - the codec library API is not designed to be binary compatible across\n+versions. We always recommend rebuilding your client-side code using the updated\n+`astcenc.h` header.\n+\n* **General:**\n+ * **Bug-fix:** Use lower case `windows.h` include for MinGW compatibility.\n+ * **Change:** The `-mask` command line option, `ASTCENC_FLG_MAP_MASK` in the\n+ library API, has been removed.\n* **Optimization:** Always skip blue-contraction for `QUANT_256` encodings.\nThis gives a small image quality improvement for the 4x4 block size.\n* **Optimization:** Always skip RGBO vector calculation for LDR encodings.\n@@ -24,7 +31,6 @@ and image quality improvements in this release.\nImpact increases with the active block size.\n* **Optimization:** Increased trial and refinement pruning by using stricter\ntarget errors when determining whether to skip iterations.\n- * **Bug-fix:** Use lower case `windows.h` include for MinGW compatibility.\n<!-- ---------------------------------------------------------------------- -->\n## 4.2.0\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc.h",
"new_path": "Source/astcenc.h",
"diff": "@@ -306,14 +306,6 @@ enum astcenc_type\n*/\nstatic const unsigned int ASTCENC_FLG_MAP_NORMAL = 1 << 0;\n-/**\n- * @brief Enable mask map compression.\n- *\n- * Input data will be treated a multi-layer mask map, where is is desirable for the color components\n- * to be treated independently for the purposes of error analysis.\n- */\n-static const unsigned int ASTCENC_FLG_MAP_MASK = 1 << 1;\n-\n/**\n* @brief Enable alpha weighting.\n*\n@@ -376,7 +368,6 @@ static const unsigned int ASTCENC_FLG_MAP_RGBM = 1 << 6;\n* @brief The bit mask of all valid flags.\n*/\nstatic const unsigned int ASTCENC_ALL_FLAGS =\n- ASTCENC_FLG_MAP_MASK |\nASTCENC_FLG_MAP_NORMAL |\nASTCENC_FLG_MAP_RGBM |\nASTCENC_FLG_USE_ALPHA_WEIGHT |\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -273,8 +273,7 @@ static astcenc_error validate_flags(\n}\n// Flags field must only contain at most a single map type\n- exMask = ASTCENC_FLG_MAP_MASK\n- | ASTCENC_FLG_MAP_NORMAL\n+ exMask = ASTCENC_FLG_MAP_NORMAL\n| ASTCENC_FLG_MAP_RGBM;\nif (popcount(flags & exMask) > 1)\n{\n@@ -665,12 +664,6 @@ astcenc_error astcenc_config_init(\n// so force compressor to try harder here ...\nconfig.tune_db_limit *= 1.03f;\n}\n- else if (flags & ASTCENC_FLG_MAP_MASK)\n- {\n- // Masks are prone to blocking artifacts on mask edges\n- // so force compressor to try harder here ...\n- config.tune_db_limit *= 1.03f;\n- }\nelse if (flags & ASTCENC_FLG_MAP_RGBM)\n{\nconfig.rgbm_m_scale = 5.0f;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -551,10 +551,6 @@ static int init_astcenc_config(\nargidx++;\nflags |= ASTCENC_FLG_USE_ALPHA_WEIGHT;\n}\n- else if (!strcmp(argv[argidx], \"-mask\"))\n- {\n- flags |= ASTCENC_FLG_MAP_MASK;\n- }\nelse if (!strcmp(argv[argidx], \"-normal\"))\n{\nflags |= ASTCENC_FLG_MAP_NORMAL;\n@@ -842,10 +838,6 @@ static int edit_astcenc_config(\ncli_config.swz_decode.a = swizzle_components[3];\n}\n// presets begin here\n- else if (!strcmp(argv[argidx], \"-mask\"))\n- {\n- argidx++;\n- }\nelse if (!strcmp(argv[argidx], \"-normal\"))\n{\nargidx++;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "@@ -159,12 +159,6 @@ COMPRESSION\nto consider for common usage, based on the type of image data being\ncompressed.\n- -mask\n- The input texture is a mask texture with unrelated data stored\n- in the various color components, so enable error heuristics that\n- aim to improve quality by minimizing the effect of error\n- cross-talk across the color components.\n-\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"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -804,27 +804,6 @@ class CLIPTest(CLITestBase):\ncolOut = tli.Image(imOut2).get_colors((7, 7))\nself.assertColorSame(colIn, colOut2)\n- def test_compress_mask(self):\n- \"\"\"\n- Test compression of mask textures.\n- \"\"\"\n- decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n-\n- command = [\n- self.binary, \"-tl\",\n- \"./Test/Images/Small/LDR-RGB/ldr-rgb-10.png\",\n- decompFile, \"4x4\", \"-medium\"]\n-\n- noMaskdB = float(self.exec(command, LDR_RGB_PSNR_PATTERN))\n-\n- command.append(\"-mask\")\n- maskdB = float(self.exec(command, LDR_RGB_PSNR_PATTERN))\n-\n- # Note that this test simply asserts that the \"-mask\" is connected and\n- # affects the output. We don't test it does something useful; that it\n- # outside the scope of this test case.\n- self.assertNotEqual(noMaskdB, maskdB)\n-\ndef test_compress_normal_psnr(self):\n\"\"\"\nTest compression of normal textures using PSNR error metrics.\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/encoder.py",
"new_path": "Test/testlib/encoder.py",
"diff": "@@ -285,9 +285,6 @@ class Encoder2x(EncoderBase):\nif image.colorFormat == \"xy\":\ncommand.append(\"-normal\")\n- if image.isMask:\n- command.append(\"-mask\")\n-\nif image.isAlphaScaled:\ncommand.append(\"-a\")\ncommand.append(\"1\")\n@@ -389,9 +386,6 @@ class Encoder1_7(EncoderBase):\nif image.colorProfile == \"hdr\":\ncommand.append(\"-hdr\")\n- if image.isMask:\n- command.append(\"-mask\")\n-\nif image.isAlphaScaled:\ncommand.append(\"-alphablend\")\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/image.py",
"new_path": "Test/testlib/image.py",
"diff": "@@ -59,7 +59,6 @@ class TestImage():\ncolorFormat: The image color format.\nname: The image human name.\nis3D: True if the image is 3D, else False.\n- isMask: True if the image is a non-correlated mask texture, else False.\nisAlphaScaled: True if the image wants alpha scaling, else False.\nTEST_EXTS: Expected test image extensions.\nPROFILES: Tuple of valid color profile values.\n@@ -150,7 +149,6 @@ class TestImage():\n# Set default values for the optional fields\nself.is3D = False\n- self.isMask = False\nself.isAlphaScaled = False\n# Decode the flags field if present\n@@ -165,7 +163,6 @@ class TestImage():\nseenFlags.add(flag)\nself.is3D = \"3\" in seenFlags\n- self.isMask = \"m\" in seenFlags\nself.isAlphaScaled = \"a\" in seenFlags\ndef get_size(self):\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove -mask option and MAP_MASK flag
|
61,745 |
17.01.2023 21:08:13
| 0 |
049d5ca97a62bc19ef56a51eede1b52c67797db7
|
Tweak search cutoff thresholds
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -1353,7 +1353,7 @@ void compress_block(\n// If attempting two planes is much worse than the best one plane result\n// then further two plane searches are unlikely to help so move on ...\n- if (errorval > (best_errorvals_for_pcount[0] * 1.75f))\n+ if (errorval > (best_errorvals_for_pcount[0] * 1.85f))\n{\nbreak;\n}\n@@ -1401,7 +1401,7 @@ void compress_block(\n// aligns with a partitioning that suits that encoding, so for this inner loop check add\n// a large error scale because the \"other\" trial could be a lot better.\nfloat best_error = best_errorvals_for_pcount[partition_count - 1];\n- float best_error_scale = exit_thresholds_for_pcount[partition_count - 1] * 1.75f;\n+ float best_error_scale = exit_thresholds_for_pcount[partition_count - 1] * 1.85f;\nif (best_error > (best_error_in_prev * best_error_scale))\n{\ntrace_add_data(\"skip\", \"tune_partition_early_out_limit_factor\");\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Tweak search cutoff thresholds
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.