author
int64
0
755k
date
stringlengths
19
19
timezone
int64
-46,800
39.6k
hash
stringlengths
40
40
message
stringlengths
5
485
mods
list
language
stringclasses
1 value
license
stringclasses
3 values
repo
stringlengths
5
46
original_message
stringlengths
12
491
61,753
30.03.2017 09:47:22
18,000
ddadf547770ddbe8261cfd854b2a5f21b3a9074c
Typo: Dimention -> Dimension
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -237,7 +237,7 @@ astc_codec_image *load_astc_file(const char *filename, int bitness, astc_decode_\nif (xsize == 0 || ysize == 0 || zsize == 0)\n{\nfclose(f);\n- printf(\"File %s has zero dimention %d %d %d\\n\", filename, xsize, ysize, zsize);\n+ printf(\"File %s has zero dimension %d %d %d\\n\", filename, xsize, ysize, zsize);\nexit(1);\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Typo: Dimention -> Dimension
61,770
13.11.2017 12:17:07
0
8ae1e9f50a1e930e79c4cef1545a884823b04628
A small fix for msvc build and README update
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -14,7 +14,7 @@ See [license.txt](license.txt) file for details.\n# Compilation from Sources\n* You can use GCC >= 4.6 and standard GNU tools to perform make-driven compilation on Linux and/or MacOS systems.\n-* You can use Visual Studio 2010 to compile for Windows systems (using solution file from `Source/win32-2010/astcenc` directory).\n+* You can use Visual Studio 2013 to compile for Windows systems (using solution file from `Source/win32-2013/astcenc` directory).\n# ASTC Features & Benefits\n@@ -105,4 +105,4 @@ The compression speed runs from `-veryfast`, through `-fast`, `-medium` and `-th\nPlease submit your questions and issues to the [ARM Mali Graphics forums](http://community.arm.com/groups/arm-mali-graphics).\n- - -\n-_Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved._\n+_Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved._\n" }, { "change_type": "MODIFY", "old_path": "Source/mathlib.cpp", "new_path": "Source/mathlib.cpp", "diff": "@@ -52,7 +52,7 @@ float nan(int p)\nreturn v.q;\n}\n-#if __cplusplus < 201103L\n+#if (!_MSC_VER) && (__cplusplus < 201103L)\nfloat fmax(float p, float q)\n{\nif (p != p)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
A small fix for msvc build and README update
61,770
14.11.2017 10:31:38
0
0d22d5543a3b9e42cc365236db9a4a1641df1678
Producing new binaries for a release
[ { "change_type": "DELETE", "old_path": "Binary/Linux32/astcenc", "new_path": "Binary/Linux32/astcenc", "diff": "Binary files a/Binary/Linux32/astcenc and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "Binary/MacOS/astcenc", "new_path": "Binary/MacOS/astcenc", "diff": "Binary files a/Binary/MacOS/astcenc and /dev/null differ\n" }, { "change_type": "ADD", "old_path": "Binary/linux-x64/astcenc", "new_path": "Binary/linux-x64/astcenc", "diff": "Binary files /dev/null and b/Binary/linux-x64/astcenc differ\n" }, { "change_type": "ADD", "old_path": "Binary/linux-x86/astcenc", "new_path": "Binary/linux-x86/astcenc", "diff": "Binary files /dev/null and b/Binary/linux-x86/astcenc differ\n" }, { "change_type": "ADD", "old_path": "Binary/mac-x64/astcenc", "new_path": "Binary/mac-x64/astcenc", "diff": "Binary files /dev/null and b/Binary/mac-x64/astcenc differ\n" }, { "change_type": "RENAME", "old_path": "Binary/Win32/astcenc.exe", "new_path": "Binary/windows-x64/astcenc.exe", "diff": "Binary files a/Binary/Win32/astcenc.exe and b/Binary/windows-x64/astcenc.exe differ\n" }, { "change_type": "RENAME", "old_path": "Binary/Win64/astcenc.exe", "new_path": "Binary/windows-x86/astcenc.exe", "diff": "Binary files a/Binary/Win64/astcenc.exe and b/Binary/windows-x86/astcenc.exe differ\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -45,11 +45,11 @@ ASTC specification includes two profiles: LDR and Full. The smaller LDR Profile\n* Source code\n* Full specification of the ASTC data format\n-* Binaries for Windows, Mac OS X and Linux (x86, 32-bit)\n+* Binaries for Windows, Mac OS X and Linux\n# Getting Started\n-First, accept the [license](license.txt) and download the source code. In the subdirectories Win32, Mac OS X and Linux32 are binaries for Windows, Mac OS X, and Linux (x86 versions). If you are running on another system, you might like to try compiling from source.\n+First, accept the [license](license.txt) and download the source code. The `Binary` subdirectory contains executable binaries for Windows, Mac OS X, and Linux. If you are running on another system, you might like to try compiling from source.\nOpen a terminal, change to the appropriate directory for your system, and run the astcenc encoder program, like this on Linux or Mac OS:\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Producing new binaries for a release
61,770
14.11.2017 11:07:53
0
b6bf6e7a523ddafdb8cfdc84b068d8fe70ffb45e
Improved binary for windows x64
[ { "change_type": "MODIFY", "old_path": "Binary/linux-x64/astcenc", "new_path": "Binary/linux-x64/astcenc", "diff": "Binary files a/Binary/linux-x64/astcenc and b/Binary/linux-x64/astcenc differ\n" }, { "change_type": "MODIFY", "old_path": "Binary/linux-x86/astcenc", "new_path": "Binary/linux-x86/astcenc", "diff": "Binary files a/Binary/linux-x86/astcenc and b/Binary/linux-x86/astcenc differ\n" }, { "change_type": "MODIFY", "old_path": "Binary/windows-x64/astcenc.exe", "new_path": "Binary/windows-x64/astcenc.exe", "diff": "Binary files a/Binary/windows-x64/astcenc.exe and b/Binary/windows-x64/astcenc.exe differ\n" }, { "change_type": "MODIFY", "old_path": "Binary/windows-x86/astcenc.exe", "new_path": "Binary/windows-x86/astcenc.exe", "diff": "Binary files a/Binary/windows-x86/astcenc.exe and b/Binary/windows-x86/astcenc.exe differ\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Improved binary for windows x64
61,745
02.02.2018 21:13:56
0
7ad12fbd0d53ada8ab735188560465cb536861b0
Remove redundant memory allocation in struct imageblock rgb_lns, alpha_lns, and nan_texel all store one value per texel, not one value per color channel, so the multiply by 4 is superfluous.
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -190,9 +190,9 @@ struct imageblock\nfloat work_data[MAX_TEXELS_PER_BLOCK * 4]; // the data that we will compress, either linear or LNS (0..65535 in both cases)\nfloat deriv_data[MAX_TEXELS_PER_BLOCK * 4]; // derivative of the conversion function used, used to modify error weighting\n- uint8_t rgb_lns[MAX_TEXELS_PER_BLOCK * 4]; // 1 if RGB data are being treated as LNS\n- uint8_t alpha_lns[MAX_TEXELS_PER_BLOCK * 4]; // 1 if Alpha data are being treated as LNS\n- uint8_t nan_texel[MAX_TEXELS_PER_BLOCK * 4]; // 1 if the texel is a NaN-texel.\n+ uint8_t rgb_lns[MAX_TEXELS_PER_BLOCK]; // 1 if RGB data are being treated as LNS\n+ uint8_t alpha_lns[MAX_TEXELS_PER_BLOCK]; // 1 if Alpha data are being treated as LNS\n+ uint8_t nan_texel[MAX_TEXELS_PER_BLOCK]; // 1 if the texel is a NaN-texel.\nfloat red_min, red_max;\nfloat green_min, green_max;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove redundant memory allocation in struct imageblock rgb_lns, alpha_lns, and nan_texel all store one value per texel, not one value per color channel, so the multiply by 4 is superfluous.
61,745
02.02.2018 21:16:14
0
954eba4125e235674a08921380dbfd7172d00930
Remove unused stepsize entry Using it improves quality by about 0.005dB but incurs a significant performance penalty, so assume it has been disabled for performance reasons (there are similar optimizations for similar quality losses in other places in the reference codec).
[ { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1141,7 +1141,7 @@ void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * ea\ninfilled_weights[i] = compute_value_of_texel_flt(i, it, weight_set);\n}\n- const float stepsizes[3] = { 0.25f, 0.125f, 0.0625f };\n+ const float stepsizes[2] = { 0.25f, 0.125f };\nfor (j = 0; j < 2; j++)\n{\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove unused stepsize entry Using it improves quality by about 0.005dB but incurs a significant performance penalty, so assume it has been disabled for performance reasons (there are similar optimizations for similar quality losses in other places in the reference codec).
61,745
16.02.2018 22:34:44
0
a84401e44a7c878cb9156daefd42503a66fe539d
Update astc_compute_variance.cpp Avoid mixed type comparison of float and double.
[ { "change_type": "MODIFY", "old_path": "Source/astc_compute_variance.cpp", "new_path": "Source/astc_compute_variance.cpp", "diff": "@@ -115,10 +115,10 @@ static void compute_pixel_region_variance(const astc_codec_image * img, float rg\nif (!powers_are_1)\n{\n- d.x = pow(MAX(d.x, 1e-6f), (double)rgb_power_to_use);\n- d.y = pow(MAX(d.y, 1e-6f), (double)rgb_power_to_use);\n- d.z = pow(MAX(d.z, 1e-6f), (double)rgb_power_to_use);\n- d.w = pow(MAX(d.w, 1e-6f), (double)alpha_power_to_use);\n+ d.x = pow(MAX(d.x, 1e-6), (double)rgb_power_to_use);\n+ d.y = pow(MAX(d.y, 1e-6), (double)rgb_power_to_use);\n+ d.z = pow(MAX(d.z, 1e-6), (double)rgb_power_to_use);\n+ d.w = pow(MAX(d.w, 1e-6), (double)alpha_power_to_use);\n}\nvarbuf1[z][y][x] = d;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update astc_compute_variance.cpp Avoid mixed type comparison of float and double.
61,758
02.11.2018 11:43:53
18,000
8e5907a6691f07f25d1f5137338666b5c23b5009
Fix comparison that always evaluates to true
[ { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -457,7 +457,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\nscb->color_formats_matched = 0;\nif ((partition_count >= 2 && scb->color_formats[0] == scb->color_formats[1]\n- && color_quantization_level != color_quantization_level_mod)\n+ && color_quantization_level[i] != color_quantization_level_mod[i])\n&& (partition_count == 2 || (scb->color_formats[0] == scb->color_formats[2] && (partition_count == 3 || (scb->color_formats[0] == scb->color_formats[3])))))\n{\nint colorvals[4][12];\n@@ -753,7 +753,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\nscb->color_formats_matched = 0;\nif ((partition_count >= 2 && scb->color_formats[0] == scb->color_formats[1]\n- && color_quantization_level != color_quantization_level_mod)\n+ && color_quantization_level[i] != color_quantization_level_mod[i])\n&& (partition_count == 2 || (scb->color_formats[0] == scb->color_formats[2] && (partition_count == 3 || (scb->color_formats[0] == scb->color_formats[3])))))\n{\nint colorvals[4][12];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix comparison that always evaluates to true
61,768
01.05.2019 15:43:45
-3,600
bd21dc54c8fd4ff4075f3e06ef9549158778593d
Library Enable the project to be compiled as a library Fix fmax fmin on Visual Studio
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -39,6 +39,7 @@ SOURCES = \\\nastc_toplevel.cpp \\\nmathlib.cpp \\\nsoftfloat.cpp \\\n+ astc_main.cpp \\\nHEADERS = \\\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -811,5 +811,6 @@ void physical_to_symbolic(int xdim, int ydim, int zdim, physical_compressed_bloc\nuint16_t unorm16_to_sf16(uint16_t p);\nuint16_t lns_to_sf16(uint16_t p);\n+int astc_main(int argc, char ** argv);\n#endif\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Source/astc_main.cpp", "diff": "+#include \"astc_codec_internals.h\"\n+\n+int main(int argc, char **argv)\n+{\n+ return astc_main(argc, argv);\n+}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -749,7 +749,7 @@ void dump_image(astc_codec_image * img)\n}\n-int main(int argc, char **argv)\n+int astc_main(int argc, char **argv)\n{\nint i;\n" }, { "change_type": "MODIFY", "old_path": "Source/mathlib.h", "new_path": "Source/mathlib.h", "diff": "@@ -27,7 +27,7 @@ float cospi(float p);\nfloat nan(int p);\n-#if __cplusplus < 201103L\n+#if (!_MSC_VER) && (__cplusplus < 201103L)\nfloat fmax(float p, float q);\nfloat fmin(float p, float q);\n#endif // C++11\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Library - Enable the project to be compiled as a library - Fix fmax fmin on Visual Studio
61,768
02.05.2019 10:51:46
-3,600
f789719d6313ec0affb59e25f54d53a7ade7d563
Update MSVC project
[ { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/astcenc.sln", "new_path": "Source/win32-2017/astcenc/astcenc.sln", "diff": "" }, { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/astcenc.vcproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcproj", "diff": "" }, { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/astcenc.vcxproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "diff": "<ProjectGuid>{D6D60D86-0502-446A-8498-888F78B869C2}</ProjectGuid>\n<RootNamespace>astcenc</RootNamespace>\n<Keyword>Win32Proj</Keyword>\n+ <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>\n</PropertyGroup>\n<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n<ConfigurationType>Application</ConfigurationType>\n<CharacterSet>Unicode</CharacterSet>\n- <PlatformToolset>v120</PlatformToolset>\n+ <PlatformToolset>v141</PlatformToolset>\n</PropertyGroup>\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n<ConfigurationType>Application</ConfigurationType>\n<ClCompile Include=\"..\\..\\astc_integer_sequence.cpp\" />\n<ClCompile Include=\"..\\..\\astc_kmeans_partitioning.cpp\" />\n<ClCompile Include=\"..\\..\\astc_ktx_dds.cpp\" />\n+ <ClCompile Include=\"..\\..\\astc_main.cpp\" />\n<ClCompile Include=\"..\\..\\astc_partition_tables.cpp\" />\n<ClCompile Include=\"..\\..\\astc_percentile_tables.cpp\" />\n<ClCompile Include=\"..\\..\\astc_pick_best_endpoint_format.cpp\" />\n" }, { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/astcenc.vcxproj.filters", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj.filters", "diff": "<ClCompile Include=\"..\\..\\astc_weight_quant_xfer_tables.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n+ <ClCompile Include=\"..\\..\\astc_main.cpp\">\n+ <Filter>Source Files</Filter>\n+ </ClCompile>\n</ItemGroup>\n<ItemGroup>\n<ClInclude Include=\"..\\..\\astc_codec_internals.h\">\n" }, { "change_type": "RENAME", "old_path": "Source/win32-2013/astcenc/stdint.h", "new_path": "Source/win32-2017/astcenc/stdint.h", "diff": "" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update MSVC project
61,745
25.06.2019 20:47:50
-3,600
480855465d5e521a6648b63224e1a19e67a25358
Remove deprecated or conflicting VS solution opts
[ { "change_type": "MODIFY", "old_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "diff": "<Optimization>Disabled</Optimization>\n<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n- <MinimalRebuild>true</MinimalRebuild>\n+ <MinimalRebuild>\n+ </MinimalRebuild>\n<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n<SubSystem>Console</SubSystem>\n<TargetMachine>MachineX86</TargetMachine>\n+ <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>\n</Link>\n</ItemDefinitionGroup>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n</PrecompiledHeader>\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n+ <MinimalRebuild />\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove deprecated or conflicting VS solution opts
61,745
25.06.2019 22:06:39
-3,600
3c59cf25d0c53283e8254a93d90a88f0ca1a650b
Namespace all VS build outputs by platform
[ { "change_type": "MODIFY", "old_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "diff": "<PropertyGroup Label=\"UserMacros\" />\n<PropertyGroup>\n<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\n- <OutDir Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(SolutionDir)$(Configuration)\\</OutDir>\n- <IntDir Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(Configuration)\\</IntDir>\n+ <OutDir Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(SolutionDir)$(Platform)\\$(Configuration)\\</OutDir>\n+ <IntDir Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(Platform)\\$(Configuration)\\</IntDir>\n<LinkIncremental Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">true</LinkIncremental>\n<LinkIncremental Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">true</LinkIncremental>\n- <OutDir Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">$(SolutionDir)$(Configuration)\\</OutDir>\n- <IntDir Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">$(Configuration)\\</IntDir>\n+ <OutDir Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">$(SolutionDir)$(Platform)\\$(Configuration)\\</OutDir>\n+ <IntDir Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">$(Platform)\\$(Configuration)\\</IntDir>\n<LinkIncremental Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">false</LinkIncremental>\n<LinkIncremental Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">false</LinkIncremental>\n</PropertyGroup>\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Namespace all VS build outputs by platform
61,745
27.06.2019 16:20:51
-3,600
16f516753d20d2ffb61c632fc0d4d70ed7c4763c
Updated README after review. Remove legacy specification PDF.
[ { "change_type": "DELETE", "old_path": "Documentation/ASTC Specification 1.0.pdf", "new_path": "Documentation/ASTC Specification 1.0.pdf", "diff": "Binary files a/Documentation/ASTC Specification 1.0.pdf and /dev/null differ\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -14,9 +14,9 @@ content creators. This allows more assets to use compression, often at a\nreduced bitrate compared to legacy formats, reducing memory bandwidth and\nenergy consumption.\n-The ASTC format specification is available here:\n+The ASTC data format specification is available here:\n-* [ASTC Specification v1.0 (PDF)](./Documentation/ASTC%20Specification%20v1.0.pdf)\n+* [OES_texture_compression_astc](https://www.khronos.org/registry/OpenGL/extensions/OES/OES_texture_compression_astc.txt)\n# Encoder feature support\n@@ -35,14 +35,14 @@ image and the compressed output.\nThe ASTC specification allows three profiles of implementation:\n-* 2D Low Dynamic Range (LDR)\n-* 2D LDR and High Dynamic Range (HDR)\n-* 2D and 3D, LDR and HDR\n+* 2D Low Dynamic Range (LDR profile)\n+* 2D LDR and High Dynamic Range (HDR profile)\n+* 2D and 3D, LDR and HDR (Full profile)\nThe `astcenc` compressor supports generation of images for all three profiles.\nIn addition it also supports all of the ASTC block sizes and compression\nmodes, allowing content creators access the full spectrum of quality-to-bitrate\n-trade options ranging from 0.89 bits/pixel up to 8bits/pixel.\n+options ranging from 0.89 bits/pixel up to 8 bits/pixel.\n# License\n@@ -77,12 +77,12 @@ the astcenc encoder program, like this on Linux or Mac OS:\n./astcenc\n-Or like this on Windows:\n+... or like this on Windows:\nastcenc\nInvoking the tool with no arguments gives an extensive help message, including\n-usage instructions, and details of all the available options.\n+usage instructions, and details of all the available command line options.\n## Compressing an image\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Updated README after review. Remove legacy specification PDF.
61,745
27.06.2019 16:46:19
-3,600
38a9535142630c1fc45b285dc0d4d71e4ee0f21b
Change specification link to the DataFormat spec
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -16,7 +16,7 @@ energy consumption.\nThe ASTC data format specification is available here:\n-* [OES_texture_compression_astc](https://www.khronos.org/registry/OpenGL/extensions/OES/OES_texture_compression_astc.txt)\n+* [Khronos Data Format Specification v1.2 # ASTC](https://www.khronos.org/registry/DataFormat/specs/1.2/dataformat.1.2.html#ASTC)\n# Encoder feature support\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Change specification link to the DataFormat spec
61,745
27.06.2019 17:17:53
-3,600
4baeb8e63cb98b5e7fb8cc8463e52b93cdbf5c34
Add note that binaries come from last stable tag
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -57,6 +57,9 @@ and macOS (x64) are available here:\n* [Binary directory](/Binary/).\n+ These binaries are built from the latest stable tag, and therefore do not\n+ necessarily represent the current state of the `master` branch source code.\n+\n# Building from source\nBuilds for Linux and macOS use GCC and Make, and are tested with GCC 4.6 and\n@@ -116,14 +119,14 @@ console.\n## Experimenting\n-Efficient real-time graphics benefits from low bandwidth texture access,\n-as it reduces bandwidth, saves energy, and can improve texture cache\n-efficiency. However, like any lossy compression format there will come a point\n-where the output compression quality is unacceptable because there are simply\n-not enough bits to represent the output at the quality needed. We recommend\n-experimenting with the block footprint to find the optimum balance between size\n-and quality, as the finely adjustable compression ratio is one of major\n-strengths of the ASTC format.\n+Efficient real-time graphics benefits from minimizing the bitrate needed to\n+store a texture, as it reduces memory bandwidth, saves energy, and can improve\n+texture cache efficiency. However, like any lossy compression format there will\n+come a point where the compressed image quality is unacceptable because there\n+are simply not enough bits to represent the output with the precision needed.\n+We recommend experimenting with the block footprint to find the optimum balance\n+between size and quality, as the finely adjustable compression ratio is one of\n+major strengths of the ASTC format.\nThe compression speed can be controlled from `-veryfast`, through `-fast`,\n`-medium` and `-thorough`, up to `-exhaustive`. In general, the more time the\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add note that binaries come from last stable tag
61,745
27.06.2019 23:31:00
-3,600
8f6db5a0e1cbfb115f06c29291d6ee0a76f172ef
Add declarative Jenkinsfile for Jenkins CI builds (Windows builds only) Add a Jenkinsfile to automate some basic builds CI testing.
[ { "change_type": "ADD", "old_path": null, "new_path": "Jenkinsfile", "diff": "+pipeline {\n+ agent any\n+ options {\n+ buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))\n+ }\n+ tools {\n+ msbuild 'MSBuild-15.0'\n+ }\n+ stages {\n+ stage('Build') {\n+ parallel {\n+ stage('x64 Release') {\n+ steps {\n+ script {\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Release /p:Platform=x64\", returnStatus: false, returnStdout: false)\n+ }\n+ }\n+ }\n+ stage('x64 Debug') {\n+ steps {\n+ script {\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Debug /p:Platform=x64\", returnStatus: false, returnStdout: false)\n+ }\n+\n+ }\n+ }\n+ stage('x86 Release') {\n+ steps {\n+ script {\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Release /p:Platform=Win32\", returnStatus: false, returnStdout: false)\n+ }\n+\n+ }\n+ }\n+ stage('x86 Debug') {\n+ steps {\n+ script {\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Debug /p:Platform=Win32\", returnStatus: false, returnStdout: false)\n+ }\n+\n+ }\n+ }\n+ }\n+ }\n+ stage('Archive') {\n+ steps {\n+ archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\Win32\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\Win32\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\x64\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\x64\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n+ }\n+ }\n+ }\n+ post {\n+ always {\n+ recordIssues(enabledForFailure: true, tool: msBuild())\n+ }\n+ }\n+ triggers {\n+ pollSCM('H/15 * * * *')\n+ }\n+}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add declarative Jenkinsfile for Jenkins CI builds (Windows builds only) (#45) Add a Jenkinsfile to automate some basic builds CI testing.
61,745
05.07.2019 08:18:35
-3,600
62fadfcaf5bb8a9cc8ffa1370fc12b55f20f972c
Fix success path memory leaks Errors still expected on the failure path, but this is a harder one to fix with the current code, so not part of this commit
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -2352,11 +2352,6 @@ int astc_main(int argc, char **argv)\nprintf(\"3D source images not supported with -array option: %s\\n\", new_input_filename);\nexit(1);\n}\n-\n- // BCJ(DEBUG)\n- // printf(\"\\n\\n Image %d \\n\", image_index);\n- // dump_image( input_images[image_index] );\n- // printf(\"\\n\\n\");\n}\n// Check load result.\n@@ -2414,15 +2409,17 @@ int astc_main(int argc, char **argv)\n{\ndestroy_image(input_images[i]);\n}\n- input_images = NULL;\n// Clamp texels outside the actual image area.\nfill_image_padding_area(input_image);\n-\n- // BCJ(DEBUG)\n- // dump_image( input_image );\n}\n+ delete[] input_images;\n+ input_images = NULL;\n+\n+ delete[] load_results;\n+ load_results = NULL;\n+\ninput_components = load_result & 7;\ninput_image_is_hdr = (load_result & 0x80) ? 1 : 0;\n@@ -2511,11 +2508,13 @@ int astc_main(int argc, char **argv)\n}\n}\n}\n+\nif (opmode == 0)\n{\nstore_astc_file(input_image, output_filename, xdim, ydim, zdim, &ewp, decode_mode, swz_encode, thread_count);\n}\n+ destroy_image(input_image);\nif (print_block_mode_histogram)\n{\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix success path memory leaks (#49) Errors still expected on the failure path, but this is a harder one to fix with the current code, so not part of this commit
61,745
05.07.2019 09:30:27
-3,600
a8f9dd778f9fbbbed206e0e703e9630674acac62
Update Encoding.md Add a missing "-"
[ { "change_type": "MODIFY", "old_path": "Docs/Encoding.md", "new_path": "Docs/Encoding.md", "diff": "@@ -135,7 +135,7 @@ Most other texture compression formats have a static channel assignment in\nterms of the expected data correlation. For example, ETC2+EAC assumes that RGB\nare always correlated and that alpha is non-correlated. ASTC can automatically\nencode data as either fully correlated across all 4 channels, or with any one\n-channel assigned to a separate non correlated partition to the other three.\n+channel assigned to a separate non-correlated partition to the other three.\nThe non-correlated channel can be changed on a block-by-block basis, so the\ncompressor can dynamically adjust the coding based on the data present in the\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update Encoding.md Add a missing "-"
61,745
06.07.2019 21:15:30
-3,600
b49291a9efca81a6e991beb9612ce93766e9cad7
Use <cmath> to get C++ overloaded math functions This avoids many double to float cast precision warnings which we get using the C versions of e.g. min/max/sqrt from <math.h>.
[ { "change_type": "MODIFY", "old_path": "Source/astc_averages_and_directions.cpp", "new_path": "Source/astc_averages_and_directions.cpp", "diff": "#include \"astc_codec_internals.h\"\n-#include <math.h>\n+#include <cmath>\n#include \"mathlib.h\"\n#ifdef DEBUG_CAPTURE_NAN\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_quantize.cpp", "new_path": "Source/astc_color_quantize.cpp", "diff": "#include \"astc_codec_internals.h\"\n#include \"softfloat.h\"\n-#include <math.h>\n+#include <cmath>\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n#include <stdio.h>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "#include \"astc_codec_internals.h\"\n#include \"softfloat.h\"\n-#include <math.h>\n+#include <cmath>\n#include <string.h>\n#include <stdio.h>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compute_variance.cpp", "new_path": "Source/astc_compute_variance.cpp", "diff": "#include \"astc_codec_internals.h\"\n-#include <math.h>\n+#include <cmath>\n#include \"mathlib.h\"\n#include \"softfloat.h\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_decompress_symbolic.cpp", "new_path": "Source/astc_decompress_symbolic.cpp", "diff": "*/\n/*----------------------------------------------------------------------------*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_encoding_choice_error.cpp", "new_path": "Source/astc_encoding_choice_error.cpp", "diff": "#include \"astc_codec_internals.h\"\n-#include <math.h>\n+#include <cmath>\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n#include <stdio.h>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_find_best_partitioning.cpp", "new_path": "Source/astc_find_best_partitioning.cpp", "diff": "* each element in the table is an uint8_t indicating partition index (0, 1, 2 or 3)\n*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "*/\n/*----------------------------------------------------------------------------*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_image_load_store.cpp", "new_path": "Source/astc_image_load_store.cpp", "diff": "*/\n/*----------------------------------------------------------------------------*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n@@ -1272,7 +1272,7 @@ astc_codec_image *astc_codec_load_image(const char *input_filename, int padding,\n// check the ending of the input filename\nint load_fileformat = LOAD_STB_IMAGE;\n- int filename_len = strlen(input_filename);\n+ size_t filename_len = strlen(input_filename);\nconst char *eptr = input_filename + filename_len - 5;\nif (eptr > input_filename && (strcmp(eptr, \".htga\") == 0 || strcmp(eptr, \".HTGA\") == 0))\n@@ -1346,7 +1346,7 @@ int get_output_filename_enforced_bitness(const char *output_filename)\nif (output_filename == NULL)\nreturn -1;\n- int filename_len = strlen(output_filename);\n+ size_t filename_len = strlen(output_filename);\nconst char *eptr = output_filename + filename_len - 5;\nif (eptr > output_filename && (strcmp(eptr, \".htga\") == 0 || strcmp(eptr, \".HTGA\") == 0))\n@@ -1380,7 +1380,7 @@ int astc_codec_store_image(const astc_codec_image * output_image, const char *ou\n#define STORE_DDS 3\n#define STORE_EXR 4\n- int filename_len = strlen(output_filename);\n+ size_t filename_len = strlen(output_filename);\nint store_fileformat = STORE_TGA;\nconst char *eptr = output_filename + filename_len - 5;\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_pick_best_endpoint_format.cpp", "new_path": "Source/astc_pick_best_endpoint_format.cpp", "diff": "#include <stdio.h>\n#endif\n-#include <math.h>\n+#include <cmath>\n// clamp an input value to [0,1]; Nan is turned into 0.\nstatic inline float clamp01(float val)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "#include <stdio.h>\n#include <stdlib.h>\n-#include <math.h>\n+#include <cmath>\n#ifndef WIN32\n#include <sys/time.h>\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_align.cpp", "new_path": "Source/astc_weight_align.cpp", "diff": "*/\n/*----------------------------------------------------------------------------*/\n-#include <math.h>\n+#include <cmath>\n#include \"astc_codec_internals.h\"\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n" }, { "change_type": "MODIFY", "old_path": "Source/mathlib.cpp", "new_path": "Source/mathlib.cpp", "diff": "#include <time.h>\n#include <stdlib.h>\n#include <stdio.h>\n-#include <math.h>\n+#include <cmath>\n#include \"mathlib.h\"\n/**************************\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Use <cmath> to get C++ overloaded math functions (#42) This avoids many double to float cast precision warnings which we get using the C versions of e.g. min/max/sqrt from <math.h>.
61,745
07.07.2019 22:03:23
-3,600
9c93e80a3b3a7988a38a11a8efe1433eaf192ab4
Re-enable JPEG and GIF input texture support
[ { "change_type": "MODIFY", "old_path": "Source/astc_stb_tga.cpp", "new_path": "Source/astc_stb_tga.cpp", "diff": "* @brief Functions for loading and storing files via stb_image.\n*/\n-\n#include \"astc_codec_internals.h\"\n#include \"softfloat.h\"\n#include <stdio.h>\n#define STB_IMAGE_IMPLEMENTATION\n-#define STBI_NO_JPEG\n#define STBI_NO_PSD\n-#define STBI_NO_GIF\n#define STBI_NO_PIC\n#define STBI_NO_PNM\n#include \"stb_image.h\"\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Re-enable JPEG and GIF input texture support (#55)
61,745
07.07.2019 22:04:20
-3,600
da70ab4e7a9c0b9761d9c19b127c5f8db9b7bb79
Remove support for non-standard block sizes
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "#include <fenv.h>\n#endif\n-// Define this to be 1 to allow \"illegal\" block sizes\n-#define DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES 0\n-\nextern int block_mode_histogram[2048];\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -566,7 +563,7 @@ astc_codec_image *pack_and_unpack_astc_image(const astc_codec_image * input_imag\nreturn img;\n}\n-void find_closest_blockdim_2d(float target_bitrate, int *x, int *y, int consider_illegal)\n+void find_closest_blockdim_2d(float target_bitrate, int *x, int *y)\n{\nint blockdims[6] = { 4, 5, 6, 8, 10, 12 };\n@@ -582,8 +579,7 @@ void find_closest_blockdim_2d(float target_bitrate, int *x, int *y, int consider\n{\n// NxN MxN 8x5 10x5 10x6\nint is_legal = (j==i) || (j==i+1) || (j==3 && i==1) || (j==4 && i==1) || (j==4 && i==2);\n-\n- if(consider_illegal || is_legal)\n+ if(is_legal)\n{\nfloat bitrate = 128.0f / (blockdims[i] * blockdims[j]);\nfloat bitrate_error = fabs(bitrate - target_bitrate);\n@@ -600,7 +596,7 @@ void find_closest_blockdim_2d(float target_bitrate, int *x, int *y, int consider\n}\n}\n-void find_closest_blockdim_3d(float target_bitrate, int *x, int *y, int *z, int consider_illegal)\n+void find_closest_blockdim_3d(float target_bitrate, int *x, int *y, int *z)\n{\nint blockdims[4] = { 3, 4, 5, 6 };\n@@ -616,8 +612,7 @@ void find_closest_blockdim_3d(float target_bitrate, int *x, int *y, int *z, int\n{\n// NxNxN MxNxN MxMxN\nint is_legal = ((k==j)&&(j==i)) || ((k==j+1)&&(j==i)) || ((k==j)&&(j==i+1));\n-\n- if(consider_illegal || is_legal)\n+ if(is_legal)\n{\nfloat bitrate = 128.0f / (blockdims[i] * blockdims[j] * blockdims[k]);\nfloat bitrate_error = fabs(bitrate - target_bitrate);\n@@ -1342,8 +1337,8 @@ int astc_main(int argc, char **argv)\n{\ntarget_bitrate = static_cast < float >(atof(argv[4]));\ntarget_bitrate_set = 1;\n- find_closest_blockdim_2d(target_bitrate, &xdim_2d, &ydim_2d, DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES);\n- find_closest_blockdim_3d(target_bitrate, &xdim_3d, &ydim_3d, &zdim_3d, DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES);\n+ find_closest_blockdim_2d(target_bitrate, &xdim_2d, &ydim_2d);\n+ find_closest_blockdim_3d(target_bitrate, &xdim_3d, &ydim_3d, &zdim_3d);\n}\nelse\n{\n@@ -1370,7 +1365,7 @@ int astc_main(int argc, char **argv)\nint is_legal_2d = (xdim_3d==ydim_3d) || (xdim_3d==ydim_3d+1) || ((xdim_3d==ydim_3d+2) && !(xdim_3d==6 && ydim_3d==4)) ||\n(xdim_3d==8 && ydim_3d==5) || (xdim_3d==10 && ydim_3d==5) || (xdim_3d==10 && ydim_3d==6);\n- if(!DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES && !is_legal_2d)\n+ if(!is_legal_2d)\n{\nprintf(\"Block dimensions %d x %d disallowed\\n\", xdim_3d, ydim_3d);\nexit(1);\n@@ -1388,7 +1383,7 @@ int astc_main(int argc, char **argv)\nint is_legal_3d = ((xdim_3d==ydim_3d)&&(ydim_3d==zdim_3d)) || ((xdim_3d==ydim_3d+1)&&(ydim_3d==zdim_3d)) || ((xdim_3d==ydim_3d)&&(ydim_3d==zdim_3d+1));\n- if(!DEBUG_ALLOW_ILLEGAL_BLOCK_SIZES && !is_legal_3d)\n+ if(!is_legal_3d)\n{\nprintf(\"Block dimensions %d x %d x %d disallowed\\n\", xdim_3d, ydim_3d, zdim_3d);\nexit(1);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove support for non-standard block sizes (#56)
61,745
07.07.2019 22:05:04
-3,600
f5304a604212f548346d17a72cc864fde9a84897
Remove all IGNORED parameters from interfaces
[ { "change_type": "MODIFY", "old_path": "Source/astc_block_sizes2.cpp", "new_path": "Source/astc_block_sizes2.cpp", "diff": "@@ -169,11 +169,8 @@ const float *get_2d_percentile_table(int blockdim_x, int blockdim_y)\n// stubbed for the time being.\nstatic const float dummy_percentile_table_3d[2048] = { 0 };\n-const float *get_3d_percentile_table(int blockdim_x, int blockdim_y, int blockdim_z)\n+const float *get_3d_percentile_table()\n{\n- IGNORE(blockdim_x);\n- IGNORE(blockdim_y);\n- IGNORE(blockdim_z);\nreturn dummy_percentile_table_3d;\n}\n@@ -864,7 +861,7 @@ void construct_block_size_descriptor_3d(int xdim, int ydim, int zdim, block_size\nbsd->decimation_mode_count = decimation_mode_count;\n- const float *percentiles = get_3d_percentile_table(xdim, ydim, zdim);\n+ const float *percentiles = get_3d_percentile_table();\n// then construct the list of block formats\nfor (i = 0; i < 2048; i++)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "#define MAX(x,y) ((x)>(y)?(x):(y))\n#endif\n-// Macro to silence warnings on ignored parameters.\n-// The presence of this macro should be a signal to look at refactoring.\n-#define IGNORE(param) ((void)&param)\n-\n#define astc_isnan(p) ((p)!=(p))\n// ASTC parameters\n@@ -567,7 +563,7 @@ void write_imageblock(astc_codec_image * img, const imageblock * pb, // picture-\n// helper function to check whether a given picture-block has alpha that is not\n// just uniformly 1.\n-int imageblock_uses_alpha(int xdim, int ydim, int zdim, const imageblock * pb);\n+int imageblock_uses_alpha(const imageblock * pb);\nfloat compute_imageblock_difference(int xdim, int ydim, int zdim, const imageblock * p1, const imageblock * p2, const error_weight_block * ewb);\n@@ -616,7 +612,7 @@ void merge_endpoints(const endpoints * ep1, // contains three of the color compo\n// function to pack a pair of color endpoints into a series of integers.\n// the format used may or may not match the format specified;\n// the return value is the format actually used.\n-int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, float2 luminances, int format, int *output, int quantization_level);\n+int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, int format, int *output, int quantization_level);\n// unpack a pair of color endpoints from a series of integers.\nvoid unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_quantize.cpp", "new_path": "Source/astc_color_quantize.cpp", "diff": "@@ -695,15 +695,9 @@ void quantize_luminance_alpha(float4 color0, float4 color1, int output[4], int q\noutput[3] = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)];\n}\n-void quantize0(float4 color0, float4 color1, int output[8], int quantization_level)\n+void quantize0(int output[8])\n{\n- IGNORE(color0);\n- IGNORE(color1);\n- IGNORE(output);\n- IGNORE(quantization_level);\n-\n- int i;\n- for (i = 0; i < 8; i++)\n+ for (int i = 0; i < 8; i++)\noutput[i] = 0;\n}\n@@ -1829,12 +1823,9 @@ void quantize_hdr_rgb_alpha3(float4 color0, float4 color1, int output[8], int qu\nQuantize a color. When quantizing an RGB or RGBA color, the quantizer may choose a\ndelta-based representation; as such, it will report back the format it actually used.\n*/\n-int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, float2 luminances, // ! Unused\n+int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color,\nint format, int *output, int quantization_level)\n{\n-\n- IGNORE(luminances);\n-\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n{\n@@ -1972,7 +1963,7 @@ int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 col\ndefault:\nASTC_CODEC_INTERNAL_ERROR;\n- quantize0(color0, color1, output, quantization_level);\n+ quantize0(output);\nretval = FMT_LUMINANCE;\nbreak;\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -427,7 +427,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\nscb->color_formats[j] = pack_color_endpoints(decode_mode,\neix[decimation_mode].ep.endpt0[j],\neix[decimation_mode].ep.endpt1[j],\n- rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n+ rgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n}\n// if all the color endpoint modes are the same, we get a few more\n@@ -447,7 +447,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\ncolor_formats_mod[j] = pack_color_endpoints(decode_mode,\neix[decimation_mode].ep.endpt0[j],\neix[decimation_mode].ep.endpt1[j],\n- rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n+ rgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n}\nif (color_formats_mod[0] == color_formats_mod[1]\n&& (partition_count == 2 || (color_formats_mod[0] == color_formats_mod[2] && (partition_count == 3 || (color_formats_mod[0] == color_formats_mod[3])))))\n@@ -717,7 +717,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\nscb->color_formats[j] = pack_color_endpoints(decode_mode,\nepm.endpt0[j],\nepm.endpt1[j],\n- rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n+ rgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n}\nscb->color_formats_matched = 0;\n@@ -732,7 +732,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\ncolor_formats_mod[j] = pack_color_endpoints(decode_mode,\nepm.endpt0[j],\nepm.endpt1[j],\n- rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n+ rgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n}\nif (color_formats_mod[0] == color_formats_mod[1]\n&& (partition_count == 2 || (color_formats_mod[0] == color_formats_mod[2] && (partition_count == 3 || (color_formats_mod[0] == color_formats_mod[3])))))\n@@ -1382,7 +1382,7 @@ float compress_symbolic_block(const astc_codec_image * input_image,\nfor (i = 0; i < 17; i++)\nbest_errorvals_in_modes[i] = 1e30f;\n- int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, blk);\n+ int uses_alpha = imageblock_uses_alpha(blk);\n// compression of average-color blocks disabled for the time being;\n// they produce extremely severe block artifacts.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_find_best_partitioning.cpp", "new_path": "Source/astc_find_best_partitioning.cpp", "diff": "#include <stdio.h>\n#endif\n-int imageblock_uses_alpha(int xdim, int ydim, int zdim, const imageblock * pb)\n+int imageblock_uses_alpha(const imageblock * pb)\n{\n- IGNORE(xdim);\n- IGNORE(ydim);\n- IGNORE(zdim);\n-\nreturn pb->alpha_max != pb->alpha_min;\n}\n@@ -227,7 +223,7 @@ void find_best_partitionings(int partition_search_limit, int xdim, int ydim, int\nprintf(\"weight_imprecision_estim = %g\\n\", weight_imprecision_estim);\n#endif\n- int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, pb);\n+ int uses_alpha = imageblock_uses_alpha(pb);\nconst partition_info *ptab = get_partition_table(xdim, ydim, zdim, partition_count);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -858,7 +858,7 @@ void compute_endpoints_and_ideal_weights_1_plane(int xdim, int ydim, int zdim, c\nprintf(\"%s: texels_per_block=%dx%dx%d\\n\\n\", __func__, xdim, ydim, zdim);\n#endif\n- int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, blk);\n+ int uses_alpha = imageblock_uses_alpha(blk);\nif (uses_alpha)\n{\ncompute_endpoints_and_ideal_weights_rgba(xdim, ydim, zdim, pt, blk, ewb, ei);\n@@ -878,7 +878,7 @@ void compute_endpoints_and_ideal_weights_2_planes(int xdim, int ydim, int zdim,\nprintf(\"%s: texels_per_block=%dx%dx%d, separate_component=%d\\n\\n\", __func__, xdim, ydim, zdim, separate_component);\n#endif\n- int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, blk);\n+ int uses_alpha = imageblock_uses_alpha(blk);\nswitch (separate_component)\n{\ncase 0: // separate weights for red\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "}\n#else\n- // Windows.h defines IGNORE, so we must #undef our own version.\n- #undef IGNORE\n-\n// Define pthread-like functions in terms of Windows threading API\n#define WIN32_LEAN_AND_MEAN\n#include <windows.h>\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove all IGNORED parameters from interfaces (#57)
61,745
08.07.2019 09:18:41
-3,600
5208b9f9aed8d42aaf59d59b0d6f9bb9e7280367
Specify Makefile build as C++ 11
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -43,7 +43,7 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -O3 -Wall -W -Wextra -msse2 -mfpmath=sse\n+CPPFLAGS = -std=c++11 -O3 -Wall -W -Wextra -msse2 -mfpmath=sse\nastcenc: $(OBJECTS)\ng++ -o $@ $^ $(CPPFLAGS) -lpthread\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Specify Makefile build as C++ 11
61,745
08.07.2019 09:26:29
-3,600
e5617947c6a573c3513bcc851d438d11b7eb50ee
Update --help message Version string update Typo fixes Copyright year ARM -> Arm
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -736,8 +736,8 @@ int astc_main(int argc, char **argv)\nif (argc < 4)\n{\n- printf( \"ASTC codec version 1.3\\n\"\n- \"Copyright (C) 2011-2013 ARM Limited\\n\"\n+ printf( \"ASTC codec version 1.7\\n\"\n+ \"Copyright (C) 2011-2019 Arm Limited\\n\"\n\"All rights reserved. Use of this software is subject to terms of its license.\\n\\n\"\n\"Usage:\\n\"\n\"Compress to texture file:\\n\"\n@@ -786,7 +786,7 @@ int astc_main(int argc, char **argv)\n\" * KTX (*.ktx)\\n\"\n\" * DDS (*.dds)\\n\"\n\" * Half-Float-TGA (*.htga)\\n\"\n- \" * OpenEXR (*.exr; only if t'exr_to_htga' is present in the path)\\n\"\n+ \" * OpenEXR (*.exr; only if 'exr_to_htga' is present in the path)\\n\"\n\"\\n\"\n\"Targa is suitable only for 2D LDR images; for HDR and/or 3D images,\\n\"\n\"please use KTX or DDS.\\n\"\n@@ -796,7 +796,7 @@ int astc_main(int argc, char **argv)\n\" * A decimal number (at least one actual decimal needed). This will cause \\n\"\n\" the codec to interpret the number as a desired bitrate, and pick a block\\n\"\n\" size to match that bitrate as closely as possible. For example, if you want a\\n\"\n- \" bitrate of 2.0 bits per texel, then specifiy the <rate> argument as 2.0\\n\"\n+ \" bitrate of 2.0 bits per texel, then specify the <rate> argument as 2.0\\n\"\n\" * A block size. This specifies the block dimensions to use along the\\n\"\n\" X, Y (and for 3D textures) Z axes. The dimensions are separated with\\n\"\n\" the character x, with no spaces. For 2D textures, the supported\\n\"\n@@ -967,7 +967,7 @@ int astc_main(int argc, char **argv)\n\" Assign relative weight to each color channel.\\n\"\n\" If this option is combined with any of the other options above,\\n\"\n\" the other options are used to compute a weighting, then the \\n\"\n- \" weigthing is multiplied by the weighting provided by this argument.\\n\"\n+ \" weighting is multiplied by the weighting provided by this argument.\\n\"\n\"\\n\"\n\" -rn\\n\"\n\" Assume that the red and alpha color channels (after swizzle)\\n\"\n@@ -1111,7 +1111,7 @@ int astc_main(int argc, char **argv)\n\"\\n\"\n\" -dsw <swizzlepattern>\\n\"\n\" Swizzle pattern to apply after decoding a texture. This pattern is\\n\"\n- \" specified in the samw way as the pre-encoding swizzle pattern\\n\"\n+ \" specified in the same way as the pre-encoding swizzle pattern\\n\"\n\" for the -sw switch. However, one additional character is supported,\\n\"\n\" namely 'z' for constructing the third component of a normal map.\\n\"\n\"\\n\"\n" }, { "change_type": "MODIFY", "old_path": "Source/mathlib.h", "new_path": "Source/mathlib.h", "diff": "@@ -24,15 +24,14 @@ float fmax(float p, float q);\nfloat fmin(float p, float q);\n#endif // C++11\n-float2 fmax(float2 p, float2 q);\n-\n-float3 fmax(float3 p, float3 q);\n-\n-float4 fmax(float4 p, float4 q);\nfloat2 fmin(float2 p, float2 q);\nfloat3 fmin(float3 p, float3 q);\nfloat4 fmin(float4 p, float4 q);\n+float2 fmax(float2 p, float2 q);\n+float3 fmax(float3 p, float3 q);\n+float4 fmax(float4 p, float4 q);\n+\nstatic inline float dot(float2 p, float2 q)\n{\nreturn p.x * q.x + p.y * q.y;\n" }, { "change_type": "MODIFY", "old_path": "Source/softfloat.cpp", "new_path": "Source/softfloat.cpp", "diff": "-/*----------------------------------------------------------------------------*/\n+// ----------------------------------------------------------------------------\n+// This confidential and proprietary software may be used only as authorised\n+// by a licensing agreement from Arm Limited.\n+// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// The entire notice above must be reproduced on all authorised copies and\n+// copies may only be made to the extent permitted by a licensing agreement\n+// from Arm Limited.\n+// ----------------------------------------------------------------------------\n+\n/**\n- * This confidential and proprietary software may be used only as\n- * authorised by a licensing agreement from ARM Limited\n- * (C) COPYRIGHT 2011-2012 ARM Limited\n- * ALL RIGHTS RESERVED\n- *\n- * The entire notice above must be reproduced on all authorised\n- * copies and copies may only be made to the extent permitted\n- * by a licensing agreement from ARM Limited.\n- *\n- * @brief Soft IEEE-754 floating point library.\n+ * @brief Soft-float library for IEEE-754.\n*/\n-/*----------------------------------------------------------------------------*/\n#include \"softfloat.h\"\n};\n#endif\n-\n/*\n32-bit count-leading-zeros function: use the Assembly instruction whenever possible. */\nSOFTFLOAT_INLINE uint32_t clz32(uint32_t inp)\n@@ -103,7 +100,6 @@ static SOFTFLOAT_INLINE uint32_t rtna_shift32(uint32_t inp, uint32_t shamt)\nreturn inp;\n}\n-\nstatic SOFTFLOAT_INLINE uint32_t rtup_shift32(uint32_t inp, uint32_t shamt)\n{\nuint32_t vl1 = UINT32_C(1) << shamt;\n@@ -113,9 +109,6 @@ static SOFTFLOAT_INLINE uint32_t rtup_shift32(uint32_t inp, uint32_t shamt)\nreturn inp;\n}\n-\n-\n-\n/* convert from FP16 to FP32. */\nsf32 sf16_to_sf32(sf16 inp)\n{\n@@ -168,7 +161,6 @@ sf32 sf16_to_sf32(sf16 inp)\n}\n/* Conversion routine that converts from FP32 to FP16. It supports denormals and all rounding modes. If a NaN is given as input, it is quietened. */\n-\nsf16 sf32_to_sf16(sf32 inp, roundmode rmode)\n{\n/* for each possible sign/exponent combination, store a case index. This gives a 512-byte table */\n@@ -370,8 +362,6 @@ sf16 sf32_to_sf16(sf32 inp, roundmode rmode)\nreturn 0;\n}\n-\n-\ntypedef union if32_\n{\nuint32_t u;\n@@ -380,7 +370,6 @@ typedef union if32_\n} if32;\n/* convert from soft-float to native-float */\n-\nfloat sf16_to_float(sf16 p)\n{\nif32 i;\n@@ -389,7 +378,6 @@ float sf16_to_float(sf16 p)\n}\n/* convert from native-float to soft-float */\n-\nsf16 float_to_sf16(float p, roundmode rm)\n{\nif32 i;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update --help message - Version string update - Typo fixes - Copyright year - ARM -> Arm
61,745
08.07.2019 21:22:07
-3,600
4c820b65d52ba7b2df17bf1fce2c407ddf7fcf6a
Cleanup handling of ASTC_CODEC_INTERNAL_ERROR Error function calls exit(), so mark as [[noreturn]]. Remove duplicate calls to exit(). Remove functional logic which is redundant due to erro.
[ { "change_type": "MODIFY", "old_path": "Source/astc_averages_and_directions.cpp", "new_path": "Source/astc_averages_and_directions.cpp", "diff": "@@ -223,11 +223,9 @@ void compute_averages_and_directions_3_components(const partition_info * pt,\ntexel_weights = ewb->texel_weight_rgb;\nelse\n{\n- texel_weights = ewb->texel_weight_gba;\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n-\nfor (partition = 0; partition < partition_count; partition++)\n{\nconst uint8_t *weights = pt->texels_of_partition[partition];\n@@ -316,10 +314,7 @@ void compute_averages_and_directions_2_components(const partition_info * pt,\ntexel_weights = ewb->texel_weight_gb;\nelse\n{\n- texel_weights = ewb->texel_weight_rg;\n- // unsupported set of color components.\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nfor (partition = 0; partition < partition_count; partition++)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "#define MAX_WEIGHT_MODES 2048\n// error reporting for codec internal errors.\n-#define ASTC_CODEC_INTERNAL_ERROR astc_codec_internal_error(__FILE__, __LINE__)\n-\n-void astc_codec_internal_error(const char *filename, int linenumber);\n+#define ASTC_CODEC_INTERNAL_ERROR() astc_codec_internal_error(__FILE__, __LINE__)\n+[[noreturn]] void astc_codec_internal_error(const char *filename, int linenumber);\n// uncomment this macro to enable checking for inappropriate NaNs;\n// works on Linux only, and slows down encoding significantly.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_quantize.cpp", "new_path": "Source/astc_color_quantize.cpp", "diff": "@@ -695,12 +695,6 @@ void quantize_luminance_alpha(float4 color0, float4 color1, int output[4], int q\noutput[3] = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)];\n}\n-void quantize0(int output[8])\n-{\n- for (int i = 0; i < 8; i++)\n- output[i] = 0;\n-}\n-\n// quantize and unquantize a number, wile making sure to retain the top two bits.\nstatic inline void quantize_and_unquantize_retain_top_two_bits(int quantization_level, int value_to_quantize, // 0 to 255.\nint *quantized_value, int *unquantized_value)\n@@ -1962,10 +1956,7 @@ int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 col\nbreak;\ndefault:\n- ASTC_CODEC_INTERNAL_ERROR;\n- quantize0(output);\n- retval = FMT_LUMINANCE;\n- break;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_unquantize.cpp", "new_path": "Source/astc_color_unquantize.cpp", "diff": "@@ -825,7 +825,7 @@ void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quanti\nbreak;\ndefault:\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nif (*alpha_hdr == -1)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -337,7 +337,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\nint decimation_mode = bsd->block_modes[i].decimation_mode;\nif (bsd->decimation_mode_percentile[decimation_mode] > mode_cutoff)\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n// compute weight bitcount for the mode\nint bits_used_by_weights = compute_ise_bitcount(ixtab2[decimation_mode]->num_weights,\n@@ -1023,7 +1023,7 @@ static void compute_covariance_matrix(int xdim, int ydim, int zdim, const imageb\n{\nfloat weight = ewb->texel_weight[i];\nif (weight < 0.0f)\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\nweight_sum += weight;\nfloat r = blk->work_data[4 * i];\nfloat g = blk->work_data[4 * i + 1];\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -60,8 +60,7 @@ static void compute_endpoints_and_ideal_weights_1_component(int xdim, int ydim,\nerror_weights = ewb->texel_weight_a;\nbreak;\ndefault:\n- error_weights = ewb->texel_weight_r;\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nfor (i = 0; i < partition_count; i++)\n@@ -112,7 +111,7 @@ static void compute_endpoints_and_ideal_weights_1_component(int xdim, int ydim,\nei->weight_error_scale[i] = partition_error_scale[partition] * error_weights[i];\nif (astc_isnan(ei->weight_error_scale[i]))\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -187,7 +186,7 @@ static void compute_endpoints_and_ideal_weights_2_components(int xdim, int ydim,\nelse\n{\nerror_weights = ewb->texel_weight_rg;\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nint texels_per_block = xdim * ydim * zdim;\n@@ -377,7 +376,7 @@ static void compute_endpoints_and_ideal_weights_2_components(int xdim, int ydim,\nei->weight_error_scale[i] = length_squared[partition] * error_weights[i];\nif (astc_isnan(ei->weight_error_scale[i]))\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -430,8 +429,7 @@ static void compute_endpoints_and_ideal_weights_3_components(int xdim, int ydim,\nerror_weights = ewb->texel_weight_rgb;\nelse\n{\n- error_weights = ewb->texel_weight_gba;\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\ncompute_partition_error_color_weightings(xdim, ydim, zdim, ewb, pt, error_weightings, color_scalefactors);\n@@ -657,7 +655,7 @@ static void compute_endpoints_and_ideal_weights_3_components(int xdim, int ydim,\nei->weight_error_scale[i] = length_squared[partition] * error_weights[i];\nif (astc_isnan(ei->weight_error_scale[i]))\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -817,7 +815,7 @@ static void compute_endpoints_and_ideal_weights_rgba(int xdim, int ydim, int zdi\nei->weight_error_scale[i] = error_weights[i] * length_squared[partition];\nif (astc_isnan(ei->weight_error_scale[i]))\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -908,7 +906,7 @@ void compute_endpoints_and_ideal_weights_2_planes(int xdim, int ydim, int zdim,\ncase 3: // separate weights for alpha\nif (uses_alpha == 0)\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\ncompute_endpoints_and_ideal_weights_3_components(xdim, ydim, zdim, pt, blk, ewb, ei1, 0, 1, 2);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_image_load_store.cpp", "new_path": "Source/astc_image_load_store.cpp", "diff": "@@ -88,8 +88,7 @@ astc_codec_image *allocate_image(int bitness, int xsize, int ysize, int zsize, i\n}\nelse\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nreturn img;\n@@ -129,8 +128,7 @@ void initialize_image(astc_codec_image * img)\n}\nelse\n{\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\n}\n@@ -1287,8 +1285,7 @@ astc_codec_image *astc_codec_load_image(const char *input_filename, int padding,\ninput_image = load_image_with_stb(input_filename, padding, load_result);\nbreak;\ndefault:\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n+ ASTC_CODEC_INTERNAL_ERROR();\n}\nif (load_exr)\n@@ -1399,9 +1396,7 @@ int astc_codec_store_image(const astc_codec_image * output_image, const char *ou\nstore_result = -99;\nbreak;\ndefault:\n- ASTC_CODEC_INTERNAL_ERROR;\n- exit(1);\n- break;\n+ ASTC_CODEC_INTERNAL_ERROR();\n};\nreturn store_result;\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -150,7 +150,7 @@ unsigned get_number_of_cpus(void)\nreturn n_cpus;\n}\n-void astc_codec_internal_error(const char *filename, int linenum)\n+[[noreturn]] void astc_codec_internal_error(const char *filename, int linenum)\n{\nprintf(\"Internal error: File=%s Line=%d\\n\", filename, linenum);\nexit(1);\n" }, { "change_type": "MODIFY", "old_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "new_path": "Source/win32-2017/astcenc/astcenc.vcxproj", "diff": "<SubSystem>Console</SubSystem>\n<TargetMachine>MachineX86</TargetMachine>\n<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>\n+ <AdditionalDependencies>\n+ </AdditionalDependencies>\n</Link>\n</ItemDefinitionGroup>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n<SubSystem>Console</SubSystem>\n+ <AdditionalDependencies>\n+ </AdditionalDependencies>\n</Link>\n</ItemDefinitionGroup>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\n<OptimizeReferences>true</OptimizeReferences>\n<EnableCOMDATFolding>true</EnableCOMDATFolding>\n<TargetMachine>MachineX86</TargetMachine>\n+ <AdditionalDependencies />\n+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>\n</Link>\n</ItemDefinitionGroup>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n</PrecompiledHeader>\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n+ <StringPooling>true</StringPooling>\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n<SubSystem>Console</SubSystem>\n<OptimizeReferences>true</OptimizeReferences>\n<EnableCOMDATFolding>true</EnableCOMDATFolding>\n+ <AdditionalDependencies>\n+ </AdditionalDependencies>\n+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>\n</Link>\n</ItemDefinitionGroup>\n<ItemGroup>\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Cleanup handling of ASTC_CODEC_INTERNAL_ERROR (#63) - Error function calls exit(), so mark as [[noreturn]]. - Remove duplicate calls to exit(). - Remove functional logic which is redundant due to erro.
61,745
08.07.2019 23:07:01
-3,600
d675f437254928e855a3dfdcf9dd2789e6908df4
Remove support for 32-bit (Win32) Windows builds
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": ".vscode\nSource/*.o\nSource/astcenc\n-Source/win32-2017/astcenc/.vs\n-Source/win32-2017/astcenc/Win32\n-Source/win32-2017/astcenc/x64\n-Source/win32-2017/astcenc/astcenc.vcxproj.user\n+Source/VS2017/.vs\n+Source/VS2017/Release\n+Source/VS2017/Debug\n+Source/VS2017/astcenc.vcxproj.user\nTestOutput\n" }, { "change_type": "DELETE", "old_path": "Binary/windows-x86/astcenc.exe", "new_path": "Binary/windows-x86/astcenc.exe", "diff": "Binary files a/Binary/windows-x86/astcenc.exe and /dev/null differ\n" }, { "change_type": "MODIFY", "old_path": "Docs/Building.md", "new_path": "Docs/Building.md", "diff": "@@ -6,11 +6,12 @@ this repository.\n## Windows\nBuilds for Windows use Visual Studio 2017, using the solution file located in\n-the `Source/win32-2017/astcenc/` directory. To compile a release build from\n-the command line, it is possible to use the `msbuild` utility:\n+the `Source/VS2017/` directory. To compile a release build from the command\n+line, it is possible to use the `msbuild` utility from the Visual Studio 2017\n+installation:\n```\n-msbuild .\\Source\\win32-2017\\astcenc\\astcenc.sln /p:Configuration=Release /p:Platform=x64\n+msbuild .\\Source\\VS2017\\astcenc.sln /p:Configuration=Release /p:Platform=x64\n```\n## macOS\n" }, { "change_type": "MODIFY", "old_path": "Jenkinsfile", "new_path": "Jenkinsfile", "diff": "@@ -12,28 +12,14 @@ pipeline {\nstage('x64 Release') {\nsteps {\nscript {\n- bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Release /p:Platform=x64\", returnStatus: false, returnStdout: false)\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\VS2017\\\\astcenc.sln /p:Configuration=Release /p:Platform=x64\", returnStatus: false, returnStdout: false)\n}\n}\n}\nstage('x64 Debug') {\nsteps {\nscript {\n- bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Debug /p:Platform=x64\", returnStatus: false, returnStdout: false)\n- }\n- }\n- }\n- stage('x86 Release') {\n- steps {\n- script {\n- bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Release /p:Platform=Win32\", returnStatus: false, returnStdout: false)\n- }\n- }\n- }\n- stage('x86 Debug') {\n- steps {\n- script {\n- bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\win32-2017\\\\astcenc\\\\astcenc.sln /p:Configuration=Debug /p:Platform=Win32\", returnStatus: false, returnStdout: false)\n+ bat(script: \"\\\"${tool 'MSBuild-15.0'}\\\" .\\\\Source\\\\VS2017\\\\astcenc.sln /p:Configuration=Debug /p:Platform=x64\", returnStatus: false, returnStdout: false)\n}\n}\n}\n@@ -41,10 +27,8 @@ pipeline {\n}\nstage('Archive') {\nsteps {\n- archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\Win32\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n- archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\Win32\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n- archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\x64\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n- archiveArtifacts(artifacts: 'Source\\\\win32-2017\\\\astcenc\\\\x64\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\VS2017\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n+ archiveArtifacts(artifacts: 'Source\\\\VS2017\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n}\n}\nstage('Test') {\n" }, { "change_type": "RENAME", "old_path": "Source/win32-2017/astcenc/astcenc.vcxproj.filters", "new_path": "Source/VS2017/astcenc.vcxproj.filters", "diff": "</Filter>\n</ItemGroup>\n<ItemGroup>\n- <ClCompile Include=\"..\\..\\astc_block_sizes2.cpp\">\n+ <ClCompile Include=\"..\\astc_averages_and_directions.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_color_quantize.cpp\">\n+ <ClCompile Include=\"..\\astc_block_sizes2.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_color_unquantize.cpp\">\n+ <ClCompile Include=\"..\\astc_color_quantize.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_compress_symbolic.cpp\">\n+ <ClCompile Include=\"..\\astc_color_unquantize.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_compute_variance.cpp\">\n+ <ClCompile Include=\"..\\astc_compress_symbolic.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_decompress_symbolic.cpp\">\n+ <ClCompile Include=\"..\\astc_compute_variance.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_encoding_choice_error.cpp\">\n+ <ClCompile Include=\"..\\astc_decompress_symbolic.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_find_best_partitioning.cpp\">\n+ <ClCompile Include=\"..\\astc_encoding_choice_error.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_image_load_store.cpp\">\n+ <ClCompile Include=\"..\\astc_find_best_partitioning.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_integer_sequence.cpp\">\n+ <ClCompile Include=\"..\\astc_ideal_endpoints_and_weights.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_kmeans_partitioning.cpp\">\n+ <ClCompile Include=\"..\\astc_image_load_store.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_ktx_dds.cpp\">\n+ <ClCompile Include=\"..\\astc_integer_sequence.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_partition_tables.cpp\">\n+ <ClCompile Include=\"..\\astc_kmeans_partitioning.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_pick_best_endpoint_format.cpp\">\n+ <ClCompile Include=\"..\\astc_ktx_dds.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_quantization.cpp\">\n+ <ClCompile Include=\"..\\astc_main.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_symbolic_physical.cpp\">\n+ <ClCompile Include=\"..\\astc_partition_tables.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_toplevel.cpp\">\n+ <ClCompile Include=\"..\\astc_percentile_tables.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\mathlib.cpp\">\n+ <ClCompile Include=\"..\\astc_pick_best_endpoint_format.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\softfloat.cpp\">\n+ <ClCompile Include=\"..\\astc_quantization.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_percentile_tables.cpp\">\n+ <ClCompile Include=\"..\\astc_stb_tga.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_averages_and_directions.cpp\">\n+ <ClCompile Include=\"..\\astc_symbolic_physical.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_stb_tga.cpp\">\n+ <ClCompile Include=\"..\\astc_toplevel.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_ideal_endpoints_and_weights.cpp\">\n+ <ClCompile Include=\"..\\astc_weight_align.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_weight_align.cpp\">\n+ <ClCompile Include=\"..\\astc_weight_quant_xfer_tables.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_weight_quant_xfer_tables.cpp\">\n+ <ClCompile Include=\"..\\mathlib.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n- <ClCompile Include=\"..\\..\\astc_main.cpp\">\n+ <ClCompile Include=\"..\\softfloat.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n</ItemGroup>\n<ItemGroup>\n- <ClInclude Include=\"..\\..\\astc_codec_internals.h\">\n+ <ClInclude Include=\"..\\astc_codec_internals.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\..\\mathlib.h\">\n+ <ClInclude Include=\"..\\mathlib.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\..\\softfloat.h\">\n+ <ClInclude Include=\"..\\softfloat.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\..\\vectypes.h\">\n+ <ClInclude Include=\"..\\stb_image.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n- <ClInclude Include=\"..\\..\\stb_image.h\">\n+ <ClInclude Include=\"..\\vectypes.h\">\n<Filter>Header Files</Filter>\n</ClInclude>\n</ItemGroup>\n" }, { "change_type": "DELETE", "old_path": "Source/win32-2017/astcenc/astcenc.vcproj", "new_path": null, "diff": "-<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n-<VisualStudioProject\n- ProjectType=\"Visual C++\"\n- Version=\"8.00\"\n- Name=\"astcenc\"\n- ProjectGUID=\"{D6D60D86-0502-446A-8498-888F78B869C2}\"\n- RootNamespace=\"astcenc\"\n- Keyword=\"Win32Proj\"\n- >\n- <Platforms>\n- <Platform\n- Name=\"Win32\"\n- />\n- </Platforms>\n- <ToolFiles>\n- </ToolFiles>\n- <Configurations>\n- <Configuration\n- Name=\"Debug|Win32\"\n- OutputDirectory=\"$(SolutionDir)$(ConfigurationName)\"\n- IntermediateDirectory=\"$(ConfigurationName)\"\n- ConfigurationType=\"1\"\n- CharacterSet=\"1\"\n- >\n- <Tool\n- Name=\"VCPreBuildEventTool\"\n- />\n- <Tool\n- Name=\"VCCustomBuildTool\"\n- />\n- <Tool\n- Name=\"VCXMLDataGeneratorTool\"\n- />\n- <Tool\n- Name=\"VCWebServiceProxyGeneratorTool\"\n- />\n- <Tool\n- Name=\"VCMIDLTool\"\n- />\n- <Tool\n- Name=\"VCCLCompilerTool\"\n- Optimization=\"0\"\n- AdditionalIncludeDirectories=\"C:\\work\\ASTC3\\codec\\win32\\astcenc\"\n- PreprocessorDefinitions=\"WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS\"\n- MinimalRebuild=\"true\"\n- BasicRuntimeChecks=\"3\"\n- RuntimeLibrary=\"3\"\n- EnableEnhancedInstructionSet=\"0\"\n- UsePrecompiledHeader=\"0\"\n- WarningLevel=\"3\"\n- Detect64BitPortabilityProblems=\"true\"\n- DebugInformationFormat=\"4\"\n- />\n- <Tool\n- Name=\"VCManagedResourceCompilerTool\"\n- />\n- <Tool\n- Name=\"VCResourceCompilerTool\"\n- />\n- <Tool\n- Name=\"VCPreLinkEventTool\"\n- />\n- <Tool\n- Name=\"VCLinkerTool\"\n- LinkIncremental=\"2\"\n- GenerateDebugInformation=\"true\"\n- SubSystem=\"1\"\n- TargetMachine=\"1\"\n- />\n- <Tool\n- Name=\"VCALinkTool\"\n- />\n- <Tool\n- Name=\"VCManifestTool\"\n- />\n- <Tool\n- Name=\"VCXDCMakeTool\"\n- />\n- <Tool\n- Name=\"VCBscMakeTool\"\n- />\n- <Tool\n- Name=\"VCFxCopTool\"\n- />\n- <Tool\n- Name=\"VCAppVerifierTool\"\n- />\n- <Tool\n- Name=\"VCWebDeploymentTool\"\n- />\n- <Tool\n- Name=\"VCPostBuildEventTool\"\n- />\n- </Configuration>\n- <Configuration\n- Name=\"Release|Win32\"\n- OutputDirectory=\"$(SolutionDir)$(ConfigurationName)\"\n- IntermediateDirectory=\"$(ConfigurationName)\"\n- ConfigurationType=\"1\"\n- CharacterSet=\"1\"\n- WholeProgramOptimization=\"1\"\n- >\n- <Tool\n- Name=\"VCPreBuildEventTool\"\n- />\n- <Tool\n- Name=\"VCCustomBuildTool\"\n- />\n- <Tool\n- Name=\"VCXMLDataGeneratorTool\"\n- />\n- <Tool\n- Name=\"VCWebServiceProxyGeneratorTool\"\n- />\n- <Tool\n- Name=\"VCMIDLTool\"\n- />\n- <Tool\n- Name=\"VCCLCompilerTool\"\n- AdditionalIncludeDirectories=\"C:\\work\\ASTC3\\codec\\win32\\astcenc\"\n- PreprocessorDefinitions=\"WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS\"\n- RuntimeLibrary=\"2\"\n- BufferSecurityCheck=\"false\"\n- EnableEnhancedInstructionSet=\"0\"\n- FloatingPointModel=\"0\"\n- UsePrecompiledHeader=\"0\"\n- WarningLevel=\"3\"\n- Detect64BitPortabilityProblems=\"true\"\n- DebugInformationFormat=\"3\"\n- />\n- <Tool\n- Name=\"VCManagedResourceCompilerTool\"\n- />\n- <Tool\n- Name=\"VCResourceCompilerTool\"\n- />\n- <Tool\n- Name=\"VCPreLinkEventTool\"\n- />\n- <Tool\n- Name=\"VCLinkerTool\"\n- LinkIncremental=\"1\"\n- GenerateDebugInformation=\"true\"\n- SubSystem=\"1\"\n- OptimizeReferences=\"2\"\n- EnableCOMDATFolding=\"2\"\n- TargetMachine=\"1\"\n- />\n- <Tool\n- Name=\"VCALinkTool\"\n- />\n- <Tool\n- Name=\"VCManifestTool\"\n- />\n- <Tool\n- Name=\"VCXDCMakeTool\"\n- />\n- <Tool\n- Name=\"VCBscMakeTool\"\n- />\n- <Tool\n- Name=\"VCFxCopTool\"\n- />\n- <Tool\n- Name=\"VCAppVerifierTool\"\n- />\n- <Tool\n- Name=\"VCWebDeploymentTool\"\n- />\n- <Tool\n- Name=\"VCPostBuildEventTool\"\n- />\n- </Configuration>\n- </Configurations>\n- <References>\n- </References>\n- <Files>\n- <Filter\n- Name=\"Source Files\"\n- Filter=\"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx\"\n- UniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\"\n- >\n- <File\n- RelativePath=\"..\\..\\astc_block_sizes2.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_color_quantize.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_color_unquantize.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_compress_symbolic.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_compute_variance.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_decompress_symbolic.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_encoding_choice_error.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_find_best_partitioning.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_ideal_endpoints_and_weights.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_image_load_store.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_integer_sequence.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_kmeans_partitioning.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_ktx_dds.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_partition_tables.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_pick_best_endpoint_format.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_quantization.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_symbolic_physical.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_toplevel.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_weight_align.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\astc_weight_quant_xfer_tables.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\mathlib.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\softfloat.cpp\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\stb_image.c\"\n- >\n- </File>\n- </Filter>\n- <Filter\n- Name=\"Header Files\"\n- Filter=\"h;hpp;hxx;hm;inl;inc;xsd\"\n- UniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\"\n- >\n- <File\n- RelativePath=\"..\\..\\astc_codec_internals.h\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\mathlib.h\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\softfloat.h\"\n- >\n- </File>\n- <File\n- RelativePath=\"..\\..\\vectypes.h\"\n- >\n- </File>\n- </Filter>\n- <Filter\n- Name=\"Resource Files\"\n- Filter=\"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav\"\n- UniqueIdentifier=\"{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}\"\n- >\n- </Filter>\n- </Files>\n- <Globals>\n- </Globals>\n-</VisualStudioProject>\n" }, { "change_type": "MODIFY", "old_path": "Test/runner.py", "new_path": "Test/runner.py", "diff": "@@ -239,7 +239,7 @@ def get_test_binary():\nelif sys.platform == \"darwin\":\nreturn \"./Source/astcenc\"\nelif sys.platform == \"win32\":\n- return \"./Source/win32-2017/astcenc/x64/Release/astcenc.exe\"\n+ return \"./Source/VS2017/Release/astcenc.exe\"\nassert False, \"Unknown operating system %s\" % sys.platform\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove support for 32-bit (Win32) Windows builds
61,745
09.07.2019 11:25:36
-3,600
8cbe69831abbc7279eaa447c2201e7d3dda73693
Temporary backwards compatibility for VS2013 Expect this to get removed later once the nightly build machine is upgraded to VS2017 ...
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "#include <stdlib.h>\n#include \"mathlib.h\"\n+// Temporary workaround to build machine still running VS2013\n+// Version 1910 is Visual Studio 2017\n+#if !defined(_MSC_VER) || (_MSC_VER >= 1910)\n+ #define NORETURN [[noreturn]]\n+#else\n+ #define NORETURN\n+ #define __func__ __FUNCTION__\n+#endif\n+\n#ifndef MIN\n#define MIN(x,y) ((x)<(y)?(x):(y))\n#endif\n// error reporting for codec internal errors.\n#define ASTC_CODEC_INTERNAL_ERROR() astc_codec_internal_error(__FILE__, __LINE__)\n-[[noreturn]] void astc_codec_internal_error(const char *filename, int linenumber);\n+NORETURN void astc_codec_internal_error(const char *filename, int linenumber);\n// uncomment this macro to enable checking for inappropriate NaNs;\n// works on Linux only, and slows down encoding significantly.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -149,7 +149,7 @@ unsigned get_number_of_cpus(void)\nreturn n_cpus;\n}\n-[[noreturn]] void astc_codec_internal_error(const char *filename, int linenum)\n+NORETURN void astc_codec_internal_error(const char *filename, int linenum)\n{\nprintf(\"Internal error: File=%s Line=%d\\n\", filename, linenum);\nexit(1);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Temporary backwards compatibility for VS2013 Expect this to get removed later once the nightly build machine is upgraded to VS2017 ...
61,745
14.07.2019 23:44:52
-3,600
0c749dfc0cb6b1e563348c2926be65def2add96e
Remove duplicate half table for weight alignment Current table is 256 entries, but consists of 128 entries repeated twice. This patch halves the size of the table, and clamps index values to the narrower range.
[ { "change_type": "MODIFY", "old_path": "Source/VS2017/astcenc.sln", "new_path": "Source/VS2017/astcenc.sln", "diff": "@@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"astcenc\", \"astcenc.vcxproj\", \"{D6D60D86-0502-446A-8498-888F78B869C2}\"\nEndProject\nGlobal\n+ GlobalSection(Performance) = preSolution\n+ HasPerformanceSessions = true\n+ EndGlobalSection\nGlobalSection(SolutionConfigurationPlatforms) = preSolution\nDebug|x64 = Debug|x64\nRelease|x64 = Release|x64\n@@ -22,4 +25,10 @@ Global\nGlobalSection(ExtensibilityGlobals) = postSolution\nSolutionGuid = {867DE95A-BBF0-43D6-B199-4678354DB74B}\nEndGlobalSection\n+ GlobalSection(Performance) = preSolution\n+ HasPerformanceSessions = true\n+ EndGlobalSection\n+ GlobalSection(Performance) = preSolution\n+ HasPerformanceSessions = true\n+ EndGlobalSection\nEndGlobal\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_align.cpp", "new_path": "Source/astc_weight_align.cpp", "diff": "@@ -186,37 +186,16 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nint8_t * lowest_weight, int8_t * highest_weight,\nfloat *error, float *cut_low_weight_error, float *cut_high_weight_error)\n{\n- int i;\n-\n- int sp;\n-\nfloat error_from_forcing_weight_down[60];\nfloat error_from_forcing_weight_either_way[60];\n- for (i = 0; i < 60; i++)\n+ for (int i = 0; i < 60; i++)\n{\nerror_from_forcing_weight_down[i] = 0;\nerror_from_forcing_weight_either_way[i] = 0;\n}\n// weight + 12\n- static const unsigned int idxtab[256] = {\n- 12, 13, 14, 15, 16, 17, 18, 19,\n- 20, 21, 22, 23, 24, 25, 26, 27,\n- 28, 29, 30, 31, 32, 33, 34, 35,\n- 36, 37, 38, 39, 40, 41, 42, 43,\n- 44, 45, 46, 47, 48, 49, 50, 51,\n- 52, 53, 54, 55, 55, 55, 55, 55,\n- 55, 55, 55, 55, 55, 55, 55, 55,\n- 55, 55, 55, 55, 55, 55, 55, 55,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 1, 2, 3,\n- 4, 5, 6, 7, 8, 9, 10, 11,\n-\n+ static const unsigned int idxtab[128] = {\n12, 13, 14, 15, 16, 17, 18, 19,\n20, 21, 22, 23, 24, 25, 26, 27,\n28, 29, 30, 31, 32, 33, 34, 35,\n@@ -235,7 +214,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\n4, 5, 6, 7, 8, 9, 10, 11\n};\n- for (sp = 0; sp < max_angular_steps; sp++)\n+ for (int sp = 0; sp < max_angular_steps; sp++)\n{\nunsigned int minidx_bias12 = 55;\nunsigned int maxidx_bias12 = 0;\n@@ -247,7 +226,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nfloat scaled_offset = rcp_stepsize * offset;\n- for (i = 0; i < samplecount - 1; i += 2)\n+ for (int i = 0; i < samplecount - 1; i += 2)\n{\nfloat wt1 = sample_weights[i];\nfloat wt2 = sample_weights[i + 1];\n@@ -265,8 +244,8 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nerrval += (dif2 * wt2) * dif2;\n// table lookups that really perform a minmax function.\n- unsigned int idx1_bias12 = idxtab[p1.u & 0xFF];\n- unsigned int idx2_bias12 = idxtab[p2.u & 0xFF];\n+ unsigned int idx1_bias12 = idxtab[p1.u & 0x7F];\n+ unsigned int idx2_bias12 = idxtab[p2.u & 0x7F];\nif (idx1_bias12 < minidx_bias12)\nminidx_bias12 = idx1_bias12;\n@@ -286,7 +265,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nif (samplecount & 1)\n{\n- i = samplecount - 1;\n+ int i = samplecount - 1;\nfloat wt = sample_weights[i];\nif32 p;\nfloat sval = (samples[i] * rcp_stepsize) - scaled_offset;\n@@ -296,7 +275,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nerrval += (dif * wt) * dif;\n- unsigned int idx_bias12 = idxtab[p.u & 0xFF];\n+ unsigned int idx_bias12 = idxtab[p.u & 0x7F];\nif (idx_bias12 < minidx_bias12)\nminidx_bias12 = idx_bias12;\n@@ -307,7 +286,6 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\nerror_from_forcing_weight_down[idx_bias12] += dif * wt;\n}\n-\nlowest_weight[sp] = (int)minidx_bias12 - 12;\nhighest_weight[sp] = (int)maxidx_bias12 - 12;\nerror[sp] = errval;\n@@ -320,8 +298,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\n// clear out the error-from-forcing values we actually used in this pass\n// so that these are clean for the next pass.\n- unsigned int ui;\n- for (ui = minidx_bias12 & ~0x3; ui <= maxidx_bias12; ui += 4)\n+ for (unsigned int ui = minidx_bias12 & ~0x3; ui <= maxidx_bias12; ui += 4)\n{\nerror_from_forcing_weight_either_way[ui] = 0;\nerror_from_forcing_weight_down[ui] = 0;\n@@ -334,7 +311,7 @@ void compute_lowest_and_highest_weight(int samplecount, const float *samples, co\n}\n}\n- for (sp = 0; sp < max_angular_steps; sp++)\n+ for (int sp = 0; sp < max_angular_steps; sp++)\n{\nfloat errscale = stepsizes_sqr[sp];\nerror[sp] *= errscale;\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove duplicate half table for weight alignment (#66) Current table is 256 entries, but consists of 128 entries repeated twice. This patch halves the size of the table, and clamps index values to the narrower range.
61,744
05.09.2019 22:08:07
-10,800
e811f4abf83b60a6e512b48aa50288ebdf6f53d1
Fixed parse -va commandline argument
[ { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -1443,7 +1443,7 @@ int astc_main(int argc, char **argv)\nprintf(\"-va switch with less than 4 arguments, quitting\\n\");\nexit(1);\n}\n- ewp.alpha_power = static_cast < float >(atof(argv[argidx - 5]));\n+ ewp.alpha_power = static_cast < float >(atof(argv[argidx - 4]));\newp.alpha_base_weight = static_cast < float >(atof(argv[argidx - 3]));\newp.alpha_mean_weight = static_cast < float >(atof(argv[argidx - 2]));\newp.alpha_stdev_weight = static_cast < float >(atof(argv[argidx - 1]));\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fixed parse -va commandline argument (#68)
61,756
05.09.2019 12:11:23
25,200
64c718ed55a298b3a517b7767fcc2bdb063dc63c
Fix GCC 8 compile warnings
[ { "change_type": "MODIFY", "old_path": "Source/vectypes.h", "new_path": "Source/vectypes.h", "diff": "@@ -13364,361 +13364,362 @@ static inline ushort4 convert_ushort4(ushort4 p)\nstatic inline float2 as_float2(float2 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(float2 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(float2 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline double2 as_double2(double2 inp)\n{\ndouble2 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline float2 as_float2(int2 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(int2 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(int2 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float2 as_float2(uint2 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(uint2 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(uint2 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline short2 as_short2(short2 inp)\n{\nshort2 val1;\n- memcpy(&val1, &inp, 4);\n+ memcpy((void*)&val1, &inp, 4);\nreturn val1;\n}\nstatic inline ushort2 as_ushort2(short2 inp)\n{\nushort2 val1;\n- memcpy(&val1, &inp, 4);\n+ memcpy((void*)&val1, &inp, 4);\nreturn val1;\n}\nstatic inline short2 as_short2(ushort2 inp)\n{\nshort2 val1;\n- memcpy(&val1, &inp, 4);\n+ memcpy((void*)&val1, &inp, 4);\nreturn val1;\n}\nstatic inline ushort2 as_ushort2(ushort2 inp)\n{\nushort2 val1;\n- memcpy(&val1, &inp, 4);\n+ memcpy((void*)&val1, &inp, 4);\nreturn val1;\n}\nstatic inline short4 as_short4(float2 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(float2 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float4 as_float4(double2 inp)\n{\nfloat4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline int4 as_int4(double2 inp)\n{\nint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline uint4 as_uint4(double2 inp)\n{\nuint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline short4 as_short4(int2 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(int2 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline short4 as_short4(uint2 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(uint2 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float3 as_float3(float3 inp)\n{\nfloat3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline int3 as_int3(float3 inp)\n{\nint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline uint3 as_uint3(float3 inp)\n{\nuint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline double3 as_double3(double3 inp)\n{\ndouble3 val1;\n- memcpy(&val1, &inp, 24);\n+ memcpy((void*)&val1, &inp, 24);\nreturn val1;\n}\n+\nstatic inline float3 as_float3(int3 inp)\n{\nfloat3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline int3 as_int3(int3 inp)\n{\nint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline uint3 as_uint3(int3 inp)\n{\nuint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline float3 as_float3(uint3 inp)\n{\nfloat3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline int3 as_int3(uint3 inp)\n{\nint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline uint3 as_uint3(uint3 inp)\n{\nuint3 val1;\n- memcpy(&val1, &inp, 12);\n+ memcpy((void*)&val1, &inp, 12);\nreturn val1;\n}\nstatic inline short3 as_short3(short3 inp)\n{\nshort3 val1;\n- memcpy(&val1, &inp, 6);\n+ memcpy((void*)&val1, &inp, 6);\nreturn val1;\n}\nstatic inline ushort3 as_ushort3(short3 inp)\n{\nushort3 val1;\n- memcpy(&val1, &inp, 6);\n+ memcpy((void*)&val1, &inp, 6);\nreturn val1;\n}\nstatic inline short3 as_short3(ushort3 inp)\n{\nshort3 val1;\n- memcpy(&val1, &inp, 6);\n+ memcpy((void*)&val1, &inp, 6);\nreturn val1;\n}\nstatic inline ushort3 as_ushort3(ushort3 inp)\n{\nushort3 val1;\n- memcpy(&val1, &inp, 6);\n+ memcpy((void*)&val1, &inp, 6);\nreturn val1;\n}\nstatic inline double2 as_double2(float4 inp)\n{\ndouble2 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline double2 as_double2(int4 inp)\n{\ndouble2 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline double2 as_double2(uint4 inp)\n{\ndouble2 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline float2 as_float2(short4 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(short4 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(short4 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float2 as_float2(ushort4 inp)\n{\nfloat2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline int2 as_int2(ushort4 inp)\n{\nint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline uint2 as_uint2(ushort4 inp)\n{\nuint2 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline float4 as_float4(float4 inp)\n{\nfloat4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline int4 as_int4(float4 inp)\n{\nint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline uint4 as_uint4(float4 inp)\n{\nuint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline double4 as_double4(double4 inp)\n{\ndouble4 val1;\n- memcpy(&val1, &inp, 32);\n+ memcpy((void*)&val1, &inp, 32);\nreturn val1;\n}\nstatic inline float4 as_float4(int4 inp)\n{\nfloat4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline int4 as_int4(int4 inp)\n{\nint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline uint4 as_uint4(int4 inp)\n{\nuint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline float4 as_float4(uint4 inp)\n{\nfloat4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline int4 as_int4(uint4 inp)\n{\nint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline uint4 as_uint4(uint4 inp)\n{\nuint4 val1;\n- memcpy(&val1, &inp, 16);\n+ memcpy((void*)&val1, &inp, 16);\nreturn val1;\n}\nstatic inline short4 as_short4(short4 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(short4 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline short4 as_short4(ushort4 inp)\n{\nshort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\nstatic inline ushort4 as_ushort4(ushort4 inp)\n{\nushort4 val1;\n- memcpy(&val1, &inp, 8);\n+ memcpy((void*)&val1, &inp, 8);\nreturn val1;\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix GCC 8 compile warnings
61,745
28.11.2019 16:56:21
0
fd077aba89e1862f6b0583070a085e736393068e
Add RGBM encoding blockify helper utility
[ { "change_type": "ADD", "old_path": null, "new_path": "Utils/astc_rgbm_blockify.cpp", "diff": "+\n+// ----------------------------------------------------------------------------\n+// This confidential and proprietary software may be used only as authorised\n+// by a licensing agreement from Arm Limited.\n+// (C) COPYRIGHT 2019 Arm Limited, ALL RIGHTS RESERVED\n+// The entire notice above must be reproduced on all authorised copies and\n+// copies may only be made to the extent permitted by a licensing agreement\n+// from Arm Limited.\n+// ----------------------------------------------------------------------------\n+\n+// This is a utility tool to blockify the M channel of an RGBM image, writing\n+// the result back to a file on disk.\n+//\n+// This tool requires stb_image.h and stb_image_write.h single header libraries\n+// from: https://github.com/nothings/stb.\n+\n+#include <stdint.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+\n+#define STB_IMAGE_IMPLEMENTATION\n+#include \"stb_image.h\"\n+\n+#define STB_IMAGE_WRITE_IMPLEMENTATION\n+#include \"stb_image_write.h\"\n+\n+// Force val[N+1] to be contrained to not be less than val[N]*(R/256)\n+void impose_ratio(uint8_t *data, int length, int stride, uint32_t ratio) {\n+ uint8_t val = *data;\n+ for (int i = 1; i < length; i++) {\n+ data += stride;\n+\n+ int min_val = (val * ratio) >> 8;\n+ uint8_t vl2 = *data;\n+ if (vl2 < min_val) {\n+ *data = vl2 = min_val;\n+ }\n+ val = vl2;\n+ }\n+}\n+\n+int main( int argc, char **argv ) {\n+ // Parse command line\n+ if (argc < 5) {\n+ printf(\"Usage:\\n\"\n+ \" %s <source> <dest> <blocksize> <ratio>\\n\"\n+ \"where the arguments are:\\n\"\n+ \"\\n\"\n+ \"<source> : Source image in RGBM representation.\\n\"\n+ \"<dest> : Destination PNG image file to write.\\n\"\n+ \"<blocksize> : ASTC block size we are blockifying for; e.g. 6x6.\\n\"\n+ \"<ratio> : The maximum permitted ratio of M between two\\n\"\n+ \" adjacent blocks. Can be set to any value between\\n\"\n+ \" 0.01 and 0.99. Recommend 0.7 to start with.\\n\"\n+ , argv[0]);\n+ exit(1);\n+ }\n+\n+ int x_blockdim, y_blockdim;\n+ if (sscanf(argv[3], \"%dx%d\", &x_blockdim, &y_blockdim) < 2) {\n+ printf(\"Blockdim must be of form WxH; e.g. 8x4\\n\");\n+ exit(1);\n+ }\n+\n+ double ratio_f = atof(argv[4]);\n+ if (ratio_f < 0.01 || ratio_f > 0.99) {\n+ printf(\"Ratio parameter must be in range 0.01 to 0.99\\n\");\n+ }\n+\n+ int ratio_i = (int)floor(ratio_f * 256.0 + 0.5);\n+\n+ // Load the image\n+ int xdim, ydim, ncomp;\n+ uint8_t *data = (uint8_t *)stbi_load(argv[1], &xdim, &ydim, &ncomp, 4);\n+ if (!data) {\n+ printf(\"Failed to load image \\\"%s\\\"\\n\", data );\n+ exit(1);\n+ }\n+\n+ int x_blockcount = (xdim + x_blockdim - 1) / x_blockdim;\n+ int y_blockcount = (ydim + y_blockdim - 1) / y_blockdim;\n+ int y_leftover = y_blockdim * y_blockcount - ydim;\n+\n+ uint8_t *mbuf = (uint8_t *)calloc(x_blockcount * y_blockcount, 1);\n+\n+ // For each block, obtain the maximum M-value\n+ for (int y = 0; y < ydim; y++) {\n+ int ctr = 0;\n+ uint8_t *s = data + 4 * y * xdim + 3;\n+ uint8_t *d = mbuf + ((y + y_leftover) / y_blockdim) * x_blockcount;\n+\n+ int accum = *d;\n+ for (int x = 0; x < xdim; x++) {\n+ uint8_t p = s[4*x];\n+ if (p > accum) {\n+ accum = p;\n+ }\n+\n+ if(++ctr == x_blockdim) {\n+ *d++ = accum;\n+ accum = *d;\n+ ctr = 0;\n+ }\n+ }\n+\n+ if (ctr != 0) {\n+ *d = accum;\n+ }\n+ }\n+\n+ // Impose ratio restriction on M-values in adjacent blocks.\n+ for (int y = 0; y < y_blockcount; y++) {\n+ impose_ratio(mbuf + y * x_blockcount, x_blockcount, 1, ratio_i);\n+ impose_ratio(mbuf + ((y + 1) * x_blockcount) - 1, x_blockcount, - 1, ratio_i);\n+ }\n+\n+ for (int x = 0; x < x_blockcount; x++) {\n+ impose_ratio(mbuf + x, y_blockcount, x_blockcount, ratio_i);\n+ impose_ratio(mbuf + x + (x_blockcount * (y_blockcount - 1)), y_blockcount, -x_blockcount, ratio_i);\n+ }\n+\n+ // For each pixel, scale the pixel RGB values based on chosen M\n+ for (int y = 0; y < ydim; y++) {\n+ int ctr = 0;\n+ uint8_t *s = data + 4 * y * xdim;\n+ uint8_t *d = mbuf + ((y + y_leftover) / y_blockdim) * x_blockcount;\n+ int mm = *d++;\n+ for (int x = 0; x < xdim; x++) {\n+ uint8_t m = s[4 * x + 3];\n+ if(m != mm) {\n+ uint8_t r = s[4 * x];\n+ uint8_t g = s[4 * x + 1];\n+ uint8_t b = s[4 * x + 2];\n+ s[4 * x] = (r * m + (mm >> 1)) / mm;\n+ s[4 * x + 1] = (g * m + (mm >> 1)) / mm;\n+ s[4 * x + 2] = (b * m + (mm >> 1)) / mm;\n+ s[4 * x + 3] = mm;\n+ }\n+\n+ if (++ctr == x_blockdim) {\n+ ctr = 0;\n+ mm = *d++;\n+ }\n+ }\n+ }\n+\n+ // Write out the result\n+ stbi_write_png(argv[2], xdim, ydim, 4, data, 4*xdim);\n+ return 0;\n+}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add RGBM encoding blockify helper utility
61,745
02.01.2020 23:18:01
0
917c08aeb2677c3c9693119ed2e4e3244fc2d90c
Improve Make build Enable more warnings Improve log clarity
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -43,16 +43,19 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -std=c++11 -O3 -Wall -W -Wextra -Werror=shadow -msse2 -mfpmath=sse\n+CPPFLAGS = -std=c++11 -O3 -Wall -W -Wall -Wextra -Wpedantic -Werror -Werror=shadow -msse2 -mfpmath=sse\nastcenc: $(OBJECTS)\n- g++ -o $@ $^ $(CPPFLAGS) -lpthread\n+ @g++ -o $@ $^ $(CPPFLAGS) -lpthread\n+ @echo \"[Link] $@\"\n$(OBJECTS): %.o: %.cpp $(HEADERS)\n- g++ -c -o $@ $< $(CPPFLAGS)\n+ @g++ -c -o $@ $< $(CPPFLAGS)\n+ @echo \"[C++] $<\"\nclean:\n- rm -f *.o\n- rm -f *.obj\n- rm -f astcenc\n- rm -f astcenc.exe\n+ @rm -f *.o\n+ @rm -f *.obj\n+ @rm -f astcenc\n+ @rm -f astcenc.exe\n+ @echo \"[Clean] Removing build outputs\"\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -2090,7 +2090,7 @@ int astc_main(int argc, char **argv)\nargidx++;\n// Read array size (image depth).\n- if (!sscanf(argv[argidx], \"%u\", &array_size) || array_size == 0)\n+ if (!sscanf(argv[argidx], \"%d\", &array_size) || array_size == 0)\n{\nprintf(\"Invalid array size (image depth) given with -array option: \\\"%s\\\".\\n\", argv[argidx]);\nexit(1);\n" }, { "change_type": "MODIFY", "old_path": "Source/stb_image.h", "new_path": "Source/stb_image.h", "diff": "@@ -994,7 +994,7 @@ STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip)\nstbi__vertically_flip_on_load = flag_true_if_should_flip;\n}\n-static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc)\n+static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri)\n{\nmemset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields\nri->bits_per_channel = 8; // default is 8 so most paths don't have to be changed\n@@ -1112,7 +1112,7 @@ static void stbi__vertical_flip_slices(void *image, int w, int h, int z, int byt\nstatic unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\nstbi__result_info ri;\n- void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8);\n+ void *result = stbi__load_main(s, x, y, comp, req_comp, &ri);\nif (result == NULL)\nreturn NULL;\n@@ -1136,7 +1136,7 @@ static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x,\nstatic stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\nstbi__result_info ri;\n- void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 16);\n+ void *result = stbi__load_main(s, x, y, comp, req_comp, &ri);\nif (result == NULL)\nreturn NULL;\n@@ -5103,7 +5103,7 @@ static int stbi__shiftsigned(unsigned int v, int shift, int bits)\nv <<= -shift;\nelse\nv >>= shift;\n- STBI_ASSERT(v >= 0 && v < 256);\n+ STBI_ASSERT(v < 256);\nv >>= (8-bits);\nSTBI_ASSERT(bits >= 0 && bits <= 8);\nreturn (int) ((unsigned) v * mul_table[bits]) >> shift_table[bits];\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Improve Make build - Enable more warnings - Improve log clarity
61,745
03.01.2020 00:08:20
0
7b4415478a9d790536f2fc998165a174e61d64e1
Add helper scripts for profiling
[ { "change_type": "ADD", "old_path": null, "new_path": "Test/astc_run.py", "diff": "+#!/usr/bin/env python3\n+# -----------------------------------------------------------------------------\n+# This confidential and proprietary software may be used only as authorised by\n+# a licensing agreement from Arm Limited.\n+# (C) COPYRIGHT 2019-2020 Arm Limited, ALL RIGHTS RESERVED\n+# The entire notice above must be reproduced on all authorised copies and\n+# copies may only be made to the extent permitted by a licensing agreement from\n+# Arm Limited.\n+# -----------------------------------------------------------------------------\n+\n+import argparse\n+import os\n+from PIL import Image\n+import re\n+import shutil\n+import subprocess as sp\n+import sys\n+\n+\n+class TestImage():\n+ \"\"\"\n+ A single test definition, and the test results if it is actually run.\n+ \"\"\"\n+\n+ def __init__(self, filePath):\n+ \"\"\"\n+ Construct a new test definition.\n+ \"\"\"\n+ # Remove any leading \"./\" or \".\\\" prefix\n+ if filePath.startswith(\"./\") or filePath.startswith(\".\\\\\"):\n+ filePath = filePath[2:]\n+\n+ name = os.path.basename(filePath)\n+ nameParts = name.split(\"-\")\n+\n+ self.filePath = filePath\n+ self.dynamicRange = nameParts[0]\n+ self.format = nameParts[1]\n+\n+ def run_once(self, testBinary, blockSize, profile):\n+ \"\"\"\n+ Run a single compression pass.\n+ \"\"\"\n+ pathParts = splitall(self.filePath)\n+\n+ # Create the test output directory if it doesn't exist\n+ outDir = os.path.join(\"TestOutput\", \"Images\", pathParts[2], blockSize)\n+ os.makedirs(outDir, exist_ok=True)\n+\n+ if self.dynamicRange == \"ldr\":\n+ outFile = pathParts[-1].replace(\".png\", \".tga\")\n+ else:\n+ outFile = pathParts[-1].replace(\".hdr\", \".htga\")\n+ outFilePath = os.path.join(outDir, outFile)\n+\n+ if self.dynamicRange == \"ldr\":\n+ outFile = pathParts[-1].replace(\".png\", \"-out.png\")\n+ outFilePath2 = os.path.join(outDir, outFile)\n+\n+ # Run the compressor\n+ args = [testBinary, \"-t\", self.filePath, outFilePath,\n+ blockSize, \"-thorough\", \"-time\", \"-showpsnr\", \"-silentmode\"]\n+\n+ # Switch normal maps into angular error metrics\n+ if self.format == \"xy\":\n+ args.append(\"-normal_psnr\")\n+\n+ # Inject the callgrind profiler prefix\n+ if profile:\n+ args.insert(0, \"--callgrind-out-file=callgrind.out\")\n+ args.insert(0, \"--tool=callgrind\")\n+ args.insert(0, \"valgrind\")\n+ if os.path.exists(\"callgrind.out\"):\n+ os.remove(\"callgrind.out\")\n+ if os.path.exists(\"callgrind.dot\"):\n+ os.remove(\"callgrind.dot\")\n+ if os.path.exists(\"callgrind.png\"):\n+ os.remove(\"callgrind.png\")\n+\n+ try:\n+ result = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\n+ check=True, universal_newlines=True)\n+ except (OSError, sp.CalledProcessError):\n+ print(\"ERROR: Test run failed\")\n+ print(\" + %s\" % \" \".join(args))\n+ sys.exit(1)\n+\n+ # Convert the TGA to PNG and delete the TGA (LDR only)\n+ if self.dynamicRange == \"ldr\":\n+ im = Image.open(outFilePath)\n+ im.save(outFilePath2)\n+ os.remove(outFilePath)\n+ outFilePath = outFilePath2\n+\n+ # Create log parsing patterns\n+ if self.dynamicRange == \"ldr\":\n+ if self.format in (\"rgb\", \"xy\"):\n+ patternPSNR = \"PSNR \\\\(LDR-RGB\\\\): ([0-9.]*) dB\"\n+ elif self.format == \"rgba\":\n+ patternPSNR = \"PSNR \\\\(LDR-RGBA\\\\): ([0-9.]*) dB\"\n+ else:\n+ assert False, \"Unsupported LDR color format %s\" % self.format\n+ else:\n+ patternPSNR = \"PSNR \\\\(RGB normalized to peak\\\\): ([0-9.]*) dB\"\n+\n+ patternPSNR = re.compile(patternPSNR)\n+ patternTime = re.compile(\".* coding time: ([0-9.]*) seconds\")\n+\n+ # Extract results from the log\n+ runPSNR = None\n+ runTime = None\n+\n+ for line in result.stdout.splitlines():\n+ match = patternPSNR.match(line)\n+ if match:\n+ runPSNR = float(match.group(1))\n+\n+ match = patternTime.match(line)\n+ if match:\n+ runTime = float(match.group(1))\n+\n+ # Convert the callgrind log to an image\n+ if profile:\n+ os.system(\"gprof2dot ./callgrind.out -f callgrind -s -z \\\"astc_main(int, char*)\\\" > callgrind.dot\")\n+ os.system(\"dot -Tpng callgrind.dot -o callgrind.png\")\n+ os.remove(\"callgrind.dot\")\n+\n+ assert runPSNR is not None, \"No coding PSNR found %s\" % result.stdout\n+ assert runTime is not None, \"No coding time found %s\" % result.stdout\n+ return (runPSNR, runTime, outFilePath)\n+\n+\n+def splitall(path):\n+ \"\"\"\n+ Completely tokenize a path into its component pieces.\n+ \"\"\"\n+ allparts = []\n+ while True:\n+ parts = os.path.split(path)\n+ if parts[0] == path:\n+ allparts.insert(0, parts[0])\n+ break\n+ elif parts[1] == path:\n+ allparts.insert(0, parts[1])\n+ break\n+ else:\n+ path = parts[0]\n+ allparts.insert(0, parts[1])\n+\n+ return allparts\n+\n+\n+def get_test_binary():\n+ \"\"\"\n+ Return the test binary path for the current host machine.\n+ \"\"\"\n+ if \"linux\" in sys.platform:\n+ return \"./Source/astcenc\"\n+ elif sys.platform == \"darwin\":\n+ return \"./Source/astcenc\"\n+ elif sys.platform == \"win32\":\n+ return \"./Source/VS2017/Release/astcenc.exe\"\n+\n+ assert False, \"Unknown operating system %s\" % sys.platform\n+\n+\n+def get_reference_binary():\n+ \"\"\"\n+ Return the reference binary path for the current host machine.\n+ \"\"\"\n+ if \"linux\" in sys.platform:\n+ return \"./Binary/linux-x64/astcenc\"\n+ elif sys.platform == \"darwin\":\n+ return \"./Binary/mac-x64/astcenc\"\n+ elif sys.platform == \"win32\":\n+ return \"./Binary/windows-x64/astcenc.exe\"\n+\n+ assert False, \"Unknown operating system %s\" % sys.platform\n+\n+\n+def parse_command_line():\n+ \"\"\"\n+ Parse the command line.\n+ \"\"\"\n+\n+ parser = argparse.ArgumentParser()\n+\n+ parser.add_argument(\"image\", help=\"image to compress\")\n+\n+ parser.add_argument(\"block\", nargs=\"?\", default=\"6x6\",\n+ choices=[\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\n+ help=\"block size\")\n+\n+ parser.add_argument(\"--profile\", dest=\"profile\", default=False,\n+ action=\"store_true\", help=\"use callgrind profiler\")\n+\n+ parser.add_argument(\"--reference\", dest=\"useReference\", default=False,\n+ action=\"store_true\", help=\"use reference binary\")\n+\n+ parser.add_argument(\"--repeats\", dest=\"testRepeats\", default=1,\n+ type=int, help=\"test iteration count\")\n+\n+ parser.add_argument(\"--warmup\", dest=\"testWarmups\", default=0,\n+ type=int, help=\"warmup iteration count\")\n+\n+ args = parser.parse_args()\n+ return args\n+\n+\n+def main():\n+ \"\"\"\n+ The main function.\n+ \"\"\"\n+ # Parse command lines\n+ args = parse_command_line()\n+\n+ app = get_test_binary()\n+ if args.useReference:\n+ app = get_reference_binary()\n+\n+ image = TestImage(args.image)\n+\n+ # Run the test scenario\n+ times = []\n+ for _ in range(0, args.testRepeats + args.testWarmups):\n+ psnr, secs, output = image.run_once(app, args.block, args.profile)\n+ times.append(secs)\n+\n+ # Strip off the warmup times and average the rest\n+ times = times[args.testWarmups:]\n+ secs = sum(times) / len(times)\n+\n+ # Print summary results\n+ print(\"PSNR: %0.3f dB\" % psnr)\n+ print(\"Time: %0.3f s (avg of %u runs)\" % (secs, len(times)))\n+ print(\"Image: %s\" % output)\n+\n+\n+if __name__ == \"__main__\":\n+ sys.exit(main())\n" }, { "change_type": "ADD", "old_path": null, "new_path": "Test/astc_size.py", "diff": "+#!/usr/bin/env python3\n+# -----------------------------------------------------------------------------\n+# This confidential and proprietary software may be used only as authorised by\n+# a licensing agreement from Arm Limited.\n+# (C) COPYRIGHT 2019-2020 Arm Limited, ALL RIGHTS RESERVED\n+# The entire notice above must be reproduced on all authorised copies and\n+# copies may only be made to the extent permitted by a licensing agreement from\n+# Arm Limited.\n+# -----------------------------------------------------------------------------\n+\n+import argparse\n+import os\n+import shutil\n+import subprocess as sp\n+import sys\n+\n+\n+def get_test_binary():\n+ \"\"\"\n+ Return the test binary path for the current host machine.\n+ \"\"\"\n+ return \"./Source/astcenc\"\n+\n+\n+def get_reference_binary():\n+ \"\"\"\n+ Return the reference binary path for the current host machine.\n+ \"\"\"\n+ return \"./Binary/linux-x64/astcenc\"\n+\n+\n+def run_size(binary):\n+ args = [\"size\", binary]\n+ result = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\n+ check=True, universal_newlines=True)\n+\n+ lines = result.stdout.splitlines()\n+ assert len(lines) == 2\n+ values = lines[1].split()\n+\n+ codeSection = float(values[0])\n+ roSection = float(values[1])\n+ ziSection = float(values[2])\n+ return (codeSection, roSection, ziSection)\n+\n+\n+def main():\n+ \"\"\"\n+ The main function.\n+ \"\"\"\n+ refApp = get_reference_binary()\n+ newApp = get_test_binary()\n+\n+ refSize = run_size(refApp)\n+ newSize = run_size(newApp)\n+\n+ print(\"%8s % 8s % 8s % 8s\" % (\"\", \"Code\", \"RO\", \"ZI\"))\n+ print(\"%8s % 8u % 8u % 8u\" % (\"Ref\", *refSize))\n+ print(\"%8s % 8u % 8u % 8u\" % (\"New\", *newSize))\n+\n+ diffAbs = []\n+ diffRel = []\n+ for a, b in zip(refSize, newSize):\n+ diff = b - a\n+ diffAbs.append(diff)\n+ rel = diff / a\n+ diffRel.append((diff / a) * 100.0)\n+\n+ print(\"%8s % 8u % 8u % 8u\" % (\"Abs D\", *diffAbs))\n+ print(\"%8s % 7.2f%% % 7.2f%% % 7.2f%%\" % (\"Rel D\", *diffRel))\n+\n+\n+if __name__ == \"__main__\":\n+ sys.exit(main())\n" }, { "change_type": "RENAME", "old_path": "Test/reference.csv", "new_path": "Test/astc_test_reference.csv", "diff": "" }, { "change_type": "RENAME", "old_path": "Test/runner.py", "new_path": "Test/astc_test_run.py", "diff": "# -----------------------------------------------------------------------------\n# This confidential and proprietary software may be used only as authorised by\n# a licensing agreement from Arm Limited.\n-# (C) COPYRIGHT 2019 Arm Limited, ALL RIGHTS RESERVED\n+# (C) COPYRIGHT 2019-2020 Arm Limited, ALL RIGHTS RESERVED\n# The entire notice above must be reproduced on all authorised copies and\n# copies may only be made to the extent permitted by a licensing agreement from\n# Arm Limited.\n@@ -28,6 +28,8 @@ else:\nTEST_EXTENSIONS = [\".png\", \".hdr\"]\n+TEST_REFERENCE = \"Test/astc_test_reference.csv\"\n+\nclass TestReference():\n\"\"\"\n@@ -129,12 +131,13 @@ class TestImage():\nargs.append(\"-normal_psnr\")\ntry:\n- result = sp.run(args, capture_output=True, check=True, text=True)\n- except OSError:\n- print(args)\n+ result = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\n+ check=True, universal_newlines=True)\n+ except (OSError, sp.CalledProcessError):\n+ print(\"ERROR: Test run failed\")\n+ print(\" + %s\" % \" \".join(args))\nsys.exit(1)\n-\n# Convert the TGA to PNG and delete the TGA (LDR only)\nif self.dynamicRange == \"ldr\":\nim = Image.open(outFilePath)\n@@ -294,7 +297,7 @@ def get_test_reference_scores():\nReturn the test reference score listing.\n\"\"\"\nreferenceResults = []\n- with open('Test/reference.csv') as csvfile:\n+ with open(TEST_REFERENCE) as csvfile:\nreader = csv.reader(csvfile)\nnext(reader)\nfor row in reader:\n@@ -329,23 +332,27 @@ def run_tests(args):\nmaxCount = len(args.testBlockSize) * len(testList)\ncurCount = 0\n+ statRun = 0\n+ statSkip = 0\n+ statPass = 0\n+\nfor blockSize in args.testBlockSize:\nfor test in testList:\ncurCount += 1\n# Skip tests not enabled for the current testing throughness level\nif args.testLevel not in test.useLevel:\n- # TODO: Flag these as skipped in juxml?\n+ statSkip += 1\ncontinue\n# Skip tests not enabled for the current dynamic range level\nif args.testRange not in test.useRange:\n- # TODO: Flag these as skipped in juxml?\n+ statSkip += 1\ncontinue\n# Skip tests not enabled for the current data format\nif args.testFormat not in test.useFormat:\n- # TODO: Flag these as skipped in juxml?\n+ statSkip += 1\ncontinue\n# Start a new suite if the format changes\n@@ -362,6 +369,12 @@ def run_tests(args):\ndat = (curCount, maxCount, test.name, blockSize,\ntest.runPSNR[blockSize], test.runTime[blockSize],\ntest.status[blockSize])\n+\n+ # Log results\n+ statRun += 1\n+ if \"pass\" in test.status[blockSize]:\n+ statPass += 1\n+\nlog = \"Ran test %u/%u: %s %s, %0.3f dB, %0.3f s, %s\" % dat\nprint(\" + %s\" % log)\n@@ -377,6 +390,13 @@ def run_tests(args):\nmsg = \"PSNR fail %0.3f dB is worse than %s dB\" % dat\ncase.add_failure_info(msg)\n+ # Print summary results\n+ print(\"\\nSummary\")\n+ if statRun == statPass:\n+ print(\"+ PASS (%u ran)\" % statRun)\n+ else:\n+ print(\"+ FAIL (%u ran, %u failed)\" % (statRun, statRun - statPass))\n+\n# Write the JUnit results file\nwith open(\"TestOutput/results.xml\", \"w\") as fileHandle:\njuxml.TestSuite.to_file(fileHandle, suites)\n@@ -420,7 +440,7 @@ def run_reference_rebuild():\nprint(\" + %s dB / %s s\" % (runPSNR, runTime))\n# Write CSV\n- with open(\"Test/reference.csv\", \"w\", newline=\"\") as fileHandle:\n+ with open(TEST_REFERENCE, \"w\", newline=\"\") as fileHandle:\nwriter = csv.writer(fileHandle)\nwriter.writerow([\"Name\", \"Block Size\", \"PSNR (dB)\", \"Time (s)\"])\nfor blockSize in TEST_BLOCK_SIZES:\n@@ -439,7 +459,7 @@ def run_reference_update():\nTestImage.testRuns = 1\nTestImage.warmupRuns = 0\nelse:\n- TestImage.testRuns = 10\n+ TestImage.testRuns = 3\nTestImage.warmupRuns = 1\n# Delete and recreate test output location\n@@ -473,7 +493,7 @@ def run_reference_update():\nprint(\" + %s dB / %s s\" % (runPSNR, runTime))\n# Write CSV\n- with open(\"Test/reference.csv\", \"w\", newline=\"\") as fileHandle:\n+ with open(TEST_REFERENCE, \"w\", newline=\"\") as fileHandle:\nwriter = csv.writer(fileHandle)\nwriter.writerow([\"Name\", \"Block Size\", \"PSNR (dB)\", \"Time (s)\"])\nfor blockSize in TEST_BLOCK_SIZES:\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Add helper scripts for profiling
61,745
03.01.2020 00:17:02
0
c4ff635a28aa2295687b8d6af7151965b987fe6f
Disable compressor diagnostic support by default
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -58,9 +58,9 @@ NORETURN void astc_codec_internal_error(const char *filename, int linenumber);\n// works on Linux only, and slows down encoding significantly.\n// #define DEBUG_CAPTURE_NAN\n-// the PRINT_DIAGNOSTICS macro enables the -diag command line switch,\n-// which can be used to look for codec bugs\n-#define DEBUG_PRINT_DIAGNOSTICS\n+// uncomment this macro to enable the ability to log diagnostics using the\n+// -diag command line switch, which is useful for bug hunting in the encoder\n+// #define DEBUG_PRINT_DIAGNOSTICS\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nextern int print_diagnostics;\n@@ -620,7 +620,7 @@ void merge_endpoints(const endpoints * ep1, // contains three of the color compo\n// function to pack a pair of color endpoints into a series of integers.\n// the format used may or may not match the format specified;\n// the return value is the format actually used.\n-int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, int format, int *output, int quantization_level);\n+int pack_color_endpoints(float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, int format, int *output, int quantization_level);\n// unpack a pair of color endpoints from a series of integers.\nvoid unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_quantize.cpp", "new_path": "Source/astc_color_quantize.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -1816,7 +1816,7 @@ void quantize_hdr_rgb_alpha3(float4 color0, float4 color1, int output[8], int qu\nQuantize a color. When quantizing an RGB or RGBA color, the quantizer may choose a\ndelta-based representation; as such, it will report back the format it actually used.\n*/\n-int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color,\n+int pack_color_endpoints(float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color,\nint format, int *output, int quantization_level)\n{\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -1967,18 +1967,6 @@ int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 col\nfor (i = 0; i < 8; i++)\nprintf(\" %X\", output[i]);\n-\n- ushort4 res0;\n- ushort4 res1;\n- int rgb_hdr;\n- int alpha_hdr;\n- int nan_endpoint;\n-\n- unpack_color_endpoints(decode_mode, retval, quantization_level, output, &rgb_hdr, &alpha_hdr, &nan_endpoint, &res0, &res1);\n- printf(\"rgb-hdr=%d alpha-hdr=%d nan-endpoint=%d\\n\", rgb_hdr, alpha_hdr, nan_endpoint);\n-\n- printf(\"Unquantized color 0: <%u %u %u %u>\\n\", res0.x, res0.y, res0.z, res0.w);\n- printf(\"Unquantized color 1: <%u %u %u %u>\\n\", res1.x, res1.y, res1.z, res1.w);\nprintf(\"\\n\\n\");\n}\n#endif\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -423,8 +423,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\n// store the colors for the block\nfor (j = 0; j < partition_count; j++)\n{\n- scb->color_formats[j] = pack_color_endpoints(decode_mode,\n- eix[decimation_mode].ep.endpt0[j],\n+ scb->color_formats[j] = pack_color_endpoints(eix[decimation_mode].ep.endpt0[j],\neix[decimation_mode].ep.endpt1[j],\nrgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n}\n@@ -443,8 +442,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\nint color_formats_mod[4];\nfor (j = 0; j < partition_count; j++)\n{\n- color_formats_mod[j] = pack_color_endpoints(decode_mode,\n- eix[decimation_mode].ep.endpt0[j],\n+ color_formats_mod[j] = pack_color_endpoints(eix[decimation_mode].ep.endpt0[j],\neix[decimation_mode].ep.endpt1[j],\nrgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n}\n@@ -713,8 +711,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\n// store the colors for the block\nfor (j = 0; j < partition_count; j++)\n{\n- scb->color_formats[j] = pack_color_endpoints(decode_mode,\n- epm.endpt0[j],\n+ scb->color_formats[j] = pack_color_endpoints(epm.endpt0[j],\nepm.endpt1[j],\nrgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]);\n}\n@@ -728,8 +725,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\nint color_formats_mod[4];\nfor (j = 0; j < partition_count; j++)\n{\n- color_formats_mod[j] = pack_color_endpoints(decode_mode,\n- epm.endpt0[j],\n+ color_formats_mod[j] = pack_color_endpoints(epm.endpt0[j],\nepm.endpt1[j],\nrgbs_colors[j], rgbo_colors[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]);\n}\n@@ -1256,7 +1252,6 @@ float compress_symbolic_block(const astc_codec_image * input_image,\nint xpos = blk->xpos;\nint ypos = blk->ypos;\nint zpos = blk->zpos;\n- int x, y, z;\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n@@ -1271,9 +1266,9 @@ float compress_symbolic_block(const astc_codec_image * input_image,\nprintf(\"Alpha-min: %f Alpha-max: %f\\n\", blk->alpha_min, blk->alpha_max);\nprintf(\"Grayscale: %d\\n\", blk->grayscale);\n- for (z = 0; z < zdim; z++)\n- for (y = 0; y < ydim; y++)\n- for (x = 0; x < xdim; x++)\n+ for (int z = 0; z < zdim; z++)\n+ for (int y = 0; y < ydim; y++)\n+ for (int x = 0; x < xdim; x++)\n{\nint idx = ((z * ydim + y) * xdim + x) * 4;\nprintf(\"Texel (%d %d %d) : orig=< %g, %g, %g, %g >, work=< %g, %g, %g, %g >\\n\",\n@@ -1357,9 +1352,9 @@ float compress_symbolic_block(const astc_codec_image * input_image,\nif (print_diagnostics)\n{\nprintf(\"\\n\");\n- for (z = 0; z < zdim; z++)\n- for (y = 0; y < ydim; y++)\n- for (x = 0; x < xdim; x++)\n+ for (int z = 0; z < zdim; z++)\n+ for (int y = 0; y < ydim; y++)\n+ for (int x = 0; x < xdim; x++)\n{\nint idx = (z * ydim + y) * xdim + x;\nprintf(\"ErrorWeight (%d %d %d) : < %g, %g, %g, %g >\\n\", x, y, z, ewb->error_weights[idx].x, ewb->error_weights[idx].y, ewb->error_weights[idx].z, ewb->error_weights[idx].w);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -1018,13 +1018,13 @@ void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * ea\n{\nint i, j, k;\n- int blockdim = (int)floor(sqrt((float)it->num_texels) + 0.5f);\nint texels_per_block = it->num_texels;\nint weight_count = it->num_weights;\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n{\n+ int blockdim = (int)floor(sqrt((float)it->num_texels) + 0.5f);\nprintf(\"%s : decimation from %d to %d weights\\n\\n\", __func__, it->num_texels, it->num_weights);\nprintf(\"Input weight set:\\n\");\nfor (i = 0; i < it->num_texels; i++)\n@@ -1054,7 +1054,6 @@ void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * ea\n// if the shortcut is not available, we will instead compute a simple estimate\n// and perform three rounds of refinement on that estimate.\n- float initial_weight_set[MAX_WEIGHTS_PER_BLOCK];\nfloat infilled_weights[MAX_TEXELS_PER_BLOCK];\n// compute an initial average for each weight.\n@@ -1078,6 +1077,7 @@ void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * ea\n}\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n+ float initial_weight_set[MAX_WEIGHTS_PER_BLOCK];\nif (print_diagnostics)\n{\n// stash away the initial-weight estimates for later printing\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_pick_best_endpoint_format.cpp", "new_path": "Source/astc_pick_best_endpoint_format.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -45,7 +45,7 @@ static void compute_color_error_for_every_integer_count_and_quantization_level(i\n// arrays to return results back through.\nfloat best_error[21][4], int format_of_choice[21][4])\n{\n- int i, j;\n+ int i;\nint partition_size = pi->texels_per_partition[partition_index];\nstatic const float baseline_quant_error[21] = {\n@@ -286,7 +286,7 @@ static void compute_color_error_for_every_integer_count_and_quantization_level(i\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n{\n- for (j = 0; j < 4; j++)\n+ for (int j = 0; j < 4; j++)\n{\nprintf(\"(hdr) quant-level=%d ints=%d format=%d error=%f\\n\", i, j, format_of_choice[i][j], best_error[i][j]);\n}\n@@ -383,7 +383,7 @@ static void compute_color_error_for_every_integer_count_and_quantization_level(i\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n{\n- for (j = 0; j < 4; j++)\n+ for (int j = 0; j < 4; j++)\n{\nprintf(\" (ldr) quant-level=%d ints=%d format=%d error=%f\\n\", i, j, format_of_choice[i][j], best_error[i][j]);\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_weight_align.cpp", "new_path": "Source/astc_weight_align.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n#include \"astc_codec_internals.h\"\n-#ifdef DEBUG_PRINT_DIAGNOSTICS\n#include <stdio.h>\n-#endif\nstatic const float angular_steppings[] = {\n1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875,\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Disable compressor diagnostic support by default (#73)
61,745
03.01.2020 00:30:44
0
ff880faf267895761eae4242506c6a99c9c770a2
Remove unused lum path from recompute_ideal_colors
[ { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -673,7 +673,6 @@ void determine_optimal_set_of_endpoint_formats_to_use(int xdim, int ydim, int zd\nvoid recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantization_mode, endpoints * ep, // contains the endpoints we wish to update\nfloat4 * rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6\nfloat4 * rgbo_vectors, // used to return RGBS-vectors for endpoint mode #7\n- float2 * lum_vectors, // used to return luminance-vectors.\nconst uint8_t * weight_set, // the current set of weight values\nconst uint8_t * plane2_weight_set, // NULL if plane 2 is not actually used.\nint plane2_color_component, // color component for 2nd plane of weights; -1 if the 2nd plane of weights is not present\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -411,12 +411,11 @@ static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode dec\n// recompute the ideal color endpoints before storing them.\nfloat4 rgbs_colors[4];\nfloat4 rgbo_colors[4];\n- float2 lum_intervals[4];\nint l;\nfor (l = 0; l < max_refinement_iters; l++)\n{\n- recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &(eix[decimation_mode].ep), rgbs_colors, rgbo_colors, lum_intervals, u8_weight_src, NULL, -1, pi, it, blk, ewb);\n+ recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &(eix[decimation_mode].ep), rgbs_colors, rgbo_colors, u8_weight_src, NULL, -1, pi, it, blk, ewb);\n// quantize the chosen color\n@@ -701,12 +700,11 @@ static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode de\nfloat4 rgbs_colors[4];\nfloat4 rgbo_colors[4];\n- float2 lum_intervals[4];\nint l;\nfor (l = 0; l < max_refinement_iters; l++)\n{\n- recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &epm, rgbs_colors, rgbo_colors, lum_intervals, u8_weight1_src, u8_weight2_src, separate_component, pi, it, blk, ewb);\n+ recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &epm, rgbs_colors, rgbo_colors, u8_weight1_src, u8_weight2_src, separate_component, pi, it, blk, ewb);\n// store the colors for the block\nfor (j = 0; j < partition_count; j++)\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1467,7 +1467,6 @@ static inline float mat_square_sum(mat2 p)\nvoid recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantization_mode, endpoints * ep, // contains the endpoints we wish to update\nfloat4 * rgbs_vectors, // used to return RGBS-vectors. (endpoint mode #6)\nfloat4 * rgbo_vectors, // used to return RGBO-vectors. (endpoint mode #7)\n- float2 * lum_vectors, // used to return luminance-vectors.\nconst uint8_t * weight_set8, // the current set of weight values\nconst uint8_t * plane2_weight_set8, // NULL if plane 2 is not actually used.\nint plane2_color_component, // color component for 2nd plane of weights; -1 if the 2nd plane of weights is not present\n@@ -1510,13 +1509,12 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\n}\n#endif\n- mat2 pmat1_red[4], pmat1_green[4], pmat1_blue[4], pmat1_alpha[4], pmat1_lum[4], pmat1_scale[4]; // matrices for plane of weights 1\n+ mat2 pmat1_red[4], pmat1_green[4], pmat1_blue[4], pmat1_alpha[4], pmat1_scale[4]; // matrices for plane of weights 1\nmat2 pmat2_red[4], pmat2_green[4], pmat2_blue[4], pmat2_alpha[4]; // matrices for plane of weights 2\nfloat2 red_vec[4];\nfloat2 green_vec[4];\nfloat2 blue_vec[4];\nfloat2 alpha_vec[4];\n- float2 lum_vec[4];\nfloat2 scale_vec[4];\nfor (i = 0; i < partition_count; i++)\n@@ -1531,7 +1529,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\npmat2_blue[i].v[j] = float2(0, 0);\npmat1_alpha[i].v[j] = float2(0, 0);\npmat2_alpha[i].v[j] = float2(0, 0);\n- pmat1_lum[i].v[j] = float2(0, 0);\npmat1_scale[i].v[j] = float2(0, 0);\n}\n@@ -1539,7 +1536,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\ngreen_vec[i] = float2(0, 0);\nblue_vec[i] = float2(0, 0);\nalpha_vec[i] = float2(0, 0);\n- lum_vec[i] = float2(0, 0);\nscale_vec[i] = float2(0, 0);\n}\n@@ -1549,7 +1545,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nfloat green_weight_sum[4];\nfloat blue_weight_sum[4];\nfloat alpha_weight_sum[4];\n- float lum_weight_sum[4];\nfloat scale_weight_sum[4];\nfloat red_weight_weight_sum[4];\n@@ -1570,7 +1565,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nblue_weight_sum[i] = 1e-17f;\nalpha_weight_sum[i] = 1e-17f;\n- lum_weight_sum[i] = 1e-17f;\nscale_weight_sum[i] = 1e-17f;\nred_weight_weight_sum[i] = 1e-17f;\n@@ -1587,8 +1581,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nfloat3 scale_directions[4];\nfloat scale_min[4];\nfloat scale_max[4];\n- float lum_min[4];\n- float lum_max[4];\nfor (i = 0; i < partition_count; i++)\n{\n@@ -1613,8 +1605,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nscale_directions[i] = normalize(rgb_sum[i] / rgb_weight_sum[i]);\nscale_max[i] = 0.0f;\nscale_min[i] = 1e10f;\n- lum_max[i] = 0.0f;\n- lum_min[i] = 1e10f;\n}\nfor (i = 0; i < texels_per_block; i++)\n@@ -1638,16 +1628,10 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nfloat blue_weight = ewb->texel_weight_b[i];\nfloat alpha_weight = ewb->texel_weight_a[i];\n- float lum_weight = (red_weight + green_weight + blue_weight);\n- float scale_weight = lum_weight;\n+ float scale_weight = (red_weight + green_weight + blue_weight);\n- float lum = (r * red_weight + g * green_weight + b * blue_weight) / lum_weight;\nfloat3 scale_direction = scale_directions[part];\nfloat scale = dot(scale_direction, float3(r, g, b));\n- if (lum < lum_min[part])\n- lum_min[part] = scale;\n- if (lum > lum_max[part])\n- lum_max[part] = scale;\nif (scale < scale_min[part])\nscale_min[part] = scale;\nif (scale > scale_max[part])\n@@ -1657,7 +1641,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\ngreen_weight_sum[part] += green_weight;\nblue_weight_sum[part] += blue_weight;\nalpha_weight_sum[part] += alpha_weight;\n- lum_weight_sum[part] += lum_weight;\nscale_weight_sum[part] += scale_weight;\npmat1_red[part].v[0].x += om_idx0 * om_idx0 * red_weight;\n@@ -1680,11 +1663,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\npmat1_alpha[part].v[1].x += idx0 * om_idx0 * alpha_weight;\npmat1_alpha[part].v[1].y += idx0 * idx0 * alpha_weight;\n- pmat1_lum[part].v[0].x += om_idx0 * om_idx0 * lum_weight;\n- pmat1_lum[part].v[0].y += idx0 * om_idx0 * lum_weight;\n- pmat1_lum[part].v[1].x += idx0 * om_idx0 * lum_weight;\n- pmat1_lum[part].v[1].y += idx0 * idx0 * lum_weight;\n-\npmat1_scale[part].v[0].x += om_idx0 * om_idx0 * scale_weight;\npmat1_scale[part].v[0].y += idx0 * om_idx0 * scale_weight;\npmat1_scale[part].v[1].x += idx0 * om_idx0 * scale_weight;\n@@ -1730,14 +1708,12 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\ngreen_vec[part].x += (green_weight * g) * (1.0f - green_idx);\nblue_vec[part].x += (blue_weight * b) * (1.0f - blue_idx);\nalpha_vec[part].x += (alpha_weight * a) * (1.0f - alpha_idx);\n- lum_vec[part].x += (lum_weight * lum) * om_idx0;\nscale_vec[part].x += (scale_weight * scale) * om_idx0;\nred_vec[part].y += (red_weight * r) * red_idx;\ngreen_vec[part].y += (green_weight * g) * green_idx;\nblue_vec[part].y += (blue_weight * b) * blue_idx;\nalpha_vec[part].y += (alpha_weight * a) * alpha_idx;\n- lum_vec[part].y += (lum_weight * lum) * idx0;\nscale_vec[part].y += (scale_weight * scale) * idx0;\nred_weight_weight_sum[part] += red_weight * red_idx;\n@@ -1812,7 +1788,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nscalediv = 1.0f;\nrgbs_vectors[i] = float4(scale_directions[i] * scale_max[i], scalediv);\n- lum_vectors[i] = float2(lum_min[i], lum_max[i]);\n}\nfor (i = 0; i < partition_count; i++)\n@@ -1836,8 +1811,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nep->endpt0[i].w = ep->endpt1[i].w = avg.w;\nrgbs_vectors[i] = float4(scale_directions[i] * scale_max[i], 1.0f);\n- float lumval = (red_vec[i].x + red_vec[i].y + green_vec[i].x + green_vec[i].y + blue_vec[i].x + blue_vec[i].y) / (red_weight_sum[i] + green_weight_sum[i] + blue_weight_sum[i]);\n- lum_vectors[i] = float2(lumval, lumval);\n}\nelse\n{\n@@ -1852,14 +1825,12 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nfloat green_det1 = determinant(pmat1_green[i]);\nfloat blue_det1 = determinant(pmat1_blue[i]);\nfloat alpha_det1 = determinant(pmat1_alpha[i]);\n- float lum_det1 = determinant(pmat1_lum[i]);\nfloat scale_det1 = determinant(pmat1_scale[i]);\nfloat red_mss1 = mat_square_sum(pmat1_red[i]);\nfloat green_mss1 = mat_square_sum(pmat1_green[i]);\nfloat blue_mss1 = mat_square_sum(pmat1_blue[i]);\nfloat alpha_mss1 = mat_square_sum(pmat1_alpha[i]);\n- float lum_mss1 = mat_square_sum(pmat1_lum[i]);\nfloat scale_mss1 = mat_square_sum(pmat1_scale[i]);\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -1871,7 +1842,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\npmat1_green[i] = invert(pmat1_green[i]);\npmat1_blue[i] = invert(pmat1_blue[i]);\npmat1_alpha[i] = invert(pmat1_alpha[i]);\n- pmat1_lum[i] = invert(pmat1_lum[i]);\npmat1_scale[i] = invert(pmat1_scale[i]);\nfloat4 ep0 = float4(dot(pmat1_red[i].v[0], red_vec[i]),\n@@ -1883,8 +1853,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\ndot(pmat1_blue[i].v[1], blue_vec[i]),\ndot(pmat1_alpha[i].v[1], alpha_vec[i]));\n- float lum_ep0 = dot(pmat1_lum[i].v[0], lum_vec[i]);\n- float lum_ep1 = dot(pmat1_lum[i].v[1], lum_vec[i]);\nfloat scale_ep0 = dot(pmat1_scale[i].v[0], scale_vec[i]);\nfloat scale_ep1 = dot(pmat1_scale[i].v[1], scale_vec[i]);\n@@ -1909,11 +1877,6 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\nep->endpt1[i].w = ep1.w;\n}\n- if (fabs(lum_det1) > (lum_mss1 * 1e-4f) && lum_ep0 == lum_ep0 && lum_ep1 == lum_ep1 && lum_ep0 < lum_ep1)\n- {\n- lum_vectors[i].x = lum_ep0;\n- lum_vectors[i].y = lum_ep1;\n- }\nif (fabs(scale_det1) > (scale_mss1 * 1e-4f) && scale_ep0 == scale_ep0 && scale_ep1 == scale_ep1 && scale_ep0 < scale_ep1)\n{\nfloat scalediv = scale_ep0 / scale_ep1;\n@@ -2038,12 +2001,8 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\n{\nprintf(\"%d Low <%g %g %g %g>\\n\", i, ep->endpt0[i].x, ep->endpt0[i].y, ep->endpt0[i].z, ep->endpt0[i].w);\nprintf(\"%d High <%g %g %g %g>\\n\", i, ep->endpt1[i].x, ep->endpt1[i].y, ep->endpt1[i].z, ep->endpt1[i].w);\n-\nprintf(\"%d RGBS: <%g %g %g %g>\\n\", i, rgbs_vectors[i].x, rgbs_vectors[i].y, rgbs_vectors[i].z, rgbs_vectors[i].w);\n-\nprintf(\"%d RGBO <%g %g %g %g>\\n\", i, rgbo_vectors[i].x, rgbo_vectors[i].y, rgbo_vectors[i].z, rgbo_vectors[i].w);\n-\n- printf(\"%d Lum: <%g %g>\\n\", i, lum_vectors[i].x, lum_vectors[i].y);\n}\n}\n#endif\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove unused lum path from recompute_ideal_colors
61,745
03.01.2020 00:32:36
0
daea597c13e6feaf7505235186b86c01eaa59e40
Remove unused lum diagnostic print
[ { "change_type": "MODIFY", "old_path": "Source/astc_ideal_endpoints_and_weights.cpp", "new_path": "Source/astc_ideal_endpoints_and_weights.cpp", "diff": "@@ -1835,7 +1835,7 @@ void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantizatio\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n- printf(\"Plane-1 partition %d determinants: R=%g G=%g B=%g A=%g L=%g S=%g\\n\", i, red_det1, green_det1, blue_det1, alpha_det1, lum_det1, scale_det1);\n+ printf(\"Plane-1 partition %d determinants: R=%g G=%g B=%g A=%g S=%g\\n\", i, red_det1, green_det1, blue_det1, alpha_det1, scale_det1);\n#endif\npmat1_red[i] = invert(pmat1_red[i]);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove unused lum diagnostic print
61,745
03.01.2020 09:39:05
0
218fcdaa8e6534e9a6286ef59eb76f6ac6d65c9b
Clean up Makefile options
[ { "change_type": "MODIFY", "old_path": "Source/Makefile", "new_path": "Source/Makefile", "diff": "@@ -43,7 +43,8 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -std=c++11 -O3 -Wall -W -Wall -Wextra -Wpedantic -Werror -Werror=shadow -msse2 -mfpmath=sse\n+CPPFLAGS = -std=c++11 -O3 -msse2 -mfpmath=sse \\\n+ -Wall -Wextra -Wpedantic -Werror -Werror=shadow\nastcenc: $(OBJECTS)\n@g++ -o $@ $^ $(CPPFLAGS) -lpthread\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Clean up Makefile options
61,745
04.01.2020 02:32:34
0
79dc6767ed124a279a9c98afa3b8c61e6c655b68
Bump version number on the command line
[ { "change_type": "MODIFY", "old_path": "Docs/ChangeLog.md", "new_path": "Docs/ChangeLog.md", "diff": "@@ -7,8 +7,8 @@ bisection easier, the list is maintained in approximate chronological order\n## Maths library changes\n-The astc_mathlib library has been cleaned up, with a lot of unused\n-functionality stripped out.\n+The astc_mathlib library has been cleaned up, with all unused functionality\n+stripped out.\nThe vector template classes have been stripped back to a basic implementation,\nwith the flexible channel swizzle functionality removed. This makes it easier\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_toplevel.cpp", "new_path": "Source/astc_toplevel.cpp", "diff": "@@ -728,8 +728,8 @@ int astc_main(int argc, char **argv)\nif (argc < 4)\n{\n- printf( \"ASTC codec version 1.7\\n\"\n- \"Copyright (C) 2011-2019 Arm Limited\\n\"\n+ printf( \"ASTC codec version 2.0 (alpha)\\n\"\n+ \"Copyright (C) 2011-2020 Arm Limited\\n\"\n\"All rights reserved. Use of this software is subject to terms of its license.\\n\\n\"\n\"Usage:\\n\"\n\"Compress to texture file:\\n\"\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Bump version number on the command line
61,745
04.01.2020 14:49:10
0
c6e90e45f1fa7fd607de567fdc9977bd3e5cb5c1
Swap all ushort4 for uint4 and remove ushort4 support
[ { "change_type": "ADD", "old_path": null, "new_path": "Docs/BranchNotes.md", "diff": "+# Branch 2.0 design notes\n+\n+# Objectives\n+\n+The aim of the 2.0 work is to achieve the equivalent of `-thorough` encoding\n+quality with `-medium` performance. This equates to an ~8x performance\n+improvement over the version 1.x codec, at the same output quality, and without\n+losing any of the format features (e.g. block sizes and modes) currently\n+supported.\n+\n+There are four main approaches which will be used to achieve this.\n+\n+* Code simplification\n+* Datapath restructuring\n+* Algorithm tuning\n+* CPU SIMD vectorization\n+\n+We are currently focussing on the code simplification and algorithm review.\n+\n+## Code simplification\n+\n+The version 1.0 codec was initially developed as part of the the ASTC format\n+design, evolving as the format was developed and refined. A lot of the v1.x\n+implementation was therefore built to be modular and easy to adapt as the\n+format design changed, rather than for the best possible performance. Now that\n+the format has been published we can review all of the existing code, and\n+rework it for performance rather than ease of modification.\n+\n+## Datapath restructuring\n+\n+The current code does one block at a time, in a depth-first search with full\n+iterative refinement at each stage until the target quality is either hit or we\n+run out of codec options to try. This approach is easier to understand, but the\n+resulting code is control plane heavy and includes a lot of overhead which\n+cannot be amoritzed over multiple blocks. As a first step for SIMD\n+vectorization the data path must be reviewed to make sure that it can be\n+vectorized efficiently.\n+\n+* Batching processing passes for multiple blocks.\n+* Reducing branching and branch divergence to allow SIMD batching.\n+* Reducing scatter/gather loads to ensure efficient memory access.\n+* Amortizing memory access cost over multiple blocks\n+\n+The restructure becomes particular important with an eye on a long-term\n+objective (v3?) to support compression passes running on a GPU, as it is\n+necessary to offload relatively large batches of work, while also avoiding\n+bottlenecking GPU performance on memory access overheads rather than useful\n+processing.\n+\n+## Algorithm tuning\n+\n+As part of the restructuring we will review the effectiveness of the existing\n+optimization passes that we have in the code, to see what can be removed. We\n+know that some passes are expensive and/or difficult to vectorize, and do not\n+actually justify that cost in significant quality improvements.\n+\n+In addition many math library operations will be reviewed and replaced with\n+faster implementations which are less accurate but more friendly towards\n+vectorization in future.\n+\n+## CPU SIMD vectorization\n+\n+The final stage, once we are happy with the data path design, will be to look\n+at implementing a true SIMD data path for the CPU. This could be done using\n+manual SIMD code, such as intrinsics, or a compiled SIMD generator,\n+such as ISPC; the decision here can happen later.\n+\n+# TODOs\n+\n+* The `double4` vector type doesn't vectorize well with SIMD; it should be\n+ removed, but this probably means we need a new algorithm for that part\n+ of the code.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -604,7 +604,7 @@ void merge_endpoints(const endpoints * ep1, // contains three of the color compo\nint pack_color_endpoints(float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, int format, int *output, int quantization_level);\n// unpack a pair of color endpoints from a series of integers.\n-void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1);\n+void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, uint4 * output0, uint4 * output1);\nstruct encoding_choice_errors\n{\n@@ -692,7 +692,7 @@ float4 lerp_color_flt(const float4 color0, const float4 color1, float weight, //\nint plane2_color_component // 0..3; -1 if only one plane of weights is present.\n);\n-ushort4 lerp_color_int(astc_decode_mode decode_mode, ushort4 color0, ushort4 color1, int weight, // 0..64\n+uint4 lerp_color_int(astc_decode_mode decode_mode, uint4 color0, uint4 color1, int weight, // 0..64\nint plane2_weight, // 0..64\nint plane2_color_component // 0..3; -1 if only one plane of weights is present.\n);\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_color_unquantize.cpp", "new_path": "Source/astc_color_unquantize.cpp", "diff": "#include \"astc_codec_internals.h\"\n-int rgb_delta_unpack(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1)\n+int rgb_delta_unpack(const int input[6], int quantization_level, uint4 * output0, uint4 * output1)\n{\n// unquantize the color endpoints\nint r0 = color_unquantization_tables[quantization_level][input[0]];\n@@ -124,7 +124,7 @@ int rgb_delta_unpack(const int input[6], int quantization_level, ushort4 * outpu\nreturn retval;\n}\n-int rgb_unpack(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1)\n+int rgb_unpack(const int input[6], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint ri0b = color_unquantization_tables[quantization_level][input[0]];\n@@ -168,7 +168,7 @@ int rgb_unpack(const int input[6], int quantization_level, ushort4 * output0, us\n}\n}\n-void rgba_unpack(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void rgba_unpack(const int input[8], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint order = rgb_unpack(input, quantization_level, output0, output1);\nif (order == 0)\n@@ -183,7 +183,7 @@ void rgba_unpack(const int input[8], int quantization_level, ushort4 * output0,\n}\n}\n-void rgba_delta_unpack(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void rgba_delta_unpack(const int input[8], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint a0 = color_unquantization_tables[quantization_level][input[6]];\nint a1 = color_unquantization_tables[quantization_level][input[7]];\n@@ -213,7 +213,7 @@ void rgba_delta_unpack(const int input[8], int quantization_level, ushort4 * out\n}\n}\n-void rgb_scale_unpack(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void rgb_scale_unpack(const int input[4], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint ir = color_unquantization_tables[quantization_level][input[0]];\nint ig = color_unquantization_tables[quantization_level][input[1]];\n@@ -221,26 +221,26 @@ void rgb_scale_unpack(const int input[4], int quantization_level, ushort4 * outp\nint iscale = color_unquantization_tables[quantization_level][input[3]];\n- *output1 = ushort4(ir, ig, ib, 255);\n- *output0 = ushort4((ir * iscale) >> 8, (ig * iscale) >> 8, (ib * iscale) >> 8, 255);\n+ *output1 = uint4(ir, ig, ib, 255);\n+ *output0 = uint4((ir * iscale) >> 8, (ig * iscale) >> 8, (ib * iscale) >> 8, 255);\n}\n-void rgb_scale_alpha_unpack(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void rgb_scale_alpha_unpack(const int input[6], int quantization_level, uint4 * output0, uint4 * output1)\n{\nrgb_scale_unpack(input, quantization_level, output0, output1);\noutput0->w = color_unquantization_tables[quantization_level][input[4]];\noutput1->w = color_unquantization_tables[quantization_level][input[5]];\n}\n-void luminance_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void luminance_unpack(const int input[2], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint lum0 = color_unquantization_tables[quantization_level][input[0]];\nint lum1 = color_unquantization_tables[quantization_level][input[1]];\n- *output0 = ushort4(lum0, lum0, lum0, 255);\n- *output1 = ushort4(lum1, lum1, lum1, 255);\n+ *output0 = uint4(lum0, lum0, lum0, 255);\n+ *output1 = uint4(lum1, lum1, lum1, 255);\n}\n-void luminance_delta_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void luminance_delta_unpack(const int input[2], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\nint v1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -250,21 +250,21 @@ void luminance_delta_unpack(const int input[2], int quantization_level, ushort4\nif (l1 > 255)\nl1 = 255;\n- *output0 = ushort4(l0, l0, l0, 255);\n- *output1 = ushort4(l1, l1, l1, 255);\n+ *output0 = uint4(l0, l0, l0, 255);\n+ *output1 = uint4(l1, l1, l1, 255);\n}\n-void luminance_alpha_unpack(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void luminance_alpha_unpack(const int input[4], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint lum0 = color_unquantization_tables[quantization_level][input[0]];\nint lum1 = color_unquantization_tables[quantization_level][input[1]];\nint alpha0 = color_unquantization_tables[quantization_level][input[2]];\nint alpha1 = color_unquantization_tables[quantization_level][input[3]];\n- *output0 = ushort4(lum0, lum0, lum0, alpha0);\n- *output1 = ushort4(lum1, lum1, lum1, alpha1);\n+ *output0 = uint4(lum0, lum0, lum0, alpha0);\n+ *output1 = uint4(lum1, lum1, lum1, alpha1);\n}\n-void luminance_alpha_delta_unpack(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void luminance_alpha_delta_unpack(const int input[4], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint lum0 = color_unquantization_tables[quantization_level][input[0]];\nint lum1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -297,12 +297,12 @@ void luminance_alpha_delta_unpack(const int input[4], int quantization_level, us\nelse if (alpha1 > 255)\nalpha1 = 255;\n- *output0 = ushort4(lum0, lum0, lum0, alpha0);\n- *output1 = ushort4(lum1, lum1, lum1, alpha1);\n+ *output0 = uint4(lum0, lum0, lum0, alpha0);\n+ *output1 = uint4(lum1, lum1, lum1, alpha1);\n}\n// RGB-offset format\n-void hdr_rgbo_unpack3(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_rgbo_unpack3(const int input[4], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\nint v1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -438,11 +438,11 @@ void hdr_rgbo_unpack3(const int input[4], int quantization_level, ushort4 * outp\nif (blue0 < 0)\nblue0 = 0;\n- *output0 = ushort4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);\n- *output1 = ushort4(red << 4, green << 4, blue << 4, 0x7800);\n+ *output0 = uint4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);\n+ *output1 = uint4(red << 4, green << 4, blue << 4, 0x7800);\n}\n-void hdr_rgb_unpack3(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_rgb_unpack3(const int input[6], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\n@@ -459,8 +459,8 @@ void hdr_rgb_unpack3(const int input[6], int quantization_level, ushort4 * outpu\nif (majcomp == 3)\n{\n- *output0 = ushort4(v0 << 8, v2 << 8, (v4 & 0x7F) << 9, 0x7800);\n- *output1 = ushort4(v1 << 8, v3 << 8, (v5 & 0x7F) << 9, 0x7800);\n+ *output0 = uint4(v0 << 8, v2 << 8, (v4 & 0x7F) << 9, 0x7800);\n+ *output1 = uint4(v1 << 8, v3 << 8, (v5 & 0x7F) << 9, 0x7800);\nreturn;\n}\n@@ -612,11 +612,11 @@ void hdr_rgb_unpack3(const int input[6], int quantization_level, ushort4 * outpu\nbreak;\n}\n- *output0 = ushort4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);\n- *output1 = ushort4(red1 << 4, green1 << 4, blue1 << 4, 0x7800);\n+ *output0 = uint4(red0 << 4, green0 << 4, blue0 << 4, 0x7800);\n+ *output1 = uint4(red1 << 4, green1 << 4, blue1 << 4, 0x7800);\n}\n-void hdr_rgb_ldr_alpha_unpack3(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_rgb_ldr_alpha_unpack3(const int input[8], int quantization_level, uint4 * output0, uint4 * output1)\n{\nhdr_rgb_unpack3(input, quantization_level, output0, output1);\n@@ -626,7 +626,7 @@ void hdr_rgb_ldr_alpha_unpack3(const int input[8], int quantization_level, ushor\noutput1->w = v7;\n}\n-void hdr_luminance_small_range_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_luminance_small_range_unpack(const int input[2], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\nint v1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -647,11 +647,11 @@ void hdr_luminance_small_range_unpack(const int input[2], int quantization_level\nif (y1 > 0xFFF)\ny1 = 0xFFF;\n- *output0 = ushort4(y0 << 4, y0 << 4, y0 << 4, 0x7800);\n- *output1 = ushort4(y1 << 4, y1 << 4, y1 << 4, 0x7800);\n+ *output0 = uint4(y0 << 4, y0 << 4, y0 << 4, 0x7800);\n+ *output1 = uint4(y1 << 4, y1 << 4, y1 << 4, 0x7800);\n}\n-void hdr_luminance_large_range_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_luminance_large_range_unpack(const int input[2], int quantization_level, uint4 * output0, uint4 * output1)\n{\nint v0 = color_unquantization_tables[quantization_level][input[0]];\nint v1 = color_unquantization_tables[quantization_level][input[1]];\n@@ -667,8 +667,8 @@ void hdr_luminance_large_range_unpack(const int input[2], int quantization_level\ny0 = (v1 << 4) + 8;\ny1 = (v0 << 4) - 8;\n}\n- *output0 = ushort4(y0 << 4, y0 << 4, y0 << 4, 0x7800);\n- *output1 = ushort4(y1 << 4, y1 << 4, y1 << 4, 0x7800);\n+ *output0 = uint4(y0 << 4, y0 << 4, y0 << 4, 0x7800);\n+ *output1 = uint4(y1 << 4, y1 << 4, y1 << 4, 0x7800);\n}\nvoid hdr_alpha_unpack(const int input[2], int quantization_level, int *a0, int *a1)\n@@ -708,7 +708,7 @@ void hdr_alpha_unpack(const int input[2], int quantization_level, int *a0, int *\n*a1 <<= 4;\n}\n-void hdr_rgb_hdr_alpha_unpack3(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1)\n+void hdr_rgb_hdr_alpha_unpack3(const int input[8], int quantization_level, uint4 * output0, uint4 * output1)\n{\nhdr_rgb_unpack3(input, quantization_level, output0, output1);\n@@ -719,7 +719,7 @@ void hdr_rgb_hdr_alpha_unpack3(const int input[8], int quantization_level, ushor\noutput1->w = alpha1;\n}\n-void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1)\n+void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, uint4 * output0, uint4 * output1)\n{\n*nan_endpoint = 0;\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_compress_symbolic.cpp", "new_path": "Source/astc_compress_symbolic.cpp", "diff": "@@ -46,8 +46,8 @@ int realign_weights(astc_decode_mode decode_mode,\nint weight_quantization_level = bsd->block_modes[scb->block_mode].quantization_mode;\n// decode the color endpoints\n- ushort4 color_endpoint0[4];\n- ushort4 color_endpoint1[4];\n+ uint4 color_endpoint0[4];\n+ uint4 color_endpoint1[4];\nint rgb_hdr[4];\nint alpha_hdr[4];\nint nan_endpoint[4];\n@@ -92,7 +92,7 @@ int realign_weights(astc_decode_mode decode_mode,\nplane2_weight = compute_value_of_texel_flt( texel, it, uq_plane2_weights ); \\\nint int_plane1_weight = static_cast<int>(floor( plane1_weight*64.0f + 0.5f ) ); \\\nint int_plane2_weight = static_cast<int>(floor( plane2_weight*64.0f + 0.5f ) ); \\\n- ushort4 lrp_color = lerp_color_int( \\\n+ uint4 lrp_color = lerp_color_int( \\\ndecode_mode, \\\ncolor_endpoint0[partition], \\\ncolor_endpoint1[partition], \\\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_decompress_symbolic.cpp", "new_path": "Source/astc_decompress_symbolic.cpp", "diff": "@@ -27,7 +27,7 @@ int compute_value_of_texel_int(int texel_to_get, const decimation_table * it, co\nreturn summed_value >> 4;\n}\n-ushort4 lerp_color_int(astc_decode_mode decode_mode, ushort4 color0, ushort4 color1, int weight, int plane2_weight, int plane2_color_component // -1 in 1-plane mode\n+uint4 lerp_color_int(astc_decode_mode decode_mode, uint4 color0, uint4 color1, int weight, int plane2_weight, int plane2_color_component // -1 in 1-plane mode\n)\n{\nint4 ecolor0 = int4(color0.x, color0.y, color0.z, color0.w);\n@@ -65,7 +65,7 @@ ushort4 lerp_color_int(astc_decode_mode decode_mode, ushort4 color0, ushort4 col\nif (decode_mode == DECODE_LDR_SRGB)\ncolor = color * 257;\n- return ushort4(color.x, color.y, color.z, color.w);\n+ return uint4(color.x, color.y, color.z, color.w);\n}\nvoid decompress_symbolic_block(astc_decode_mode decode_mode,\n@@ -196,8 +196,8 @@ void decompress_symbolic_block(astc_decode_mode decode_mode,\nint weight_quantization_level = bsd->block_modes[scb->block_mode].quantization_mode;\n// decode the color endpoints\n- ushort4 color_endpoint0[4];\n- ushort4 color_endpoint1[4];\n+ uint4 color_endpoint0[4];\n+ uint4 color_endpoint1[4];\nint rgb_hdr_endpoint[4];\nint alpha_hdr_endpoint[4];\nint nan_endpoint[4];\n@@ -245,7 +245,7 @@ void decompress_symbolic_block(astc_decode_mode decode_mode,\n{\nint partition = pt->partition_of_texel[i];\n- ushort4 color = lerp_color_int(decode_mode,\n+ uint4 color = lerp_color_int(decode_mode,\ncolor_endpoint0[partition],\ncolor_endpoint1[partition],\nweights[i],\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_mathlib.h", "new_path": "Source/astc_mathlib.h", "diff": "@@ -53,18 +53,15 @@ typedef vtype2<float> float2;\ntypedef vtype3<float> float3;\ntypedef vtype4<float> float4;\ntypedef vtype4<double> double4;\n-typedef vtype4<unsigned short> ushort4;\ntypedef vtype4<int> int4;\ntypedef vtype4<unsigned int> uint4;\n-// TODO: Optimizations need to get rid of double and ushort from here (double\n-// is large and slow and ushort has weaker support in SSE and AVX than uint)\n+// TODO: Optimizations need to get rid of double; it's slow\nstatic inline float2 operator+(float2 p, float2 q) { return float2( p.x + q.x, p.y + q.y ); }\nstatic inline float3 operator+(float3 p, float3 q) { return float3( p.x + q.x, p.y + q.y, p.z + q.z ); }\nstatic inline float4 operator+(float4 p, float4 q) { return float4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\nstatic inline double4 operator+(double4 p, double4 q) { return double4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\n-static inline ushort4 operator+(ushort4 p, ushort4 q) { return ushort4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\nstatic inline int4 operator+(int4 p, int4 q) { return int4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\nstatic inline uint4 operator+(uint4 p, uint4 q) { return uint4( p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w ); }\n@@ -72,7 +69,6 @@ static inline float2 operator-(float2 p, float2 q) { return float2( p.x - q\nstatic inline float3 operator-(float3 p, float3 q) { return float3( p.x - q.x, p.y - q.y, p.z - q.z ); }\nstatic inline float4 operator-(float4 p, float4 q) { return float4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\nstatic inline double4 operator-(double4 p, double4 q) { return double4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\n-static inline ushort4 operator-(ushort4 p, ushort4 q) { return ushort4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\nstatic inline int4 operator-(int4 p, int4 q) { return int4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\nstatic inline uint4 operator-(uint4 p, uint4 q) { return uint4( p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w ); }\n@@ -80,7 +76,6 @@ static inline float2 operator*(float2 p, float2 q) { return float2( p.x * q\nstatic inline float3 operator*(float3 p, float3 q) { return float3( p.x * q.x, p.y * q.y, p.z * q.z ); }\nstatic inline float4 operator*(float4 p, float4 q) { return float4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\nstatic inline double4 operator*(double4 p, double4 q) { return double4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\n-static inline ushort4 operator*(ushort4 p, ushort4 q) { return ushort4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\nstatic inline int4 operator*(int4 p, int4 q) { return int4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\nstatic inline uint4 operator*(uint4 p, uint4 q) { return uint4( p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w ); }\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Swap all ushort4 for uint4 and remove ushort4 support
61,745
04.01.2020 17:18:24
0
21b9fa84158b70778c7ff567b7ad614a228f0583
Fix bug in cross() and add regression test
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "+.vs\n.vscode\n+*.log\n+*.diff\nSource/*.o\nSource/astcenc\nSource/VS2017/.vs\n" }, { "change_type": "MODIFY", "old_path": "Docs/BranchNotes.md", "new_path": "Docs/BranchNotes.md", "diff": "@@ -70,3 +70,4 @@ such as ISPC; the decision here can happen later.\n* The `double4` vector type doesn't vectorize well with SIMD; it should be\nremoved, but this probably means we need a new algorithm for that part\nof the code.\n+* Remove globals.\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_mathlib.cpp", "new_path": "Source/astc_mathlib.cpp", "diff": "@@ -364,7 +364,7 @@ float3 cross(float3 p, float3 q)\n{\nreturn float3(p.y * q.z - p.z * q.y,\np.z * q.x - p.x * q.z,\n- p.x * q.y - p.y * q.z);\n+ p.x * q.y - p.y * q.x);\n}\n@@ -374,15 +374,6 @@ float determinant(mat2 p)\nreturn v.x - v.y;\n}\n-float determinant(mat4 p)\n-{\n- return dot(p.v[0],\n- float4(dot(float3(p.v[1].y, p.v[1].z, p.v[1].w), cross(float3(p.v[2].y, p.v[2].z, p.v[2].w), float3(p.v[3].y, p.v[3].z, p.v[3].w))),\n- -dot(float3(p.v[1].x, p.v[1].z, p.v[1].w), cross(float3(p.v[2].x, p.v[2].z, p.v[2].w), float3(p.v[3].x, p.v[3].z, p.v[3].w))),\n- dot(float3(p.v[1].x, p.v[1].y, p.v[1].w), cross(float3(p.v[2].x, p.v[2].y, p.v[2].w), float3(p.v[3].x, p.v[3].y, p.v[3].w))),\n- -dot(float3(p.v[1].x, p.v[1].y, p.v[1].z), cross(float3(p.v[2].x, p.v[2].y, p.v[2].z), float3(p.v[3].x, p.v[3].y, p.v[3].z)))));\n-}\n-\nfloat2 transform(mat2 p, float2 q)\n{\nreturn float2(dot(p.v[0], q), dot(p.v[1], q));\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_mathlib.h", "new_path": "Source/astc_mathlib.h", "diff": "@@ -168,11 +168,6 @@ struct mat2\nfloat2 v[2];\n};\n-struct mat3\n-{\n- float3 v[3];\n-};\n-\nstruct mat4\n{\nfloat4 v[4];\n@@ -223,7 +218,6 @@ struct processed_line4\n};\nfloat determinant(mat2 p);\n-float determinant(mat4 p);\nfloat2 transform(mat2 p, float2 q);\nfloat4 transform(mat4 p, float4 q);\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_reference.csv", "new_path": "Test/astc_test_reference.csv", "diff": "Name,Block Size,PSNR (dB),Time (s)\n-hdr-rgb-00,4x4,38.855,2.077\n-ldr-rgb-00,4x4,39.193,1.230\n-ldr-rgb-01,4x4,40.370,1.021\n-ldr-rgb-02,4x4,35.458,0.927\n-ldr-rgb-03,4x4,47.483,1.201\n-ldr-rgb-04,4x4,42.300,0.918\n-ldr-rgb-05,4x4,38.003,0.995\n-ldr-rgb-06,4x4,35.452,0.879\n-ldr-rgb-07,4x4,39.762,1.266\n-ldr-rgb-08,4x4,45.781,1.171\n-ldr-rgb-09,4x4,42.162,0.996\n-ldr-rgba-00,4x4,37.065,1.215\n-ldr-rgba-01,4x4,39.032,1.098\n-ldr-rgba-02,4x4,35.025,1.410\n-ldr-xy-00,4x4,34.063,0.976\n-ldr-xy-01,4x4,34.733,1.160\n-ldr-xy-02,4x4,54.330,1.414\n-hdr-rgb-00,5x5,35.036,1.236\n-ldr-rgb-00,5x5,35.387,1.337\n-ldr-rgb-01,5x5,36.544,1.196\n-ldr-rgb-02,5x5,31.189,1.093\n-ldr-rgb-03,5x5,44.547,1.286\n-ldr-rgb-04,5x5,37.947,1.033\n-ldr-rgb-05,5x5,33.761,1.197\n-ldr-rgb-06,5x5,31.156,1.054\n-ldr-rgb-07,5x5,36.717,1.481\n-ldr-rgb-08,5x5,42.299,1.334\n-ldr-rgb-09,5x5,37.709,1.116\n-ldr-rgba-00,5x5,33.490,1.465\n-ldr-rgba-01,5x5,35.381,1.275\n-ldr-rgba-02,5x5,31.184,1.796\n-ldr-xy-00,5x5,33.898,0.862\n-ldr-xy-01,5x5,34.370,1.458\n-ldr-xy-02,5x5,51.346,1.630\n-hdr-rgb-00,6x6,32.385,1.462\n-ldr-rgb-00,6x6,32.739,1.681\n-ldr-rgb-01,6x6,33.246,1.682\n-ldr-rgb-02,6x6,27.569,1.783\n-ldr-rgb-03,6x6,42.525,0.922\n-ldr-rgb-04,6x6,34.496,1.716\n-ldr-rgb-05,6x6,30.444,1.785\n-ldr-rgb-06,6x6,27.572,1.796\n-ldr-rgb-07,6x6,34.549,1.751\n-ldr-rgb-08,6x6,39.939,0.982\n-ldr-rgb-09,6x6,33.861,1.646\n-ldr-rgba-00,6x6,30.959,1.723\n-ldr-rgba-01,6x6,32.344,1.393\n-ldr-rgba-02,6x6,27.900,2.046\n-ldr-xy-00,6x6,33.531,0.708\n-ldr-xy-01,6x6,33.740,1.309\n-ldr-xy-02,6x6,48.673,1.589\n-hdr-rgb-00,8x8,28.643,1.512\n-ldr-rgb-00,8x8,29.096,1.782\n-ldr-rgb-01,8x8,29.135,1.666\n-ldr-rgb-02,8x8,23.223,1.865\n-ldr-rgb-03,8x8,39.343,0.346\n-ldr-rgb-04,8x8,29.875,1.730\n-ldr-rgb-05,8x8,26.150,1.857\n-ldr-rgb-06,8x8,23.326,1.869\n-ldr-rgb-07,8x8,31.297,1.801\n-ldr-rgb-08,8x8,36.574,0.704\n-ldr-rgb-09,8x8,29.177,1.423\n-ldr-rgba-00,8x8,26.892,1.829\n-ldr-rgba-01,8x8,28.519,1.394\n-ldr-rgba-02,8x8,23.988,1.976\n-ldr-xy-00,8x8,32.378,0.710\n-ldr-xy-01,8x8,32.549,0.730\n-ldr-xy-02,8x8,44.943,0.688\n+hdr-rgb-00,4x4,21.400,1.084\n+ldr-rgb-00,4x4,39.193,1.054\n+ldr-rgb-01,4x4,40.370,0.958\n+ldr-rgb-02,4x4,35.458,0.844\n+ldr-rgb-03,4x4,47.483,1.087\n+ldr-rgb-04,4x4,42.300,0.829\n+ldr-rgb-05,4x4,38.003,0.925\n+ldr-rgb-06,4x4,35.452,0.782\n+ldr-rgb-07,4x4,39.762,1.201\n+ldr-rgb-08,4x4,45.781,1.104\n+ldr-rgb-09,4x4,42.162,0.922\n+ldr-rgba-00,4x4,37.065,1.150\n+ldr-rgba-01,4x4,39.032,1.035\n+ldr-rgba-02,4x4,35.025,1.361\n+ldr-xy-00,4x4,34.063,0.966\n+ldr-xy-01,4x4,34.733,1.101\n+ldr-xy-02,4x4,54.330,1.337\n+hdr-rgb-00,5x5,20.206,1.205\n+ldr-rgb-00,5x5,35.387,1.291\n+ldr-rgb-01,5x5,36.544,1.167\n+ldr-rgb-02,5x5,31.189,1.055\n+ldr-rgb-03,5x5,44.547,1.241\n+ldr-rgb-04,5x5,37.947,0.995\n+ldr-rgb-05,5x5,33.761,1.167\n+ldr-rgb-06,5x5,31.156,0.999\n+ldr-rgb-07,5x5,36.717,1.421\n+ldr-rgb-08,5x5,42.299,1.278\n+ldr-rgb-09,5x5,37.709,1.062\n+ldr-rgba-00,5x5,33.490,1.407\n+ldr-rgba-01,5x5,35.381,1.228\n+ldr-rgba-02,5x5,31.184,1.767\n+ldr-xy-00,5x5,33.898,0.828\n+ldr-xy-01,5x5,34.370,1.418\n+ldr-xy-02,5x5,51.346,1.539\n+hdr-rgb-00,6x6,23.292,1.217\n+ldr-rgb-00,6x6,32.739,1.660\n+ldr-rgb-01,6x6,33.246,1.622\n+ldr-rgb-02,6x6,27.569,1.719\n+ldr-rgb-03,6x6,42.525,0.863\n+ldr-rgb-04,6x6,34.496,1.630\n+ldr-rgb-05,6x6,30.444,1.721\n+ldr-rgb-06,6x6,27.572,1.714\n+ldr-rgb-07,6x6,34.549,1.658\n+ldr-rgb-08,6x6,39.939,0.933\n+ldr-rgb-09,6x6,33.861,1.580\n+ldr-rgba-00,6x6,30.959,1.662\n+ldr-rgba-01,6x6,32.344,1.321\n+ldr-rgba-02,6x6,27.900,1.975\n+ldr-xy-00,6x6,33.531,0.668\n+ldr-xy-01,6x6,33.740,1.256\n+ldr-xy-02,6x6,48.673,1.490\n+hdr-rgb-00,8x8,20.331,1.169\n+ldr-rgb-00,8x8,29.096,1.628\n+ldr-rgb-01,8x8,29.135,1.587\n+ldr-rgb-02,8x8,23.223,1.739\n+ldr-rgb-03,8x8,39.343,0.304\n+ldr-rgb-04,8x8,29.875,1.587\n+ldr-rgb-05,8x8,26.150,1.721\n+ldr-rgb-06,8x8,23.326,1.731\n+ldr-rgb-07,8x8,31.297,1.635\n+ldr-rgb-08,8x8,36.574,0.635\n+ldr-rgb-09,8x8,29.177,1.304\n+ldr-rgba-00,8x8,26.892,1.671\n+ldr-rgba-01,8x8,28.519,1.318\n+ldr-rgba-02,8x8,23.988,1.845\n+ldr-xy-00,8x8,32.378,0.670\n+ldr-xy-01,8x8,32.549,0.669\n+ldr-xy-02,8x8,44.943,0.635\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_run.py", "new_path": "Test/astc_test_run.py", "diff": "@@ -19,11 +19,8 @@ import subprocess as sp\nimport sys\n-DEBUG = False\n+LOG_CLI = False\n-if DEBUG:\n- TEST_BLOCK_SIZES = [\"4x4\", \"8x8\"]\n-else:\nTEST_BLOCK_SIZES = [\"4x4\", \"5x5\", \"6x6\", \"8x8\"]\nTEST_EXTENSIONS = [\".png\", \".hdr\"]\n@@ -101,7 +98,7 @@ class TestImage():\nself.runPSNR = dict()\nself.status = dict()\n- def run_once(self, testBinary, blockSize):\n+ def run_once(self, testBinary, blockSize, firstRun):\n\"\"\"\nRun a single compression pass.\n\"\"\"\n@@ -130,6 +127,14 @@ class TestImage():\nif self.format == \"xy\":\nargs.append(\"-normal_psnr\")\n+ # Switch HDR data formats into HDR compression mode; note that this\n+ # mode assumes that the alpha channel is non-correlated\n+ if self.dynamicRange == \"hdr\":\n+ args.append(\"-hdr\")\n+\n+ if LOG_CLI:\n+ print(\" + %s \" % \" \".join(args))\n+\ntry:\nresult = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\ncheck=True, universal_newlines=True)\n@@ -185,10 +190,10 @@ class TestImage():\n\"\"\"\nresults = []\nfor i in range(0, self.warmupRuns):\n- self.run_once(testBinary, blockSize)\n+ self.run_once(testBinary, blockSize, False)\nfor i in range(0, self.testRuns):\n- result = self.run_once(testBinary, blockSize)\n+ result = self.run_once(testBinary, blockSize, i == 0)\nresults.append(result)\nlistPSNR, timeList = list(zip(*results))\n@@ -406,10 +411,6 @@ def run_reference_rebuild():\n\"\"\"\nRun the reference test generator rebuild process.\n\"\"\"\n- if DEBUG:\n- TestImage.testRuns = 1\n- TestImage.warmupRuns = 0\n- else:\nTestImage.testRuns = 10\nTestImage.warmupRuns = 1\n@@ -455,10 +456,6 @@ def run_reference_update():\n\"\"\"\nRun the reference test generator update process.\n\"\"\"\n- if DEBUG:\n- TestImage.testRuns = 1\n- TestImage.warmupRuns = 0\n- else:\nTestImage.testRuns = 3\nTestImage.warmupRuns = 1\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix bug in cross() and add regression test
61,745
04.01.2020 17:39:46
0
1e5b364844f2173b4bfa2ea3430e05fa2b6269d4
Enable -hdr for the helper run utility
[ { "change_type": "MODIFY", "old_path": "Test/astc_run.py", "new_path": "Test/astc_run.py", "diff": "@@ -65,6 +65,11 @@ class TestImage():\nif self.format == \"xy\":\nargs.append(\"-normal_psnr\")\n+ # Switch HDR data formats into HDR compression mode; note that this\n+ # mode assumes that the alpha channel is non-correlated\n+ if self.dynamicRange == \"hdr\":\n+ args.append(\"-hdr\")\n+\n# Inject the callgrind profiler prefix\nif profile:\nargs.insert(0, \"--callgrind-out-file=callgrind.out\")\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Enable -hdr for the helper run utility
61,745
06.01.2020 23:00:46
0
1ef41839f04d574ea4beb679efea9da6b13f2dad
Remove global partition tables, move to bsd
[ { "change_type": "MODIFY", "old_path": "Source/astc_block_sizes2.cpp", "new_path": "Source/astc_block_sizes2.cpp", "diff": "// ----------------------------------------------------------------------------\n// This confidential and proprietary software may be used only as authorised\n// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2019 Arm Limited, ALL RIGHTS RESERVED\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n// The entire notice above must be reproduced on all authorised copies and\n// copies may only be made to the extent permitted by a licensing agreement\n// from Arm Limited.\n@@ -897,10 +897,13 @@ static void construct_block_size_descriptor_3d(int xdim, int ydim, int zdim, blo\n}\n}\n+/* Public function, see header file for detailed documentation */\nvoid init_block_size_descriptor(int xdim, int ydim, int zdim, block_size_descriptor* bsd)\n{\nif (zdim > 1)\nconstruct_block_size_descriptor_3d(xdim, ydim, zdim, bsd);\nelse\nconstruct_block_size_descriptor_2d(xdim, ydim, bsd);\n+\n+ init_partition_tables(bsd);\n}\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_codec_internals.h", "new_path": "Source/astc_codec_internals.h", "diff": "@@ -147,6 +147,9 @@ struct block_size_descriptor\n// which 64 texels (if that many) to consider.\nint texelcount_for_bitmap_partitioning;\nint texels_for_bitmap_partitioning[64];\n+\n+ // All the partitioning information for this block size\n+ partition_info partitions[(3*PARTITION_COUNT)+1];\n};\n// data structure representing one block of an image.\n@@ -341,12 +344,45 @@ struct physical_compressed_block\nuint8_t data[16];\n};\n+/**\n+ * @brief Populate the blocksize descriptor for the target block size.\n+ *\n+ * This will also initialize the partition table metadata, which is stored\n+ * as part of the BSD structure.\n+ *\n+ * @param xdim The x axis size of the block.\n+ * @param ydim The y axis size of the block.\n+ * @param zdim The z axis size of the block.\n+ * @param bsd The structure to populate.\n+ */\nvoid init_block_size_descriptor(\nint xdim,\nint ydim,\nint zdim,\nblock_size_descriptor* bsd);\n+/**\n+ * @brief Populate the partition tables for the target block size.\n+ *\n+ * Note the block_size_size descriptor must be initialized before calling this\n+ * function.\n+ *\n+ * @param bsd The structure to populate.\n+ */\n+void init_partition_tables(\n+ block_size_descriptor* bsd);\n+\n+static inline const partition_info *get_partition_table(\n+ const block_size_descriptor* bsd,\n+ int partition_count\n+) {\n+ if (partition_count == 1) {\n+ partition_count = 5;\n+ }\n+ int index = (partition_count - 2) * PARTITION_COUNT;\n+ return bsd->partitions + index;\n+}\n+\n// ***********************************************************\n// functions and data pertaining to quantization and encoding\n// **********************************************************\n@@ -368,10 +404,7 @@ extern int quantization_mode_table[17][128];\n// functions and data pertaining to partitioning\n// **********************************************\n-// function to get a pointer to a partition table or an array thereof.\n-const partition_info *get_partition_table(\n- const block_size_descriptor* bsd,\n- int partition_count);\n+\n// functions to compute color averages and dominant directions\n// for each partition in a block\n" }, { "change_type": "MODIFY", "old_path": "Source/astc_partition_tables.cpp", "new_path": "Source/astc_partition_tables.cpp", "diff": "#include \"astc_codec_internals.h\"\n-static partition_info **partition_tables[4096];\n-\n/*\nProduce a canonicalized representation of a partition pattern\n@@ -258,45 +256,24 @@ void generate_one_partition_table(\n}\n}\n-static void generate_partition_tables(\n- const block_size_descriptor* bsd\n+/* Public function, see header file for detailed documentation */\n+void init_partition_tables(\n+ block_size_descriptor* bsd\n) {\n- int i;\n-\n- partition_info *one_partition = new partition_info;\n- partition_info *two_partitions = new partition_info[1024];\n- partition_info *three_partitions = new partition_info[1024];\n- partition_info *four_partitions = new partition_info[1024];\n+ partition_info *par_tab2 = bsd->partitions;\n+ partition_info *par_tab3 = par_tab2 + PARTITION_COUNT;\n+ partition_info *par_tab4 = par_tab3 + PARTITION_COUNT;\n+ partition_info *par_tab1 = par_tab4 + PARTITION_COUNT;\n- partition_info **partition_table = new partition_info *[5];\n- partition_table[0] = NULL;\n- partition_table[1] = one_partition;\n- partition_table[2] = two_partitions;\n- partition_table[3] = three_partitions;\n- partition_table[4] = four_partitions;\n-\n- generate_one_partition_table(bsd, 1, 0, one_partition);\n- for (i = 0; i < 1024; i++)\n+ generate_one_partition_table(bsd, 1, 0, par_tab1);\n+ for (int i = 0; i < 1024; i++)\n{\n- generate_one_partition_table(bsd, 2, i, two_partitions + i);\n- generate_one_partition_table(bsd, 3, i, three_partitions + i);\n- generate_one_partition_table(bsd, 4, i, four_partitions + i);\n- }\n-\n- partition_table_zap_equal_elements(bsd->texel_count, two_partitions);\n- partition_table_zap_equal_elements(bsd->texel_count, three_partitions);\n- partition_table_zap_equal_elements(bsd->texel_count, four_partitions);\n-\n- partition_tables[bsd->xdim + 16 * bsd->ydim + 256 * bsd->zdim] = partition_table;\n+ generate_one_partition_table(bsd, 2, i, par_tab2 + i);\n+ generate_one_partition_table(bsd, 3, i, par_tab3 + i);\n+ generate_one_partition_table(bsd, 4, i, par_tab4 + i);\n}\n-const partition_info *get_partition_table(\n- const block_size_descriptor* bsd,\n- int partition_count\n-) {\n- int ptindex = bsd->xdim + 16 * bsd->ydim + 256 * bsd->zdim;\n- if (partition_tables[ptindex] == NULL)\n- generate_partition_tables(bsd);\n-\n- return partition_tables[ptindex][partition_count];\n+ partition_table_zap_equal_elements(bsd->texel_count, par_tab2);\n+ partition_table_zap_equal_elements(bsd->texel_count, par_tab3);\n+ partition_table_zap_equal_elements(bsd->texel_count, par_tab4);\n}\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove global partition tables, move to bsd
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
0
Edit dataset card