author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
61,745 |
21.11.2020 00:03:25
| 0 |
c1a5de4b7c5db2438e1a67d6e3a02deb1a2f00a0
|
Add bracketing to make precedence clear
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -1141,7 +1141,7 @@ void compute_ideal_quantized_weights_for_decimation_table(\nvfloat ixl = gatherf(qat->unquantized_value_unsc, weight);\nvfloat ixh = gatherf(qat->unquantized_value_unsc, weight1);\n- vmask mask = ixl + ixh < vfloat(128.0f) * ix;\n+ vmask mask = (ixl + ixh) < (vfloat(128.0f) * ix);\nweight = select(weight, weight1, mask);\nixl = select(ixl, ixh, mask);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add bracketing to make precedence clear
|
61,745 |
22.11.2020 22:57:34
| 0 |
a4a007fe4be7a7bc65594326c52c20f729e9937c
|
Enable vfloat4 for prototyping use
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib.h",
"new_path": "Source/astcenc_vecmathlib.h",
"diff": "#endif\n#if ASTCENC_AVX >= 2\n- /* If we have AVX2 expose 8-wide VLA. */\n+ /* If we have AVX2 expose 8-wide VLA, and 4-wide fixed width. */\n#include \"astcenc_vecmathlib_avx2_8.h\"\n+ #include \"astcenc_vecmathlib_sse_4.h\"\n#define ASTCENC_SIMD_WIDTH 8\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_sse_4.h",
"new_path": "Source/astcenc_vecmathlib_sse_4.h",
"diff": "@@ -738,6 +738,39 @@ ASTCENC_SIMD_INLINE vfloat4 sqrt(vfloat4 a)\nreturn vfloat4(_mm_sqrt_ps(a.m));\n}\n+/**\n+ * @brief Return the dot product for the full 4 lanes, returning scalar.\n+ */\n+static inline float dot(vfloat4 a, vfloat4 b)\n+{\n+#if (ASTCENC_SSE >= 41) && (ASTCENC_ISA_INVARIANCE == 0)\n+ return _mm_cvtss_f32(_mm_dp_ps(a.m, b.m, 0xFF));\n+#else\n+ alignas(16) float av[4];\n+ alignas(16) float bv[4];\n+ storea(a, av);\n+ storea(b, bv);\n+ return av[0] * bv[0] + av[1] * bv[1] + av[2] * bv[2] + av[3] * bv[3];\n+#endif\n+}\n+\n+/**\n+ * @brief Return the dot product for the full 4 lanes, returning vector.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 dotv(vfloat4 a, vfloat4 b)\n+{\n+#if (ASTCENC_SSE >= 41) && (ASTCENC_ISA_INVARIANCE == 0)\n+ return vfloat4(_mm_dp_ps(a.m, b.m, 0xFF));\n+#else\n+ alignas(16) float av[4];\n+ alignas(16) float bv[4];\n+ storea(a, av);\n+ storea(b, bv);\n+ float s = av[0] * bv[0] + av[1] * bv[1] + av[2] * bv[2] + av[3] * bv[3];\n+ return vfloat4(s);\n+#endif\n+}\n+\n/**\n* @brief Return lanes from @c b if MSB of @c cond is set, else @c a.\n*/\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Enable vfloat4 for prototyping use
|
61,745 |
22.11.2020 23:07:40
| 0 |
5e7fe2eae648605a1026457dd940db086df9fcc8
|
Move compute_error_squared_rgb_single_partition
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_encoding_choice_error.cpp",
"new_path": "Source/astcenc_encoding_choice_error.cpp",
"diff": "@@ -89,6 +89,43 @@ void merge_endpoints(\n}\n}\n+// function to compute the error across a tile when using a particular line for\n+// a particular partition.\n+static float compute_error_squared_rgb_single_partition(\n+ int partition_to_test,\n+ const block_size_descriptor* bsd,\n+ const partition_info* pt, // the partition that we use when computing the squared-error.\n+ const imageblock* blk,\n+ const error_weight_block* ewb,\n+ const processed_line3* lin // the line for the partition.\n+) {\n+ int texels_per_block = bsd->texel_count;\n+ float errorsum = 0.0f;\n+\n+ for (int i = 0; i < texels_per_block; i++)\n+ {\n+ int partition = pt->partition_of_texel[i];\n+ float texel_weight = ewb->texel_weight_rgb[i];\n+\n+ if (partition != partition_to_test || texel_weight < 1e-20f)\n+ {\n+ continue;\n+ }\n+\n+ float3 point = float3(blk->data_r[i],\n+ blk->data_g[i],\n+ blk->data_b[i]);\n+ float param = dot(point, lin->bs);\n+ float3 rp1 = lin->amod + param * lin->bis;\n+ float3 dist = rp1 - point;\n+ float4 ews = ewb->error_weights[i];\n+ float3 ews3 = float3(ews.r, ews.g, ews.b);\n+ errorsum += dot(ews3, dist * dist);\n+ }\n+\n+ return errorsum;\n+}\n+\n/*\nfor a given set of input colors and a given partitioning, determine: color error that results\nfrom RGB-scale encoding (relevant for LDR only) color error that results from RGB-lumashift encoding\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -778,17 +778,6 @@ void compute_error_squared_rgb(\nfloat* samechroma_error,\nfloat3* separate_color_error);\n-// functions to compute error value across a tile for a particular line function\n-// for a single partition.\n-float compute_error_squared_rgb_single_partition(\n- int partition_to_test,\n- const block_size_descriptor* bsd,\n- const partition_info* pt,\n- const imageblock* blk,\n- const error_weight_block* ewb,\n- const processed_line3* lin // the line for the partition.\n-);\n-\n// for each partition, compute its color weightings.\nvoid compute_partition_error_color_weightings(\nconst block_size_descriptor* bsd,\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Move compute_error_squared_rgb_single_partition
|
61,745 |
22.11.2020 23:08:47
| 0 |
cf29513ad8bad79890fd9ae6b93a31354c2b3625
|
Make astc::min/max have consistent NaN handling
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_mathlib.h",
"new_path": "Source/astcenc_mathlib.h",
"diff": "@@ -80,9 +80,9 @@ static inline float fabs(float val)\n* @param valA The first value to compare.\n* @param valB The second value to compare.\n*\n- * @return The smallest value.\n+ * @return The smallest value (q if either is NaN).\n*/\n-static inline float fmin(float p, float q)\n+static inline float min(float p, float q)\n{\nreturn p < q ? p : q;\n}\n@@ -93,11 +93,11 @@ static inline float fmin(float p, float q)\n* @param valA The first value to compare.\n* @param valB The second value to compare.\n*\n- * @return The largest value.\n+ * @return The largest value (q if either is NaN).\n*/\n-static inline float fmax(float p, float q)\n+static inline float max(float p, float q)\n{\n- return q < p ? p : q;\n+ return p > q ? p : q;\n}\n/**\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Make astc::min/max have consistent NaN handling
|
61,745 |
22.11.2020 23:29:30
| 0 |
65f1c422a67b0d7557302865cf0c7d652474ec4e
|
Cleanup handling of clamps / NaN filters
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_averages_and_directions.cpp",
"new_path": "Source/astcenc_averages_and_directions.cpp",
"diff": "@@ -558,35 +558,12 @@ void compute_error_squared_rgba(\nfloat4 separate_linelen = separate_highparam - separate_lowparam;\n// Turn very small numbers and NaNs into a small number\n- if (!(uncorr_linelen > 1e-7f))\n- {\n- uncorr_linelen = 1e-7f;\n- }\n-\n- if (!(samechroma_linelen > 1e-7f))\n- {\n- samechroma_linelen = 1e-7f;\n- }\n-\n- if (!(separate_linelen.r > 1e-7f))\n- {\n- separate_linelen.r = 1e-7f;\n- }\n-\n- if (!(separate_linelen.g > 1e-7f))\n- {\n- separate_linelen.g = 1e-7f;\n- }\n-\n- if (!(separate_linelen.b > 1e-7f))\n- {\n- separate_linelen.b = 1e-7f;\n- }\n-\n- if (!(separate_linelen.a > 1e-7f))\n- {\n- separate_linelen.a = 1e-7f;\n- }\n+ uncorr_linelen = astc::max(uncorr_linelen, 1e-7f);\n+ samechroma_linelen = astc::max(samechroma_linelen, 1e-7f);\n+ separate_linelen.r = astc::max(separate_linelen.r, 1e-7f);\n+ separate_linelen.g = astc::max(separate_linelen.g, 1e-7f);\n+ separate_linelen.b = astc::max(separate_linelen.b, 1e-7f);\n+ separate_linelen.a = astc::max(separate_linelen.a, 1e-7f);\nlengths_uncorr[partition] = uncorr_linelen;\nlengths_samechroma[partition] = samechroma_linelen;\n@@ -707,30 +684,11 @@ void compute_error_squared_rgb(\nfloat3 separate_linelen = separate_highparam - separate_lowparam;\n// Turn very small numbers and NaNs into a small number\n- if (!(uncorr_linelen > 1e-7f))\n- {\n- uncorr_linelen = 1e-7f;\n- }\n-\n- if (!(samechroma_linelen > 1e-7f))\n- {\n- samechroma_linelen = 1e-7f;\n- }\n-\n- if (!(separate_linelen.r > 1e-7f))\n- {\n- separate_linelen.r = 1e-7f;\n- }\n-\n- if (!(separate_linelen.g > 1e-7f))\n- {\n- separate_linelen.g = 1e-7f;\n- }\n-\n- if (!(separate_linelen.b > 1e-7f))\n- {\n- separate_linelen.b = 1e-7f;\n- }\n+ uncorr_linelen = astc::max(uncorr_linelen, 1e-7f);\n+ samechroma_linelen = astc::max(samechroma_linelen, 1e-7f);\n+ separate_linelen.r = astc::max(separate_linelen.r, 1e-7f);\n+ separate_linelen.g = astc::max(separate_linelen.g, 1e-7f);\n+ separate_linelen.b = astc::max(separate_linelen.b, 1e-7f);\nlengths_uncorr[partition] = uncorr_linelen;\nlengths_samechroma[partition] = samechroma_linelen;\n@@ -742,41 +700,4 @@ void compute_error_squared_rgb(\n}\n}\n-// function to compute the error across a tile when using a particular line for\n-// a particular partition.\n-float compute_error_squared_rgb_single_partition(\n- int partition_to_test,\n- const block_size_descriptor* bsd,\n- const partition_info* pt, // the partition that we use when computing the squared-error.\n- const imageblock* blk,\n- const error_weight_block* ewb,\n- const processed_line3* lin // the line for the partition.\n-) {\n- int texels_per_block = bsd->texel_count;\n- float errorsum = 0.0f;\n-\n- for (int i = 0; i < texels_per_block; i++)\n- {\n- int partition = pt->partition_of_texel[i];\n- float texel_weight = ewb->texel_weight_rgb[i];\n-\n- if (partition != partition_to_test || texel_weight < 1e-20f)\n- {\n- continue;\n- }\n-\n- float3 point = float3(blk->data_r[i],\n- blk->data_g[i],\n- blk->data_b[i]);\n- float param = dot(point, lin->bs);\n- float3 rp1 = lin->amod + param * lin->bis;\n- float3 dist = rp1 - point;\n- float4 ews = ewb->error_weights[i];\n- float3 ews3 = float3(ews.r, ews.g, ews.b);\n- errorsum += dot(ews3, dist * dist);\n- }\n-\n- return errorsum;\n-}\n-\n#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_color_quantize.cpp",
"new_path": "Source/astcenc_color_quantize.cpp",
"diff": "@@ -700,7 +700,7 @@ static void quantize_rgbs_new(\nfloat scale = astc::clamp1f(rgbs_color.a * (oldcolorsum + 1e-10f) / (newcolorsum + 1e-10f));\nint scale_idx = astc::flt2int_rtn(scale * 256.0f);\n- scale_idx = astc::clampi(scale_idx, 0, 255);\n+ scale_idx = astc::clamp(scale_idx, 0, 255);\noutput[0] = ri;\noutput[1] = gi;\n@@ -895,25 +895,10 @@ static void quantize_hdr_rgbo3(\ncolor.g += color.a;\ncolor.b += color.a;\n- if (!(color.r > 0.0f))\n- color.r = 0.0f;\n- else if (color.r > 65535.0f)\n- color.r = 65535.0f;\n-\n- if (!(color.g > 0.0f))\n- color.g = 0.0f;\n- else if (color.g > 65535.0f)\n- color.g = 65535.0f;\n-\n- if (!(color.b > 0.0f))\n- color.b = 0.0f;\n- else if (color.b > 65535.0f)\n- color.b = 65535.0f;\n-\n- if (!(color.a > 0.0f))\n- color.a = 0.0f;\n- else if (color.a > 65535.0f)\n- color.a = 65535.0f;\n+ color.r = astc::clamp(color.r, 0.0f, 65535.0f);\n+ color.g = astc::clamp(color.g, 0.0f, 65535.0f);\n+ color.b = astc::clamp(color.b, 0.0f, 65535.0f);\n+ color.a = astc::clamp(color.a, 0.0f, 65535.0f);\nfloat4 color_bak = color;\nint majcomp;\n@@ -1264,59 +1249,14 @@ static void quantize_hdr_rgb3(\nint output[6],\nint quantization_level\n) {\n- if (!(color0.r > 0.0f))\n- {\n- color0.r = 0.0f;\n- }\n- else if (color0.r > 65535.0f)\n- {\n- color0.r = 65535.0f;\n- }\n-\n- if (!(color0.g > 0.0f))\n- {\n- color0.g = 0.0f;\n- }\n- else if (color0.g > 65535.0f)\n- {\n- color0.g = 65535.0f;\n- }\n-\n- if (!(color0.b > 0.0f))\n- {\n- color0.b = 0.0f;\n- }\n- else if (color0.b > 65535.0f)\n- {\n- color0.b = 65535.0f;\n- }\n+ color0.r = astc::clamp(color0.r, 0.0f, 65535.0f);\n+ color0.g = astc::clamp(color0.g, 0.0f, 65535.0f);\n+ color0.b = astc::clamp(color0.b, 0.0f, 65535.0f);\n- if (!(color1.r > 0.0f))\n- {\n- color1.r = 0.0f;\n- }\n- else if (color1.r > 65535.0f)\n- {\n- color1.r = 65535.0f;\n- }\n+ color1.r = astc::clamp(color1.r, 0.0f, 65535.0f);\n+ color1.g = astc::clamp(color1.g, 0.0f, 65535.0f);\n+ color1.b = astc::clamp(color1.b, 0.0f, 65535.0f);\n- if (!(color1.g > 0.0f))\n- {\n- color1.g = 0.0f;\n- }\n- else if (color1.g > 65535.0f)\n- {\n- color1.g = 65535.0f;\n- }\n-\n- if (!(color1.b > 0.0f))\n- {\n- color1.b = 0.0f;\n- }\n- else if (color1.b > 65535.0f)\n- {\n- color1.b = 65535.0f;\n- }\nfloat4 color0_bak = color0;\nfloat4 color1_bak = color1;\n@@ -1351,14 +1291,7 @@ static void quantize_hdr_rgb3(\n}\nfloat a_base = color1.r;\n- if (a_base < 0.0f)\n- {\n- a_base = 0.0f;\n- }\n- else if (a_base > 65535.0f)\n- {\n- a_base = 65535.0f;\n- }\n+ a_base = astc::clamp(a_base, 0.0f, 65535.0f);\nfloat b0_base = a_base - color1.g;\nfloat b1_base = a_base - color1.b;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -1235,7 +1235,7 @@ void compress_block(\nfloat lowest_correl;\nfloat best_errorval_in_mode;\n- int start_trial = bsd->texel_count < TUNE_MAX_TEXELS_MODE0_FASTPATH ? 1 : 0;\n+ int start_trial = bsd->texel_count < (int)TUNE_MAX_TEXELS_MODE0_FASTPATH ? 1 : 0;\nfor (int i = start_trial; i < 2; i++)\n{\ncompress_symbolic_block_fixed_partition_1_plane(\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -246,10 +246,10 @@ static astcenc_error validate_config(\nconfig.b_deblock_weight = MAX(config.b_deblock_weight, 0.0f);\n- config.tune_partition_limit = astc::clampi(config.tune_partition_limit, 1, PARTITION_COUNT);\n- config.tune_block_mode_limit = astc::clampi(config.tune_block_mode_limit, 1, 100);\n+ config.tune_partition_limit = astc::clamp(config.tune_partition_limit, 1u, (unsigned int)PARTITION_COUNT);\n+ config.tune_block_mode_limit = astc::clamp(config.tune_block_mode_limit, 1u, 100u);\nconfig.tune_refinement_limit = MAX(config.tune_refinement_limit, 1);\n- config.tune_candidate_limit = astc::clampi(config.tune_candidate_limit, 1, TUNE_MAX_TRIAL_CANDIDATES);\n+ config.tune_candidate_limit = astc::clamp(config.tune_candidate_limit, 1u, TUNE_MAX_TRIAL_CANDIDATES);\nconfig.tune_db_limit = MAX(config.tune_db_limit, 0.0f);\nconfig.tune_partition_early_out_limit = MAX(config.tune_partition_early_out_limit, 0.0f);\nconfig.tune_two_plane_early_out_limit = MAX(config.tune_two_plane_early_out_limit, 0.0f);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -124,15 +124,7 @@ static void compute_endpoints_and_ideal_weights_1_component(\nint partition = pt->partition_of_texel[i];\nvalue -= lowvalues[partition];\nvalue *= linelengths_rcp[partition];\n-\n- if (value > 1.0f)\n- {\n- value = 1.0f;\n- }\n- else if (!(value > 0.0f))\n- {\n- value = 0.0f;\n- }\n+ value = astc::clamp1f(value);\nei->weights[i] = value;\nei->weight_error_scale[i] = partition_error_scale[partition] * error_weights[i];\n@@ -397,14 +389,7 @@ static void compute_endpoints_and_ideal_weights_2_components(\n{\nint partition = pt->partition_of_texel[i];\nfloat idx = (ei->weights[i] - lowparam[partition]) * scale[partition];\n- if (idx > 1.0f)\n- {\n- idx = 1.0f;\n- }\n- else if (!(idx > 0.0f))\n- {\n- idx = 0.0f;\n- }\n+ idx = astc::clamp1f(idx);\nei->weights[i] = idx;\nei->weight_error_scale[i] = length_squared[partition] * error_weights[i];\n@@ -651,14 +636,7 @@ static void compute_endpoints_and_ideal_weights_3_components(\n{\nint partition = pt->partition_of_texel[i];\nfloat idx = (ei->weights[i] - lowparam[partition]) * scale[partition];\n- if (idx > 1.0f)\n- {\n- idx = 1.0f;\n- }\n- else if (!(idx > 0.0f))\n- {\n- idx = 0.0f;\n- }\n+ idx = astc::clamp1f(idx);\nei->weights[i] = idx;\nei->weight_error_scale[i] = length_squared[partition] * error_weights[i];\n@@ -799,14 +777,8 @@ static void compute_endpoints_and_ideal_weights_rgba(\n{\nint partition = pt->partition_of_texel[i];\nfloat idx = (ei->weights[i] - lowparam[partition]) * scale[partition];\n- if (idx > 1.0f)\n- {\n- idx = 1.0f;\n- }\n- else if (!(idx > 0.0f))\n- {\n- idx = 0.0f;\n- }\n+ idx = astc::clamp1f(idx);\n+\nei->weights[i] = idx;\nei->weight_error_scale[i] = error_weights[i] * length_squared[partition];\nassert(!astc::isnan(ei->weight_error_scale[i]));\n@@ -1467,15 +1439,7 @@ void recompute_ideal_colors(\n#endif\nfloat scalediv = scale_min * (1.0f / MAX(scale_max, 1e-10f));\n- if (!(scalediv > 0.0f))\n- {\n- scalediv = 0.0f; // set to zero if scalediv is negative, or NaN.\n- }\n-\n- if (scalediv > 1.0f)\n- {\n- scalediv = 1.0f;\n- }\n+ scalediv = astc::clamp1f(scalediv);\n#ifdef DEBUG_CAPTURE_NAN\nfeenableexcept(FE_DIVBYZERO | FE_INVALID);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -73,11 +73,11 @@ static const float ERROR_CALC_DEFAULT { 1e30f };\n============================================================================ */\n// The max texel count in a block which can try the one partition fast path.\n// Default: enabled for 4x4 and 5x4 blocks.\n-static const int TUNE_MAX_TEXELS_MODE0_FASTPATH { 24 };\n+static const unsigned int TUNE_MAX_TEXELS_MODE0_FASTPATH { 24 };\n// The maximum number of candidate encodings returned for each encoding mode.\n// Default: depends on quality preset\n-static const int TUNE_MAX_TRIAL_CANDIDATES { 4 };\n+static const unsigned int TUNE_MAX_TRIAL_CANDIDATES { 4 };\n/* ============================================================================\nOther configuration parameters\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_mathlib.h",
"new_path": "Source/astcenc_mathlib.h",
"diff": "@@ -113,25 +113,28 @@ static inline int isnan(float val)\n}\n/**\n- * @brief Clamp a float value between 0.0f and 1.0f.\n+ * @brief Clamp a value value between mn and mx\n*\n- * NaNs are turned into 0.0f.\n+ * For floats, NaNs are turned into mn.\n*\n* @param val The value clamp.\n+ * @param mn The min value (inclusive).\n+ * @param mx The max value (inclusive).\n*\n* @return The clamped value.\n*/\n-static inline float clamp1f(float val)\n+template<typename T>\n+inline T clamp(T val, T mn, T mx)\n{\n- // Do not reorder these, correct NaN handling relies on the fact that\n- // any comparison with NaN returns false so will fall-though to the 0.0f.\n- if (val > 1.0f) return 1.0f;\n- if (val > 0.0f) return val;\n- return 0.0f;\n+ // Do not reorder; correct NaN handling relies on the fact that comparison\n+ // with NaN returns false and will fall-though to the \"min\" value.\n+ if (val > mx) return mx;\n+ if (val > mn) return val;\n+ return mn;\n}\n/**\n- * @brief Clamp a float value between 0.0f and 255.0f.\n+ * @brief Clamp a float value between 0.0f and 1.0f.\n*\n* NaNs are turned into 0.0f.\n*\n@@ -139,34 +142,23 @@ static inline float clamp1f(float val)\n*\n* @return The clamped value.\n*/\n-static inline float clamp255f(float val)\n+static inline float clamp1f(float val)\n{\n- // Do not reorder these, correct NaN handling relies on the fact that\n- // any comparison with NaN returns false so will fall-though to the 0.0f.\n- if (val > 255.0f) return 255.0f;\n- if (val > 0.0f) return val;\n- return 0.0f;\n+ return astc::clamp(val, 0.0f, 1.0f);\n}\n/**\n- * @brief Clamp a value value between mn and mx\n+ * @brief Clamp a float value between 0.0f and 255.0f.\n*\n- * For floats, NaNs are turned into mn.\n+ * NaNs are turned into 0.0f.\n*\n* @param val The value clamp.\n- * @param mn The min value (inclusive).\n- * @param mx The max value (inclusive).\n*\n* @return The clamped value.\n*/\n-template<typename T>\n-inline T clamp(T val, T mn, T mx)\n+static inline float clamp255f(float val)\n{\n- // Do not reorder; correct NaN handling relies on the fact that comparison\n- // with NaN returns false and will fall-though to the \"min\" value.\n- if (val > mx) return mx;\n- if (val > mn) return val;\n- return mn;\n+ return astc::clamp(val, 0.0f, 255.0f);\n}\n/**\n@@ -180,26 +172,9 @@ inline T clamp(T val, T mn, T mx)\n*/\nstatic inline float clamp64Kf(float val)\n{\n- // Do not reorder these, correct NaN handling relies on the fact that\n- // any comparison with NaN returns false so will fall-though to the 0.0f.\n- if (val > 65504.0f) return 65504.0f;\n- if (val > 0.0f) return val;\n- return 0.0f;\n+ return astc::clamp(val, 0.0f, 65504.0f);\n}\n-/**\n- * @brief Clamp an integer between two specified limits.\n- *\n- * @param val The value clamp.\n- *\n- * @return The clamped value.\n- */\n-static inline int clampi(int val, int low, int high)\n-{\n- if (val < low) return low;\n- if (val > high) return high;\n- return val;\n-}\n/**\n* @brief SP float round-to-nearest.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Cleanup handling of clamps / NaN filters
|
61,745 |
22.11.2020 23:32:42
| 0 |
d0f68904aaa0398999b205fa87d4db927f861bb1
|
Fix MSCV compile error due to function order
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_sse_4.h",
"new_path": "Source/astcenc_vecmathlib_sse_4.h",
"diff": "@@ -738,39 +738,6 @@ ASTCENC_SIMD_INLINE vfloat4 sqrt(vfloat4 a)\nreturn vfloat4(_mm_sqrt_ps(a.m));\n}\n-/**\n- * @brief Return the dot product for the full 4 lanes, returning scalar.\n- */\n-static inline float dot(vfloat4 a, vfloat4 b)\n-{\n-#if (ASTCENC_SSE >= 41) && (ASTCENC_ISA_INVARIANCE == 0)\n- return _mm_cvtss_f32(_mm_dp_ps(a.m, b.m, 0xFF));\n-#else\n- alignas(16) float av[4];\n- alignas(16) float bv[4];\n- storea(a, av);\n- storea(b, bv);\n- return av[0] * bv[0] + av[1] * bv[1] + av[2] * bv[2] + av[3] * bv[3];\n-#endif\n-}\n-\n-/**\n- * @brief Return the dot product for the full 4 lanes, returning vector.\n- */\n-ASTCENC_SIMD_INLINE vfloat4 dotv(vfloat4 a, vfloat4 b)\n-{\n-#if (ASTCENC_SSE >= 41) && (ASTCENC_ISA_INVARIANCE == 0)\n- return vfloat4(_mm_dp_ps(a.m, b.m, 0xFF));\n-#else\n- alignas(16) float av[4];\n- alignas(16) float bv[4];\n- storea(a, av);\n- storea(b, bv);\n- float s = av[0] * bv[0] + av[1] * bv[1] + av[2] * bv[2] + av[3] * bv[3];\n- return vfloat4(s);\n-#endif\n-}\n-\n/**\n* @brief Return lanes from @c b if MSB of @c cond is set, else @c a.\n*/\n@@ -810,6 +777,23 @@ ASTCENC_SIMD_INLINE void storea(vfloat4 a, float* p)\n_mm_store_ps(p, a.m);\n}\n+/**\n+ * @brief Return the dot product for the full 4 lanes, returning vector.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 dot(vfloat4 a, vfloat4 b)\n+{\n+#if (ASTCENC_SSE >= 41) && (ASTCENC_ISA_INVARIANCE == 0)\n+ return vfloat4(_mm_dp_ps(a.m, b.m, 0xFF));\n+#else\n+ alignas(16) float av[4];\n+ alignas(16) float bv[4];\n+ storea(a, av);\n+ storea(b, bv);\n+ float s = av[0] * bv[0] + av[1] * bv[1] + av[2] * bv[2] + av[3] * bv[3];\n+ return vfloat4(s);\n+#endif\n+}\n+\n/**\n* @brief Return a integer value for a float vector, using truncation.\n*/\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix MSCV compile error due to function order
|
61,745 |
30.11.2020 21:45:33
| 0 |
dfe0ca3fdc59cb3473daecb943162369d00371a5
|
Improve normal map -help text
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "@@ -159,19 +159,21 @@ COMPRESSION\n-mask\nThe input texture is a mask texture with unrelated data stored\n- in the various color channels. This improves image quality by\n- trying to minimize the effect of error cross-talk across the\n- color channels.\n+ in the various color channels, so enable error heuristics that\n+ aim to improve perceptual quality by minimizing the effect of\n+ error cross-talk across the color channels.\n-normal\n- The input texture is a three channel normal map, storing unit\n- length normals as R=X, G=Y, and B=Z, optimized for angular PSNR.\n- The compressor will compress this data as a two channel X+Y\n- normal map with the following channel layout (RGB=X, A=Y). The\n- Z component can be recovered programatically in shader core by\n+ The input texture is a three channel linear LDR normal map\n+ storing unit length normals as (R=X, G=Y, B=Z). The output\n+ will be a two channel X+Y normal map stored as (RGB=X, A=Y),\n+ optimized for angular error instead of simple PSNR. The Z\n+ component can be recovered programatically in shader code by\nusing the equation:\n- Z = sqrt(1 - X^2 - Y^2).\n+ nml.xy = texture(...).ga; // Load in [0,1]\n+ nml.xy = nml.xy * 2.0 - 1.0; // Unpack to [-1,1]\n+ nml.z = sqrt(1 - dot(nml.xy, nml.xy)); // Compute Z\n-perceptual\nThe codec should optimize perceptual error, instead of direct\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Improve normal map -help text
|
61,745 |
01.12.2020 00:08:30
| 0 |
ad8313a14b96441ccef12fe36fd5b996ea65e5cc
|
Cleanup doxygen keywords
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1179,19 +1179,19 @@ struct astcenc_context\n============================================================================ */\n/**\n* @brief Run-time detection if the host CPU supports SSE 4.1.\n- * @returns Zero if not supported, positive value if it is.\n+ * @return Zero if not supported, positive value if it is.\n*/\nint cpu_supports_sse41();\n/**\n* @brief Run-time detection if the host CPU supports popcnt.\n- * @returns Zero if not supported, positive value if it is.\n+ * @return Zero if not supported, positive value if it is.\n*/\nint cpu_supports_popcnt();\n/**\n* @brief Run-time detection if the host CPU supports avx2.\n- * @returns Zero if not supported, positive value if it is.\n+ * @return Zero if not supported, positive value if it is.\n*/\nint cpu_supports_avx2();\n@@ -1204,7 +1204,7 @@ int cpu_supports_avx2();\n* @param size The desired buffer size.\n* @param align The desired buffer alignment; must be 2^N.\n*\n- * @returns The memory buffer pointer or nullptr on allocation failure.\n+ * @return The memory buffer pointer or nullptr on allocation failure.\n*/\ntemplate<typename T>\nT* aligned_malloc(size_t size, size_t align)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_internal.h",
"new_path": "Source/astcenccli_internal.h",
"diff": "@@ -167,14 +167,14 @@ void compute_error_metrics(\n/**\n* @brief Get the current time.\n*\n- * @returns The current time in seconds since arbitrary epoch.\n+ * @return The current time in seconds since arbitrary epoch.\n*/\ndouble get_time();\n/**\n* @brief Get the number of CPU cores.\n*\n- * @returns The number of online or onlineable CPU cores in the system.\n+ * @return The number of online or onlineable CPU cores in the system.\n*/\nint get_cpu_count();\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Cleanup doxygen keywords
|
61,745 |
08.12.2020 13:59:18
| 0 |
7fe74bcf6ef27298afebf49cdd5bb45016cb8dea
|
Repartition long literal string for MSVC limits
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "@@ -414,7 +414,10 @@ ADVANCED COMPRESSION\nError messages will always be printed, as will mandatory outputs\nfor the selected operation mode. For example, the test mode\nwill always output image quality metrics and compression time\n- but will suppress all other output.\n+ but will suppress all other output.)\"\n+// This split in the literals is needed for Visual Studio; the compiler\n+// will concatenate these two strings together ...\n+R\"(\nDECOMPRESSION\nTo decompress an image stored in the ASTC format you must specify\n@@ -444,10 +447,7 @@ TEST\nThis operation mode will print error metrics suitable for either\nLDR and HDR images, allowing some assessment of the compression\n- image quality.)\"\n-// This split in the literals is needed for Visual Studio; the compiler\n-// will concatenate these two strings together ...\n-R\"(\n+ image quality.\nCOMPRESSION FILE FORMATS\nThe following formats are supported as compression inputs:\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Repartition long literal string for MSVC limits
|
61,745 |
15.12.2020 17:45:30
| 0 |
6eb47aebb4221dcd99ed6ce5f9278f83149cdd1a
|
Update Jenkinsfile for Cmake
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -32,7 +32,7 @@ pipeline {\nsh '''\nmkdir build_rel\ncd build_rel\n- make -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\nmake package -j4\n'''\n}\n@@ -42,7 +42,7 @@ pipeline {\nsh '''\nmkdir build_dbg\ncd build_dbg\n- make -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\nmake install -j4\n'''\n}\n@@ -80,7 +80,7 @@ pipeline {\nbat '''\nmkdir build_rel\ncd build_rel\n- make -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+ cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\nnmake package -j4\n'''\n}\n@@ -90,7 +90,7 @@ pipeline {\nbat '''\nmkdir build_dbg\ncd build_dbg\n- make -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\nnmake install -j4\n'''\n}\n@@ -128,7 +128,7 @@ pipeline {\nsh '''\nmkdir build_rel\ncd build_rel\n- make -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\nmake package -j4\n'''\n}\n@@ -138,7 +138,7 @@ pipeline {\nsh '''\nmkdir build_dbg\ncd build_dbg\n- make -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\nmake install -j4\n'''\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update Jenkinsfile for Cmake
|
61,745 |
15.12.2020 18:20:50
| 0 |
34566b227590e5952500cdc0d7bba1142df59a54
|
Add AppleClang for CMake generator expressions
Implemented with a GNU_LIKE variable (DRY)
|
[
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "project(astcenc-${ISA_SIMD})\n+set(GNU_LIKE \"GNU,Clang,AppleClang\")\n+\nadd_executable(astcenc-${ISA_SIMD})\ntarget_sources(astcenc-${ISA_SIMD}\n@@ -73,12 +75,12 @@ target_compile_options(astcenc-${ISA_SIMD}\n$<$<CXX_COMPILER_ID:MSVC>:/EHsc>\n# G++ and Clang++ compiler defines\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-Wall>\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-Wextra>\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-Wpedantic>\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-Werror>\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-Wshadow>\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-Wdouble-promotion>)\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wextra>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wpedantic>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Werror>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wshadow>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wdouble-promotion>)\ntarget_link_options(astcenc-${ISA_SIMD}\nPRIVATE\n@@ -114,7 +116,7 @@ if(${ISA_SIMD} MATCHES \"none\")\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-mfpmath=sse -msse2>)\n+ $<$<CXX_COMPILER_ID:${GNU_LIKE}>:-mfpmath=sse -msse2>)\nelseif(${ISA_SIMD} MATCHES \"sse2\")\ntarget_compile_definitions(astcenc-${ISA_SIMD}\n@@ -126,7 +128,7 @@ elseif(${ISA_SIMD} MATCHES \"sse2\")\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-mfpmath=sse -msse2>)\n+ $<$<CXX_COMPILER_ID:${GNU_LIKE}>:-mfpmath=sse -msse2>)\nelseif(${ISA_SIMD} MATCHES \"sse4.1\")\ntarget_compile_definitions(astcenc-${ISA_SIMD}\n@@ -138,7 +140,7 @@ elseif(${ISA_SIMD} MATCHES \"sse4.1\")\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-mfpmath=sse -msse4.1 -mpopcnt>)\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mfpmath=sse -msse4.1 -mpopcnt>)\nelseif(${ISA_SIMD} MATCHES \"avx2\")\ntarget_compile_definitions(astcenc-${ISA_SIMD}\n@@ -150,7 +152,7 @@ elseif(${ISA_SIMD} MATCHES \"avx2\")\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n- $<$<CXX_COMPILER_ID:GNU,Clang>:-mfpmath=sse -mavx2 -mpopcnt>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mfpmath=sse -mavx2 -mpopcnt>\n$<$<CXX_COMPILER_ID:MSVC>:/arch:AVX2>)\nendif()\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -78,20 +78,22 @@ pipeline {\nstage('Build R') {\nsteps {\nbat '''\n+ call c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\nmkdir build_rel\ncd build_rel\ncmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- nmake package -j4\n+ nmake package -j1\n'''\n}\n}\nstage('Build D') {\nsteps {\nbat '''\n+ call c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\nmkdir build_dbg\ncd build_dbg\ncmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- nmake install -j4\n+ nmake install -j1\n'''\n}\n}\n@@ -129,7 +131,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- make package -j4\n+ make package -j1\n'''\n}\n}\n@@ -139,7 +141,7 @@ pipeline {\nmkdir build_dbg\ncd build_dbg\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make install -j4\n+ make install -j1\n'''\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add AppleClang for CMake generator expressions
Implemented with a GNU_LIKE variable (DRY)
|
61,745 |
15.12.2020 18:24:13
| 0 |
df9fe969f159a9e57ca1fc02af1a223761c8f6ee
|
Remove -j1 option from nmake in Jekinsfile
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -82,7 +82,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- nmake package -j1\n+ nmake package\n'''\n}\n}\n@@ -93,7 +93,7 @@ pipeline {\nmkdir build_dbg\ncd build_dbg\ncmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- nmake install -j1\n+ nmake install\n'''\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove -j1 option from nmake in Jekinsfile
|
61,745 |
15.12.2020 20:48:45
| 0 |
2cd1fecabc32367ffde165d5c902ae50aabc6b18
|
Switch ROC testing back to release builds
Debug -thorough tests take a few hours on Windows builders,
which is longer than we'd like, so until we get a faster
build machine drop to testing Release -medium.
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -32,8 +32,8 @@ pipeline {\nsh '''\nmkdir build_rel\ncd build_rel\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- make package -j4\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ make install package -j1\n'''\n}\n}\n@@ -43,7 +43,7 @@ pipeline {\nmkdir build_dbg\ncd build_dbg\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make install -j4\n+ make -j1\n'''\n}\n}\n@@ -58,7 +58,7 @@ pipeline {\nsteps {\nsh '''\npython3 ./Test/astc_test_functional.py\n- python3 ./Test/astc_test_image.py --encoder=all --test-set Small\n+ python3 ./Test/astc_test_image.py --encoder=all --test-set Small --test-quality medium\n'''\n}\n}\n@@ -82,7 +82,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- nmake package\n+ nmake install package\n'''\n}\n}\n@@ -93,7 +93,7 @@ pipeline {\nmkdir build_dbg\ncd build_dbg\ncmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- nmake install\n+ nmake\n'''\n}\n}\n@@ -108,7 +108,7 @@ pipeline {\nsteps {\nbat '''\nset Path=c:\\\\Python38;c:\\\\Python38\\\\Scripts;%Path%\n- call python ./Test/astc_test_image.py --test-set Small\n+ call python ./Test/astc_test_image.py --test-set Small --test-quality medium\n'''\n}\n}\n@@ -131,7 +131,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- make package -j1\n+ make install package -j1\n'''\n}\n}\n@@ -141,7 +141,7 @@ pipeline {\nmkdir build_dbg\ncd build_dbg\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make install -j1\n+ make -j1\n'''\n}\n}\n@@ -156,7 +156,7 @@ pipeline {\nsteps {\nsh '''\nexport PATH=/usr/local/bin:$PATH\n- python3 ./Test/astc_test_image.py --test-set Small\n+ python3 ./Test/astc_test_image.py --test-set Small --test-quality medium\n'''\n}\n}\n@@ -181,13 +181,13 @@ pipeline {\nstage('Unstash') {\nsteps {\ndeleteDir()\n- dir('upload/Linux-x86_64') {\n+ dir('upload/linux-x64') {\nunstash 'astcenc-linux'\n}\n- dir('upload/Windows-x86_64') {\n+ dir('upload/windows-x64') {\nunstash 'astcenc-windows'\n}\n- dir('upload/MacOS-x86_64') {\n+ dir('upload/macos-x64') {\nunstash 'astcenc-macos'\n}\n}\n@@ -195,7 +195,7 @@ pipeline {\nstage('Upload') {\nsteps {\nzip zipFile: 'astcenc.zip', dir: 'upload', archive: false\n- cepeArtifactoryUpload(sourcePattern: '*.zip')\n+ cepeArtifactoryUpload(sourcePattern: 'astcenc.zip')\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Switch ROC testing back to release builds
Debug -thorough tests take a few hours on Windows builders,
which is longer than we'd like, so until we get a faster
build machine drop to testing Release -medium.
|
61,745 |
15.12.2020 20:54:52
| 0 |
94e95f3a102b739045435fa56dea97120caa7e95
|
Set install prefix on Jenkins builder
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -32,7 +32,7 @@ pipeline {\nsh '''\nmkdir build_rel\ncd build_rel\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\nmake install package -j1\n'''\n}\n@@ -42,7 +42,7 @@ pipeline {\nsh '''\nmkdir build_dbg\ncd build_dbg\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\nmake -j1\n'''\n}\n@@ -81,7 +81,7 @@ pipeline {\ncall c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\nmkdir build_rel\ncd build_rel\n- cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+ cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\nnmake install package\n'''\n}\n@@ -92,7 +92,7 @@ pipeline {\ncall c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\nmkdir build_dbg\ncd build_dbg\n- cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\nnmake\n'''\n}\n@@ -130,7 +130,7 @@ pipeline {\nsh '''\nmkdir build_rel\ncd build_rel\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\nmake install package -j1\n'''\n}\n@@ -140,7 +140,7 @@ pipeline {\nsh '''\nmkdir build_dbg\ncd build_dbg\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\nmake -j1\n'''\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Set install prefix on Jenkins builder
|
61,745 |
15.12.2020 21:12:11
| 0 |
b41f5b289ea864912009f3ced4fb524d0bf84a90
|
More markdown changes for CMake builds
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/Building.md",
"new_path": "Docs/Building.md",
"diff": "@@ -64,7 +64,7 @@ cd build\n# Create the build system\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./ \\\n- -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON\n+ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n```\nThis example shows all SIMD variants being enabled. It is possible to build a\n"
},
{
"change_type": "MODIFY",
"old_path": "Docs/Testing.md",
"new_path": "Docs/Testing.md",
"diff": "@@ -8,7 +8,11 @@ bitrate of the standard.\n# Required software\nRunning the tests requires Python 3.7 to be installed on the host machine, and\n-an `astcenc-avx2` release build to have been previously compiled.\n+an `astcenc-avx2` release build to have been previously compiled and installed\n+into an directory called `astcenc` in the root of the git checkout. This\n+can be achieved by configuring the CMake build using the install prefix\n+`-DCMAKE_INSTALL_PREFIX=../` and then running a build with the `install` build\n+target.\n# Running unit tests\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
More markdown changes for CMake builds
|
61,745 |
15.12.2020 21:30:44
| 0 |
c256e6520d41ef86209810c2f41843c319c04f46
|
Force CMake to use -flto not -flto=thin
|
[
{
"change_type": "MODIFY",
"old_path": "Source/CMakeLists.txt",
"new_path": "Source/CMakeLists.txt",
"diff": "# under the License.\n# ----------------------------------------------------------------------------\n+# Overwrite the LTO flags to force fat LTO; worth 3-4% performance\n+# See https://gitlab.kitware.com/cmake/cmake/-/issues/16808\n+if(CMAKE_CXX_COMPILER_ID MATCHES \"GNU|Clang\")\n+ set(CMAKE_CXX_COMPILE_OPTIONS_IPO \"-flto\")\n+endif()\n+\nif (${ISA_AVX2})\nset(ISA_SIMD avx2)\ninclude(cmake_core.cmake)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Force CMake to use -flto not -flto=thin
|
61,745 |
15.12.2020 21:59:26
| 0 |
0bfb63a8ebc87fab8dfde942e1ddf6959ea9eda8
|
Switch Jenkins Linux builds to Clang 9.0
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -30,6 +30,7 @@ pipeline {\nstage('Build R') {\nsteps {\nsh '''\n+ export CXX=clang++-9\nmkdir build_rel\ncd build_rel\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n@@ -40,6 +41,7 @@ pipeline {\nstage('Build D') {\nsteps {\nsh '''\n+ export CXX=clang++-9\nmkdir build_dbg\ncd build_dbg\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Switch Jenkins Linux builds to Clang 9.0
|
61,745 |
15.12.2020 22:14:12
| 0 |
b75cf0cc55ec2651f419ba768d5c783a1983ea4c
|
Fix Jenkins Linux AVX2 build
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -33,7 +33,7 @@ pipeline {\nexport CXX=clang++-9\nmkdir build_rel\ncd build_rel\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\nmake install package -j1\n'''\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix Jenkins Linux AVX2 build
|
61,745 |
16.12.2020 08:26:00
| 0 |
a398a07ea0b3718552935ec7f1f77cb8653bb758
|
Move ASTCENC_VECALIGN out of build system
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Fuzzers/build.sh",
"new_path": "Source/Fuzzers/build.sh",
"diff": "@@ -30,7 +30,6 @@ for fuzzer in $SRC/astc-encoder/Source/Fuzzers/fuzz_*.cpp; do\n-DASTCENC_SSE=0 \\\n-DASTCENC_AVX=0 \\\n-DASTCENC_POPCNT=0 \\\n- -DASTCENC_VECALIGN=16 \\\n-DASTCENC_ISA_INVARIANCE=0 \\\n-I. -std=c++14 $fuzzer $LIB_FUZZING_ENGINE $SRC/astc-encoder/Source/libastcenc.a \\\n-o $OUT/$(basename -s .cpp $fuzzer)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "#endif\n#endif\n+#if ASTCENC_AVX\n+ #define ASTCENC_VECALIGN 32\n+#else\n+ #define ASTCENC_VECALIGN 16\n+#endif\n+\n#ifndef ASTCENC_ISA_INVARIANCE\n-#error ERROR: ASTCENC_ISA_INVARIANCE not defined\n+ #define ASTCENC_ISA_INVARIANCE 0\n#endif\n#include \"astcenc.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -111,8 +111,7 @@ if(${ISA_SIMD} MATCHES \"none\")\nPRIVATE\nASTCENC_SSE=0\nASTCENC_AVX=0\n- ASTCENC_POPCNT=0\n- ASTCENC_VECALIGN=16)\n+ ASTCENC_POPCNT=0)\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n@@ -123,8 +122,7 @@ elseif(${ISA_SIMD} MATCHES \"sse2\")\nPRIVATE\nASTCENC_SSE=20\nASTCENC_AVX=0\n- ASTCENC_POPCNT=0\n- ASTCENC_VECALIGN=16)\n+ ASTCENC_POPCNT=0)\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n@@ -135,8 +133,7 @@ elseif(${ISA_SIMD} MATCHES \"sse4.1\")\nPRIVATE\nASTCENC_SSE=41\nASTCENC_AVX=0\n- ASTCENC_POPCNT=1\n- ASTCENC_VECALIGN=16)\n+ ASTCENC_POPCNT=1)\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n@@ -147,8 +144,7 @@ elseif(${ISA_SIMD} MATCHES \"avx2\")\nPRIVATE\nASTCENC_SSE=41\nASTCENC_AVX=2\n- ASTCENC_POPCNT=1\n- ASTCENC_VECALIGN=32)\n+ ASTCENC_POPCNT=1)\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Move ASTCENC_VECALIGN out of build system
|
61,745 |
16.12.2020 08:40:37
| 0 |
dac64876cea711006e5d8392e44a7adccaea9a86
|
Generate release package SHA256 checksums
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -81,6 +81,8 @@ set(PKG_VER ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR})\nset(CPACK_PACKAGE_FILE_NAME \"astcenc-${PKG_VER}-${PKG_OS}-x64\")\nset(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)\n+set(CPACK_PACKAGE_CHECKSUM SHA256)\n+\nif(\"${CMAKE_SYSTEM_NAME}\" STREQUAL \"Windows\")\nset(CPACK_GENERATOR ZIP)\nelse()\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -52,7 +52,8 @@ pipeline {\nstage('Stash') {\nsteps {\ndir('build_rel') {\n- stash name: 'astcenc-linux', includes: '*.tar.gz'\n+ stash name: 'astcenc-linux-x64', includes: '*.tar.gz'\n+ stash name: 'astcenc-linux-x64-hash', includes: '*.tar.gz.sha256'\n}\n}\n}\n@@ -102,7 +103,8 @@ pipeline {\nstage('Stash') {\nsteps {\ndir('build_rel') {\n- stash name: 'astcenc-windows', includes: '*.zip'\n+ stash name: 'astcenc-windows-x64', includes: '*.zip'\n+ stash name: 'astcenc-windows-x64-hash', includes: '*.zip.sha256'\n}\n}\n}\n@@ -150,7 +152,8 @@ pipeline {\nstage('Stash') {\nsteps {\ndir('build_rel') {\n- stash name: 'astcenc-macos', includes: '*.tar.gz'\n+ stash name: 'astcenc-macos-x64', includes: '*.tar.gz'\n+ stash name: 'astcenc-macos-x64-hash', includes: '*.tar.gz.sha256'\n}\n}\n}\n@@ -184,13 +187,18 @@ pipeline {\nsteps {\ndeleteDir()\ndir('upload/linux-x64') {\n- unstash 'astcenc-linux'\n+ unstash 'astcenc-linux-x64'\n}\ndir('upload/windows-x64') {\n- unstash 'astcenc-windows'\n+ unstash 'astcenc-windows-x64'\n}\ndir('upload/macos-x64') {\n- unstash 'astcenc-macos'\n+ unstash 'astcenc-macos-x64'\n+ }\n+ dir('upload') {\n+ unstash 'astcenc-linux-x64-hash'\n+ unstash 'astcenc-windows-x64-hash'\n+ unstash 'astcenc-macos-x64-hash'\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Generate release package SHA256 checksums
|
61,745 |
16.12.2020 08:52:37
| 0 |
242f28334e59c7ead9f9501dd71d561e0f712ac1
|
Add team slack notification on build failure
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "pipeline {\nagent none\n+\noptions {\nansiColor('xterm')\ntimestamps()\n@@ -211,4 +212,12 @@ pipeline {\n}\n}\n}\n+\n+ post {\n+ failure {\n+ script {\n+ slackSend channel: '#dsg-eng-astcenc', color: 'danger', message: \"Build ${JOB_NAME} ${BUILD_NUMBER} failed. (<${BUILD_URL}|Open>)\", teamDomain: 'arm-dsg', tokenCredentialId: 'jenkins-slack', username: 'jenkins'\n+ }\n+ }\n+ }\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add team slack notification on build failure
|
61,745 |
16.12.2020 12:31:19
| 0 |
50b00c4c5935a0a79c2cc9ba9c49bb54d95ec3a3
|
Trial Windows code signing
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -187,11 +187,17 @@ pipeline {\nstage('Unstash') {\nsteps {\ndeleteDir()\n+ sh 'git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\ndir('upload/linux-x64') {\nunstash 'astcenc-linux-x64'\n}\ndir('upload/windows-x64') {\nunstash 'astcenc-windows-x64'\n+ withCredentials([usernamePassword(credentialsId: 'win-signing',\n+ usernameVariable: 'USERNAME',\n+ passwordVariable: 'PASSWORD')]) {\n+ sh 'python3 ../../signing/authenticode-client.py -v -u ${USERNAME} *.zip'\n+ }\n}\ndir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Trial Windows code signing
|
61,745 |
16.12.2020 13:14:53
| 0 |
3bb871c2b065a70927cc3dc68826f90ddebb04d2
|
Trial Windows signing
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -187,7 +187,6 @@ pipeline {\nstage('Unstash') {\nsteps {\ndeleteDir()\n- sh 'git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\ndir('upload/linux-x64') {\nunstash 'astcenc-linux-x64'\n}\n@@ -196,7 +195,8 @@ pipeline {\nwithCredentials([usernamePassword(credentialsId: 'win-signing',\nusernameVariable: 'USERNAME',\npasswordVariable: 'PASSWORD')]) {\n- sh 'python3 ../../signing/authenticode-client.py -v -u ${USERNAME} *.zip'\n+ sh 'git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n+ sh 'python3 ./signing/authenticode-client.py -v -u ${USERNAME} *.zip'\n}\n}\ndir('upload/macos-x64') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Trial Windows signing
|
61,745 |
16.12.2020 13:53:22
| 0 |
7674fa7c92f6440aa18b5af609b7caad4c1c9809
|
More Jenkins diagnostics.
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -186,22 +186,17 @@ pipeline {\nstages {\nstage('Unstash') {\nsteps {\n- deleteDir()\ndir('upload/linux-x64') {\nunstash 'astcenc-linux-x64'\n}\ndir('upload/windows-x64') {\nunstash 'astcenc-windows-x64'\n- withCredentials([usernamePassword(credentialsId: 'win-signing',\n- usernameVariable: 'USERNAME',\n- passwordVariable: 'PASSWORD')]) {\n//sh 'git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n//sh 'python3 ./signing/authenticode-client.py -v -u ${USERNAME} *.zip'\nsh \"echo Test\"\nsh \"pwd\"\nsh \"ls -al\"\n}\n- }\ndir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n}\n@@ -216,6 +211,7 @@ pipeline {\nsteps {\nzip zipFile: 'astcenc.zip', dir: 'upload', archive: false\ncepeArtifactoryUpload(sourcePattern: 'astcenc.zip')\n+ deleteDir()\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
More Jenkins diagnostics.
|
61,745 |
16.12.2020 14:51:54
| 0 |
dd37cf206b4cb1aa8e802ee1a3683dd5511ecd8f
|
Jenkins trial
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -193,7 +193,7 @@ pipeline {\nunstash 'astcenc-windows-x64'\nwithCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\nkeyFileVariable: 'SSH_AUTH_FILE')]) {\n- sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n+ sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE -o StrictHostKeyChecking=no\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n}\nwithCredentials([usernamePassword(credentialsId: 'win-signing',\nusernameVariable: 'USERNAME',\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Jenkins trial
|
61,745 |
16.12.2020 15:07:40
| 0 |
4b8ea140c4d5376b009e1b440eb65f4542617607
|
Add Python requests to Docker image
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Dockerfile",
"new_path": "jenkins/build.Dockerfile",
"diff": "FROM ubuntu:18.04\n-LABEL build.environment.version=\"2.2.0\"\n+LABEL build.environment.version=\"2.3.0\"\nRUN useradd -u 1001 -U -m -c Jenkins jenkins\n@@ -14,12 +14,16 @@ RUN apt update && apt-get install -y \\\nimagemagick \\\nmake \\\npython3 \\\n+ python3-pip \\\n+ python3-venv \\\npython3-numpy \\\npython3-pil \\\nca-certificates \\\ngnupg \\\nwget\n+RUN pip3 install requests\n+\n# Install up-to-date CMake, as standard Ubuntu 18.04 package is too old\nRUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \\\n| gpg --dearmor - > /etc/apt/trusted.gpg.d/kitware.gpg\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -15,7 +15,7 @@ pipeline {\nstage('Linux') {\nagent {\ndocker {\n- image 'astcenc:2.2.0'\n+ image 'astcenc:2.3.0'\nregistryUrl 'https://mobile-studio--docker.artifactory.geo.arm.com'\nregistryCredentialsId 'cepe-artifactory-jenkins'\nlabel 'docker'\n@@ -173,7 +173,7 @@ pipeline {\nstage('Artifactory') {\nagent {\ndocker {\n- image 'astcenc:2.2.0'\n+ image 'astcenc:2.3.0'\nregistryUrl 'https://mobile-studio--docker.artifactory.geo.arm.com'\nregistryCredentialsId 'cepe-artifactory-jenkins'\nlabel 'docker'\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add Python requests to Docker image
|
61,745 |
16.12.2020 15:27:59
| 0 |
e765a1d7794160826746d2958cab8fa549aed655
|
Add post cleanup step for the unstash builder
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -215,10 +215,12 @@ pipeline {\nsteps {\nzip zipFile: 'astcenc.zip', dir: 'upload', archive: false\ncepeArtifactoryUpload(sourcePattern: 'astcenc.zip')\n- deleteDir()\n}\n}\n}\n+ always {\n+ deleteDir()\n+ }\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add post cleanup step for the unstash builder
|
61,745 |
16.12.2020 16:10:17
| 0 |
0b47848034f203f7b74f930d7968fff22a2426c2
|
Don't verify signatures - no local SDK
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -198,7 +198,7 @@ pipeline {\nwithCredentials([usernamePassword(credentialsId: 'win-signing',\nusernameVariable: 'USERNAME',\npasswordVariable: 'PASSWORD')]) {\n- sh 'python3 ./signing/authenticode-client.py -v -u ${USERNAME} *.zip'\n+ sh 'python3 ./signing/authenticode-client.py -u ${USERNAME} *.zip'\n}\n}\ndir('upload/macos-x64') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Don't verify signatures - no local SDK
|
61,745 |
16.12.2020 16:31:47
| 0 |
c3890c0efaa6bad3103516f9acf0719a68f7ec5f
|
Remove temporary git checkout for signing scripts
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -200,6 +200,7 @@ pipeline {\npasswordVariable: 'PASSWORD')]) {\nsh 'python3 ./signing/authenticode-client.py -u ${USERNAME} *.zip'\n}\n+ deleteDir(signing)\n}\ndir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove temporary git checkout for signing scripts
|
61,745 |
16.12.2020 16:35:04
| 0 |
e97a018a75488e387fc84e904f01d8d0795f3cf1
|
Remove script dir
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -199,8 +199,8 @@ pipeline {\nusernameVariable: 'USERNAME',\npasswordVariable: 'PASSWORD')]) {\nsh 'python3 ./signing/authenticode-client.py -u ${USERNAME} *.zip'\n+ sh ' rm -rf ./signing'\n}\n- deleteDir(signing)\n}\ndir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove script dir
|
61,745 |
16.12.2020 16:49:14
| 0 |
bbc95f22017668cbfdd337b669a1ae088693af39
|
Tidy up binary code signing
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -207,7 +207,8 @@ pipeline {\n}\ndir('upload') {\nunstash 'astcenc-linux-x64-hash'\n- unstash 'astcenc-windows-x64-hash'\n+ // Don't keep Windows hash - we have signed binaries now\n+ // unstash 'astcenc-windows-x64-hash'\nunstash 'astcenc-macos-x64-hash'\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Tidy up binary code signing
|
61,745 |
16.12.2020 17:53:26
| 0 |
049bfc04c75259ceb2053544de29ffc639a91615
|
Trial macOS signing
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -82,11 +82,6 @@ set(PKG_VER ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR})\nset(CPACK_PACKAGE_FILE_NAME \"astcenc-${PKG_VER}-${PKG_OS}-x64\")\nset(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)\nset(CPACK_PACKAGE_CHECKSUM SHA256)\n-\n-if(\"${CMAKE_SYSTEM_NAME}\" STREQUAL \"Windows\")\nset(CPACK_GENERATOR ZIP)\n-else()\n- set(CPACK_GENERATOR TGZ)\n-endif()\ninclude(CPack) # Must be included after CPack configuration.\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -53,8 +53,8 @@ pipeline {\nstage('Stash') {\nsteps {\ndir('build_rel') {\n- stash name: 'astcenc-linux-x64', includes: '*.tar.gz'\n- stash name: 'astcenc-linux-x64-hash', includes: '*.tar.gz.sha256'\n+ stash name: 'astcenc-linux-x64', includes: '*.zip'\n+ stash name: 'astcenc-linux-x64-hash', includes: '*.zip.sha256'\n}\n}\n}\n@@ -153,8 +153,8 @@ pipeline {\nstage('Stash') {\nsteps {\ndir('build_rel') {\n- stash name: 'astcenc-macos-x64', includes: '*.tar.gz'\n- stash name: 'astcenc-macos-x64-hash', includes: '*.tar.gz.sha256'\n+ stash name: 'astcenc-macos-x64', includes: '*.zip'\n+ stash name: 'astcenc-macos-x64-hash', includes: '*.zip.sha256'\n}\n}\n}\n@@ -204,6 +204,16 @@ pipeline {\n}\ndir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n+ withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n+ keyFileVariable: 'SSH_AUTH_FILE')]) {\n+ sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE -o StrictHostKeyChecking=no\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n+ }\n+ withCredentials([usernamePassword(credentialsId: 'win-signing',\n+ usernameVariable: 'USERNAME',\n+ passwordVariable: 'PASSWORD')]) {\n+ sh 'python3 ./signing/macos-client.py -t mach-o --timestamp-server default --signature-flag runtime --deep ${USERNAME} *.zip *.zip'\n+ sh 'rm -rf ./signing'\n+ }\n}\ndir('upload') {\nunstash 'astcenc-linux-x64-hash'\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Trial macOS signing
|
61,745 |
17.12.2020 13:55:51
| 0 |
3b8a1ae5fa245736eea70ff704b609578cb50ecb
|
Split Jenkins into nightly and release runs
|
[
{
"change_type": "RENAME",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/nightly.Jenkinsfile",
"diff": ""
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "jenkins/release.Jenkinsfile",
"diff": "+@Library('hive-infra-library@master') _\n+\n+pipeline {\n+ agent none\n+\n+ options {\n+ ansiColor('xterm')\n+ timestamps()\n+ }\n+\n+ stages {\n+ stage('Build All') {\n+ parallel {\n+ /* Build for Linux on x86_64 */\n+ stage('Linux') {\n+ agent {\n+ docker {\n+ image 'astcenc:2.3.0'\n+ registryUrl 'https://mobile-studio--docker.artifactory.geo.arm.com'\n+ registryCredentialsId 'cepe-artifactory-jenkins'\n+ label 'docker'\n+ alwaysPull true\n+ }\n+ }\n+ stages {\n+ stage('Clean') {\n+ steps {\n+ sh 'git clean -fdx'\n+ }\n+ }\n+ stage('Build R') {\n+ steps {\n+ sh '''\n+ export CXX=clang++-9\n+ mkdir build_rel\n+ cd build_rel\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ make install package -j1\n+ '''\n+ }\n+ }\n+ stage('Build D') {\n+ steps {\n+ sh '''\n+ export CXX=clang++-9\n+ mkdir build_dbg\n+ cd build_dbg\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ make -j1\n+ '''\n+ }\n+ }\n+ stage('Stash') {\n+ steps {\n+ dir('build_rel') {\n+ stash name: 'astcenc-linux-x64', includes: '*.zip'\n+ stash name: 'astcenc-linux-x64-hash', includes: '*.zip.sha256'\n+ }\n+ }\n+ }\n+ stage('Test') {\n+ steps {\n+ sh '''\n+ python3 ./Test/astc_test_functional.py\n+ python3 ./Test/astc_test_image.py --encoder=all --test-set Small --test-quality medium\n+ '''\n+ }\n+ }\n+ }\n+ }\n+ /* Build for Windows on x86_64 */\n+ stage('Windows') {\n+ agent {\n+ label 'Windows && x86_64'\n+ }\n+ stages {\n+ stage('Clean') {\n+ steps {\n+ bat 'git clean -fdx'\n+ }\n+ }\n+ stage('Build R') {\n+ steps {\n+ bat '''\n+ call c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n+ mkdir build_rel\n+ cd build_rel\n+ cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+ nmake install package\n+ '''\n+ }\n+ }\n+ stage('Build D') {\n+ steps {\n+ bat '''\n+ call c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n+ mkdir build_dbg\n+ cd build_dbg\n+ cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ nmake\n+ '''\n+ }\n+ }\n+ stage('Stash') {\n+ steps {\n+ dir('build_rel') {\n+ stash name: 'astcenc-windows-x64', includes: '*.zip'\n+ stash name: 'astcenc-windows-x64-hash', includes: '*.zip.sha256'\n+ }\n+ }\n+ }\n+ stage('Test') {\n+ steps {\n+ bat '''\n+ set Path=c:\\\\Python38;c:\\\\Python38\\\\Scripts;%Path%\n+ call python ./Test/astc_test_image.py --test-set Small --test-quality medium\n+ '''\n+ }\n+ }\n+ }\n+ }\n+ /* Build for macOS on x86_64 */\n+ stage('macOS') {\n+ agent {\n+ label 'mac && x86_64'\n+ }\n+ stages {\n+ stage('Clean') {\n+ steps {\n+ sh 'git clean -fdx'\n+ }\n+ }\n+ stage('Build R') {\n+ steps {\n+ sh '''\n+ mkdir build_rel\n+ cd build_rel\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n+ make install package -j1\n+ '''\n+ }\n+ }\n+ stage('Build D') {\n+ steps {\n+ sh '''\n+ mkdir build_dbg\n+ cd build_dbg\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ make -j1\n+ '''\n+ }\n+ }\n+ stage('Stash') {\n+ steps {\n+ dir('build_rel') {\n+ stash name: 'astcenc-macos-x64', includes: '*.zip'\n+ stash name: 'astcenc-macos-x64-hash', includes: '*.zip.sha256'\n+ }\n+ }\n+ }\n+ stage('Test') {\n+ steps {\n+ sh '''\n+ export PATH=/usr/local/bin:$PATH\n+ python3 ./Test/astc_test_image.py --test-set Small --test-quality medium\n+ '''\n+ }\n+ }\n+ }\n+ }\n+ }\n+ }\n+ stage('Artifactory') {\n+ agent {\n+ docker {\n+ image 'astcenc:2.3.0'\n+ registryUrl 'https://mobile-studio--docker.artifactory.geo.arm.com'\n+ registryCredentialsId 'cepe-artifactory-jenkins'\n+ label 'docker'\n+ alwaysPull true\n+ }\n+ }\n+ options {\n+ skipDefaultCheckout true\n+ }\n+ stages {\n+ stage('Unstash') {\n+ steps {\n+ dir('upload/linux-x64') {\n+ unstash 'astcenc-linux-x64'\n+ }\n+ dir('upload/windows-x64') {\n+ unstash 'astcenc-windows-x64'\n+ withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n+ keyFileVariable: 'SSH_AUTH_FILE')]) {\n+ sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE -o StrictHostKeyChecking=no\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n+ }\n+ withCredentials([usernamePassword(credentialsId: 'win-signing',\n+ usernameVariable: 'USERNAME',\n+ passwordVariable: 'PASSWORD')]) {\n+ sh 'python3 ./signing/authenticode-client.py -u ${USERNAME} *.zip'\n+ sh 'rm -rf ./signing'\n+ }\n+ }\n+ dir('upload/macos-x64') {\n+ unstash 'astcenc-macos-x64'\n+ withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n+ keyFileVariable: 'SSH_AUTH_FILE')]) {\n+ sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE -o StrictHostKeyChecking=no\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n+ }\n+ withCredentials([usernamePassword(credentialsId: 'win-signing',\n+ usernameVariable: 'USERNAME',\n+ passwordVariable: 'PASSWORD')]) {\n+ sh 'python3 ./signing/macos-client.py -t mach-o --timestamp-server default --signature-flag runtime --deep ${USERNAME} *.zip *.zip'\n+ sh 'rm -rf ./signing'\n+ }\n+ }\n+ dir('upload') {\n+ unstash 'astcenc-linux-x64-hash'\n+ // Don't keep Windows hash - we have signed binaries now\n+ // unstash 'astcenc-windows-x64-hash'\n+ unstash 'astcenc-macos-x64-hash'\n+ }\n+ }\n+ }\n+ stage('Upload') {\n+ steps {\n+ zip zipFile: 'astcenc.zip', dir: 'upload', archive: false\n+ cepeArtifactoryUpload(sourcePattern: 'astcenc.zip')\n+ }\n+ }\n+ }\n+ post {\n+ always {\n+ deleteDir()\n+ }\n+ }\n+ }\n+ }\n+\n+ post {\n+ failure {\n+ script {\n+ slackSend channel: '#dsg-eng-astcenc', color: 'danger', message: \"Build ${JOB_NAME} ${BUILD_NUMBER} failed. (<${BUILD_URL}|Open>)\", teamDomain: 'arm-dsg', tokenCredentialId: 'jenkins-slack', username: 'jenkins'\n+ }\n+ }\n+ }\n+}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Split Jenkins into nightly and release runs
|
61,745 |
17.12.2020 17:43:56
| 0 |
9aaa591af5e5cf148b69a6e678982f1d539fd5b3
|
Specialize nightly/release Jenkins jobs
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/nightly.Jenkinsfile",
"new_path": "jenkins/nightly.Jenkinsfile",
"diff": "+/* This pipeline is used for post-commit testing, so it runs frequently.\n+ *\n+ * Test objectives for this pipeline are:\n+ *\n+ * - Run the entire pipeline in less than 10 minutes.\n+ * - Test builds on all supported operating systems.\n+ * - Test builds on all supported compilers.\n+ * - Test release and debug build variants.\n+ * - Run functional smoke tests.\n+ * - Run image quality smoke tests.\n+ *\n+ * The test matrix is not fully covered; e.g. we can assume compilers behave\n+ * similarly on different operating systems, so we test one compiler per OS.\n+ */\n+\n@Library('hive-infra-library@master') _\npipeline {\n@@ -11,7 +26,7 @@ pipeline {\nstages {\nstage('Build All') {\nparallel {\n- /* Build for Linux on x86_64 */\n+ /* Build for Linux on x86-64 using GCC */\nstage('Linux') {\nagent {\ndocker {\n@@ -31,22 +46,20 @@ pipeline {\nstage('Build R') {\nsteps {\nsh '''\n- export CXX=clang++-9\nmkdir build_rel\ncd build_rel\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make install package -j1\n+ make install -j4\n'''\n}\n}\nstage('Build D') {\nsteps {\nsh '''\n- export CXX=clang++-9\nmkdir build_dbg\ncd build_dbg\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make -j1\n+ make -j4\n'''\n}\n}\n@@ -54,7 +67,6 @@ pipeline {\nsteps {\ndir('build_rel') {\nstash name: 'astcenc-linux-x64', includes: '*.zip'\n- stash name: 'astcenc-linux-x64-hash', includes: '*.zip.sha256'\n}\n}\n}\n@@ -68,7 +80,7 @@ pipeline {\n}\n}\n}\n- /* Build for Windows on x86_64 */\n+ /* Build for Windows on x86-64 using MSVC */\nstage('Windows') {\nagent {\nlabel 'Windows && x86_64'\n@@ -86,7 +98,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- nmake install package\n+ nmake install\n'''\n}\n}\n@@ -105,7 +117,6 @@ pipeline {\nsteps {\ndir('build_rel') {\nstash name: 'astcenc-windows-x64', includes: '*.zip'\n- stash name: 'astcenc-windows-x64-hash', includes: '*.zip.sha256'\n}\n}\n}\n@@ -119,7 +130,7 @@ pipeline {\n}\n}\n}\n- /* Build for macOS on x86_64 */\n+ /* Build for macOS on x86-64 using Clang */\nstage('macOS') {\nagent {\nlabel 'mac && x86_64'\n@@ -136,7 +147,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- make install package -j1\n+ make install -j4\n'''\n}\n}\n@@ -146,7 +157,7 @@ pipeline {\nmkdir build_dbg\ncd build_dbg\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make -j1\n+ make -j4\n'''\n}\n}\n@@ -154,7 +165,6 @@ pipeline {\nsteps {\ndir('build_rel') {\nstash name: 'astcenc-macos-x64', includes: '*.zip'\n- stash name: 'astcenc-macos-x64-hash', includes: '*.zip.sha256'\n}\n}\n}\n@@ -191,35 +201,9 @@ pipeline {\n}\ndir('upload/windows-x64') {\nunstash 'astcenc-windows-x64'\n- withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n- keyFileVariable: 'SSH_AUTH_FILE')]) {\n- sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE -o StrictHostKeyChecking=no\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n- }\n- withCredentials([usernamePassword(credentialsId: 'win-signing',\n- usernameVariable: 'USERNAME',\n- passwordVariable: 'PASSWORD')]) {\n- sh 'python3 ./signing/authenticode-client.py -u ${USERNAME} *.zip'\n- sh 'rm -rf ./signing'\n- }\n}\ndir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n- withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n- keyFileVariable: 'SSH_AUTH_FILE')]) {\n- sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE -o StrictHostKeyChecking=no\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n- }\n- withCredentials([usernamePassword(credentialsId: 'win-signing',\n- usernameVariable: 'USERNAME',\n- passwordVariable: 'PASSWORD')]) {\n- sh 'python3 ./signing/macos-client.py -t mach-o --timestamp-server default --signature-flag runtime --deep ${USERNAME} *.zip *.zip'\n- sh 'rm -rf ./signing'\n- }\n- }\n- dir('upload') {\n- unstash 'astcenc-linux-x64-hash'\n- // Don't keep Windows hash - we have signed binaries now\n- // unstash 'astcenc-windows-x64-hash'\n- unstash 'astcenc-macos-x64-hash'\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "+/* This pipeline is used for release testing, so it runs rarely.\n+ *\n+ * Test objectives for this pipeline are:\n+ *\n+ * - Run the entire pipeline in less than 60 minutes.\n+ * - Test builds on all supported operating systems.\n+ * - Test builds on optimized compiler choices (i.e. prefer Clang over GCC).\n+ * - Build only release variants.\n+ * - Run full functional tests.\n+ * - Run full image quality tests.\n+ * - Code sign the binaries on supported operating systems.\n+ * - Build the release package.\n+ *\n+ * The test matrix is not fully covered; e.g. we can assume compilers behave\n+ * similarly on different operating systems, so we test one compiler per OS.\n+ */\n+\n@Library('hive-infra-library@master') _\npipeline {\n@@ -11,7 +28,7 @@ pipeline {\nstages {\nstage('Build All') {\nparallel {\n- /* Build for Linux on x86_64 */\n+ /* Build for Linux on x86-64 using Clang */\nstage('Linux') {\nagent {\ndocker {\n@@ -35,18 +52,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make install package -j1\n- '''\n- }\n- }\n- stage('Build D') {\n- steps {\n- sh '''\n- export CXX=clang++-9\n- mkdir build_dbg\n- cd build_dbg\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make -j1\n+ make install package -j4\n'''\n}\n}\n@@ -62,13 +68,13 @@ pipeline {\nsteps {\nsh '''\npython3 ./Test/astc_test_functional.py\n- python3 ./Test/astc_test_image.py --encoder=all --test-set Small --test-quality medium\n+ python3 ./Test/astc_test_image.py --encoder=all --test-set Small\n'''\n}\n}\n}\n}\n- /* Build for Windows on x86_64 */\n+ /* Build for Windows on x86-64 using MSVC */\nstage('Windows') {\nagent {\nlabel 'Windows && x86_64'\n@@ -90,17 +96,6 @@ pipeline {\n'''\n}\n}\n- stage('Build D') {\n- steps {\n- bat '''\n- call c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n- mkdir build_dbg\n- cd build_dbg\n- cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- nmake\n- '''\n- }\n- }\nstage('Stash') {\nsteps {\ndir('build_rel') {\n@@ -113,13 +108,13 @@ pipeline {\nsteps {\nbat '''\nset Path=c:\\\\Python38;c:\\\\Python38\\\\Scripts;%Path%\n- call python ./Test/astc_test_image.py --test-set Small --test-quality medium\n+ call python ./Test/astc_test_image.py --test-set Small\n'''\n}\n}\n}\n}\n- /* Build for macOS on x86_64 */\n+ /* Build for macOS on x86-64 using Clang */\nstage('macOS') {\nagent {\nlabel 'mac && x86_64'\n@@ -140,16 +135,6 @@ pipeline {\n'''\n}\n}\n- stage('Build D') {\n- steps {\n- sh '''\n- mkdir build_dbg\n- cd build_dbg\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make -j1\n- '''\n- }\n- }\nstage('Stash') {\nsteps {\ndir('build_rel') {\n@@ -162,7 +147,7 @@ pipeline {\nsteps {\nsh '''\nexport PATH=/usr/local/bin:$PATH\n- python3 ./Test/astc_test_image.py --test-set Small --test-quality medium\n+ python3 ./Test/astc_test_image.py --test-set Small\n'''\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Specialize nightly/release Jenkins jobs
|
61,745 |
17.12.2020 17:53:56
| 0 |
92d24d93d83c4ee35ff9d0d914113e4668765424
|
Archive package in nightly builds
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/nightly.Jenkinsfile",
"new_path": "jenkins/nightly.Jenkinsfile",
"diff": "@@ -49,7 +49,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n- make install -j4\n+ make install package -j4\n'''\n}\n}\n@@ -98,7 +98,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- nmake install\n+ nmake install package\n'''\n}\n}\n@@ -147,7 +147,7 @@ pipeline {\nmkdir build_rel\ncd build_rel\ncmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n- make install -j4\n+ make install package -j4\n'''\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Archive package in nightly builds
|
61,745 |
17.12.2020 20:06:53
| 0 |
a404fe393fee8f6f7e54536e8bf156cb82aac4df
|
Add Coverity to Docker
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/dockerimage.Jenkinsfile",
"new_path": "jenkins/dockerimage.Jenkinsfile",
"diff": "@@ -12,7 +12,10 @@ pipeline {\nstages {\nstage('Build and Push Image') {\nsteps {\n- sh './jenkins/build-image.sh push'\n+ sh '''\n+ chmod u+x ./jenkins/build-image.sh\n+ ./jenkins/build-image.sh push\n+ '''\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add Coverity to Docker
|
61,745 |
17.12.2020 20:11:46
| 0 |
ea93ff656712db5bec6658a62493055b29a8f1d0
|
Add Coverity to Dockerfile
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build-image.sh",
"new_path": "jenkins/build-image.sh",
"diff": "@@ -24,7 +24,7 @@ pushd tmp\npopd\necho \"Building image\"\n-docker build -f build.Dockerfile \\\n+docker build -f jenkins/build.Dockerfile \\\n-t $IMAGE_NAME:latest \\\n-t $IMAGE_NAME:$IMAGE_VERSION \\\n-t $DOCKER_REGISTRY/$IMAGE_NAME:latest \\\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add Coverity to Dockerfile
|
61,745 |
17.12.2020 20:29:39
| 0 |
a2bf6250cb545796688914962be3533e4e114637
|
Enable Coverity in Weekly Jenkins
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -28,6 +28,51 @@ pipeline {\nstages {\nstage('Build All') {\nparallel {\n+ /* Run static analysis on Linux */\n+ stage('Coverity') {\n+ agent {\n+ docker {\n+ image 'astcenc:2.4.0'\n+ registryUrl 'https://mobile-studio--docker.artifactory.geo.arm.com'\n+ registryCredentialsId 'cepe-artifactory-jenkins'\n+ label 'docker'\n+ alwaysPull true\n+ }\n+ }\n+ stages {\n+ stage('Clean') {\n+ steps {\n+ sh 'git clean -fdx'\n+ }\n+ }\n+ stage('Coverity') {\n+ steps {\n+ withCredentials([usernamePassword(credentialsId: 'jenkins-password',\n+ usernameVariable: 'USERNAME',\n+ passwordVariable: 'PASSWORD')]) {\n+ sh script: '''#!/bin/bash\n+ mkdir -p ${WORKSPACE}/occonfig\n+\n+ mkdir build_cov\n+ cd build_cov\n+\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON ..\n+\n+ cov-configure --template --compiler cc --comptype gcc\n+ cov-configure --template --compiler c++ --comptype g++\n+ cov-build --dir ${WORKSPACE}/intermediate make install\n+ cov-analyze --dir ${WORKSPACE}/intermediate\n+ cov-commit-defects --dir ${WORKSPACE}/intermediate \\\\\n+ --stream astcenc-master \\\\\n+ --url https://coverity.cambridge.arm.com \\\\\n+ --user jenkins@arm.com --password ${PASSWORD} \\\\\n+ --strip-path ${WORKSPACE}\n+ '''\n+ }\n+ }\n+ }\n+ }\n+ }\n/* Build for Linux on x86-64 using Clang */\nstage('Linux') {\nagent {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Enable Coverity in Weekly Jenkins
|
61,745 |
17.12.2020 21:05:03
| 0 |
a6a4e3c070f6f379ae7312886eef23d8c5f78942
|
Close file handle in load_ktx_compressed_image
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_image_load_store.cpp",
"new_path": "Source/astcenccli_image_load_store.cpp",
"diff": "@@ -1105,6 +1105,7 @@ bool load_ktx_compressed_image(\n{\nprintf(\"Failed to skip key-value pairs in %s\\n\", filename);\nfclose(f);\n+ return true;\n}\n// Read the length of the data and endianess convert\n@@ -1146,6 +1147,7 @@ bool load_ktx_compressed_image(\nis_srgb = fmt->srgb;\n+ fclose(f);\nreturn false;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Close file handle in load_ktx_compressed_image
|
61,745 |
17.12.2020 21:08:30
| 0 |
2a5f21e70f4cbafbe453e49568b416f071ef2e5f
|
Check fopen result in store_ktx_compressed_image()
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_image_load_store.cpp",
"new_path": "Source/astcenccli_image_load_store.cpp",
"diff": "@@ -1179,6 +1179,11 @@ bool store_ktx_compressed_image(\nsize_t actual = 0;\nFILE *wf = fopen(filename, \"wb\");\n+ if (!wf)\n+ {\n+ return true;\n+ }\n+\nactual += fwrite(&hdr, 1, sizeof(ktx_header), wf);\nactual += fwrite(&img.data_len, 1, 4, wf);\nactual += fwrite(img.data, 1, img.data_len, wf);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Check fopen result in store_ktx_compressed_image()
|
61,745 |
17.12.2020 21:22:00
| 0 |
86f7013808f3f99a69db4968c1f1e0dac0e09e01
|
Fix clamps in compute_pixel_region_variance()
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compute_variance.cpp",
"new_path": "Source/astcenc_compute_variance.cpp",
"diff": "@@ -423,9 +423,9 @@ static void compute_pixel_region_variance(\nint z_low = z_src - alpha_kernel_radius;\nint z_high = z_src + alpha_kernel_radius + 1;\n- astc::clamp(z_src, 0, (int)(img->dim_z - 1));\n- astc::clamp(z_low, 0, (int)(img->dim_z - 1));\n- astc::clamp(z_high, 0, (int)(img->dim_z - 1));\n+ z_src = astc::clamp(z_src, 0, (int)(img->dim_z - 1));\n+ z_low = astc::clamp(z_low, 0, (int)(img->dim_z - 1));\n+ z_high = astc::clamp(z_high, 0, (int)(img->dim_z - 1));\nfor (int y = 0; y < size_y; y++)\n@@ -435,9 +435,9 @@ static void compute_pixel_region_variance(\nint y_low = y_src - alpha_kernel_radius;\nint y_high = y_src + alpha_kernel_radius + 1;\n- astc::clamp(y_src, 0, (int)(img->dim_y - 1));\n- astc::clamp(y_low, 0, (int)(img->dim_y - 1));\n- astc::clamp(y_high, 0, (int)(img->dim_y - 1));\n+ y_src = astc::clamp(y_src, 0, (int)(img->dim_y - 1));\n+ y_low = astc::clamp(y_low, 0, (int)(img->dim_y - 1));\n+ y_high = astc::clamp(y_high, 0, (int)(img->dim_y - 1));\nfor (int x = 0; x < size_x; x++)\n{\n@@ -446,9 +446,9 @@ static void compute_pixel_region_variance(\nint x_low = x_src - alpha_kernel_radius;\nint x_high = x_src + alpha_kernel_radius + 1;\n- astc::clamp(x_src, 0, (int)(img->dim_x - 1));\n- astc::clamp(x_low, 0, (int)(img->dim_x - 1));\n- astc::clamp(x_high, 0, (int)(img->dim_x - 1));\n+ x_src = astc::clamp(x_src, 0, (int)(img->dim_x - 1));\n+ x_low = astc::clamp(x_low, 0, (int)(img->dim_x - 1));\n+ x_high = astc::clamp(x_high, 0, (int)(img->dim_x - 1));\n// Summed-area table lookups for alpha average\nfloat vasum = ( VARBUF1(z_high, y_low, x_low).a\n@@ -502,9 +502,9 @@ static void compute_pixel_region_variance(\nint y_low = y_src - alpha_kernel_radius;\nint y_high = y_src + alpha_kernel_radius + 1;\n- astc::clamp(y_src, 0, (int)(img->dim_y - 1));\n- astc::clamp(y_low, 0, (int)(img->dim_y - 1));\n- astc::clamp(y_high, 0, (int)(img->dim_y - 1));\n+ y_src = astc::clamp(y_src, 0, (int)(img->dim_y - 1));\n+ y_low = astc::clamp(y_low, 0, (int)(img->dim_y - 1));\n+ y_high = astc::clamp(y_high, 0, (int)(img->dim_y - 1));\nfor (int x = 0; x < size_x; x++)\n{\n@@ -513,9 +513,9 @@ static void compute_pixel_region_variance(\nint x_low = x_src - alpha_kernel_radius;\nint x_high = x_src + alpha_kernel_radius + 1;\n- astc::clamp(x_src, 0, (int)(img->dim_x - 1));\n- astc::clamp(x_low, 0, (int)(img->dim_x - 1));\n- astc::clamp(x_high, 0, (int)(img->dim_x - 1));\n+ x_src = astc::clamp(x_src, 0, (int)(img->dim_x - 1));\n+ x_low = astc::clamp(x_low, 0, (int)(img->dim_x - 1));\n+ x_high = astc::clamp(x_high, 0, (int)(img->dim_x - 1));\n// Summed-area table lookups for alpha average\nfloat vasum = VARBUF1(0, y_low, x_low).a\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix clamps in compute_pixel_region_variance()
|
61,745 |
17.12.2020 22:09:49
| 0 |
d10ccadf03a875c0252094219493f7c2a987e5e2
|
TinyEXR: Fix leak in SaveEXRImageToFile()
|
[
{
"change_type": "MODIFY",
"old_path": "Source/tinyexr.h",
"new_path": "Source/tinyexr.h",
"diff": "@@ -12552,6 +12552,7 @@ int SaveEXRImageToFile(const EXRImage *exr_image, const EXRHeader *exr_header,\nunsigned char *mem = NULL;\nsize_t mem_size = SaveEXRImageToMemory(exr_image, exr_header, &mem, err);\nif (mem_size == 0) {\n+ fclose(fp);\nreturn TINYEXR_ERROR_SERIALZATION_FAILED;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
TinyEXR: Fix leak in SaveEXRImageToFile()
|
61,745 |
17.12.2020 22:13:01
| 0 |
9e76c9c2a861357eb068ea8a96878d0ab18159bf
|
TinyEXR: Fix leak in LoadEXRImageFromFile()
|
[
{
"change_type": "MODIFY",
"old_path": "Source/tinyexr.h",
"new_path": "Source/tinyexr.h",
"diff": "@@ -11965,6 +11965,7 @@ int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header,\nfseek(fp, 0, SEEK_SET);\nif (filesize < 16) {\n+ fclose(fp);\ntinyexr::SetErrorMessage(\"File size too short \" + std::string(filename),\nerr);\nreturn TINYEXR_ERROR_INVALID_FILE;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
TinyEXR: Fix leak in LoadEXRImageFromFile()
|
61,745 |
17.12.2020 22:14:51
| 0 |
b331e70e337133d50c6234aed8b51c10e4bb85bb
|
TinyEXR: Fix leak in ParseEXRVersionFromFile()
|
[
{
"change_type": "MODIFY",
"old_path": "Source/tinyexr.h",
"new_path": "Source/tinyexr.h",
"diff": "@@ -13289,6 +13289,7 @@ int ParseEXRVersionFromFile(EXRVersion *version, const char *filename) {\nfseek(fp, 0, SEEK_SET);\nif (file_size < tinyexr::kEXRVersionSize) {\n+ fclose(fp);\nreturn TINYEXR_ERROR_INVALID_FILE;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
TinyEXR: Fix leak in ParseEXRVersionFromFile()
|
61,745 |
17.12.2020 22:16:29
| 0 |
2994ecc6961b5e4259ca4c826cc2514d131658ea
|
TinyEXR: Remove dead code
|
[
{
"change_type": "MODIFY",
"old_path": "Source/tinyexr.h",
"new_path": "Source/tinyexr.h",
"diff": "@@ -13244,10 +13244,6 @@ int ParseEXRVersionFromMemory(EXRVersion *version, const unsigned char *memory,\nreturn TINYEXR_ERROR_INVALID_EXR_VERSION;\n}\n- if (version == NULL) {\n- return TINYEXR_SUCCESS; // May OK\n- }\n-\nversion->version = 2;\nif (marker[1] & 0x2) { // 9th bit\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
TinyEXR: Remove dead code
|
61,745 |
17.12.2020 22:57:09
| 0 |
8fb9572b1f4f394bd35adc0ecbde51f075fda4d0
|
Trap stb_image asserts to a clean error handler
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_image_external.cpp",
"new_path": "Source/astcenccli_image_external.cpp",
"diff": "* @brief Functions for building the implementation of stb_image and tinyexr\n*/\n+#include <cstdlib>\n+#include <cstdio>\n+\n#define STB_IMAGE_IMPLEMENTATION\n#define STB_IMAGE_WRITE_IMPLEMENTATION\n#define STBI_MSC_SECURE_CRT\n#define STBI_NO_PIC\n#define STBI_NO_PNM\n#define STBI_NO_PSD\n+#define STBI_ASSERT(x) astcenc_runtime_assert(x)\n+\n+static void astcenc_runtime_assert(bool condition)\n+{\n+ if (!condition)\n+ {\n+ printf(\"ERROR: Corrupt input image\\n\");\n+ exit(1);\n+ }\n+}\n#include \"stb_image.h\"\n#include \"stb_image_write.h\"\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Trap stb_image asserts to a clean error handler
|
61,745 |
17.12.2020 23:05:44
| 0 |
3e18b2772b74459042bec35860626ac13eef45ca
|
Trap TinyEXR asserts to a clean error handler
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_image_external.cpp",
"new_path": "Source/astcenccli_image_external.cpp",
"diff": "#define STB_IMAGE_IMPLEMENTATION\n#define STB_IMAGE_WRITE_IMPLEMENTATION\n#define STBI_MSC_SECURE_CRT\n-#define TINYEXR_IMPLEMENTATION\n#define STBI_NO_GIF\n#define STBI_NO_PIC\n#define STBI_NO_PNM\n#define STBI_NO_PSD\n+\n+#define TINYEXR_IMPLEMENTATION\n+\n+// For both libraries force asserts (which can be triggered by corrupt input\n+// images) to be handled at runtime in release builds to avoid security issues.\n#define STBI_ASSERT(x) astcenc_runtime_assert(x)\n+#define TEXR_ASSERT(x) astcenc_runtime_assert(x)\nstatic void astcenc_runtime_assert(bool condition)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/tinyexr.h",
"new_path": "Source/tinyexr.h",
"diff": "@@ -501,7 +501,6 @@ extern int LoadEXRFromMemory(float **out_rgba, int *width, int *height,\n#define TINYEXR_IMPLEMENTATION_DEIFNED\n#include <algorithm>\n-#include <cassert>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n@@ -1927,10 +1926,7 @@ typedef unsigned char mz_validate_uint16[sizeof(mz_uint16) == 2 ? 1 : -1];\ntypedef unsigned char mz_validate_uint32[sizeof(mz_uint32) == 4 ? 1 : -1];\ntypedef unsigned char mz_validate_uint64[sizeof(mz_uint64) == 8 ? 1 : -1];\n-//#include <assert.h>\n-//#include <string.h>\n-\n-#define MZ_ASSERT(x) assert(x)\n+#define MZ_ASSERT(x) TEXR_ASSERT(x)\n#ifdef MINIZ_NO_MALLOC\n#define MZ_MALLOC(x) NULL\n@@ -7581,7 +7577,7 @@ static void CompressZip(unsigned char *dst,\nint ret = miniz::mz_compress(\ndst, &outSize, static_cast<const unsigned char *>(&tmpBuf.at(0)),\nsrc_size);\n- assert(ret == miniz::MZ_OK);\n+ TEXR_ASSERT(ret == miniz::MZ_OK);\n(void)ret;\ncompressedSize = outSize;\n@@ -7589,7 +7585,7 @@ static void CompressZip(unsigned char *dst,\nuLong outSize = compressBound(static_cast<uLong>(src_size));\nint ret = compress(dst, &outSize, static_cast<const Bytef *>(&tmpBuf.at(0)),\nsrc_size);\n- assert(ret == Z_OK);\n+ TEXR_ASSERT(ret == Z_OK);\ncompressedSize = outSize;\n#endif\n@@ -7841,7 +7837,7 @@ static void CompressRle(unsigned char *dst,\nint outSize = rleCompress(static_cast<int>(src_size),\nreinterpret_cast<const char *>(&tmpBuf.at(0)),\nreinterpret_cast<signed char *>(dst));\n- assert(outSize > 0);\n+ TEXR_ASSERT(outSize > 0);\ncompressedSize = static_cast<tinyexr::tinyexr_uint64>(outSize);\n@@ -8518,7 +8514,7 @@ static void hufBuildEncTable(\nfor (int j = m;; j = hlink[j]) {\nscode[j]++;\n- assert(scode[j] <= 58);\n+ TEXR_ASSERT(scode[j] <= 58);\nif (hlink[j] == j) {\n//\n@@ -8537,7 +8533,7 @@ static void hufBuildEncTable(\nfor (int j = mm;; j = hlink[j]) {\nscode[j]++;\n- assert(scode[j] <= 58);\n+ TEXR_ASSERT(scode[j] <= 58);\nif (hlink[j] == j) break;\n}\n@@ -9261,7 +9257,7 @@ static bool CompressPiz(unsigned char *outPtr, unsigned int *outSize,\n#if !MINIZ_LITTLE_ENDIAN\n// @todo { PIZ compression on BigEndian architecture. }\n- assert(0);\n+ TEXR_ASSERT(0);\nreturn false;\n#endif\n@@ -9387,7 +9383,7 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr,\n#if !MINIZ_LITTLE_ENDIAN\n// @todo { PIZ compression on BigEndian architecture. }\n- assert(0);\n+ TEXR_ASSERT(0);\nreturn false;\n#endif\n@@ -9548,7 +9544,7 @@ bool FindZFPCompressionParam(ZFPCompressionParam *param,\n}\n}\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\nreturn false;\n@@ -9569,8 +9565,8 @@ static bool DecompressZfp(float *dst, int dst_width, int dst_num_lines,\nzfp_stream *zfp = NULL;\nzfp_field *field = NULL;\n- assert((dst_width % 4) == 0);\n- assert((dst_num_lines % 4) == 0);\n+ TEXR_ASSERT((dst_width % 4) == 0);\n+ TEXR_ASSERT((dst_num_lines % 4) == 0);\nif ((dst_width & 3U) || (dst_num_lines & 3U)) {\nreturn false;\n@@ -9589,7 +9585,7 @@ static bool DecompressZfp(float *dst, int dst_width, int dst_num_lines,\n} else if (param.type == TINYEXR_ZFP_COMPRESSIONTYPE_ACCURACY) {\nzfp_stream_set_accuracy(zfp, param.tolerance, zfp_type_float);\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\nsize_t buf_size = zfp_stream_maximum_size(zfp, field);\n@@ -9632,8 +9628,8 @@ bool CompressZfp(std::vector<unsigned char> *outBuf, unsigned int *outSize,\nzfp_stream *zfp = NULL;\nzfp_field *field = NULL;\n- assert((width % 4) == 0);\n- assert((num_lines % 4) == 0);\n+ TEXR_ASSERT((width % 4) == 0);\n+ TEXR_ASSERT((num_lines % 4) == 0);\nif ((width & 3U) || (num_lines & 3U)) {\nreturn false;\n@@ -9652,7 +9648,7 @@ bool CompressZfp(std::vector<unsigned char> *outBuf, unsigned int *outSize,\n} else if (param.type == TINYEXR_ZFP_COMPRESSIONTYPE_ACCURACY) {\nzfp_stream_set_accuracy(zfp, param.tolerance, zfp_type_float);\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\nsize_t buf_size = zfp_stream_maximum_size(zfp, field);\n@@ -9786,7 +9782,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) {\n- assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT);\n+ TEXR_ASSERT(requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT);\nfor (size_t v = 0; v < static_cast<size_t>(num_lines); v++) {\nconst unsigned int *line_ptr = reinterpret_cast<unsigned int *>(\n@@ -9815,7 +9811,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {\n- assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT);\n+ TEXR_ASSERT(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT);\nfor (size_t v = 0; v < static_cast<size_t>(num_lines); v++) {\nconst float *line_ptr = reinterpret_cast<float *>(&outBuf.at(\nv * pixel_data_size * static_cast<size_t>(x_stride) +\n@@ -9842,11 +9838,11 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\n}\n#else\n- assert(0 && \"PIZ is enabled in this build\");\n+ TEXR_ASSERT(0 && \"PIZ is enabled in this build\");\nreturn false;\n#endif\n@@ -9858,7 +9854,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\npixel_data_size);\nunsigned long dstLen = static_cast<unsigned long>(outBuf.size());\n- assert(dstLen > 0);\n+ TEXR_ASSERT(dstLen > 0);\nif (!tinyexr::DecompressZip(\nreinterpret_cast<unsigned char *>(&outBuf.at(0)), &dstLen, data_ptr,\nstatic_cast<unsigned long>(data_len))) {\n@@ -9925,7 +9921,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) {\n- assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT);\n+ TEXR_ASSERT(requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT);\nfor (size_t v = 0; v < static_cast<size_t>(num_lines); v++) {\nconst unsigned int *line_ptr = reinterpret_cast<unsigned int *>(\n@@ -9954,7 +9950,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {\n- assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT);\n+ TEXR_ASSERT(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT);\nfor (size_t v = 0; v < static_cast<size_t>(num_lines); v++) {\nconst float *line_ptr = reinterpret_cast<float *>(\n&outBuf.at(v * pixel_data_size * static_cast<size_t>(width) +\n@@ -9981,7 +9977,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\nreturn false;\n}\n}\n@@ -10059,7 +10055,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) {\n- assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT);\n+ TEXR_ASSERT(requested_pixel_types[c] == TINYEXR_PIXELTYPE_UINT);\nfor (size_t v = 0; v < static_cast<size_t>(num_lines); v++) {\nconst unsigned int *line_ptr = reinterpret_cast<unsigned int *>(\n@@ -10088,7 +10084,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {\n- assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT);\n+ TEXR_ASSERT(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT);\nfor (size_t v = 0; v < static_cast<size_t>(num_lines); v++) {\nconst float *line_ptr = reinterpret_cast<float *>(\n&outBuf.at(v * pixel_data_size * static_cast<size_t>(width) +\n@@ -10115,7 +10111,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\nreturn false;\n}\n}\n@@ -10124,7 +10120,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\ntinyexr::ZFPCompressionParam zfp_compression_param;\nif (!FindZFPCompressionParam(&zfp_compression_param, attributes,\nnum_attributes)) {\n- assert(0);\n+ TEXR_ASSERT(0);\nreturn false;\n}\n@@ -10134,7 +10130,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\npixel_data_size);\nunsigned long dstLen = outBuf.size();\n- assert(dstLen > 0);\n+ TEXR_ASSERT(dstLen > 0);\ntinyexr::DecompressZfp(reinterpret_cast<float *>(&outBuf.at(0)), width,\nnum_lines, num_channels, data_ptr,\nstatic_cast<unsigned long>(data_len),\n@@ -10151,9 +10147,9 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n// pixel sample data for channel n for scanline 1\n// ...\nfor (size_t c = 0; c < static_cast<size_t>(num_channels); c++) {\n- assert(channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT);\n+ TEXR_ASSERT(channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT);\nif (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {\n- assert(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT);\n+ TEXR_ASSERT(requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT);\nfor (size_t v = 0; v < static_cast<size_t>(num_lines); v++) {\nconst float *line_ptr = reinterpret_cast<float *>(\n&outBuf.at(v * pixel_data_size * static_cast<size_t>(width) +\n@@ -10179,7 +10175,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n}\n}\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\nreturn false;\n}\n}\n@@ -10187,7 +10183,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\n(void)attributes;\n(void)num_attributes;\n(void)num_channels;\n- assert(0);\n+ TEXR_ASSERT(0);\nreturn false;\n#endif\n} else if (compression_type == TINYEXR_COMPRESSIONTYPE_NONE) {\n@@ -10248,7 +10244,7 @@ static bool DecodePixelData(/* out */ unsigned char **out_images,\noutLine[u] = f32.f;\n}\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\nreturn false;\n}\n} else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {\n@@ -10323,8 +10319,8 @@ static bool DecodeTiledPixelData(\nconst EXRAttribute *attributes, size_t num_channels,\nconst EXRChannelInfo *channels,\nconst std::vector<size_t> &channel_offset_list) {\n- assert(tile_offset_x * tile_size_x < data_width);\n- assert(tile_offset_y * tile_size_y < data_height);\n+ TEXR_ASSERT(tile_offset_x * tile_size_x < data_width);\n+ TEXR_ASSERT(tile_offset_y * tile_size_y < data_height);\n// Compute actual image size in a tile.\nif ((tile_offset_x + 1) * tile_size_x >= data_width) {\n@@ -10398,7 +10394,7 @@ static unsigned char **AllocateImage(int num_channels,\nimages[c] = reinterpret_cast<unsigned char *>(\nstatic_cast<float *>(malloc(sizeof(float) * data_len)));\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\n} else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) {\n// pixel_data_size += sizeof(float);\n@@ -10411,7 +10407,7 @@ static unsigned char **AllocateImage(int num_channels,\nimages[c] = reinterpret_cast<unsigned char *>(\nstatic_cast<unsigned int *>(malloc(sizeof(unsigned int) * data_len)));\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\n}\n@@ -10508,7 +10504,7 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header,\nif (version->tiled && attr_name.compare(\"tiles\") == 0) {\nunsigned int x_size, y_size;\nunsigned char tile_mode;\n- assert(data.size() == 9);\n+ TEXR_ASSERT(data.size() == 9);\nmemcpy(&x_size, &data.at(0), sizeof(int));\nmemcpy(&y_size, &data.at(4), sizeof(int));\ntile_mode = data[8];\n@@ -11184,8 +11180,8 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header,\nstatic bool ReconstructLineOffsets(\nstd::vector<tinyexr::tinyexr_uint64> *offsets, size_t n,\nconst unsigned char *head, const unsigned char *marker, const size_t size) {\n- assert(head < marker);\n- assert(offsets->size() == n);\n+ TEXR_ASSERT(head < marker);\n+ TEXR_ASSERT(offsets->size() == n);\nfor (size_t i = 0; i < n; i++) {\nsize_t offset = static_cast<size_t>(marker - head);\n@@ -11975,7 +11971,7 @@ int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header,\n{\nsize_t ret;\nret = fread(&buf[0], 1, filesize, fp);\n- assert(ret == filesize);\n+ TEXR_ASSERT(ret == filesize);\nfclose(fp);\n(void)ret;\n}\n@@ -12204,7 +12200,7 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,\npixel_data_size += sizeof(unsigned int);\nchannel_offset += sizeof(unsigned int);\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\n}\n@@ -12284,7 +12280,7 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,\n}\n}\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\n} else if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) {\n@@ -12329,7 +12325,7 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,\n}\n}\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\n} else if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_UINT) {\nfor (int y = 0; y < h; y++) {\n@@ -12450,7 +12446,7 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,\nblock.begin() + data_len);\n#else\n- assert(0);\n+ TEXR_ASSERT(0);\n#endif\n} else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) {\n#if TINYEXR_USE_ZFP\n@@ -12477,10 +12473,10 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image,\nblock.begin() + data_len);\n#else\n- assert(0);\n+ TEXR_ASSERT(0);\n#endif\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\n} // omp parallel\n@@ -12613,7 +12609,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {\n{\nsize_t ret;\nret = fread(&buf[0], 1, filesize, fp);\n- assert(ret == filesize);\n+ TEXR_ASSERT(ret == filesize);\n(void)ret;\n}\nfclose(fp);\n@@ -12737,11 +12733,11 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {\n}\n}\n- assert(dx >= 0);\n- assert(dy >= 0);\n- assert(dw >= 0);\n- assert(dh >= 0);\n- assert(num_channels >= 1);\n+ TEXR_ASSERT(dx >= 0);\n+ TEXR_ASSERT(dy >= 0);\n+ TEXR_ASSERT(dw >= 0);\n+ TEXR_ASSERT(dh >= 0);\n+ TEXR_ASSERT(num_channels >= 1);\nint data_width = dw - dx + 1;\nint data_height = dh - dy + 1;\n@@ -12842,7 +12838,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {\nreturn false;\n}\n- assert(dstLen == pixelOffsetTable.size() * sizeof(int));\n+ TEXR_ASSERT(dstLen == pixelOffsetTable.size() * sizeof(int));\nfor (size_t i = 0; i < static_cast<size_t>(data_width); i++) {\ndeep_image->offset_table[y][i] = pixelOffsetTable[i];\n}\n@@ -12861,7 +12857,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {\nstatic_cast<unsigned long>(packedSampleDataSize))) {\nreturn false;\n}\n- assert(dstLen == static_cast<unsigned long>(unpackedSampleDataSize));\n+ TEXR_ASSERT(dstLen == static_cast<unsigned long>(unpackedSampleDataSize));\n}\n}\n@@ -12880,14 +12876,14 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) {\nTINYEXR_PIXELTYPE_FLOAT) { // float\nchannel_offset += 4;\n} else {\n- assert(0);\n+ TEXR_ASSERT(0);\n}\n}\nsampleSize = channel_offset;\n}\n- assert(sampleSize >= 2);\n+ TEXR_ASSERT(sampleSize >= 2);\n- assert(static_cast<size_t>(\n+ TEXR_ASSERT(static_cast<size_t>(\npixelOffsetTable[static_cast<size_t>(data_width - 1)] *\nsampleSize) == sample_data.size());\nint samples_per_line = static_cast<int>(sample_data.size()) / sampleSize;\n@@ -13077,7 +13073,7 @@ int ParseEXRHeaderFromFile(EXRHeader *exr_header, const EXRVersion *exr_version,\n{\nsize_t ret;\nret = fread(&buf[0], 1, filesize, fp);\n- assert(ret == filesize);\n+ TEXR_ASSERT(ret == filesize);\nfclose(fp);\nif (ret != filesize) {\n@@ -13197,7 +13193,7 @@ int ParseEXRMultipartHeaderFromFile(EXRHeader ***exr_headers, int *num_headers,\n{\nsize_t ret;\nret = fread(&buf[0], 1, filesize, fp);\n- assert(ret == filesize);\n+ TEXR_ASSERT(ret == filesize);\nfclose(fp);\nif (ret != filesize) {\n@@ -13428,7 +13424,7 @@ int LoadEXRMultipartImageFromFile(EXRImage *exr_images,\n{\nsize_t ret;\nret = fread(&buf[0], 1, filesize, fp);\n- assert(ret == filesize);\n+ TEXR_ASSERT(ret == filesize);\nfclose(fp);\n(void)ret;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Trap TinyEXR asserts to a clean error handler
|
61,745 |
17.12.2020 23:08:32
| 0 |
a9f4a31819c4f54a0f934b87f7044ee398207d76
|
Add error handling change to ChangeLog
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog.md",
"new_path": "Docs/ChangeLog.md",
"diff": "@@ -32,6 +32,9 @@ recompile your client-side code using the updated `astcenc.h` header.\n* **Feature:** New image preprocess `-pp-premultiply` option added. This\nscales RGB values by the alpha value. This can be useful to minimize\ncross-channel color bleed caused by GPU post-multiply filtering/blending.\n+ * **Improvements:** Command line tool cleanly traps and reports errors for\n+ corrupt input images rather than relying on hard standard library\n+ `assert()` calls.\n* **Core API:**\n* **API Change:** Images using region-based metrics no longer need to include\npadding; all input images should be tightly packed and `dim_pad` is removed\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add error handling change to ChangeLog
|
61,745 |
18.12.2020 14:10:18
| 0 |
44ae074c09b92cac5145e6fa09c923f3e9f28cb9
|
Update build script for oss-fuzz
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Fuzzers/build.sh",
"new_path": "Source/Fuzzers/build.sh",
"diff": "# under the License.\n# ----------------------------------------------------------------------------\n-# Build the core project\n-make -j$(nproc) BUILD=debug VEC=sse2\n+# This script is invoked by oss-fuzz from <root>/Source/\n+\n+# Build the core project for fuzz tests to link against\n+for source in ./*.cpp; do\n+ BASE=\"${source##*/}\"\n+ BASE=\"${BASE%.cpp}\"\n+ echo ${BASE}\n+\n+ $CXX $CXXFLAGS \\\n+ -c \\\n+ -DASTCENC_SSE=0 \\\n+ -DASTCENC_AVX=0 \\\n+ -DASTCENC_POPCNT=0 \\\n+ -DASTCENC_ISA_INVARIANCE=0 \\\n+ -I. -std=c++14 -mfpmath=sse -msse2 -fno-strict-aliasing -O0 -g \\\n+ $source \\\n+ -o ${BASE}.o\n+done\n-# Package up a library for fuzzers to link against\nar -qc libastcenc.a *.o\n# Build project local fuzzers\n-for fuzzer in $SRC/astc-encoder/Source/Fuzzers/fuzz_*.cpp; do\n+for fuzzer in ./Fuzzers/fuzz_*.cpp; do\n$CXX $CXXFLAGS \\\n-DASTCENC_SSE=0 \\\n-DASTCENC_AVX=0 \\\n-DASTCENC_POPCNT=0 \\\n-DASTCENC_ISA_INVARIANCE=0 \\\n- -I. -std=c++14 $fuzzer $LIB_FUZZING_ENGINE $SRC/astc-encoder/Source/libastcenc.a \\\n+ -I. -std=c++14 $fuzzer $LIB_FUZZING_ENGINE ./libastcenc.a \\\n-o $OUT/$(basename -s .cpp $fuzzer)\ndone\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update build script for oss-fuzz
|
61,745 |
26.12.2020 22:10:08
| 0 |
9efedb56a0887d7f17bae9ee69bdb265b2b7ee39
|
Use wrapper script for macOS signing
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -241,8 +241,7 @@ pipeline {\nwithCredentials([usernamePassword(credentialsId: 'win-signing',\nusernameVariable: 'USERNAME',\npasswordVariable: 'PASSWORD')]) {\n- sh 'python3 ./signing/macos-client.py -t mach-o --timestamp-server default --signature-flag runtime --deep ${USERNAME} *.zip *.zip'\n- sh 'rm -rf ./signing'\n+ sh 'python3 ./signing/macos-client-wrapper.py ${USERNAME} *.zip'\n}\n}\ndir('upload') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use wrapper script for macOS signing
|
61,745 |
26.12.2020 22:12:36
| 0 |
45e4077b41cbfa274c956ccc1c1b4837b0b99c53
|
Add script to remove signing directory
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -242,6 +242,7 @@ pipeline {\nusernameVariable: 'USERNAME',\npasswordVariable: 'PASSWORD')]) {\nsh 'python3 ./signing/macos-client-wrapper.py ${USERNAME} *.zip'\n+ sh 'rm -rf ./signing'\n}\n}\ndir('upload') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add script to remove signing directory
|
61,745 |
26.12.2020 22:24:58
| 0 |
fac1304939194e35dc99c9266e1c1844ccb970c3
|
Move signing to the macOS node
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -180,6 +180,22 @@ pipeline {\n'''\n}\n}\n+ stage('Sign') {\n+ steps {\n+ dir('build_rel') {\n+ withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n+ keyFileVariable: 'SSH_AUTH_FILE')]) {\n+ sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE -o StrictHostKeyChecking=no\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n+ }\n+ withCredentials([usernamePassword(credentialsId: 'win-signing',\n+ usernameVariable: 'USERNAME',\n+ passwordVariable: 'PASSWORD')]) {\n+ sh 'python3 ./signing/macos-client-wrapper.py ${USERNAME} *.zip'\n+ sh 'rm -rf ./signing'\n+ }\n+ }\n+ }\n+ }\nstage('Stash') {\nsteps {\ndir('build_rel') {\n@@ -234,16 +250,6 @@ pipeline {\n}\ndir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n- withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n- keyFileVariable: 'SSH_AUTH_FILE')]) {\n- sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE -o StrictHostKeyChecking=no\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n- }\n- withCredentials([usernamePassword(credentialsId: 'win-signing',\n- usernameVariable: 'USERNAME',\n- passwordVariable: 'PASSWORD')]) {\n- sh 'python3 ./signing/macos-client-wrapper.py ${USERNAME} *.zip'\n- sh 'rm -rf ./signing'\n- }\n}\ndir('upload') {\nunstash 'astcenc-linux-x64-hash'\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Move signing to the macOS node
|
61,745 |
26.12.2020 22:35:06
| 0 |
3da728c8373414baf2664904e00b0405170cc8cc
|
Force clean build directories in build nodes
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -87,7 +87,7 @@ pipeline {\nstages {\nstage('Clean') {\nsteps {\n- sh 'git clean -fdx'\n+ sh 'git clean -ffdx'\n}\n}\nstage('Build R') {\n@@ -127,7 +127,7 @@ pipeline {\nstages {\nstage('Clean') {\nsteps {\n- bat 'git clean -fdx'\n+ bat 'git clean -ffdx'\n}\n}\nstage('Build R') {\n@@ -167,7 +167,7 @@ pipeline {\nstages {\nstage('Clean') {\nsteps {\n- sh 'git clean -fdx'\n+ sh 'git clean -ffdx'\n}\n}\nstage('Build R') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Force clean build directories in build nodes
|
61,745 |
26.12.2020 22:51:27
| 0 |
88ed07b54958c2caa5d038e6fae0fb5e92eff1d7
|
Add notarization requirement on macOS node
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -162,7 +162,7 @@ pipeline {\n/* Build for macOS on x86-64 using Clang */\nstage('macOS') {\nagent {\n- label 'mac && x86_64'\n+ label 'mac && x86_64 && notarizer'\n}\nstages {\nstage('Clean') {\n@@ -180,7 +180,10 @@ pipeline {\n'''\n}\n}\n- stage('Sign') {\n+ stage('Sign and notarize') {\n+ environment {\n+ NOTARIZATION_CREDS = credentials('notarization-account')\n+ }\nsteps {\ndir('build_rel') {\nwithCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add notarization requirement on macOS node
|
61,745 |
26.12.2020 23:15:33
| 0 |
31b68182064d6140e4b059b76fffd360b08e7d1c
|
Add signing wrapper for Windows nodes
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -247,7 +247,7 @@ pipeline {\nwithCredentials([usernamePassword(credentialsId: 'win-signing',\nusernameVariable: 'USERNAME',\npasswordVariable: 'PASSWORD')]) {\n- sh 'python3 ./signing/authenticode-client.py -u ${USERNAME} *.zip'\n+ sh 'python3 ./signing/windows-client-wrapper.py -u ${USERNAME} *.zip'\nsh 'rm -rf ./signing'\n}\n}\n@@ -256,8 +256,7 @@ pipeline {\n}\ndir('upload') {\nunstash 'astcenc-linux-x64-hash'\n- // Don't keep Windows hash - we have signed binaries now\n- // unstash 'astcenc-windows-x64-hash'\n+ unstash 'astcenc-windows-x64-hash'\nunstash 'astcenc-macos-x64-hash'\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add signing wrapper for Windows nodes
|
61,745 |
26.12.2020 23:28:07
| 0 |
7de704f795552993392d200b07e65c1f38222631
|
Remove -u from windows signing script
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -247,7 +247,7 @@ pipeline {\nwithCredentials([usernamePassword(credentialsId: 'win-signing',\nusernameVariable: 'USERNAME',\npasswordVariable: 'PASSWORD')]) {\n- sh 'python3 ./signing/windows-client-wrapper.py -u ${USERNAME} *.zip'\n+ sh 'python3 ./signing/windows-client-wrapper.py ${USERNAME} *.zip'\nsh 'rm -rf ./signing'\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove -u from windows signing script
|
61,745 |
26.12.2020 23:45:48
| 0 |
96989cb19b4f2ef0707992f48d0f395ec4e53a38
|
Consolidate sha256 checksums
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -235,9 +235,16 @@ pipeline {\nstages {\nstage('Unstash') {\nsteps {\n+ dir('upload') {\n+ unstash 'astcenc-linux-x64-hash'\n+ unstash 'astcenc-macos-x64-hash'\n+ }\ndir('upload/linux-x64') {\nunstash 'astcenc-linux-x64'\n}\n+ dir('upload/macos-x64') {\n+ unstash 'astcenc-macos-x64'\n+ }\ndir('upload/windows-x64') {\nunstash 'astcenc-windows-x64'\nwithCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n@@ -248,16 +255,13 @@ pipeline {\nusernameVariable: 'USERNAME',\npasswordVariable: 'PASSWORD')]) {\nsh 'python3 ./signing/windows-client-wrapper.py ${USERNAME} *.zip'\n+ sh 'mv *.zip.sha256 ../'\nsh 'rm -rf ./signing'\n}\n}\n- dir('upload/macos-x64') {\n- unstash 'astcenc-macos-x64'\n- }\ndir('upload') {\n- unstash 'astcenc-linux-x64-hash'\n- unstash 'astcenc-windows-x64-hash'\n- unstash 'astcenc-macos-x64-hash'\n+ sh 'cat *.sha256 > release-sha256.txt'\n+ sh 'rm *.sha256'\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Consolidate sha256 checksums
|
61,745 |
30.12.2020 15:03:36
| 0 |
fc82a0727ee09b9721f58b134b16491b0a58227f
|
Add -Wdocumentation for Clang builds and fix issues
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -179,36 +179,36 @@ static const unsigned int TUNE_MAX_TRIAL_CANDIDATES { 4 };\nclass ParallelManager\n{\nprivate:\n- /** \\brief Lock used for critical section and condition synchronization. */\n+ /** @brief Lock used for critical section and condition synchronization. */\nstd::mutex m_lock;\n- /** \\brief True if the stage init() step has been executed. */\n+ /** @brief True if the stage init() step has been executed. */\nbool m_init_done;\n- /** \\brief True if the stage term() step has been executed. */\n+ /** @brief True if the stage term() step has been executed. */\nbool m_term_done;\n- /** \\brief Contition variable for tracking stage processing completion. */\n+ /** @brief Contition variable for tracking stage processing completion. */\nstd::condition_variable m_complete;\n- /** \\brief Number of tasks started, but not necessarily finished. */\n+ /** @brief Number of tasks started, but not necessarily finished. */\nunsigned int m_start_count;\n- /** \\brief Number of tasks finished. */\n+ /** @brief Number of tasks finished. */\nunsigned int m_done_count;\n- /** \\brief Number of tasks that need to be processed. */\n+ /** @brief Number of tasks that need to be processed. */\nunsigned int m_task_count;\npublic:\n- /** \\brief Create a new ParallelManager. */\n+ /** @brief Create a new ParallelManager. */\nParallelManager()\n{\nreset();\n}\n/**\n- * \\brief Reset the tracker for a new processing batch.\n+ * @brief Reset the tracker for a new processing batch.\n*\n* This must be called from single-threaded code before starting the\n* multi-threaded procesing operations.\n@@ -223,13 +223,13 @@ public:\n}\n/**\n- * \\brief Trigger the pipeline stage init step.\n+ * @brief Trigger the pipeline stage init step.\n*\n* This can be called from multi-threaded code. The first thread to\n* hit this will process the initialization. Other threads will block\n* and wait for it to complete.\n*\n- * \\param init_func Callable which executes the stage initialization.\n+ * @param init_func Callable which executes the stage initialization.\n* Must return the number of tasks in the stage.\n*/\nvoid init(std::function<unsigned int(void)> init_func)\n@@ -243,13 +243,13 @@ public:\n}\n/**\n- * \\brief Trigger the pipeline stage init step.\n+ * @brief Trigger the pipeline stage init step.\n*\n* This can be called from multi-threaded code. The first thread to\n* hit this will process the initialization. Other threads will block\n* and wait for it to complete.\n*\n- * \\param task_count Total number of tasks needing processing.\n+ * @param task_count Total number of tasks needing processing.\n*/\nvoid init(unsigned int task_count)\n{\n@@ -262,12 +262,12 @@ public:\n}\n/**\n- * \\brief Request a task assignment.\n+ * @brief Request a task assignment.\n*\n- * Assign up to \\c granule tasks to the caller for processing.\n+ * Assign up to @c granule tasks to the caller for processing.\n*\n- * \\param granule Maximum number of tasks that can be assigned.\n- * \\param[out] count Actual number of tasks assigned, or zero if\n+ * @param granule Maximum number of tasks that can be assigned.\n+ * @param[out] count Actual number of tasks assigned, or zero if\n* no tasks were assigned.\n*\n* \\return Task index of the first assigned task; assigned tasks\n@@ -283,12 +283,12 @@ public:\n}\n/**\n- * \\brief Complete a task assignment.\n+ * @brief Complete a task assignment.\n*\n- * Mark \\c count tasks as complete. This will notify all threads blocked\n- * on \\c wait() if this completes the processing of the stage.\n+ * Mark @c count tasks as complete. This will notify all threads blocked\n+ * on @c wait() if this completes the processing of the stage.\n*\n- * \\param count The number of completed tasks.\n+ * @param count The number of completed tasks.\n*/\nvoid complete_task_assignment(unsigned int count)\n{\n@@ -302,7 +302,7 @@ public:\n}\n/**\n- * \\brief Wait for stage processing to complete.\n+ * @brief Wait for stage processing to complete.\n*/\nvoid wait()\n{\n@@ -311,13 +311,13 @@ public:\n}\n/**\n- * \\brief Trigger the pipeline stage term step.\n+ * @brief Trigger the pipeline stage term step.\n*\n* This can be called from multi-threaded code. The first thread to\n* hit this will process the thread termintion. Caller must have called\n* wait() prior to calling this function to ensure processing is complete.\n*\n- * \\param term_func Callable which executes the stage termination.\n+ * @param term_func Callable which executes the stage termination.\n*/\nvoid term(std::function<void(void)> term_func)\n{\n@@ -813,15 +813,15 @@ void compute_partition_error_color_weightings(\nfloat4 color_scalefactors[4]);\n/**\n- * \\brief Find the best set of partitions to trial for a given block.\n+ * @brief Find the best set of partitions to trial for a given block.\n*\n- * On return \\c best_partition_uncorrelated contains the best partition\n- * assuming the data has noncorrelated chroma, \\c best_partition_samechroma\n+ * On return @c best_partition_uncorrelated contains the best partition\n+ * assuming the data has noncorrelated chroma, @c best_partition_samechroma\n* contains the best partition assuming the data has corelated chroma, and\n- * \\c best_partition_dualplane contains the best partition assuming the data\n+ * @c best_partition_dualplane contains the best partition assuming the data\n* has one uncorrelated color component.\n*\n- * \\c best_partition_dualplane is stored packed; bits [9:0] contain the\n+ * @c best_partition_dualplane is stored packed; bits [9:0] contain the\n* best partition, bits [11:10] contain the best color component.\n*/\nvoid find_best_partitionings(\n@@ -902,7 +902,8 @@ struct avg_var_args\n* @param avg_var_kernel_radius The kernel radius (in pixels) for avg and var.\n* @param alpha_kernel_radius The kernel radius (in pixels) for alpha mods.\n* @param swz Input data channel swizzle.\n- * @param thread_count The number of threads to use.\n+ * @param arg The pixel region arguments for this thread.\n+ * @param ag The average variance arguments for this thread.\n*\n* @return The number of tasks in the processing stage.\n*/\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_mathlib.h",
"new_path": "Source/astcenc_mathlib.h",
"diff": "@@ -50,7 +50,7 @@ static const float PI = 3.14159265358979323846f;\nstatic const float PI_OVER_TWO = 1.57079632679489661923f;\n/**\n- * @brief Fast approximation of log2(x)\n+ * @brief Fast approximation of log2(v).\n*\n* This does not produce correct results for special cases such as\n* zero/inf/nan/denormal/negative inputs:\n@@ -59,26 +59,30 @@ static const float PI_OVER_TWO = 1.57079632679489661923f;\n* resulting in a logarithm of -126.\n* * +Inf and +NaN get treated as an extension of largest-finite values,\n* which should result in a logarithm value between 128 and 129.\n+ *\n+ * @param v The input value.\n+ *\n+ * @return The approximate log2(v).\n*/\n-float log2(float val);\n+float log2(float v);\n/**\n* @brief SP float absolute value.\n*\n- * @param val The value to make absolute.\n+ * @param v The value to make absolute.\n*\n* @return The absolute value.\n*/\n-static inline float fabs(float val)\n+static inline float fabs(float v)\n{\n- return std::fabs(val);\n+ return std::fabs(v);\n}\n/**\n* @brief SP float min.\n*\n- * @param valA The first value to compare.\n- * @param valB The second value to compare.\n+ * @param p The first value to compare.\n+ * @param q The second value to compare.\n*\n* @return The smallest value (q if either is NaN).\n*/\n@@ -90,8 +94,8 @@ static inline float min(float p, float q)\n/**\n* @brief SP float max.\n*\n- * @param valA The first value to compare.\n- * @param valB The second value to compare.\n+ * @param p The first value to compare.\n+ * @param q The second value to compare.\n*\n* @return The largest value (q if either is NaN).\n*/\n@@ -103,33 +107,34 @@ static inline float max(float p, float q)\n/**\n* @brief Test if a float value is a nan.\n*\n- * @param val The value test.\n+ * @param v The value test.\n*\n* @return Zero is not a NaN, non-zero otherwise.\n*/\n-static inline int isnan(float val)\n+static inline int isnan(float v)\n{\n- return val != val;\n+ // TODO: Make this a boolean.\n+ return v != v;\n}\n/**\n- * @brief Clamp a value value between mn and mx\n+ * @brief Clamp a value value between @c mn and @c mx.\n*\n- * For floats, NaNs are turned into mn.\n+ * For floats, NaNs are turned into @c mn.\n*\n- * @param val The value clamp.\n+ * @param v The value to clamp.\n* @param mn The min value (inclusive).\n* @param mx The max value (inclusive).\n*\n* @return The clamped value.\n*/\ntemplate<typename T>\n-inline T clamp(T val, T mn, T mx)\n+inline T clamp(T v, T mn, T mx)\n{\n// Do not reorder; correct NaN handling relies on the fact that comparison\n// with NaN returns false and will fall-though to the \"min\" value.\n- if (val > mx) return mx;\n- if (val > mn) return val;\n+ if (v > mx) return mx;\n+ if (v > mn) return v;\nreturn mn;\n}\n@@ -138,13 +143,13 @@ inline T clamp(T val, T mn, T mx)\n*\n* NaNs are turned into 0.0f.\n*\n- * @param val The value clamp.\n+ * @param v The value to clamp.\n*\n* @return The clamped value.\n*/\n-static inline float clamp1f(float val)\n+static inline float clamp1f(float v)\n{\n- return astc::clamp(val, 0.0f, 1.0f);\n+ return astc::clamp(v, 0.0f, 1.0f);\n}\n/**\n@@ -152,13 +157,13 @@ static inline float clamp1f(float val)\n*\n* NaNs are turned into 0.0f.\n*\n- * @param val The value clamp.\n+ * @param v The value to clamp.\n*\n* @return The clamped value.\n*/\n-static inline float clamp255f(float val)\n+static inline float clamp255f(float v)\n{\n- return astc::clamp(val, 0.0f, 255.0f);\n+ return astc::clamp(v, 0.0f, 255.0f);\n}\n/**\n@@ -166,130 +171,131 @@ static inline float clamp255f(float val)\n*\n* NaNs are turned into 0.0f.\n*\n- * @param val The value to clamp\n+ * @param v The value to clamp\n*\n* @return The clamped value\n*/\n-static inline float clamp64Kf(float val)\n+static inline float clamp64Kf(float v)\n{\n- return astc::clamp(val, 0.0f, 65504.0f);\n+ return astc::clamp(v, 0.0f, 65504.0f);\n}\n/**\n* @brief SP float round-to-nearest.\n*\n- * @param val The value to round.\n+ * @param v The value to round.\n*\n* @return The rounded value.\n*/\n-static inline float flt_rte(float val)\n+static inline float flt_rte(float v)\n{\n- return std::floor(val + 0.5f);\n+ return std::floor(v + 0.5f);\n}\n/**\n* @brief SP float round-down.\n*\n- * @param val The value to round.\n+ * @param v The value to round.\n*\n* @return The rounded value.\n*/\n-static inline float flt_rd(float val)\n+static inline float flt_rd(float v)\n{\n- return std::floor(val);\n+ return std::floor(v);\n}\n/**\n* @brief SP float round-to-nearest and convert to integer.\n*\n- * @param val The value to round.\n+ * @param v The value to round.\n*\n* @return The rounded value.\n*/\n-static inline int flt2int_rtn(float val)\n+static inline int flt2int_rtn(float v)\n{\n- return (int)(val + 0.5f);\n+ return (int)(v + 0.5f);\n}\n/**\n* @brief SP float round down and convert to integer.\n*\n- * @param val The value to round.\n+ * @param v The value to round.\n*\n* @return The rounded value.\n*/\n-static inline int flt2int_rd(float val)\n+static inline int flt2int_rd(float v)\n{\n- return (int)(val);\n+ return (int)(v);\n}\n/**\n* @brief Population bit count.\n*\n- * @param val The value to count.\n+ * @param v The value to population count.\n*\n* @return The number of 1 bits.\n*/\n-static inline int popcount(uint64_t p)\n+static inline int popcount(uint64_t v)\n{\n#if ASTCENC_POPCNT >= 1\n- return (int)_mm_popcnt_u64(p);\n+ return (int)_mm_popcnt_u64(v);\n#else\nuint64_t mask1 = 0x5555555555555555ULL;\nuint64_t mask2 = 0x3333333333333333ULL;\nuint64_t mask3 = 0x0F0F0F0F0F0F0F0FULL;\n- p -= (p >> 1) & mask1;\n- p = (p & mask2) + ((p >> 2) & mask2);\n- p += p >> 4;\n- p &= mask3;\n- p *= 0x0101010101010101ULL;\n- p >>= 56;\n- return (int)p;\n+ v -= (v >> 1) & mask1;\n+ v = (v & mask2) + ((v >> 2) & mask2);\n+ v += v >> 4;\n+ v &= mask3;\n+ v *= 0x0101010101010101ULL;\n+ v >>= 56;\n+ return (int)v;\n#endif\n}\n/**\n* @brief Fast approximation of 1.0 / sqrt(val).\n*\n- * @param val The input value.\n+ * @param v The input value.\n*\n* @return The approximated result.\n*/\n-static inline float rsqrt(float val)\n+static inline float rsqrt(float v)\n{\n- return 1.0f / std::sqrt(val);\n+ return 1.0f / std::sqrt(v);\n}\n/**\n* @brief Fast approximation of sqrt(val).\n*\n- * @param val The input value.\n+ * @param v The input value.\n*\n* @return The approximated result.\n*/\n-static inline float sqrt(float val)\n+static inline float sqrt(float v)\n{\n- return std::sqrt(val);\n+ return std::sqrt(v);\n}\n/**\n* @brief Log base 2, linearized from 2^-14.\n*\n- * @param val The value to log2.\n+ * @param v The value to log2.\n*\n* @return The approximated result.\n*/\n-static inline float xlog2(float val)\n+static inline float xlog2(float v)\n{\n- if (val >= 0.00006103515625f)\n+ if (v >= 0.00006103515625f)\n{\n- return astc::log2(val);\n+ return astc::log2(v);\n}\n// Linearized region\n- return -15.44269504088896340735f + val * 23637.11554992477646609062f;\n+ return -15.442694664f + v * 23637.115234375f;\n+\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_internal.h",
"new_path": "Source/astcenccli_internal.h",
"diff": "@@ -59,7 +59,6 @@ struct cli_config_options\n* Functions to load image from file.\n*\n* @param filename The file path on disk.\n- * @param padding The texel padding needed around the image.\n* @param y_flip Should this image be Y flipped?\n* @param[out] is_hdr Is the loaded image HDR?\n* @param[out] num_components The number of components in the loaded image.\n@@ -154,7 +153,6 @@ void astcenc_print_longhelp();\n* @param img2 The compressed image.\n* @param fstop_lo The low exposure fstop (HDR only).\n* @param fstop_hi The high exposure fstop (HDR only).\n- * @param show_psnr Non-zero if metrics should be logged to stdout.\n*/\nvoid compute_error_metrics(\nint compute_hdr_metrics,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -303,13 +303,12 @@ static astcenc_image* load_uncomp_file(\n}\n/**\n- * @brief Parse the command line and read operation, profile\n- * input and output file names\n+ * @brief Parse the command line.\n*\n- * @param argc\n- * @param argv\n- * @param operation ASTC operation mode\n- * @param profile ASTC profile\n+ * @param argc Command line argument count.\n+ * @param[in] argv Command line argument vector.\n+ * @param[out] operation Codec operation mode.\n+ * @param[out] profile Codec color profile.\n*\n* @return 0 if everything is okay, 1 if there is some error\n*/\n@@ -347,11 +346,13 @@ int parse_commandline_options(\n/**\n* @brief Initialize the astcenc_config\n*\n- * @param argc\n- * @param argv\n- * @param operation ASTC operation mode\n- * @param comp_image\n- * @param config The astcenc configuration\n+ * @param argc Command line argument count.\n+ * @param[in] argv Command line argument vector.\n+ * @param operation Codec operation mode.\n+ * @param[out] profile Codec color profile.\n+ * @param comp_image Compressed image if a decompress operation.\n+ * @param[out] preprocess Image preprocess operation.\n+ * @param[out] config Codec configuration.\n*\n* @return 0 if everything is okay, 1 if there is some error\n*/\n@@ -513,11 +514,11 @@ int init_astcenc_config(\n/**\n* @brief Edit the astcenc_config\n*\n- * @param argc\n- * @param argv\n- * @param operation ASTC operation mode\n- * @param cli_config Command line config options\n- * @param config The astcenc configuration\n+ * @param argc Command line argument count.\n+ * @param[in] argv Command line argument vector.\n+ * @param operation Codec operation.\n+ * @param[out] cli_config Command line config.\n+ * @param[in,out] config Codec configuration.\n*\n* @return 0 if everything is Okay, 1 if there is some error\n*/\n@@ -978,7 +979,7 @@ int edit_astcenc_config(\n* @param[in] img The output image.\n* @param x The pixel x coordinate.\n* @param y The pixel y coordinate.\n- * @param x The pixel z coordinate.\n+ * @param z The pixel z coordinate.\n*\n* @return pixel The pixel color value to write.\n*/\n@@ -1035,7 +1036,7 @@ static float4 image_get_pixel(\n* @param[out] img The output image; must use F32 texture channels.\n* @param x The pixel x coordinate.\n* @param y The pixel y coordinate.\n- * @param x The pixel z coordinate.\n+ * @param z The pixel z coordinate.\n* @param pixel The pixel color value to write.\n*/\nstatic void image_set_pixel(\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "@@ -80,7 +80,8 @@ target_compile_options(astcenc-${ISA_SIMD}\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wpedantic>\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Werror>\n$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wshadow>\n- $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wdouble-promotion>)\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wdouble-promotion>\n+ $<$<CXX_COMPILER_ID:Clang>:-Wdocumentation>)\ntarget_link_options(astcenc-${ISA_SIMD}\nPRIVATE\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add -Wdocumentation for Clang builds and fix issues
|
61,745 |
30.12.2020 15:47:57
| 0 |
b4eb750bdafabc5f54f94522ed3f2a5a718025ec
|
Only initialize BSD entries we actually use
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_block_sizes2.cpp",
"new_path": "Source/astcenc_block_sizes2.cpp",
"diff": "@@ -574,9 +574,15 @@ static void initialize_decimation_table_3d(\nstatic void construct_block_size_descriptor_2d(\nint xdim,\nint ydim,\n+ float mode_cutoff,\nblock_size_descriptor* bsd\n) {\n- int decimation_mode_index[256]; // for each of the 256 entries in the decim_table_array, its index\n+ (void)mode_cutoff;\n+\n+ // Store a remap table for storing packed decimation modes.\n+ // Indexing uses [Y * 16 + X] and max block size for each axis is 12.\n+ static const int MAX_DMI = 12 * 16 + 12;\n+ int decimation_mode_index[MAX_DMI];\nint decimation_mode_count = 0;\nbsd->xdim = xdim;\n@@ -584,70 +590,74 @@ static void construct_block_size_descriptor_2d(\nbsd->zdim = 1;\nbsd->texel_count = xdim * ydim;\n- for (int i = 0; i < 256; i++)\n+ for (int i = 0; i < MAX_DMI; i++)\n{\ndecimation_mode_index[i] = -1;\n}\n- // gather all the infill-modes that can be used with the current block size\n- for (int x_weights = 2; x_weights <= 12; x_weights++)\n+ // Gather all the decimation grids that can be used with the current block.\n+\n+ // ASSUMPTION: No compressor will use more weights in any dimension than\n+ // the block has actual texels, because it wastes bits. Decompression of an\n+ // image which violates this assumption will fail, even though it is\n+ // technically permitted by the specification.\n+\n+ // TODO: Many of these decimation options may be unused for any given\n+ // compression due to use of percentile heuristics, but they are needed for\n+ // arbitrary image decompression, so we don't filter them out. We could\n+ // make the compressor startup faster if we have compress-only contexts,\n+ // where we know there is no arbitrary image decompression.\n+ for (int x_weights = 2; x_weights <= xdim; x_weights++)\n{\n- for (int y_weights = 2; y_weights <= 12; y_weights++)\n+ for (int y_weights = 2; y_weights <= ydim; y_weights++)\n{\n- if (x_weights * y_weights > MAX_WEIGHTS_PER_BLOCK)\n+ int weight_count = x_weights * y_weights;\n+ if (weight_count > MAX_WEIGHTS_PER_BLOCK)\n{\ncontinue;\n}\n+ bool try_2planes = (2 * weight_count) <= MAX_WEIGHTS_PER_BLOCK;\n+\ndecimation_table *dt = new decimation_table;\ndecimation_mode_index[y_weights * 16 + x_weights] = decimation_mode_count;\ninitialize_decimation_table_2d(xdim, ydim, x_weights, y_weights, dt);\n- int weight_count = x_weights * y_weights;\n-\nint maxprec_1plane = -1;\nint maxprec_2planes = -1;\nfor (int i = 0; i < 12; i++)\n{\nint bits_1plane = compute_ise_bitcount(weight_count, (quantization_method) i);\n- int bits_2planes = compute_ise_bitcount(2 * weight_count, (quantization_method) i);\n-\nif (bits_1plane >= MIN_WEIGHT_BITS_PER_BLOCK && bits_1plane <= MAX_WEIGHT_BITS_PER_BLOCK)\n{\nmaxprec_1plane = i;\n}\n+ if (try_2planes)\n+ {\n+ int bits_2planes = compute_ise_bitcount(2 * weight_count, (quantization_method) i);\nif (bits_2planes >= MIN_WEIGHT_BITS_PER_BLOCK && bits_2planes <= MAX_WEIGHT_BITS_PER_BLOCK)\n{\nmaxprec_2planes = i;\n}\n}\n-\n- if (2 * x_weights * y_weights > MAX_WEIGHTS_PER_BLOCK)\n- {\n- maxprec_2planes = -1;\n}\n- bsd->permit_encode[decimation_mode_count] = (x_weights <= xdim && y_weights <= ydim);\n-\nbsd->decimation_mode_samples[decimation_mode_count] = weight_count;\nbsd->decimation_mode_maxprec_1plane[decimation_mode_count] = maxprec_1plane;\nbsd->decimation_mode_maxprec_2planes[decimation_mode_count] = maxprec_2planes;\n+ bsd->decimation_mode_percentile[decimation_mode_count] = 1.0f;\nbsd->decimation_tables[decimation_mode_count] = dt;\ndecimation_mode_count++;\n}\n}\n- for (int i = 0; i < MAX_DECIMATION_MODES; i++)\n- {\n- bsd->decimation_mode_percentile[i] = 1.0f;\n- }\n-\n+ // Ensure the end of the array contains valid data (should never get read)\nfor (int i = decimation_mode_count; i < MAX_DECIMATION_MODES; i++)\n{\n- bsd->permit_encode[i] = 0;\nbsd->decimation_mode_samples[i] = 0;\n+ bsd->decimation_mode_percentile[i] = 1.0f;\nbsd->decimation_mode_maxprec_1plane[i] = -1;\nbsd->decimation_mode_maxprec_2planes[i] = -1;\n}\n@@ -658,7 +668,7 @@ static void construct_block_size_descriptor_2d(\nconst float *percentiles = get_2d_percentile_table(xdim, ydim);\n#endif\n- // then construct the list of block formats\n+ // Construct the list of block formats referencing the decimation tables\nint packed_idx = 0;\nfor (int i = 0; i < MAX_WEIGHT_MODES; i++)\n{\n@@ -682,6 +692,7 @@ static void construct_block_size_descriptor_2d(\nbsd->block_mode_to_packed[i] = -1;\nif (!permit_encode) // also disallow decode of grid size larger than block size.\ncontinue;\n+\nint decimation_mode = decimation_mode_index[y_weights * 16 + x_weights];\nbsd->block_modes_packed[packed_idx].decimation_mode = decimation_mode;\nbsd->block_modes_packed[packed_idx].quantization_mode = quantization_mode;\n@@ -706,6 +717,7 @@ static void construct_block_size_descriptor_2d(\ndelete[] percentiles;\n#endif\n+ // Determine the texels to use for kmeans clustering.\nif (xdim * ydim <= 64)\n{\nbsd->texelcount_for_bitmap_partitioning = xdim * ydim;\n@@ -773,13 +785,14 @@ static void construct_block_size_descriptor_3d(\n}\n// gather all the infill-modes that can be used with the current block size\n- for (int x_weights = 2; x_weights <= 6; x_weights++)\n+ for (int x_weights = 2; x_weights <= xdim; x_weights++)\n{\n- for (int y_weights = 2; y_weights <= 6; y_weights++)\n+ for (int y_weights = 2; y_weights <= ydim; y_weights++)\n{\n- for (int z_weights = 2; z_weights <= 6; z_weights++)\n+ for (int z_weights = 2; z_weights <= zdim; z_weights++)\n{\n- if ((x_weights * y_weights * z_weights) > MAX_WEIGHTS_PER_BLOCK)\n+ int weight_count = x_weights * y_weights * z_weights;\n+ if (weight_count > MAX_WEIGHTS_PER_BLOCK)\n{\ncontinue;\n}\n@@ -788,8 +801,6 @@ static void construct_block_size_descriptor_3d(\ndecimation_mode_index[z_weights * 64 + y_weights * 8 + x_weights] = decimation_mode_count;\ninitialize_decimation_table_3d(xdim, ydim, zdim, x_weights, y_weights, z_weights, dt);\n- int weight_count = x_weights * y_weights * z_weights;\n-\nint maxprec_1plane = -1;\nint maxprec_2planes = -1;\nfor (int i = 0; i < 12; i++)\n@@ -813,26 +824,19 @@ static void construct_block_size_descriptor_3d(\nmaxprec_2planes = -1;\n}\n- bsd->permit_encode[decimation_mode_count] = (x_weights <= xdim && y_weights <= ydim && z_weights <= zdim);\n-\nbsd->decimation_mode_samples[decimation_mode_count] = weight_count;\nbsd->decimation_mode_maxprec_1plane[decimation_mode_count] = maxprec_1plane;\nbsd->decimation_mode_maxprec_2planes[decimation_mode_count] = maxprec_2planes;\nbsd->decimation_tables[decimation_mode_count] = dt;\n-\n+ bsd->decimation_mode_percentile[decimation_mode_count] = 1.0f;\ndecimation_mode_count++;\n}\n}\n}\n- for (int i = 0; i < MAX_DECIMATION_MODES; i++)\n- {\n- bsd->decimation_mode_percentile[i] = 1.0f;\n- }\n-\nfor (int i = decimation_mode_count; i < MAX_DECIMATION_MODES; i++)\n{\n- bsd->permit_encode[i] = 0;\n+ bsd->decimation_mode_percentile[i] = 1.0f;\nbsd->decimation_mode_samples[i] = 0;\nbsd->decimation_mode_maxprec_1plane[i] = -1;\nbsd->decimation_mode_maxprec_2planes[i] = -1;\n@@ -875,6 +879,7 @@ static void construct_block_size_descriptor_3d(\n{\nbsd->decimation_mode_percentile[decimation_mode] = 0.0f;\n}\n+\nbsd->block_mode_to_packed[i] = packed_idx;\n++packed_idx;\n}\n@@ -931,6 +936,7 @@ void init_block_size_descriptor(\nint xdim,\nint ydim,\nint zdim,\n+ float mode_cutoff,\nblock_size_descriptor* bsd\n) {\nif (zdim > 1)\n@@ -939,7 +945,7 @@ void init_block_size_descriptor(\n}\nelse\n{\n- construct_block_size_descriptor_2d(xdim, ydim, bsd);\n+ construct_block_size_descriptor_2d(xdim, ydim, mode_cutoff, bsd);\n}\ninit_partition_tables(bsd);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -236,9 +236,9 @@ static void compress_symbolic_block_fixed_partition_1_plane(\n// for each decimation mode, compute an ideal set of weights\n// (that is, weights computed with the assumption that they are not quantized)\n- for (int i = 0; i < MAX_DECIMATION_MODES; i++)\n+ for (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n- if (bsd->permit_encode[i] == 0 || bsd->decimation_mode_maxprec_1plane[i] < 0 || bsd->decimation_mode_percentile[i] > mode_cutoff)\n+ if (bsd->decimation_mode_maxprec_1plane[i] < 0 || bsd->decimation_mode_percentile[i] > mode_cutoff)\n{\ncontinue;\n}\n@@ -501,9 +501,9 @@ static void compress_symbolic_block_fixed_partition_2_planes(\nuint8_t *u8_quantized_decimated_quantized_weights = tmpbuf->u8_quantized_decimated_quantized_weights;\n// for each decimation mode, compute an ideal set of weights\n- for (int i = 0; i < MAX_DECIMATION_MODES; i++)\n+ for (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n- if (bsd->permit_encode[i] == 0 || bsd->decimation_mode_maxprec_2planes[i] < 0 || bsd->decimation_mode_percentile[i] > mode_cutoff)\n+ if (bsd->decimation_mode_maxprec_2planes[i] < 0 || bsd->decimation_mode_percentile[i] > mode_cutoff)\n{\ncontinue;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -503,7 +503,7 @@ astcenc_error astcenc_context_alloc(\n}\nbsd = new block_size_descriptor;\n- init_block_size_descriptor(config.block_x, config.block_y, config.block_z, bsd);\n+ init_block_size_descriptor(config.block_x, config.block_y, config.block_z, config.tune_block_mode_limit / 100.0f, bsd);\nctx->bsd = bsd;\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -404,7 +404,6 @@ struct block_size_descriptor\nint decimation_mode_maxprec_1plane[MAX_DECIMATION_MODES];\nint decimation_mode_maxprec_2planes[MAX_DECIMATION_MODES];\nfloat decimation_mode_percentile[MAX_DECIMATION_MODES];\n- int permit_encode[MAX_DECIMATION_MODES];\nconst decimation_table *decimation_tables[MAX_DECIMATION_MODES];\n// out of all possible 2048 weight modes, only a subset is\n@@ -632,12 +631,14 @@ struct physical_compressed_block\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 mode_cutoff The block mode percentil cutoff [0-1].\n* @param bsd The structure to populate.\n*/\nvoid init_block_size_descriptor(\nint xdim,\nint ydim,\nint zdim,\n+ float mode_cutoff,\nblock_size_descriptor* bsd);\nvoid term_block_size_descriptor(\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_weight_align.cpp",
"new_path": "Source/astcenc_weight_align.cpp",
"diff": "@@ -379,14 +379,13 @@ void compute_angular_endpoints_1plane(\nfloat low_values[MAX_DECIMATION_MODES][12];\nfloat high_values[MAX_DECIMATION_MODES][12];\n- for (int i = 0; i < MAX_DECIMATION_MODES; i++)\n+ for (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n// TODO: Do this at build time and cache the result\nint samplecount = bsd->decimation_mode_samples[i];\nint quant_mode = bsd->decimation_mode_maxprec_1plane[i];\nfloat percentile = bsd->decimation_mode_percentile[i];\n- int permit_encode = bsd->permit_encode[i];\n- if (permit_encode == 0 || samplecount < 1 || quant_mode < 0 || percentile > mode_cutoff)\n+ if (samplecount < 1 || quant_mode < 0 || percentile > mode_cutoff)\n{\ncontinue;\n}\n@@ -427,15 +426,13 @@ void compute_angular_endpoints_2planes(\nfloat low_values2[MAX_DECIMATION_MODES][12];\nfloat high_values2[MAX_DECIMATION_MODES][12];\n- for (int i = 0; i < MAX_DECIMATION_MODES; i++)\n+ for (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n// TODO: Do this at build time and cache the result\nint samplecount = bsd->decimation_mode_samples[i];\nint quant_mode = bsd->decimation_mode_maxprec_2planes[i];\nfloat percentile = bsd->decimation_mode_percentile[i];\n- int permit_encode = bsd->permit_encode[i];\n-\n- if (permit_encode == 0 || samplecount < 1 || quant_mode < 0 || percentile > mode_cutoff)\n+ if (samplecount < 1 || quant_mode < 0 || percentile > mode_cutoff)\n{\ncontinue;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Only initialize BSD entries we actually use (#193)
|
61,745 |
30.12.2020 16:21:14
| 0 |
91287b595cf9c8c5d54ffafdd0750f25f61d53b9
|
Remove decimation sample count from BSD
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_block_sizes2.cpp",
"new_path": "Source/astcenc_block_sizes2.cpp",
"diff": "@@ -643,7 +643,6 @@ static void construct_block_size_descriptor_2d(\n}\n}\n- bsd->decimation_mode_samples[decimation_mode_count] = weight_count;\nbsd->decimation_mode_maxprec_1plane[decimation_mode_count] = maxprec_1plane;\nbsd->decimation_mode_maxprec_2planes[decimation_mode_count] = maxprec_2planes;\nbsd->decimation_mode_percentile[decimation_mode_count] = 1.0f;\n@@ -656,10 +655,10 @@ static void construct_block_size_descriptor_2d(\n// Ensure the end of the array contains valid data (should never get read)\nfor (int i = decimation_mode_count; i < MAX_DECIMATION_MODES; i++)\n{\n- bsd->decimation_mode_samples[i] = 0;\nbsd->decimation_mode_percentile[i] = 1.0f;\nbsd->decimation_mode_maxprec_1plane[i] = -1;\nbsd->decimation_mode_maxprec_2planes[i] = -1;\n+ bsd->decimation_tables[i] = nullptr;\n}\nbsd->decimation_mode_count = decimation_mode_count;\n@@ -824,7 +823,6 @@ static void construct_block_size_descriptor_3d(\nmaxprec_2planes = -1;\n}\n- bsd->decimation_mode_samples[decimation_mode_count] = weight_count;\nbsd->decimation_mode_maxprec_1plane[decimation_mode_count] = maxprec_1plane;\nbsd->decimation_mode_maxprec_2planes[decimation_mode_count] = maxprec_2planes;\nbsd->decimation_tables[decimation_mode_count] = dt;\n@@ -837,9 +835,9 @@ static void construct_block_size_descriptor_3d(\nfor (int i = decimation_mode_count; i < MAX_DECIMATION_MODES; i++)\n{\nbsd->decimation_mode_percentile[i] = 1.0f;\n- bsd->decimation_mode_samples[i] = 0;\nbsd->decimation_mode_maxprec_1plane[i] = -1;\nbsd->decimation_mode_maxprec_2planes[i] = -1;\n+ bsd->decimation_tables[i] = nullptr;\n}\nbsd->decimation_mode_count = decimation_mode_count;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -400,7 +400,6 @@ struct block_size_descriptor\nint texel_count;\nint decimation_mode_count;\n- int decimation_mode_samples[MAX_DECIMATION_MODES];\nint decimation_mode_maxprec_1plane[MAX_DECIMATION_MODES];\nint decimation_mode_maxprec_2planes[MAX_DECIMATION_MODES];\nfloat decimation_mode_percentile[MAX_DECIMATION_MODES];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_weight_align.cpp",
"new_path": "Source/astcenc_weight_align.cpp",
"diff": "@@ -382,10 +382,10 @@ void compute_angular_endpoints_1plane(\nfor (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n// TODO: Do this at build time and cache the result\n- int samplecount = bsd->decimation_mode_samples[i];\n+ int samplecount = bsd->decimation_tables[i]->num_weights;\nint quant_mode = bsd->decimation_mode_maxprec_1plane[i];\nfloat percentile = bsd->decimation_mode_percentile[i];\n- if (samplecount < 1 || quant_mode < 0 || percentile > mode_cutoff)\n+ if (quant_mode < 0 || percentile > mode_cutoff)\n{\ncontinue;\n}\n@@ -429,10 +429,10 @@ void compute_angular_endpoints_2planes(\nfor (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n// TODO: Do this at build time and cache the result\n- int samplecount = bsd->decimation_mode_samples[i];\n+ int samplecount = bsd->decimation_tables[i]->num_weights;\nint quant_mode = bsd->decimation_mode_maxprec_2planes[i];\nfloat percentile = bsd->decimation_mode_percentile[i];\n- if (samplecount < 1 || quant_mode < 0 || percentile > mode_cutoff)\n+ if (quant_mode < 0 || percentile > mode_cutoff)\n{\ncontinue;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove decimation sample count from BSD
|
61,745 |
30.12.2020 20:49:24
| 0 |
d076151730a73972c5843972d1df4079150ea2f1
|
Add "none" SIMD 4-wide vectors
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib.h",
"new_path": "Source/astcenc_vecmathlib.h",
"diff": "constexpr auto load1 = vfloat8::load1;\n#elif ASTCENC_SSE >= 20\n- /* If we have SSE expose 4-wide VLA. */\n+ /* If we have SSE expose 4-wide VLA, and 4-wide fixed width. */\n#include \"astcenc_vecmathlib_sse_4.h\"\n#define ASTCENC_SIMD_WIDTH 4\nconstexpr auto loada = vfloat4::loada;\nconstexpr auto load1 = vfloat4::load1;\n#else\n- /* If we have nothing expose 1-wide VLA. */\n+ /* If we have nothing expose 1-wide VLA, and 4-wide fixed width. */\n#include \"astcenc_vecmathlib_none_1.h\"\n+ #include \"astcenc_vecmathlib_none_4.h\"\n#define ASTCENC_SIMD_WIDTH 1\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Source/astcenc_vecmathlib_none_4.h",
"diff": "+// SPDX-License-Identifier: Apache-2.0\n+// ----------------------------------------------------------------------------\n+// Copyright 2019-2020 Arm Limited\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n+// use this file except in compliance with the License. You may obtain a copy\n+// of the License at:\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+// License for the specific language governing permissions and limitations\n+// under the License.\n+// ----------------------------------------------------------------------------\n+\n+/**\n+ * @brief 4x32-bit vectors, implemented using plain C++.\n+ *\n+ * This module implements 4-wide 32-bit float, int, and mask vectors. This\n+ * module provides a scalar fallback for VLA code, primarily useful for\n+ * debugging VLA algorithms without the complexity of handling SIMD. Only the\n+ * baseline level of functionality needed to support VLA is provided.\n+ *\n+ * Note that the vector conditional operators implemented by this module are\n+ * designed to behave like SIMD conditional operators that generate lane masks.\n+ * Rather than returning 0/1 booleans like normal C++ code they will return\n+ * 0/-1 to give a full lane-width bitmask.\n+ *\n+ * Note that the documentation for this module still talks about \"vectors\" to\n+ * help developers think about the implied VLA behavior when writing optimized\n+ * paths.\n+ */\n+\n+#ifndef ASTC_VECMATHLIB_NONE_4_H_INCLUDED\n+#define ASTC_VECMATHLIB_NONE_4_H_INCLUDED\n+\n+#ifndef ASTCENC_SIMD_INLINE\n+ #error \"Include astcenc_vecmathlib.h, do not include directly\"\n+#endif\n+\n+#include <cstring>\n+\n+// ============================================================================\n+// vfloat4 data type\n+// ============================================================================\n+\n+/**\n+ * @brief Data type for 4-wide floats.\n+ */\n+struct vfloat4\n+{\n+ /**\n+ * @brief Construct from zero-initialized value.\n+ */\n+ ASTCENC_SIMD_INLINE vfloat4() {}\n+\n+ /**\n+ * @brief Construct from 4 values loaded from an unaligned address.\n+ *\n+ * Consider using loada() which is better with wider VLA vectors if data is\n+ * aligned to vector length.\n+ */\n+ ASTCENC_SIMD_INLINE explicit vfloat4(const float* p)\n+ {\n+ m[0] = p[0];\n+ m[1] = p[1];\n+ m[2] = p[2];\n+ m[3] = p[3];\n+ }\n+\n+ /**\n+ * @brief Construct from 4 scalar values replicated across all lanes.\n+ *\n+ * Consider using zero() for constexpr zeros.\n+ */\n+ ASTCENC_SIMD_INLINE explicit vfloat4(float a)\n+ {\n+ m[0] = a;\n+ m[1] = a;\n+ m[2] = a;\n+ m[3] = a;\n+ }\n+\n+ /**\n+ * @brief Construct from 4 scalar values.\n+ *\n+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.\n+ */\n+ ASTCENC_SIMD_INLINE explicit vfloat4(float a, float b, float c, float d)\n+ {\n+ m[0] = a;\n+ m[1] = b;\n+ m[2] = c;\n+ m[3] = d;\n+ }\n+\n+ /**\n+ * @brief Get the scalar value of a single lane.\n+ */\n+ template <int l> ASTCENC_SIMD_INLINE float lane() const\n+ {\n+ return m[l];\n+ }\n+\n+ /**\n+ * @brief Factory that returns a vector of zeros.\n+ */\n+ static ASTCENC_SIMD_INLINE vfloat4 zero()\n+ {\n+ return vfloat4(0.0f);\n+ }\n+\n+ /**\n+ * @brief Factory that returns a replicated scalar loaded from memory.\n+ */\n+ static ASTCENC_SIMD_INLINE vfloat4 load1(const float* p)\n+ {\n+ return vfloat4(*p);\n+ }\n+\n+ /**\n+ * @brief Factory that returns a vector loaded from aligned memory.\n+ */\n+ static ASTCENC_SIMD_INLINE vfloat4 loada(const float* p)\n+ {\n+ return vfloat4(p);\n+ }\n+\n+ /**\n+ * @brief Factory that returns a vector containing the lane IDs.\n+ */\n+ static ASTCENC_SIMD_INLINE vfloat4 lane_id()\n+ {\n+ return vfloat4(0.0f, 1.0f, 2.0f, 3.0f);\n+ }\n+\n+ /**\n+ * @brief The vector ...\n+ */\n+ float m[4];\n+};\n+\n+// ============================================================================\n+// vint4 data type\n+// ============================================================================\n+\n+/**\n+ * @brief Data type for 4-wide ints.\n+ */\n+struct vint4\n+{\n+ /**\n+ * @brief Construct from zero-initialized value.\n+ */\n+ ASTCENC_SIMD_INLINE vint4() {}\n+\n+ /**\n+ * @brief Construct from 4 values loaded from an unaligned address.\n+ *\n+ * Consider using vint4::loada() which is better with wider VLA vectors\n+ * if data is aligned.\n+ */\n+ ASTCENC_SIMD_INLINE explicit vint4(const int* p)\n+ {\n+ m[0] = p[0];\n+ m[1] = p[1];\n+ m[2] = p[2];\n+ m[3] = p[3];\n+ }\n+\n+ /**\n+ * @brief Construct from 4 scalar values.\n+ *\n+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.\n+ */\n+ ASTCENC_SIMD_INLINE explicit vint4(int a, int b, int c, int d)\n+ {\n+ m[0] = a;\n+ m[1] = b;\n+ m[2] = c;\n+ m[3] = d;\n+ }\n+\n+\n+ /**\n+ * @brief Construct from 4 scalar values replicated across all lanes.\n+ *\n+ * Consider using vint4::zero() for constexpr zeros.\n+ */\n+ ASTCENC_SIMD_INLINE explicit vint4(int a)\n+ {\n+ m[0] = a;\n+ m[1] = a;\n+ m[2] = a;\n+ m[3] = a;\n+ }\n+\n+ /**\n+ * @brief Get the scalar value of a single lane.\n+ */\n+ template <int l> ASTCENC_SIMD_INLINE int lane() const\n+ {\n+ return m[l];\n+ }\n+\n+ /**\n+ * @brief Factory that returns a vector containing the lane IDs.\n+ */\n+ static ASTCENC_SIMD_INLINE vint4 lane_id()\n+ {\n+ return vint4(0, 1, 2, 3);\n+ }\n+\n+ /**\n+ * @brief The vector ...\n+ */\n+ int m[4];\n+};\n+\n+// ============================================================================\n+// vmask4 data type\n+// ============================================================================\n+\n+/**\n+ * @brief Data type for 4-wide control plane masks.\n+ */\n+struct vmask4\n+{\n+ /**\n+ * @brief Construct from an existing mask value.\n+ */\n+ ASTCENC_SIMD_INLINE explicit vmask4(int* v)\n+ {\n+ m[0] = v[0];\n+ m[1] = v[1];\n+ m[2] = v[2];\n+ m[3] = v[3];\n+ }\n+\n+ /**\n+ * @brief Construct from 4 scalar values.\n+ *\n+ * The value of @c a is stored to lane 0 (LSB) in the SIMD register.\n+ */\n+ ASTCENC_SIMD_INLINE explicit vmask4(int a, int b, int c, int d)\n+ {\n+ m[0] = a;\n+ m[1] = b;\n+ m[2] = c;\n+ m[3] = d;\n+ }\n+\n+ /**\n+ * @brief The vector ...\n+ */\n+ int m[4];\n+};\n+\n+// ============================================================================\n+// vmask4 operators and functions\n+// ============================================================================\n+\n+/**\n+ * @brief Overload: mask union (or).\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator|(vmask4 a, vmask4 b)\n+{\n+ return vmask4(a.m[0] | b.m[0],\n+ a.m[1] | b.m[1],\n+ a.m[2] | b.m[2],\n+ a.m[3] | b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: mask intersect (and).\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator&(vmask4 a, vmask4 b)\n+{\n+ return vmask4(a.m[0] & b.m[0],\n+ a.m[1] & b.m[1],\n+ a.m[2] & b.m[2],\n+ a.m[3] & b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: mask difference (xor).\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator^(vmask4 a, vmask4 b)\n+{\n+ return vmask4(a.m[0] ^ b.m[0],\n+ a.m[1] ^ b.m[1],\n+ a.m[2] ^ b.m[2],\n+ a.m[3] ^ b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: mask invert (not).\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator~(vmask4 a)\n+{\n+ return vmask4(~a.m[0],\n+ ~a.m[1],\n+ ~a.m[2],\n+ ~a.m[3]);\n+}\n+\n+/**\n+ * @brief Return a 1-bit mask code indicating mask status.\n+ *\n+ * bit0 = lane 0\n+ */\n+ASTCENC_SIMD_INLINE unsigned int mask(vmask4 a)\n+{\n+ return ((a.m[0] >> 31) & 0x1) &\n+ ((a.m[1] >> 30) & 0x2) &\n+ ((a.m[2] >> 29) & 0x4) &\n+ ((a.m[3] >> 28) & 0x8);\n+}\n+\n+/**\n+ * @brief True if any lanes are enabled, false otherwise.\n+ */\n+ASTCENC_SIMD_INLINE bool any(vmask4 a)\n+{\n+ return mask(a) != 0;\n+}\n+\n+/**\n+ * @brief True if all lanes are enabled, false otherwise.\n+ */\n+ASTCENC_SIMD_INLINE bool all(vmask4 a)\n+{\n+ return mask(a) == 0xF;\n+}\n+\n+// ============================================================================\n+// vint4 operators and functions\n+// ============================================================================\n+\n+/**\n+ * @brief Overload: vector by vector addition.\n+ */\n+ASTCENC_SIMD_INLINE vint4 operator+(vint4 a, vint4 b)\n+{\n+ return vint4(a.m[0] + b.m[0],\n+ a.m[1] + b.m[1],\n+ a.m[2] + b.m[2],\n+ a.m[3] + b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector subtraction.\n+ */\n+ASTCENC_SIMD_INLINE vint4 operator-(vint4 a, vint4 b)\n+{\n+ return vint4(a.m[0] - b.m[0],\n+ a.m[1] - b.m[1],\n+ a.m[2] - b.m[2],\n+ a.m[3] - b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector bit invert.\n+ */\n+ASTCENC_SIMD_INLINE vint4 operator~(vint4 a)\n+{\n+ return vint4(~a.m[0],\n+ ~a.m[1],\n+ ~a.m[2],\n+ ~a.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector bitwise or.\n+ */\n+ASTCENC_SIMD_INLINE vint4 operator|(vint4 a, vint4 b)\n+{\n+ return vint4(a.m[0] | b.m[0],\n+ a.m[1] | b.m[1],\n+ a.m[2] | b.m[2],\n+ a.m[3] | b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector bitwise and.\n+ */\n+ASTCENC_SIMD_INLINE vint4 operator&(vint4 a, vint4 b)\n+{\n+ return vint4(a.m[0] & b.m[0],\n+ a.m[1] & b.m[1],\n+ a.m[2] & b.m[2],\n+ a.m[3] & b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector bitwise xor.\n+ */\n+ASTCENC_SIMD_INLINE vint4 operator^(vint4 a, vint4 b)\n+{\n+ return vint4(a.m[0] ^ b.m[0],\n+ a.m[1] ^ b.m[1],\n+ a.m[2] ^ b.m[2],\n+ a.m[3] ^ b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector equality.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator==(vint4 a, vint4 b)\n+{\n+ return vmask4(a.m[0] == b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] == b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] == b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] == b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector inequality.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator!=(vint4 a, vint4 b)\n+{\n+ return vmask4(a.m[0] != b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] != b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] != b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] != b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector less than.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator<(vint4 a, vint4 b)\n+{\n+ return vmask4(a.m[0] < b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] < b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] < b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] < b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector greater than.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator>(vint4 a, vint4 b)\n+{\n+ return vmask4(a.m[0] > b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] > b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] > b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] > b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Return the min vector of two vectors.\n+ */\n+ASTCENC_SIMD_INLINE vint4 min(vint4 a, vint4 b)\n+{\n+ return vint4(a.m[0] < b.m[0] ? a.m[0] : b.m[0],\n+ a.m[1] < b.m[1] ? a.m[1] : b.m[1],\n+ a.m[2] < b.m[2] ? a.m[2] : b.m[2],\n+ a.m[3] < b.m[3] ? a.m[3] : b.m[3]);\n+}\n+\n+/**\n+ * @brief Return the min vector of two vectors.\n+ */\n+ASTCENC_SIMD_INLINE vint4 max(vint4 a, vint4 b)\n+{\n+ return vint4(a.m[0] > b.m[0] ? a.m[0] : b.m[0],\n+ a.m[1] > b.m[1] ? a.m[1] : b.m[1],\n+ a.m[2] > b.m[2] ? a.m[2] : b.m[2],\n+ a.m[3] > b.m[3] ? a.m[3] : b.m[3]);\n+}\n+\n+/**\n+ * @brief Return the horizontal minimum of a single vector.\n+ */\n+ASTCENC_SIMD_INLINE vint4 hmin(vint4 v)\n+{\n+ int a = std::min(v.m[0], v.m[1]);\n+ int b = std::min(v.m[2], v.m[3]);\n+ return vint4(std::min(a, b));\n+}\n+\n+/**\n+ * @brief Store a vector to an aligned memory address.\n+ */\n+ASTCENC_SIMD_INLINE void storea(vint4 a, int* p)\n+{\n+ p[0] = a.m[0];\n+ p[1] = a.m[1];\n+ p[2] = a.m[2];\n+ p[3] = a.m[3];\n+}\n+\n+/**\n+ * @brief Store lowest N (vector width) bytes into an unaligned address.\n+ */\n+ASTCENC_SIMD_INLINE void store_nbytes(vint4 a, uint8_t* p)\n+{\n+ int* pi = (int*)p;\n+ *pi = a.m[0];\n+}\n+\n+/**\n+ * @brief Gather N (vector width) indices from the array.\n+ */\n+ASTCENC_SIMD_INLINE vint4 gatheri(const int* base, vint4 indices)\n+{\n+ return vint4(base[indices.m[0]],\n+ base[indices.m[1]],\n+ base[indices.m[2]],\n+ base[indices.m[3]]);\n+}\n+\n+/**\n+ * @brief Pack low 8 bits of N (vector width) lanes into bottom of vector.\n+ */\n+ASTCENC_SIMD_INLINE vint4 pack_low_bytes(vint4 a)\n+{\n+ int b0 = a.m[0] & 0xFF;\n+ int b1 = a.m[1] & 0xFF;\n+ int b2 = a.m[2] & 0xFF;\n+ int b3 = a.m[3] & 0xFF;\n+\n+ int b = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);\n+ return vint4(b, 0, 0, 0);\n+}\n+\n+/**\n+ * @brief Return lanes from @c b if MSB of @c cond is set, else @c a.\n+ */\n+ASTCENC_SIMD_INLINE vint4 select(vint4 a, vint4 b, vmask4 cond)\n+{\n+ return vint4((cond.m[0] & 0x80000000) ? b.m[0] : a.m[0],\n+ (cond.m[1] & 0x80000000) ? b.m[1] : a.m[1],\n+ (cond.m[2] & 0x80000000) ? b.m[2] : a.m[2],\n+ (cond.m[3] & 0x80000000) ? b.m[3] : a.m[3]);\n+}\n+\n+// ============================================================================\n+// vfloat4 operators and functions\n+// ============================================================================\n+\n+/**\n+ * @brief Overload: vector by vector addition.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 operator+(vfloat4 a, vfloat4 b)\n+{\n+ return vfloat4(a.m[0] + b.m[0],\n+ a.m[1] + b.m[1],\n+ a.m[2] + b.m[2],\n+ a.m[3] + b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector subtraction.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 operator-(vfloat4 a, vfloat4 b)\n+{\n+ return vfloat4(a.m[0] - b.m[0],\n+ a.m[1] - b.m[1],\n+ a.m[2] - b.m[2],\n+ a.m[3] - b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector multiplication.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 operator*(vfloat4 a, vfloat4 b)\n+{\n+ return vfloat4(a.m[0] * b.m[0],\n+ a.m[1] * b.m[1],\n+ a.m[2] * b.m[2],\n+ a.m[3] * b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by scalar multiplication.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 operator*(vfloat4 a, float b)\n+{\n+ return vfloat4(a.m[0] * b,\n+ a.m[1] * b,\n+ a.m[2] * b,\n+ a.m[3] * b);\n+}\n+\n+/**\n+ * @brief Overload: scalar by vector multiplication.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 operator*(float a, vfloat4 b)\n+{\n+ return vfloat4(a * b.m[0],\n+ a * b.m[1],\n+ a * b.m[2],\n+ a * b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector division.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 operator/(vfloat4 a, vfloat4 b)\n+{\n+ return vfloat4(a.m[0] / b.m[0],\n+ a.m[1] / b.m[1],\n+ a.m[2] / b.m[2],\n+ a.m[3] / b.m[3]);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector equality.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator==(vfloat4 a, vfloat4 b)\n+{\n+ return vmask4(a.m[0] == b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] == b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] == b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] == b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector inequality.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator!=(vfloat4 a, vfloat4 b)\n+{\n+ return vmask4(a.m[0] != b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] != b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] != b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] != b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector less than.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator<(vfloat4 a, vfloat4 b)\n+{\n+ return vmask4(a.m[0] < b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] < b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] < b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] < b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector greater than.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator>(vfloat4 a, vfloat4 b)\n+{\n+ return vmask4(a.m[0] > b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] > b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] > b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] > b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector less than or equal.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator<=(vfloat4 a, vfloat4 b)\n+{\n+ return vmask4(a.m[0] <= b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] <= b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] <= b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] <= b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Overload: vector by vector greater than or equal.\n+ */\n+ASTCENC_SIMD_INLINE vmask4 operator>=(vfloat4 a, vfloat4 b)\n+{\n+ return vmask4(a.m[0] >= b.m[0] ? 0xFFFFFFFF : 0,\n+ a.m[1] >= b.m[1] ? 0xFFFFFFFF : 0,\n+ a.m[2] >= b.m[2] ? 0xFFFFFFFF : 0,\n+ a.m[3] >= b.m[3] ? 0xFFFFFFFF : 0);\n+}\n+\n+/**\n+ * @brief Return the min vector of two vectors.\n+ *\n+ * If either lane value is NaN, @c b will be returned for that lane.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 min(vfloat4 a, vfloat4 b)\n+{\n+ return vfloat4(a.m[0] < b.m[0] ? a.m[0] : b.m[0],\n+ a.m[1] < b.m[1] ? a.m[1] : b.m[1],\n+ a.m[2] < b.m[2] ? a.m[2] : b.m[2],\n+ a.m[3] < b.m[3] ? a.m[3] : b.m[3]);\n+}\n+\n+/**\n+ * @brief Return the max vector of two vectors.\n+ *\n+ * If either lane value is NaN, @c b will be returned for that lane.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 max(vfloat4 a, vfloat4 b)\n+{\n+ return vfloat4(a.m[0] > b.m[0] ? a.m[0] : b.m[0],\n+ a.m[1] > b.m[1] ? a.m[1] : b.m[1],\n+ a.m[2] > b.m[2] ? a.m[2] : b.m[2],\n+ a.m[3] > b.m[3] ? a.m[3] : b.m[3]);\n+}\n+\n+/**\n+ * @brief Return the clamped value between min and max.\n+ *\n+ * It is assumed that neither @c minv nor @c maxv are NaN values. If @c a is\n+ * NaN then @c minv will be returned for that lane.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 clamp(float minv, float maxv, vfloat4 a)\n+{\n+ return min(max(a, vfloat4(minv)), vfloat4(maxv));\n+}\n+\n+/**\n+ * @brief Return a clamped value between 0.0f and max.\n+ *\n+ * It is assumed that @c maxv is not a NaN value. If @c a is NaN then zero will\n+ * be returned for that lane.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 clampz(float maxv, vfloat4 a)\n+{\n+ return min(max(a, vfloat4(0.0f)), vfloat4(maxv));\n+}\n+\n+/**\n+ * @brief Return a clamped value between 0.0f and 1.0f.\n+ *\n+ * If @c a is NaN then zero will be returned for that lane.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 clampzo(vfloat4 a)\n+{\n+ return min(max(a, vfloat4(0.0f)), vfloat4(1.0f));\n+}\n+\n+/**\n+ * @brief Return the absolute value of the float vector.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 abs(vfloat4 a)\n+{\n+ return vfloat4(std::abs(a.m[0]),\n+ std::abs(a.m[1]),\n+ std::abs(a.m[2]),\n+ std::abs(a.m[3]));\n+}\n+\n+/**\n+ * @brief Return a float rounded to the nearest integer value.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 round(vfloat4 a)\n+{\n+ return vfloat4(std::floor(a.m[0] + 0.5f),\n+ std::floor(a.m[1] + 0.5f),\n+ std::floor(a.m[2] + 0.5f),\n+ std::floor(a.m[3] + 0.5f));\n+}\n+\n+/**\n+ * @brief Return the horizontal minimum of a vector.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 hmin(vfloat4 a)\n+{\n+ float tmp1 = std::min(a.m[0], a.m[1]);\n+ float tmp2 = std::min(a.m[2], a.m[3]);\n+ return vfloat4(std::min(tmp1, tmp2));\n+}\n+\n+/**\n+ * @brief Return lanes from @c b if MSB of @c cond is set, else @c a.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 select(vfloat4 a, vfloat4 b, vmask4 cond)\n+{\n+ return vfloat4((cond.m[0] & 0x80000000) ? b.m[0] : a.m[0],\n+ (cond.m[1] & 0x80000000) ? b.m[1] : a.m[1],\n+ (cond.m[2] & 0x80000000) ? b.m[2] : a.m[2],\n+ (cond.m[3] & 0x80000000) ? b.m[3] : a.m[3]);\n+}\n+\n+/**\n+ * @brief Load a vector of gathered results from an array;\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 gatherf(const float* base, vint4 indices)\n+{\n+ return vfloat4(base[indices.m[0]],\n+ base[indices.m[1]],\n+ base[indices.m[2]],\n+ base[indices.m[3]]);\n+}\n+\n+/**\n+ * @brief Store a vector to an aligned memory address.\n+ */\n+ASTCENC_SIMD_INLINE void storea(vfloat4 v, float* ptr)\n+{\n+ ptr[0] = v.m[0];\n+ ptr[1] = v.m[1];\n+ ptr[2] = v.m[2];\n+ ptr[3] = v.m[3];\n+}\n+\n+/**\n+ * @brief Return the dot product for the full 4 lanes, returning vector.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 dot(vfloat4 a, vfloat4 b)\n+{\n+ float s = a.m[0] * b.m[0] +\n+ a.m[1] * b.m[1] +\n+ a.m[2] * b.m[2] +\n+ a.m[3] * b.m[3];\n+ return vfloat4(s);\n+}\n+\n+/**\n+ * @brief Return a integer value for a float vector, using truncation.\n+ */\n+ASTCENC_SIMD_INLINE vint4 float_to_int(vfloat4 v)\n+{\n+ return vint4(v.m[0],\n+ v.m[1],\n+ v.m[2],\n+ v.m[3]);\n+}\n+\n+/**\n+ * @brief Return a float value as an integer bit pattern (i.e. no conversion).\n+ *\n+ * It is a common trick to convert floats into integer bit patterns, perform\n+ * some bit hackery based on knowledge they are IEEE 754 layout, and then\n+ * convert them back again. This is the first half of that flip.\n+ */\n+ASTCENC_SIMD_INLINE vint4 float_as_int(vfloat4 v)\n+{\n+ vint4 r;\n+ memcpy(r.m, v.m, 4 * 4);\n+ return r;\n+}\n+\n+/**\n+ * @brief Return a integer value as a float bit pattern (i.e. no conversion).\n+ *\n+ * It is a common trick to convert floats into integer bit patterns, perform\n+ * some bit hackery based on knowledge they are IEEE 754 layout, and then\n+ * convert them back again. This is the second half of that flip.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 int_as_float(vint4 v)\n+{\n+ vfloat4 r;\n+ memcpy(r.m, v.m, 4 * 4);\n+ return r;\n+}\n+\n+#endif // #ifndef ASTC_VECMATHLIB_NONE_1_H_INCLUDED\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add "none" SIMD 4-wide vectors
|
61,745 |
30.12.2020 21:32:36
| 0 |
8136a65ef8f0f50818fea5d0bae588f34af51d1f
|
Fix bug in BSD construction for 3D blocks
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_block_sizes2.cpp",
"new_path": "Source/astcenc_block_sizes2.cpp",
"diff": "@@ -871,7 +871,10 @@ static void construct_block_size_descriptor_3d(\nbsd->block_modes_packed[packed_idx].quantization_mode = quantization_mode;\nbsd->block_modes_packed[packed_idx].is_dual_plane = is_dual_plane;\nbsd->block_modes_packed[packed_idx].mode_index = i;\n- bsd->block_modes_packed[packed_idx].percentile = 0.0f; // No percentile table\n+\n+ // No percentile table, so enable everything legal and used ...\n+ bsd->block_modes_packed[packed_idx].percentile = 0.0f;\n+ bsd->decimation_modes[decimation_mode].percentile = 0.0f;\nbsd->block_mode_to_packed[i] = packed_idx;\n++packed_idx;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix bug in BSD construction for 3D blocks
|
61,745 |
30.12.2020 22:16:44
| 0 |
7797fa2b3d77d57939e348067e1302218620fc2a
|
Inline update_imageblock_flags in data load loop
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -1145,7 +1145,7 @@ void compress_block(\nastcenc_profile decode_mode = ctx.config.profile;\nconst block_size_descriptor* bsd = ctx.bsd;\n- if (blk->red_min == blk->red_max && blk->green_min == blk->green_max && blk->blue_min == blk->blue_max && blk->alpha_min == blk->alpha_max)\n+ if (all(blk->data_min == blk->data_max))\n{\n// detected a constant-color block. Encode as FP16 if using HDR\nscb.error_block = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_decompress_symbolic.cpp",
"new_path": "Source/astcenc_decompress_symbolic.cpp",
"diff": "@@ -271,8 +271,7 @@ void decompress_symbolic_block(\nint plane2_color_component = scb->plane2_color_component;\n- // now that we have endpoint colors and weights, we can unpack actual colors for\n- // each texel.\n+ // Now that we have endpoint colors and weights, we can unpack actual colors for each texel.\nfor (int i = 0; i < bsd->texel_count; i++)\n{\nint partition = pt->partition_of_texel[i];\n@@ -295,7 +294,6 @@ void decompress_symbolic_block(\n}\nimageblock_initialize_orig_from_work(blk, bsd->texel_count);\n- update_imageblock_flags(blk, bsd->xdim, bsd->ydim, bsd->zdim);\n}\nfloat compute_symbolic_block_difference(\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -133,8 +133,8 @@ static void compute_endpoints_and_ideal_weights_1_component(\nfor (int i = 0; i < partition_count; i++)\n{\n- ei->ep.endpt0[i] = float4(blk->red_min, blk->green_min, blk->blue_min, blk->alpha_min);\n- ei->ep.endpt1[i] = float4(blk->red_max, blk->green_max, blk->blue_max, blk->alpha_max);\n+ ei->ep.endpt0[i] = float4(blk->data_min.lane<0>(), blk->data_min.lane<1>(), blk->data_min.lane<2>(), blk->data_min.lane<3>());\n+ ei->ep.endpt1[i] = float4(blk->data_max.lane<0>(), blk->data_max.lane<1>(), blk->data_max.lane<2>(), blk->data_max.lane<3>());\nswitch (component)\n{\ncase 0: // red/x\n@@ -338,8 +338,8 @@ static void compute_endpoints_and_ideal_weights_2_components(\nfor (int i = 0; i < partition_count; i++)\n{\n- ei->ep.endpt0[i] = float4(blk->red_min, blk->green_min, blk->blue_min, blk->alpha_min);\n- ei->ep.endpt1[i] = float4(blk->red_max, blk->green_max, blk->blue_max, blk->alpha_max);\n+ ei->ep.endpt0[i] = float4(blk->data_min.lane<0>(), blk->data_min.lane<1>(), blk->data_min.lane<2>(), blk->data_min.lane<3>());\n+ ei->ep.endpt1[i] = float4(blk->data_max.lane<0>(), blk->data_max.lane<1>(), blk->data_max.lane<2>(), blk->data_max.lane<3>());\nfloat2 ep0 = lowvalues[i];\nfloat2 ep1 = highvalues[i];\n@@ -585,8 +585,8 @@ static void compute_endpoints_and_ideal_weights_3_components(\nfor (int i = 0; i < partition_count; i++)\n{\n- ei->ep.endpt0[i] = float4(blk->red_min, blk->green_min, blk->blue_min, blk->alpha_min);\n- ei->ep.endpt1[i] = float4(blk->red_max, blk->green_max, blk->blue_max, blk->alpha_max);\n+ ei->ep.endpt0[i] = float4(blk->data_min.lane<0>(), blk->data_min.lane<1>(), blk->data_min.lane<2>(), blk->data_min.lane<3>());\n+ ei->ep.endpt1[i] = float4(blk->data_max.lane<0>(), blk->data_max.lane<1>(), blk->data_max.lane<2>(), blk->data_max.lane<3>());\nfloat3 ep0 = lowvalues[i];\nfloat3 ep1 = highvalues[i];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_image.cpp",
"new_path": "Source/astcenc_image.cpp",
"diff": "@@ -203,33 +203,57 @@ void imageblock_initialize_work_from_orig(\npb->origin_texel = float4(pb->data_r[0], pb->data_g[0],\npb->data_b[0], pb->data_a[0]);\n+ vfloat4 data_min(1e38f);\n+ vfloat4 data_max(-1e38f);\n+ bool grayscale = true;\n+\nfor (int i = 0; i < pixelcount; i++)\n{\n- float4 inc = float4(pb->data_r[i], pb->data_g[i],\n+ vfloat4 data = vfloat4(pb->data_r[i], pb->data_g[i],\npb->data_b[i], pb->data_a[i]);\nif (pb->rgb_lns[i])\n{\n- pb->data_r[i] = float_to_lns(inc.r);\n- pb->data_g[i] = float_to_lns(inc.g);\n- pb->data_b[i] = float_to_lns(inc.b);\n+ data.set_lane<0>(float_to_lns(data.lane<0>()));\n+ data.set_lane<1>(float_to_lns(data.lane<1>()));\n+ data.set_lane<2>(float_to_lns(data.lane<2>()));\n}\nelse\n{\n- pb->data_r[i] = inc.r * 65535.0f;\n- pb->data_g[i] = inc.g * 65535.0f;\n- pb->data_b[i] = inc.b * 65535.0f;\n+ data.set_lane<0>(data.lane<0>() * 65535.0f);\n+ data.set_lane<1>(data.lane<1>() * 65535.0f);\n+ data.set_lane<2>(data.lane<2>() * 65535.0f);\n}\nif (pb->alpha_lns[i])\n{\n- pb->data_a[i] = float_to_lns(inc.a);\n+ data.set_lane<3>(float_to_lns(data.lane<3>()));\n}\nelse\n{\n- pb->data_a[i] = inc.a * 65535.0f;\n+ data.set_lane<3>(data.lane<3>() * 65535.0f);\n}\n+\n+ // Compute block metadata\n+ data_min = min(data_min, data);\n+ data_max = max(data_max, data);\n+\n+ if (grayscale && (data.lane<0>() != data.lane<1>() || data.lane<0>() != data.lane<2>()))\n+ {\n+ grayscale = false;\n}\n+\n+ // Store block data\n+ pb->data_r[i] = data.lane<0>();\n+ pb->data_g[i] = data.lane<1>();\n+ pb->data_b[i] = data.lane<2>();\n+ pb->data_a[i] = data.lane<3>();\n+ }\n+\n+ // Store block metadata\n+ pb->data_min = data_min;\n+ pb->data_max = data_max;\n+ pb->grayscale = grayscale;\n}\n// helper function to initialize the orig-data from the work-data\n@@ -237,33 +261,57 @@ void imageblock_initialize_orig_from_work(\nimageblock* pb,\nint pixelcount\n) {\n+ vfloat4 data_min(1e38f);\n+ vfloat4 data_max(-1e38f);\n+ bool grayscale = true;\n+\nfor (int i = 0; i < pixelcount; i++)\n{\n- float4 inc = float4(pb->data_r[i], pb->data_g[i],\n+ vfloat4 data = vfloat4(pb->data_r[i], pb->data_g[i],\npb->data_b[i], pb->data_a[i]);\nif (pb->rgb_lns[i])\n{\n- pb->data_r[i] = sf16_to_float(lns_to_sf16((uint16_t)inc.r));\n- pb->data_g[i] = sf16_to_float(lns_to_sf16((uint16_t)inc.g));\n- pb->data_b[i] = sf16_to_float(lns_to_sf16((uint16_t)inc.b));\n+ data.set_lane<0>(sf16_to_float(lns_to_sf16((uint16_t)data.lane<0>())));\n+ data.set_lane<1>(sf16_to_float(lns_to_sf16((uint16_t)data.lane<1>())));\n+ data.set_lane<2>(sf16_to_float(lns_to_sf16((uint16_t)data.lane<2>())));\n}\nelse\n{\n- pb->data_r[i] = sf16_to_float(unorm16_to_sf16((uint16_t)inc.r));\n- pb->data_g[i] = sf16_to_float(unorm16_to_sf16((uint16_t)inc.g));\n- pb->data_b[i] = sf16_to_float(unorm16_to_sf16((uint16_t)inc.b));\n+ data.set_lane<0>(sf16_to_float(unorm16_to_sf16((uint16_t)data.lane<0>())));\n+ data.set_lane<1>(sf16_to_float(unorm16_to_sf16((uint16_t)data.lane<1>())));\n+ data.set_lane<2>(sf16_to_float(unorm16_to_sf16((uint16_t)data.lane<2>())));\n}\nif (pb->alpha_lns[i])\n{\n- pb->data_a[i] = sf16_to_float(lns_to_sf16((uint16_t)inc.a));\n+ data.set_lane<3>(sf16_to_float(lns_to_sf16((uint16_t)data.lane<3>())));\n}\nelse\n{\n- pb->data_a[i] = sf16_to_float(unorm16_to_sf16((uint16_t)inc.a));\n+ data.set_lane<3>(sf16_to_float(unorm16_to_sf16((uint16_t)data.lane<3>())));\n+ }\n+\n+ // Compute block metadata\n+ data_min = min(data_min, data);\n+ data_max = max(data_max, data);\n+\n+ if (grayscale && (data.lane<0>() != data.lane<1>() || data.lane<0>() != data.lane<2>()))\n+ {\n+ grayscale = false;\n}\n+\n+ // Store block data\n+ pb->data_r[i] = data.lane<0>();\n+ pb->data_g[i] = data.lane<1>();\n+ pb->data_b[i] = data.lane<2>();\n+ pb->data_a[i] = data.lane<3>();\n}\n+\n+ // Store block metadata\n+ pb->data_min = data_min;\n+ pb->data_max = data_max;\n+ pb->grayscale = grayscale;\n}\n// fetch an imageblock from the input file.\n@@ -444,7 +492,6 @@ void fetch_imageblock(\n}\nimageblock_initialize_work_from_orig(pb, bsd->texel_count);\n- update_imageblock_flags(pb, bsd->xdim, bsd->ydim, bsd->zdim);\n}\nvoid write_imageblock(\n@@ -686,62 +733,3 @@ void write_imageblock(\n}\n}\n}\n-\n-/*\n- For an imageblock, update its flags.\n- The updating is done based on data, not orig_data.\n-*/\n-void update_imageblock_flags(\n- imageblock* pb,\n- int xdim,\n- int ydim,\n- int zdim\n-) {\n- float red_min = 1e38f, red_max = -1e38f;\n- float green_min = 1e38f, green_max = -1e38f;\n- float blue_min = 1e38f, blue_max = -1e38f;\n- float alpha_min = 1e38f, alpha_max = -1e38f;\n-\n- int texels_per_block = xdim * ydim * zdim;\n-\n- int grayscale = 1;\n-\n- for (int i = 0; i < texels_per_block; i++)\n- {\n- float red = pb->data_r[i];\n- float green = pb->data_g[i];\n- float blue = pb->data_b[i];\n- float alpha = pb->data_a[i];\n- if (red < red_min)\n- red_min = red;\n- if (red > red_max)\n- red_max = red;\n- if (green < green_min)\n- green_min = green;\n- if (green > green_max)\n- green_max = green;\n- if (blue < blue_min)\n- blue_min = blue;\n- if (blue > blue_max)\n- blue_max = blue;\n- if (alpha < alpha_min)\n- alpha_min = alpha;\n- if (alpha > alpha_max)\n- alpha_max = alpha;\n-\n- if (grayscale == 1 && (red != green || red != blue))\n- {\n- grayscale = 0;\n- }\n- }\n-\n- pb->red_min = red_min;\n- pb->red_max = red_max;\n- pb->green_min = green_min;\n- pb->green_max = green_max;\n- pb->blue_min = blue_min;\n- pb->blue_max = blue_max;\n- pb->alpha_min = alpha_min;\n- pb->alpha_max = alpha_max;\n- pb->grayscale = grayscale;\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "#include \"astcenc.h\"\n#include \"astcenc_mathlib.h\"\n+#include \"astcenc_vecmathlib.h\"\n/* ============================================================================\nConstants\n@@ -442,32 +443,24 @@ struct imageblock\nfloat data_g[MAX_TEXELS_PER_BLOCK];\nfloat data_b[MAX_TEXELS_PER_BLOCK];\nfloat data_a[MAX_TEXELS_PER_BLOCK];\n+\n+ // TODO: Migrate to vfloat4\nfloat4 origin_texel;\n+ vfloat4 data_min;\n+ vfloat4 data_max;\n+ bool grayscale;\nuint8_t rgb_lns[MAX_TEXELS_PER_BLOCK]; // 1 if RGB data are being treated as LNS\nuint8_t alpha_lns[MAX_TEXELS_PER_BLOCK]; // 1 if Alpha data are being treated as LNS\nuint8_t nan_texel[MAX_TEXELS_PER_BLOCK]; // 1 if the texel is a NaN-texel.\n-\n- float red_min, red_max;\n- float green_min, green_max;\n- float blue_min, blue_max;\n- float alpha_min, alpha_max;\n- int grayscale; // 1 if R=G=B for every pixel, 0 otherwise\n-\nint xpos, ypos, zpos;\n};\nstatic inline int imageblock_uses_alpha(const imageblock * pb)\n{\n- return pb->alpha_max != pb->alpha_min;\n+ return pb->data_min.lane<3>() != pb->data_max.lane<3>();\n}\n-void update_imageblock_flags(\n- imageblock* pb,\n- int xdim,\n- int ydim,\n- int zdim);\n-\nvoid imageblock_initialize_orig_from_work(\nimageblock * pb,\nint pixelcount);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Inline update_imageblock_flags in data load loop
|
61,745 |
30.12.2020 22:40:57
| 0 |
e2a99c1889ce94d6dab3b8dbed06fa7019cbce65
|
Add some documentation on profiling
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "Docs/Profiling.md",
"diff": "+# Profiling astcenc\n+\n+This page contains some developer notes on profiling `astcenc` using command\n+line tools on Linux hosts.\n+\n+## Building for profiling\n+\n+It is recommended to profile release builds, but you will need debug symbols.\n+It is also recommended to disable link-time optimization to get call stacks\n+that vaguely resemble the source code, although beware because this means that\n+you are not quite profiling the reality of full release builds.\n+\n+Both of these can be achieved using the following CMake build type:\n+\n+```shell\n+ -DCMAKE_BUILD_TYPE=RelWithDebInfo\n+```\n+\n+## Running Callgrind tools\n+\n+We provide a helper script that wraps Callgrind for hotspot profiling, although\n+beware that it only currently supports profiling LDR input images and the\n+single compression mode.\n+\n+This script requires the following tools on your `PATH`:\n+\n+ * valgrind\n+ * gprof2dot\n+ * dot\n+\n+Run the helper script from the root of the repository using, e.g.:\n+\n+```shell\n+python3 ./Test/astc_profile_valgrind.py <image.png> --test-quality fastest\n+```\n+\n+The output will be two files:\n+\n+- perf_<quality>.png: an annotated call graph.\n+- perf_<quality>.txt: the top N functions table.\n+\n+### Viewing disassembly\n+\n+Standard syntax x86-64 disassembly can be generated using:\n+\n+```shell\n+objdump -C -M intel --no-show-raw -d -S <binary> > dis.txt\n+```\n+\n+## Struct sizes\n+\n+Optimizing structures for size and spatial locality is important, so we keep\n+half an eye on the sizes of the structures to make sure we're not exploding the\n+sizes a lot!\n+\n+Useful snippet for dumping the main structure sizes:\n+\n+```c++\n+ printf(\"partition_info: %zu\\n\", sizeof(partition_info));\n+ printf(\"decimation_table: %zu\\n\", sizeof(decimation_table));\n+ printf(\"block_size_descriptor: %zu\\n\", sizeof(block_size_descriptor));\n+ printf(\"imageblock: %zu\\n\", sizeof(imageblock));\n+ printf(\"error_weight_block: %zu\\n\", sizeof(error_weight_block));\n+ printf(\"symbolic_compressed_block: %zu\\n\", sizeof(symbolic_compressed_block));\n+ printf(\"compress_fixed_partition_buffers: %zu\\n\", sizeof(compress_fixed_partition_buffers));\n+ printf(\"compress_symbolic_block_buffers: %zu\\n\", sizeof(compress_symbolic_block_buffers));\n+```\n+\n+Released builds return the following sizes of things (in bytes)\n+\n+| Structure | v2.1 |\n+| -------------------------------- | ------- |\n+| partition_info | 1120 |\n+| decimation_table | 364896 |\n+| block_size_descriptor | 3473152 |\n+| imageblock | 4176 |\n+| error_weight_block | 14704 |\n+| symbolic_compressed_block | 380 |\n+| compress_fixed_partition_buffers | 1729280 |\n+| compress_symbolic_block_buffers | 1745504 |\n+\n+A lot things are allocated with worst-case `MAX_TEXELS_PER_BLOCK` counts, as\n+this avoids indirect loads. Setting this to 36 (i.e. enough for 6x6 blocks)\n+improves overall performance by ~5%. Dynamic sizing would be interesting to\n+explore, but we really want to avoid indirect pointer-chasing loads on critical\n+paths.\n+\n+| Structure | v2.1 |\n+| -------------------------------- | ------- |\n+| partition_info | 224 |\n+| decimation_table | 60876 |\n+| block_size_descriptor | 718704 |\n+| imageblock | 752 |\n+| error_weight_block | 2464 |\n+| symbolic_compressed_block | 380 |\n+| compress_fixed_partition_buffers | 1475840 |\n+| compress_symbolic_block_buffers | 1479840 |\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_profile_valgrind.py",
"new_path": "Test/astc_profile_valgrind.py",
"diff": "@@ -90,12 +90,13 @@ def postprocess_cga(logfile, outfile):\nfileHandle.write(\"%5.2f%% %s\\n\" % (function[2], function[0]))\n-def run_pass(image, encoder, blocksize, quality):\n+def run_pass(image, noStartup, encoder, blocksize, quality):\n\"\"\"\nRun Valgrind on a single binary.\nArgs:\nimage (str): The path of the image to compress.\n+ noStartup (bool): Exclude startup from reported data.\nencoder (str): The name of the encoder variant to run.\nblocksize (str): The block size to use.\nquality (str): The encoding quality to use.\n@@ -114,8 +115,12 @@ def run_pass(image, encoder, blocksize, quality):\nret = sp.run(args, stdout=sp.PIPE, check=True, encoding=\"utf-8\")\npostprocess_cga(ret.stdout, \"perf_%s.txt\" % quality)\n+ if noStartup:\nargs = [\"gprof2dot\", \"--format=callgrind\", \"--output=out.dot\", \"callgrind.txt\",\n\"-s\", \"-z\", \"compress_block(astcenc_context const&, astcenc_image const&, imageblock const*, symbolic_compressed_block&, physical_compressed_block&, compress_symbolic_block_buffers*)\"]\n+ else:\n+ args = [\"gprof2dot\", \"--format=callgrind\", \"--output=out.dot\", \"callgrind.txt\",\n+ \"-s\", \"-z\", \"main\"]\nresult = sp.run(args, check=True, universal_newlines=True)\n@@ -149,6 +154,9 @@ def parse_command_line():\nparser.add_argument(\"--test-quality\", dest=\"qualities\", default=\"medium\",\nchoices=qualities, help=\"select compression quality\")\n+ parser.add_argument(\"--no-startup\", dest=\"noStartup\", default=False,\n+ action=\"store_true\", help=\"Exclude init\")\n+\nargs = parser.parse_args()\nif args.encoders == \"all\":\n@@ -175,7 +183,7 @@ def main():\nfor quality in args.qualities:\nfor encoder in args.encoders:\n- run_pass(args.img.name, encoder, \"6x6\", quality)\n+ run_pass(args.img.name, args.noStartup, encoder, \"6x6\", quality)\nreturn 0\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add some documentation on profiling
|
61,745 |
30.12.2020 23:20:48
| 0 |
2528df0f78daec927ac2ef2b73db7d1f18345058
|
Add set_lane() to "none" vfloat4
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_none_4.h",
"new_path": "Source/astcenc_vecmathlib_none_4.h",
"diff": "@@ -104,6 +104,15 @@ struct vfloat4\nreturn m[l];\n}\n+\n+ /**\n+ * @brief Set the scalar value of a single lane.\n+ */\n+ template <int l> ASTCENC_SIMD_INLINE void set_lane(float a)\n+ {\n+ m[l] = a;\n+ }\n+\n/**\n* @brief Factory that returns a vector of zeros.\n*/\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add set_lane() to "none" vfloat4
|
61,745 |
31.12.2020 01:19:14
| 0 |
2ae204131fbad34e7bba3f930eccee306f49ad31
|
Add ASTCENC_FLG_SELF_DECOMPRESS_ONLY
This allows optimization of the bsd tables based on heuristics,
but in this mode cannot be used to decompress arbitrary images.
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog.md",
"new_path": "Docs/ChangeLog.md",
"diff": "@@ -43,6 +43,13 @@ recompile your client-side code using the updated `astcenc.h` header.\n* **API Change:** Image `data` is no longer a 3D array accessed using\n`data[z][y][x]` indexing, it's an array of 2D slices. This makes it easier\nto directly use images loaded from other libraries.\n+ * **API Change:** Added new `ASTCENC_FLG_SELF_DECOMPRESS_ONLY` flag to the\n+ codec config. Using this flag enables additional optimizations that\n+ aggressively exploit implementation- and configuration-specific, behavior\n+ to gain performance. When using this flag the codec can only reliably\n+ decompress images that were compressed in the same context session. Images\n+ produced via other means may fail to decompress correctly, even if they are\n+ otherwise valid ASTC files.\n<!-- ---------------------------------------------------------------------- -->\n## 2.1\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/Fuzzers/fuzz_astc_physical_to_symbolic.cpp",
"new_path": "Source/Fuzzers/fuzz_astc_physical_to_symbolic.cpp",
"diff": "@@ -67,6 +67,7 @@ bool bsd_initializer()\ntestSz[i].x,\ntestSz[i].y,\ntestSz[i].z,\n+ false,\n&(testBSD[i]));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc.h",
"new_path": "Source/astcenc.h",
"diff": "@@ -300,11 +300,22 @@ static const unsigned int ASTCENC_FLG_USE_PERCEPTUAL = 1 << 3;\n/**\n* @brief Create a decompression-only context.\n*\n- * This mode enables context allocation to skip some transient buffer\n- * allocation, resulting in a lower-memory footprint.\n+ * This mode disables support for compression. This enables context allocation\n+ * to skip some transient buffer allocation, resulting in lower memory usage.\n*/\nstatic const unsigned int ASTCENC_FLG_DECOMPRESS_ONLY = 1 << 4;\n+/**\n+ * @brief Create a self-decompression context.\n+ *\n+ * This mode configures the compressor so that it is only guaranteed to be\n+ * able to decompress images that were actually created using the current\n+ * context. This is the common case for compression use cases, and setting this\n+ * flag enables additional optimizations, but does mean that the context cannot\n+ * reliably decompress arbitrary ASTC images.\n+ */\n+static const unsigned int ASTCENC_FLG_SELF_DECOMPRESS_ONLY = 1 << 5;\n+\n/**\n* @brief The bit mask of all valid flags.\n*/\n@@ -313,7 +324,8 @@ static const unsigned int ASTCENC_ALL_FLAGS =\nASTCENC_FLG_MAP_MASK |\nASTCENC_FLG_USE_ALPHA_WEIGHT |\nASTCENC_FLG_USE_PERCEPTUAL |\n- ASTCENC_FLG_DECOMPRESS_ONLY;\n+ ASTCENC_FLG_DECOMPRESS_ONLY |\n+ ASTCENC_FLG_SELF_DECOMPRESS_ONLY;\n/**\n* @brief The config structure.\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_block_sizes2.cpp",
"new_path": "Source/astcenc_block_sizes2.cpp",
"diff": "@@ -574,11 +574,10 @@ static void initialize_decimation_table_3d(\nstatic void construct_block_size_descriptor_2d(\nint xdim,\nint ydim,\n+ bool can_omit_modes,\nfloat mode_cutoff,\nblock_size_descriptor* bsd\n) {\n- (void)mode_cutoff;\n-\n// Store a remap table for storing packed decimation modes.\n// Indexing uses [Y * 16 + X] and max block size for each axis is 12.\nstatic const int MAX_DMI = 12 * 16 + 12;\n@@ -643,9 +642,13 @@ static void construct_block_size_descriptor_2d(\n}\n}\n+ // TODO: For fast modes are many of these unused because they\n+ // are only used by percentil skipped block modes?\n+\nbsd->decimation_modes[decimation_mode_count].maxprec_1plane = maxprec_1plane;\nbsd->decimation_modes[decimation_mode_count].maxprec_2planes = maxprec_2planes;\n- bsd->decimation_modes[decimation_mode_count].percentile = 1.0f;\n+ bsd->decimation_modes[decimation_mode_count].percentile_hit = false;\n+ bsd->decimation_modes[decimation_mode_count].percentile_always = false;\nbsd->decimation_tables[decimation_mode_count] = dt;\ndecimation_mode_count++;\n@@ -657,7 +660,8 @@ static void construct_block_size_descriptor_2d(\n{\nbsd->decimation_modes[i].maxprec_1plane = -1;\nbsd->decimation_modes[i].maxprec_2planes = -1;\n- bsd->decimation_modes[i].percentile = 1.0f;\n+ bsd->decimation_modes[i].percentile_hit = false;\n+ bsd->decimation_modes[i].percentile_always = false;\nbsd->decimation_tables[i] = nullptr;\n}\n@@ -674,39 +678,49 @@ static void construct_block_size_descriptor_2d(\nint x_weights, y_weights;\nint is_dual_plane;\nint quantization_mode;\n- int permit_encode = 1;\n- if (decode_block_mode_2d(i, &x_weights, &y_weights, &is_dual_plane, &quantization_mode))\n- {\n- if (x_weights > xdim || y_weights > ydim)\n- {\n- permit_encode = 0;\n- }\n- }\n- else\n- {\n- permit_encode = 0;\n- }\n+ bool valid = decode_block_mode_2d(i, &x_weights, &y_weights, &is_dual_plane, &quantization_mode);\n+\n+#if !defined(ASTCENC_DECOMPRESS_ONLY)\n+ float percentile = percentiles[i];\n+ (void)can_omit_modes;\n+ bool selected = (percentile <= mode_cutoff) || !can_omit_modes;\n+#else\n+ bool selected == true;\n+#endif\n+ // Skip modes that are invalid, too large, or not selected by heuristic\n+ if (!valid || !selected || (x_weights > xdim) || (y_weights > ydim))\n+ {\nbsd->block_mode_to_packed[i] = -1;\n- if (!permit_encode) // also disallow decode of grid size larger than block size.\ncontinue;\n+ }\nint decimation_mode = decimation_mode_index[y_weights * 16 + x_weights];\n- bsd->block_modes_packed[packed_idx].decimation_mode = decimation_mode;\n- bsd->block_modes_packed[packed_idx].quantization_mode = quantization_mode;\n- bsd->block_modes_packed[packed_idx].is_dual_plane = is_dual_plane;\n- bsd->block_modes_packed[packed_idx].mode_index = i;\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\n- bsd->block_modes_packed[packed_idx].percentile = percentiles[i];\n- if (bsd->decimation_modes[decimation_mode].percentile > percentiles[i])\n+ // Flatten the block mode heuristic into some precomputed flags\n+ if (percentile == 0.0f)\n{\n- bsd->decimation_modes[decimation_mode].percentile = percentiles[i];\n+ bsd->block_modes_packed[packed_idx].percentile_always = true;\n+ bsd->decimation_modes[decimation_mode].percentile_always = true;\n+\n+ bsd->block_modes_packed[packed_idx].percentile_hit = true;\n+ bsd->decimation_modes[decimation_mode].percentile_hit = true;\n+ }\n+ else if (percentile <= mode_cutoff)\n+ {\n+ bsd->block_modes_packed[packed_idx].percentile_always = false;\n+\n+ bsd->block_modes_packed[packed_idx].percentile_hit = true;\n+ bsd->decimation_modes[decimation_mode].percentile_hit = true;\n}\n-#else\n- bsd->block_modes_packed[packed_idx].percentile = 0.0f;\n#endif\n+\n+ bsd->block_modes_packed[packed_idx].decimation_mode = decimation_mode;\n+ bsd->block_modes_packed[packed_idx].quantization_mode = quantization_mode;\n+ bsd->block_modes_packed[packed_idx].is_dual_plane = is_dual_plane ? 1 : 0;\n+ bsd->block_modes_packed[packed_idx].mode_index = i;\nbsd->block_mode_to_packed[i] = packed_idx;\n++packed_idx;\n}\n@@ -825,7 +839,8 @@ static void construct_block_size_descriptor_3d(\nbsd->decimation_modes[decimation_mode_count].maxprec_1plane = maxprec_1plane;\nbsd->decimation_modes[decimation_mode_count].maxprec_2planes = maxprec_2planes;\n- bsd->decimation_modes[decimation_mode_count].percentile = 1.0f;\n+ bsd->decimation_modes[decimation_mode_count].percentile_hit = false;\n+ bsd->decimation_modes[decimation_mode_count].percentile_always = false;\nbsd->decimation_tables[decimation_mode_count] = dt;\ndecimation_mode_count++;\n}\n@@ -836,7 +851,8 @@ static void construct_block_size_descriptor_3d(\n{\nbsd->decimation_modes[i].maxprec_1plane = -1;\nbsd->decimation_modes[i].maxprec_2planes = -1;\n- bsd->decimation_modes[i].percentile = 1.0f;\n+ bsd->decimation_modes[i].percentile_hit = false;\n+ bsd->decimation_modes[i].percentile_always = false;\nbsd->decimation_tables[i] = nullptr;\n}\n@@ -869,12 +885,14 @@ static void construct_block_size_descriptor_3d(\nint decimation_mode = decimation_mode_index[z_weights * 64 + y_weights * 8 + x_weights];\nbsd->block_modes_packed[packed_idx].decimation_mode = decimation_mode;\nbsd->block_modes_packed[packed_idx].quantization_mode = quantization_mode;\n- bsd->block_modes_packed[packed_idx].is_dual_plane = is_dual_plane;\n+ bsd->block_modes_packed[packed_idx].is_dual_plane = is_dual_plane ? 1 : 0;\nbsd->block_modes_packed[packed_idx].mode_index = i;\n- // No percentile table, so enable everything legal and used ...\n- bsd->block_modes_packed[packed_idx].percentile = 0.0f;\n- bsd->decimation_modes[decimation_mode].percentile = 0.0f;\n+ // No percentile table, so enable everything all the time ...\n+ bsd->block_modes_packed[packed_idx].percentile_hit = true;\n+ bsd->block_modes_packed[packed_idx].percentile_always = true;\n+ bsd->decimation_modes[decimation_mode].percentile_hit = true;\n+ bsd->decimation_modes[decimation_mode].percentile_always = true;\nbsd->block_mode_to_packed[i] = packed_idx;\n++packed_idx;\n@@ -932,6 +950,7 @@ void init_block_size_descriptor(\nint xdim,\nint ydim,\nint zdim,\n+ bool can_omit_modes,\nfloat mode_cutoff,\nblock_size_descriptor* bsd\n) {\n@@ -941,7 +960,7 @@ void init_block_size_descriptor(\n}\nelse\n{\n- construct_block_size_descriptor_2d(xdim, ydim, mode_cutoff, bsd);\n+ construct_block_size_descriptor_2d(xdim, ydim, can_omit_modes, mode_cutoff, bsd);\n}\ninit_partition_tables(bsd);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -205,7 +205,7 @@ static int realign_weights(\n*/\nstatic void compress_symbolic_block_fixed_partition_1_plane(\nastcenc_profile decode_mode,\n- float mode_cutoff,\n+ bool only_always,\nint tune_candidate_limit,\nint max_refinement_iters,\nconst block_size_descriptor* bsd,\n@@ -238,7 +238,8 @@ static void compress_symbolic_block_fixed_partition_1_plane(\n// (that is, weights computed with the assumption that they are not quantized)\nfor (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n- if (bsd->decimation_modes[i].maxprec_1plane < 0 || bsd->decimation_modes[i].percentile > mode_cutoff)\n+ const decimation_mode& dm = bsd->decimation_modes[i];\n+ if (dm.maxprec_1plane < 0 || (only_always && !dm.percentile_always) || !dm.percentile_hit)\n{\ncontinue;\n}\n@@ -294,7 +295,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\nfloat weight_low_value[MAX_WEIGHT_MODES];\nfloat weight_high_value[MAX_WEIGHT_MODES];\n- compute_angular_endpoints_1plane(mode_cutoff, bsd, decimated_quantized_weights, decimated_weights, weight_low_value, weight_high_value);\n+ compute_angular_endpoints_1plane(only_always, bsd, decimated_quantized_weights, decimated_weights, weight_low_value, weight_high_value);\n// for each mode (which specifies a decimation and a quantization):\n// * compute number of bits needed for the quantized weights.\n@@ -306,7 +307,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\nfor (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n{\nconst block_mode& bm = bsd->block_modes_packed[i];\n- if (bm.is_dual_plane != 0 || bm.percentile > mode_cutoff)\n+ if (bm.is_dual_plane || (only_always && !bm.percentile_always) || !bm.percentile_hit)\n{\nqwt_errors[i] = 1e38f;\ncontinue;\n@@ -467,7 +468,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\nstatic void compress_symbolic_block_fixed_partition_2_planes(\nastcenc_profile decode_mode,\n- float mode_cutoff,\n+ bool only_always,\nint tune_candidate_limit,\nint max_refinement_iters,\nconst block_size_descriptor* bsd,\n@@ -503,7 +504,8 @@ static void compress_symbolic_block_fixed_partition_2_planes(\n// for each decimation mode, compute an ideal set of weights\nfor (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n- if (bsd->decimation_modes[i].maxprec_2planes < 0 || bsd->decimation_modes[i].percentile > mode_cutoff)\n+ const decimation_mode& dm = bsd->decimation_modes[i];\n+ if (dm.maxprec_2planes < 0 || (only_always && !dm.percentile_always) || !dm.percentile_hit)\n{\ncontinue;\n}\n@@ -613,7 +615,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(\nfloat weight_low_value2[MAX_WEIGHT_MODES];\nfloat weight_high_value2[MAX_WEIGHT_MODES];\n- compute_angular_endpoints_2planes(mode_cutoff, bsd, decimated_quantized_weights, decimated_weights, weight_low_value1, weight_high_value1, weight_low_value2, weight_high_value2);\n+ compute_angular_endpoints_2planes(only_always, bsd, decimated_quantized_weights, decimated_weights, weight_low_value1, weight_high_value1, weight_low_value2, weight_high_value2);\n// for each mode (which specifies a decimation and a quantization):\n// * generate an optimized set of quantized weights.\n@@ -625,7 +627,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(\nfor (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n{\nconst block_mode& bm = bsd->block_modes_packed[i];\n- if (bm.is_dual_plane != 1 || bm.percentile > mode_cutoff)\n+ if ((!bm.is_dual_plane) || (only_always && !bm.percentile_always) || !bm.percentile_hit)\n{\nqwt_errors[i] = 1e38f;\ncontinue;\n@@ -1217,8 +1219,6 @@ void compress_block(\nint uses_alpha = imageblock_uses_alpha(blk);\n- float mode_cutoff = ctx.config.tune_block_mode_limit / 100.0f;\n-\n// Trial using 1 plane of weights and 1 partition.\n// Most of the time we test it twice, first with a mode cutoff of 0 and\n@@ -1227,10 +1227,8 @@ void compress_block(\n// disabled for 4x4 and 5x4 blocks where it nearly always slows down the\n// compression and slightly reduces image quality.\n- float modecutoffs[2];\n- float errorval_mult[2] = { 2.5, 1 };\n- modecutoffs[0] = 0;\n- modecutoffs[1] = mode_cutoff;\n+ bool modecutoffs[2] = { true, false };\n+ float errorval_mult[2] = { 2.5f, 1.0f };\nfloat lowest_correl;\nfloat best_errorval_in_mode;\n@@ -1296,7 +1294,7 @@ void compress_block(\n}\ncompress_symbolic_block_fixed_partition_2_planes(\n- decode_mode, mode_cutoff,\n+ decode_mode, false,\nctx.config.tune_candidate_limit,\nctx.config.tune_refinement_limit,\nbsd, 1, // partition count\n@@ -1349,7 +1347,7 @@ void compress_block(\nfor (int i = 0; i < 2; i++)\n{\ncompress_symbolic_block_fixed_partition_1_plane(\n- decode_mode, mode_cutoff,\n+ decode_mode, false,\nctx.config.tune_candidate_limit,\nctx.config.tune_refinement_limit,\nbsd, partition_count, partition_indices_1plane[i],\n@@ -1406,7 +1404,7 @@ void compress_block(\n{\ncompress_symbolic_block_fixed_partition_2_planes(\ndecode_mode,\n- mode_cutoff,\n+ false,\nctx.config.tune_candidate_limit,\nctx.config.tune_refinement_limit,\nbsd,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -503,7 +503,8 @@ astcenc_error astcenc_context_alloc(\n}\nbsd = new block_size_descriptor;\n- init_block_size_descriptor(config.block_x, config.block_y, config.block_z, config.tune_block_mode_limit / 100.0f, bsd);\n+ bool can_omit_modes = config.flags & ASTCENC_FLG_SELF_DECOMPRESS_ONLY;\n+ init_block_size_descriptor(config.block_x, config.block_y, config.block_z, can_omit_modes, config.tune_block_mode_limit / 100.0f, bsd);\nctx->bsd = bsd;\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -388,9 +388,11 @@ struct block_mode\n{\nint8_t decimation_mode;\nint8_t quantization_mode;\n- int8_t is_dual_plane; // TODO: Replace this with a bit.\n+ uint8_t is_dual_plane : 1;\n+ uint8_t percentile_hit : 1;\n+ uint8_t percentile_always : 1;\nint16_t mode_index;\n- float percentile; // TODO: Replace this with a bit.\n+\n};\n/**\n@@ -400,7 +402,8 @@ struct decimation_mode\n{\nint8_t maxprec_1plane;\nint8_t maxprec_2planes;\n- float percentile; // TODO: Replace this with a bit.\n+ uint8_t percentile_hit : 1;\n+ uint8_t percentile_always : 1;\n};\nstruct block_size_descriptor\n@@ -638,6 +641,7 @@ void init_block_size_descriptor(\nint xdim,\nint ydim,\nint zdim,\n+ bool can_omit_modes,\nfloat mode_cutoff,\nblock_size_descriptor* bsd);\n@@ -1123,7 +1127,7 @@ void imageblock_initialize_deriv(\nfloat4* dptr);\nvoid compute_angular_endpoints_1plane(\n- float mode_cutoff,\n+ bool only_always,\nconst block_size_descriptor* bsd,\nconst float* decimated_quantized_weights,\nconst float* decimated_weights,\n@@ -1131,7 +1135,7 @@ void compute_angular_endpoints_1plane(\nfloat high_value[MAX_WEIGHT_MODES]);\nvoid compute_angular_endpoints_2planes(\n- float mode_cutoff,\n+ bool only_always,\nconst block_size_descriptor * bsd,\nconst float* decimated_quantized_weights,\nconst float* decimated_weights,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_weight_align.cpp",
"new_path": "Source/astcenc_weight_align.cpp",
"diff": "@@ -369,7 +369,7 @@ static void compute_angular_endpoints_for_quantization_levels(\n// helper functions that will compute ideal angular-endpoints\n// for a given set of weights and a given block size descriptors\nvoid compute_angular_endpoints_1plane(\n- float mode_cutoff,\n+ bool only_always,\nconst block_size_descriptor* bsd,\nconst float* decimated_quantized_weights,\nconst float* decimated_weights,\n@@ -381,24 +381,22 @@ void compute_angular_endpoints_1plane(\nfor (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n- // TODO: Do this at build time and cache the result\n- int samplecount = bsd->decimation_tables[i]->num_weights;\n- int quant_mode = bsd->decimation_modes[i].maxprec_1plane;\n- float percentile = bsd->decimation_modes[i].percentile;\n- if (quant_mode < 0 || percentile > mode_cutoff)\n+ const decimation_mode& dm = bsd->decimation_modes[i];\n+ if (dm.maxprec_1plane < 0 || (only_always && !dm.percentile_always) || !dm.percentile_hit)\n{\ncontinue;\n}\n+ int samplecount = bsd->decimation_tables[i]->num_weights;\ncompute_angular_endpoints_for_quantization_levels(samplecount,\ndecimated_quantized_weights + i * MAX_WEIGHTS_PER_BLOCK,\n- decimated_weights + i * MAX_WEIGHTS_PER_BLOCK, quant_mode, low_values[i], high_values[i]);\n+ decimated_weights + i * MAX_WEIGHTS_PER_BLOCK, dm.maxprec_1plane, low_values[i], high_values[i]);\n}\nfor (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n{\nconst block_mode& bm = bsd->block_modes_packed[i];\n- if (bm.is_dual_plane != 0 || bm.percentile > mode_cutoff)\n+ if (bm.is_dual_plane || (only_always && !bm.percentile_always) || !bm.percentile_hit)\n{\ncontinue;\n}\n@@ -412,7 +410,7 @@ void compute_angular_endpoints_1plane(\n}\nvoid compute_angular_endpoints_2planes(\n- float mode_cutoff,\n+ bool only_always,\nconst block_size_descriptor* bsd,\nconst float* decimated_quantized_weights,\nconst float* decimated_weights,\n@@ -428,28 +426,27 @@ void compute_angular_endpoints_2planes(\nfor (int i = 0; i < bsd->decimation_mode_count; i++)\n{\n- // TODO: Do this at build time and cache the result\n- int samplecount = bsd->decimation_tables[i]->num_weights;\n- int quant_mode = bsd->decimation_modes[i].maxprec_2planes;\n- float percentile = bsd->decimation_modes[i].percentile;\n- if (quant_mode < 0 || percentile > mode_cutoff)\n+ const decimation_mode& dm = bsd->decimation_modes[i];\n+ if (dm.maxprec_2planes < 0 || (only_always && !dm.percentile_always) || !dm.percentile_hit)\n{\ncontinue;\n}\n+ int samplecount = bsd->decimation_tables[i]->num_weights;\n+\ncompute_angular_endpoints_for_quantization_levels(samplecount,\ndecimated_quantized_weights + 2 * i * MAX_WEIGHTS_PER_BLOCK,\n- decimated_weights + 2 * i * MAX_WEIGHTS_PER_BLOCK, quant_mode, low_values1[i], high_values1[i]);\n+ decimated_weights + 2 * i * MAX_WEIGHTS_PER_BLOCK, dm.maxprec_2planes, low_values1[i], high_values1[i]);\ncompute_angular_endpoints_for_quantization_levels(samplecount,\ndecimated_quantized_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK,\n- decimated_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK, quant_mode, low_values2[i], high_values2[i]);\n+ decimated_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK, dm.maxprec_2planes, low_values2[i], high_values2[i]);\n}\nfor (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n{\nconst block_mode& bm = bsd->block_modes_packed[i];\n- if (bm.is_dual_plane != 1 || bm.percentile > mode_cutoff)\n+ if ((!bm.is_dual_plane) || (only_always && !bm.percentile_always) || !bm.percentile_hit)\n{\ncontinue;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -484,6 +484,19 @@ int init_astcenc_config(\n#if defined(ASTCENC_DECOMPRESS_ONLY)\nflags |= ASTCENC_FLG_DECOMPRESS_ONLY;\n+#else\n+ // Decompression can skip some memory allocation, but need full tables\n+ if (operation == ASTCENC_OP_DECOMPRESS)\n+ {\n+ flags |= ASTCENC_FLG_DECOMPRESS_ONLY;\n+ }\n+ // Compression and test passes can skip some decimation initialization\n+ // as we know we are decompressing images that were compressed using the\n+ // same settings and heuristics ...\n+ else\n+ {\n+ flags |= ASTCENC_FLG_SELF_DECOMPRESS_ONLY;\n+ }\n#endif\nastcenc_error status = astcenc_config_init(profile, block_x, block_y, block_z, preset, flags, config);\n@@ -897,6 +910,11 @@ int edit_astcenc_config(\n#if defined(ASTCENC_DECOMPRESS_ONLY)\ncli_config.thread_count = 1;\n+#else\n+ if (operation == ASTCENC_OP_DECOMPRESS)\n+ {\n+ cli_config.thread_count = 1;\n+ }\n#endif\nif (operation & ASTCENC_STAGE_COMPRESS)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add ASTCENC_FLG_SELF_DECOMPRESS_ONLY
This allows optimization of the bsd tables based on heuristics,
but in this mode cannot be used to decompress arbitrary images.
|
61,745 |
31.12.2020 01:29:05
| 0 |
91b15294d96f1d16572d7db5e3f1292c68ad2624
|
Tweak changelog wording.
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog.md",
"new_path": "Docs/ChangeLog.md",
"diff": "@@ -43,7 +43,7 @@ recompile your client-side code using the updated `astcenc.h` header.\n* **API Change:** Image `data` is no longer a 3D array accessed using\n`data[z][y][x]` indexing, it's an array of 2D slices. This makes it easier\nto directly use images loaded from other libraries.\n- * **API Change:** Added new `ASTCENC_FLG_SELF_DECOMPRESS_ONLY` flag to the\n+ * **API Change:** New `ASTCENC_FLG_SELF_DECOMPRESS_ONLY` flag added to the\ncodec config. Using this flag enables additional optimizations that\naggressively exploit implementation- and configuration-specific, behavior\nto gain performance. When using this flag the codec can only reliably\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Tweak changelog wording.
|
61,745 |
31.12.2020 01:30:29
| 0 |
74c7f103a18c0744fd7bb613328cc0b3f73e941b
|
Add binary signing to change log.
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog.md",
"new_path": "Docs/ChangeLog.md",
"diff": "@@ -24,6 +24,8 @@ recompile your client-side code using the updated `astcenc.h` header.\n* **Binary releases:**\n* **Improvement:** Linux binaries changed to use use Clang 9.0, which gives\nup to 15% performance improvement.\n+ * **Improvement:** Windows binaries are now signed, and macOS binaries are\n+ signed and notarized.\n* **Command Line:**\n* **Feature:** New image preprocess `-pp-normalize` option added. This forces\nnormal vectors to be unit length, which is useful when compressing source\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add binary signing to change log.
|
61,745 |
01.01.2021 21:23:09
| 0 |
51c5bfd5c997ad243e31e66b8b5b600e8afcea31
|
Fix crash in None SIMD build when -a option specified
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -679,7 +679,8 @@ astcenc_error astcenc_compress_image(\n}\nif (ctx->config.v_rgb_mean != 0.0f || ctx->config.v_rgb_stdev != 0.0f ||\n- ctx->config.v_a_mean != 0.0f || ctx->config.v_a_stdev != 0.0f)\n+ ctx->config.v_a_mean != 0.0f || ctx->config.v_a_stdev != 0.0f ||\n+ ctx->config.a_scale_radius != 0)\n{\n// First thread to enter will do setup, other threads will subsequently\n// enter the critical section but simply skip over the initialization\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix crash in None SIMD build when -a option specified
|
61,745 |
01.01.2021 21:24:24
| 0 |
0ee791df67974a61c4c5780667f6065606e585e2
|
Fix bug in 4-wide VLA mask() for None SIMD
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_none_4.h",
"new_path": "Source/astcenc_vecmathlib_none_4.h",
"diff": "@@ -321,9 +321,9 @@ ASTCENC_SIMD_INLINE vmask4 operator~(vmask4 a)\n*/\nASTCENC_SIMD_INLINE unsigned int mask(vmask4 a)\n{\n- return ((a.m[0] >> 31) & 0x1) &\n- ((a.m[1] >> 30) & 0x2) &\n- ((a.m[2] >> 29) & 0x4) &\n+ return ((a.m[0] >> 31) & 0x1) |\n+ ((a.m[1] >> 30) & 0x2) |\n+ ((a.m[2] >> 29) & 0x4) |\n((a.m[3] >> 28) & 0x8);\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix bug in 4-wide VLA mask() for None SIMD
|
61,745 |
01.01.2021 21:25:02
| 0 |
9d083a47adf4d556bf62b577674ddc1a78897786
|
Allow functional tests on any SIMD variant
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -60,6 +60,7 @@ HDR images are an 8x8 image containing 4 4x4 constant color blocks. Assuming\n* (7, 7) BR = LDR Green, trans = (0.25, 0.75, 0.00, 0.87)\n\"\"\"\n+import argparse\nimport filecmp\nimport os\nimport re\n@@ -107,6 +108,7 @@ ASTCENC_TEST_PATTERN_HDR = {\nLDR_RGB_PSNR_PATTERN = re.compile(r\"\\s*PSNR \\(LDR-RGB\\): (.*) dB\")\n+g_TestEncoder = \"avx2\"\nclass CLITestBase(unittest.TestCase):\n\"\"\"\n@@ -120,7 +122,7 @@ class CLITestBase(unittest.TestCase):\ndef __init__(self, *args, **kwargs):\nsuper().__init__(*args, **kwargs)\n- encoder = te.Encoder2x(\"avx2\")\n+ encoder = te.Encoder2x(g_TestEncoder)\nself.binary = encoder.binary\ndef setUp(self):\n@@ -2071,6 +2073,21 @@ def main():\nReturns:\nint: The process return code.\n\"\"\"\n+ global g_TestEncoder\n+\n+ parser = argparse.ArgumentParser()\n+\n+ coders = [\"none\", \"neon\", \"sse2\", \"sse4.1\", \"avx2\"]\n+ parser.add_argument(\"--encoder\", dest=\"encoder\", default=\"avx2\",\n+ choices=coders, help=\"test encoder variant\")\n+ args = parser.parse_known_args()\n+\n+ # Set the encoder for this test run\n+ g_TestEncoder = args[0].encoder\n+\n+ # Set the sys.argv to remaining args (leave sys.argv[0] alone)\n+ sys.argv[1:] = args[1]\n+\nresults = unittest.main(exit=False)\nreturn 0 if results.result.wasSuccessful() else 1\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Allow functional tests on any SIMD variant
|
61,745 |
01.01.2021 23:44:22
| 0 |
c8b7dcd63efc8a7436fd8d870b6f69eeb395a6cf
|
Enable full None SIMD vfloat4 and enable in unit tests
|
[
{
"change_type": "MODIFY",
"old_path": "Source/UnitTest/test_simd.cpp",
"new_path": "Source/UnitTest/test_simd.cpp",
"diff": "@@ -74,8 +74,6 @@ TEST(vfloat, Atan2)\n#endif\n-#if ASTCENC_SIMD_WIDTH >= 4\n-\nstatic const float qnan = std::numeric_limits<float>::quiet_NaN();\nalignas(16) static const float f32x4_data[5] { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f };\nalignas(16) static const int s32x4_data[5] { 0, 1, 2, 3, 4 };\n@@ -271,27 +269,27 @@ TEST(vfloat4, ceq)\n{\nvfloat4 a1(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b1(0.1f, 0.2f, 0.3f, 0.4f);\n- vmask r1 = a1 == b1;\n+ vmask4 r1 = a1 == b1;\nEXPECT_EQ(0, mask(r1));\nEXPECT_EQ(false, any(r1));\nEXPECT_EQ(false, all(r1));\nvfloat4 a2(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b2(1.0f, 0.2f, 0.3f, 0.4f);\n- vmask r2 = a2 == b2;\n+ vmask4 r2 = a2 == b2;\nEXPECT_EQ(0x1, mask(r2));\nEXPECT_EQ(true, any(r2));\nEXPECT_EQ(false, all(r2));\nvfloat4 a3(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b3(1.0f, 0.2f, 3.0f, 0.4f);\n- vmask r3 = a3 == b3;\n+ vmask4 r3 = a3 == b3;\nEXPECT_EQ(0x5, mask(r3));\nEXPECT_EQ(true, any(r3));\nEXPECT_EQ(false, all(r3));\nvfloat4 a4(1.0f, 2.0f, 3.0f, 4.0f);\n- vmask r4 = a4 == a4;\n+ vmask4 r4 = a4 == a4;\nEXPECT_EQ(0xF, mask(r4));\nEXPECT_EQ(true, any(r4));\nEXPECT_EQ(true, all(r4));\n@@ -302,27 +300,27 @@ TEST(vfloat4, cne)\n{\nvfloat4 a1(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b1(0.1f, 0.2f, 0.3f, 0.4f);\n- vmask r1 = a1 != b1;\n+ vmask4 r1 = a1 != b1;\nEXPECT_EQ(0xF, mask(r1));\nEXPECT_EQ(true, any(r1));\nEXPECT_EQ(true, all(r1));\nvfloat4 a2(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b2(1.0f, 0.2f, 0.3f, 0.4f);\n- vmask r2 = a2 != b2;\n+ vmask4 r2 = a2 != b2;\nEXPECT_EQ(0xE, mask(r2));\nEXPECT_EQ(true, any(r2));\nEXPECT_EQ(false, all(r2));\nvfloat4 a3(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b3(1.0f, 0.2f, 3.0f, 0.4f);\n- vmask r3 = a3 != b3;\n+ vmask4 r3 = a3 != b3;\nEXPECT_EQ(0xA, mask(r3));\nEXPECT_EQ(true, any(r3));\nEXPECT_EQ(false, all(r3));\nvfloat4 a4(1.0f, 2.0f, 3.0f, 4.0f);\n- vmask r4 = a4 != a4;\n+ vmask4 r4 = a4 != a4;\nEXPECT_EQ(0, mask(r4));\nEXPECT_EQ(false, any(r4));\nEXPECT_EQ(false, all(r4));\n@@ -333,7 +331,7 @@ TEST(vfloat4, clt)\n{\nvfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);\n- vmask r = a < b;\n+ vmask4 r = a < b;\nEXPECT_EQ(0xA, mask(r));\n}\n@@ -342,7 +340,7 @@ TEST(vfloat4, cle)\n{\nvfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);\n- vmask r = a <= b;\n+ vmask4 r = a <= b;\nEXPECT_EQ(0xE, mask(r));\n}\n@@ -351,7 +349,7 @@ TEST(vfloat4, cgt)\n{\nvfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);\n- vmask r = a > b;\n+ vmask4 r = a > b;\nEXPECT_EQ(0x1, mask(r));\n}\n@@ -360,7 +358,7 @@ TEST(vfloat4, cge)\n{\nvfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);\nvfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);\n- vmask r = a >= b;\n+ vmask4 r = a >= b;\nEXPECT_EQ(0x5, mask(r));\n}\n@@ -741,27 +739,27 @@ TEST(vint4, ceq)\n{\nvint4 a1(1, 2, 3, 4);\nvint4 b1(0, 1, 2, 3);\n- vmask r1 = a1 == b1;\n+ vmask4 r1 = a1 == b1;\nEXPECT_EQ(0, mask(r1));\nEXPECT_EQ(false, any(r1));\nEXPECT_EQ(false, all(r1));\nvint4 a2(1, 2, 3, 4);\nvint4 b2(1, 0, 0, 0);\n- vmask r2 = a2 == b2;\n+ vmask4 r2 = a2 == b2;\nEXPECT_EQ(0x1, mask(r2));\nEXPECT_EQ(true, any(r2));\nEXPECT_EQ(false, all(r2));\nvint4 a3(1, 2, 3, 4);\nvint4 b3(1, 0, 3, 0);\n- vmask r3 = a3 == b3;\n+ vmask4 r3 = a3 == b3;\nEXPECT_EQ(0x5, mask(r3));\nEXPECT_EQ(true, any(r3));\nEXPECT_EQ(false, all(r3));\nvint4 a4(1, 2, 3, 4);\n- vmask r4 = a4 == a4;\n+ vmask4 r4 = a4 == a4;\nEXPECT_EQ(0xF, mask(r4));\nEXPECT_EQ(true, any(r4));\nEXPECT_EQ(true, all(r4));\n@@ -772,27 +770,27 @@ TEST(vint4, cne)\n{\nvint4 a1(1, 2, 3, 4);\nvint4 b1(0, 1, 2, 3);\n- vmask r1 = a1 != b1;\n+ vmask4 r1 = a1 != b1;\nEXPECT_EQ(0xF, mask(r1));\nEXPECT_EQ(true, any(r1));\nEXPECT_EQ(true, all(r1));\nvint4 a2(1, 2, 3, 4);\nvint4 b2(1, 0, 0, 0);\n- vmask r2 = a2 != b2;\n+ vmask4 r2 = a2 != b2;\nEXPECT_EQ(0xE, mask(r2));\nEXPECT_EQ(true, any(r2));\nEXPECT_EQ(false, all(r2));\nvint4 a3(1, 2, 3, 4);\nvint4 b3(1, 0, 3, 0);\n- vmask r3 = a3 != b3;\n+ vmask4 r3 = a3 != b3;\nEXPECT_EQ(0xA, mask(r3));\nEXPECT_EQ(true, any(r3));\nEXPECT_EQ(false, all(r3));\nvint4 a4(1, 2, 3, 4);\n- vmask r4 = a4 != a4;\n+ vmask4 r4 = a4 != a4;\nEXPECT_EQ(0, mask(r4));\nEXPECT_EQ(false, any(r4));\nEXPECT_EQ(false, all(r4));\n@@ -803,7 +801,7 @@ TEST(vint4, clt)\n{\nvint4 a(1, 2, 3, 4);\nvint4 b(0, 3, 3, 5);\n- vmask r = a < b;\n+ vmask4 r = a < b;\nEXPECT_EQ(0xA, mask(r));\n}\n@@ -812,7 +810,7 @@ TEST(vint4, cle)\n{\nvint4 a(1, 2, 3, 4);\nvint4 b(0, 3, 3, 5);\n- vmask r = a > b;\n+ vmask4 r = a > b;\nEXPECT_EQ(0x1, mask(r));\n}\n@@ -995,10 +993,8 @@ TEST(vmask4, not)\nvfloat4 m1a(0, 1, 0, 1);\nvfloat4 m1b(1, 1, 1, 1);\nvmask4 m1 = m1a == m1b;\n- vmask r = ~m1;\n+ vmask4 r = ~m1;\nEXPECT_EQ(mask(r), 0x5);\n}\n-#endif\n-\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_vecmathlib_none_4.h",
"new_path": "Source/astcenc_vecmathlib_none_4.h",
"diff": "@@ -771,6 +771,17 @@ ASTCENC_SIMD_INLINE vfloat4 hmin(vfloat4 a)\nreturn vfloat4(std::min(tmp1, tmp2));\n}\n+/**\n+ * @brief Return the sqrt of the lanes in the vector.\n+ */\n+ASTCENC_SIMD_INLINE vfloat4 sqrt(vfloat4 a)\n+{\n+ return vfloat4(std::sqrt(a.m[0]),\n+ std::sqrt(a.m[1]),\n+ std::sqrt(a.m[2]),\n+ std::sqrt(a.m[3]));\n+}\n+\n/**\n* @brief Return lanes from @c b if MSB of @c cond is set, else @c a.\n*/\n@@ -793,6 +804,17 @@ ASTCENC_SIMD_INLINE vfloat4 gatherf(const float* base, vint4 indices)\nbase[indices.m[3]]);\n}\n+/**\n+ * @brief Store a vector to an unaligned memory address.\n+ */\n+ASTCENC_SIMD_INLINE void store(vfloat4 v, float* ptr)\n+{\n+ ptr[0] = v.m[0];\n+ ptr[1] = v.m[1];\n+ ptr[2] = v.m[2];\n+ ptr[3] = v.m[3];\n+}\n+\n/**\n* @brief Store a vector to an aligned memory address.\n*/\n@@ -813,6 +835,7 @@ ASTCENC_SIMD_INLINE vfloat4 dot(vfloat4 a, vfloat4 b)\na.m[1] * b.m[1] +\na.m[2] * b.m[2] +\na.m[3] * b.m[3];\n+\nreturn vfloat4(s);\n}\n@@ -827,6 +850,17 @@ ASTCENC_SIMD_INLINE vint4 float_to_int(vfloat4 v)\nv.m[3]);\n}\n+/**\n+ * @brief Return a integer value for a float vector, using truncation.\n+ */\n+ASTCENC_SIMD_INLINE vint4 float_to_int_rtn(vfloat4 v)\n+{\n+ return vint4((int)(v.m[0] + 0.5f),\n+ (int)(v.m[1] + 0.5f),\n+ (int)(v.m[2] + 0.5f),\n+ (int)(v.m[3] + 0.5f));\n+}\n+\n/**\n* @brief Return a float value as an integer bit pattern (i.e. no conversion).\n*\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Enable full None SIMD vfloat4 and enable in unit tests
|
61,745 |
01.01.2021 23:49:33
| 0 |
b50d672dba91a7363b85f5a32945cf88219fd336
|
Enable unit tests on nightly tests
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/nightly.Jenkinsfile",
"new_path": "jenkins/nightly.Jenkinsfile",
"diff": "@@ -40,7 +40,11 @@ pipeline {\nstages {\nstage('Clean') {\nsteps {\n- sh 'git clean -fdx'\n+ sh '''\n+ git clean -fdx\n+ git submodule init\n+ git submodule update\n+ '''\n}\n}\nstage('Build R') {\n@@ -48,7 +52,7 @@ pipeline {\nsh '''\nmkdir build_rel\ncd build_rel\n- cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON ..\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON -DUNITEST=ON..\nmake install package -j4\n'''\n}\n@@ -76,6 +80,9 @@ pipeline {\npython3 ./Test/astc_test_functional.py\npython3 ./Test/astc_test_image.py --encoder=all --test-set Small --test-quality medium\n'''\n+ dir('build_rel') {\n+ sh 'ctest'\n+ }\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Enable unit tests on nightly tests
|
61,745 |
01.01.2021 23:52:23
| 0 |
4ed01d4e58640acbe931b02a70c39ea4e9182598
|
Make Nightly builds force clean git (files and dirs)
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/nightly.Jenkinsfile",
"new_path": "jenkins/nightly.Jenkinsfile",
"diff": "@@ -41,7 +41,7 @@ pipeline {\nstage('Clean') {\nsteps {\nsh '''\n- git clean -fdx\n+ git clean -ffdx\ngit submodule init\ngit submodule update\n'''\n@@ -95,7 +95,7 @@ pipeline {\nstages {\nstage('Clean') {\nsteps {\n- bat 'git clean -fdx'\n+ bat 'git clean -ffdx'\n}\n}\nstage('Build R') {\n@@ -145,7 +145,7 @@ pipeline {\nstages {\nstage('Clean') {\nsteps {\n- sh 'git clean -fdx'\n+ sh 'git clean -ffdx'\n}\n}\nstage('Build R') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Make Nightly builds force clean git (files and dirs)
|
61,745 |
02.01.2021 00:12:08
| 0 |
a84f1fd921272d10d6feef374aef6b6914f4ce59
|
Change test_image so "all" is architecture aware
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_image.py",
"new_path": "Test/astc_test_image.py",
"diff": "@@ -331,12 +331,19 @@ def parse_command_line():\n\"\"\"\nparser = argparse.ArgumentParser()\n+ # All reference encoders\nrefcoders = [\"ref-1.7\",\n\"ref-2.0-sse2\", \"ref-2.0-sse4.1\", \"ref-2.0-avx2\",\n\"ref-2.1-sse2\", \"ref-2.1-sse4.1\", \"ref-2.1-avx2\",\n\"ref-master-neon\", \"ref-master-sse2\", \"ref-master-sse4.1\", \"ref-master-avx2\"]\n+\n+ # All test encoders\ntestcoders = [\"none\", \"neon\", \"sse2\", \"sse4.1\", \"avx2\"]\n- coders = refcoders + testcoders + [\"all\", \"all-ref\"]\n+ testcodersAArch64 = [\"none\", \"neon\"]\n+ testcodersX86 = [\"none\", \"sse2\", \"sse4.1\", \"avx2\"]\n+\n+ coders = refcoders + testcoders + [\"all-aarch64\", \"all-x86\"]\n+\nparser.add_argument(\"--encoder\", dest=\"encoders\", default=\"avx2\",\nchoices=coders, help=\"test encoder variant\")\n@@ -384,10 +391,10 @@ def parse_command_line():\nargs = parser.parse_args()\n# Turn things into canonical format lists\n- if args.encoders == \"all\":\n- args.encoders = testcoders\n- elif args.encoders == \"all-ref\":\n- args.encoders = refcoders\n+ if args.encoders == \"all-aarch64\":\n+ args.encoders = testcodersAArch64\n+ elif args.encoders == \"all-x86\":\n+ args.encoders = testcodersX86\nelse:\nargs.encoders = [args.encoders]\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/nightly.Jenkinsfile",
"new_path": "jenkins/nightly.Jenkinsfile",
"diff": "@@ -78,7 +78,7 @@ pipeline {\nsteps {\nsh '''\npython3 ./Test/astc_test_functional.py\n- python3 ./Test/astc_test_image.py --encoder=all --test-set Small --test-quality medium\n+ python3 ./Test/astc_test_image.py --encoder=all-x86 --test-set Small --test-quality medium\n'''\ndir('build_rel') {\nsh 'ctest'\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -113,7 +113,7 @@ pipeline {\nsteps {\nsh '''\npython3 ./Test/astc_test_functional.py\n- python3 ./Test/astc_test_image.py --encoder=all --test-set Small\n+ python3 ./Test/astc_test_image.py --encoder=all-x86 --test-set Small\n'''\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Change test_image so "all" is architecture aware
|
61,745 |
02.01.2021 00:15:23
| 0 |
75255990468467b3ed677094054993213cc6bf6a
|
Add functional tests on all Linux build variants
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/nightly.Jenkinsfile",
"new_path": "jenkins/nightly.Jenkinsfile",
"diff": "@@ -77,7 +77,10 @@ pipeline {\nstage('Test') {\nsteps {\nsh '''\n- python3 ./Test/astc_test_functional.py\n+ python3 ./Test/astc_test_functional.py --encoder=none\n+ python3 ./Test/astc_test_functional.py --encoder=sse2\n+ python3 ./Test/astc_test_functional.py --encoder=sse4.1\n+ python3 ./Test/astc_test_functional.py --encoder=avx2\npython3 ./Test/astc_test_image.py --encoder=all-x86 --test-set Small --test-quality medium\n'''\ndir('build_rel') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add functional tests on all Linux build variants
|
61,745 |
02.01.2021 00:26:04
| 0 |
2181a284fa035c507021259dacc4fde2bb00014c
|
Accept output from IM
|
[
{
"change_type": "MODIFY",
"old_path": "Test/testlib/image.py",
"new_path": "Test/testlib/image.py",
"diff": "@@ -52,7 +52,7 @@ def get_convert_version():\ncommand = list(CONVERT_BINARY)\ncommand += [\"--version\"]\nresult = sp.run(command, stdout=sp.PIPE, stderr=sp.PIPE,\n- check=True, universal_newlines=True)\n+ check=True, encoding=\"utf-8\")\n# Version is top row\nversion = result.stdout.splitlines()[0]\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Accept UTF-8 output from IM
|
61,745 |
02.01.2021 23:23:20
| 0 |
322577032ed22321fa5c3c93c18b965480f10b7c
|
Allocate decimation_table enties only when used
Original code allocated all legal decimation_tables, but then
only referenced a subset from the active block_modes given
the heuristics in the compressor. This commit changes this to
allocate only the DT entries that are actually referenced
by a block mode.
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_block_sizes2.cpp",
"new_path": "Source/astcenc_block_sizes2.cpp",
"diff": "@@ -571,56 +571,31 @@ static void initialize_decimation_table_3d(\ndt->num_weights = weights_per_block;\n}\n-static void construct_block_size_descriptor_2d(\n- int xdim,\n- int ydim,\n- bool can_omit_modes,\n- float mode_cutoff,\n- block_size_descriptor* bsd\n+/**\n+ * @brief Allocate a single 2D decimation table entry.\n+ *\n+ * @param x_dim The block X dimension.\n+ * @param y_dim The block Y dimension.\n+ * @param x_weights The weight grid X dimension.\n+ * @param y_weights The weight grid Y dimension.\n+ *\n+ * @return The new entry's index in the compacted decimation_table array.\n+ */\n+static int construct_dt_entry_2d(\n+ int x_dim,\n+ int y_dim,\n+ int x_weights,\n+ int y_weights,\n+ block_size_descriptor& bsd\n) {\n- // Store a remap table for storing packed decimation modes.\n- // Indexing uses [Y * 16 + X] and max block size for each axis is 12.\n- static const int MAX_DMI = 12 * 16 + 12;\n- int decimation_mode_index[MAX_DMI];\n- int decimation_mode_count = 0;\n-\n- bsd->xdim = xdim;\n- bsd->ydim = ydim;\n- bsd->zdim = 1;\n- bsd->texel_count = xdim * ydim;\n-\n- for (int i = 0; i < MAX_DMI; i++)\n- {\n- decimation_mode_index[i] = -1;\n- }\n-\n- // Gather all the decimation grids that can be used with the current block.\n-\n- // ASSUMPTION: No compressor will use more weights in any dimension than\n- // the block has actual texels, because it wastes bits. Decompression of an\n- // image which violates this assumption will fail, even though it is\n- // technically permitted by the specification.\n-\n- // TODO: Many of these decimation options may be unused for any given\n- // compression due to use of percentile heuristics, but they are needed for\n- // arbitrary image decompression, so we don't filter them out. We could\n- // make the compressor startup faster if we have compress-only contexts,\n- // where we know there is no arbitrary image decompression.\n- for (int x_weights = 2; x_weights <= xdim; x_weights++)\n- {\n- for (int y_weights = 2; y_weights <= ydim; y_weights++)\n- {\n+ int dm_index = bsd.decimation_mode_count;\nint weight_count = x_weights * y_weights;\n- if (weight_count > MAX_WEIGHTS_PER_BLOCK)\n- {\n- continue;\n- }\n+ assert(weight_count <= MAX_WEIGHTS_PER_BLOCK);\nbool try_2planes = (2 * weight_count) <= MAX_WEIGHTS_PER_BLOCK;\ndecimation_table *dt = new decimation_table;\n- decimation_mode_index[y_weights * 16 + x_weights] = decimation_mode_count;\n- initialize_decimation_table_2d(xdim, ydim, x_weights, y_weights, dt);\n+ initialize_decimation_table_2d(x_dim, y_dim, x_weights, y_weights, dt);\nint maxprec_1plane = -1;\nint maxprec_2planes = -1;\n@@ -642,33 +617,53 @@ static void construct_block_size_descriptor_2d(\n}\n}\n- // TODO: For fast modes are many of these unused because they\n- // are only used by percentil skipped block modes?\n+ // At least one of the two should be valid ...\n+ assert(maxprec_1plane >= 0 || maxprec_2planes >= 0);\n+ bsd.decimation_modes[dm_index].maxprec_1plane = maxprec_1plane;\n+ bsd.decimation_modes[dm_index].maxprec_2planes = maxprec_2planes;\n+ bsd.decimation_modes[dm_index].percentile_hit = false;\n+ bsd.decimation_modes[dm_index].percentile_always = false;\n+ bsd.decimation_tables[dm_index] = dt;\n- bsd->decimation_modes[decimation_mode_count].maxprec_1plane = maxprec_1plane;\n- bsd->decimation_modes[decimation_mode_count].maxprec_2planes = maxprec_2planes;\n- bsd->decimation_modes[decimation_mode_count].percentile_hit = false;\n- bsd->decimation_modes[decimation_mode_count].percentile_always = false;\n- bsd->decimation_tables[decimation_mode_count] = dt;\n-\n- decimation_mode_count++;\n- }\n+ bsd.decimation_mode_count++;\n+ return dm_index;\n}\n- // Ensure the end of the array contains valid data (should never get read)\n- for (int i = decimation_mode_count; i < MAX_DECIMATION_MODES; i++)\n+/**\n+ * @brief Allocate block modes and decimation tables for a single BSD.\n+ *\n+ * @param x_dim The block X dimension.\n+ * @param y_dim The block Y dimension.\n+ * @param can_omit_modes True if we are allowed to discard modes that\n+ * compression won't use, even if they are legal.\n+ * @param mode_cutoff Block mode percentile cut off, between [0,1].\n+ * @param bsd The BSD to populate.\n+ */\n+static void construct_block_size_descriptor_2d(\n+ int x_dim,\n+ int y_dim,\n+ bool can_omit_modes,\n+ float mode_cutoff,\n+ block_size_descriptor& bsd\n+) {\n+ // Store a remap table for storing packed decimation modes.\n+ // Indexing uses [Y * 16 + X] and max block size for each axis is 12.\n+ static const int MAX_DMI = 12 * 16 + 12;\n+ int decimation_mode_index[MAX_DMI];\n+\n+ bsd.xdim = x_dim;\n+ bsd.ydim = y_dim;\n+ bsd.zdim = 1;\n+ bsd.texel_count = x_dim * y_dim;\n+\n+ for (int i = 0; i < MAX_DMI; i++)\n{\n- bsd->decimation_modes[i].maxprec_1plane = -1;\n- bsd->decimation_modes[i].maxprec_2planes = -1;\n- bsd->decimation_modes[i].percentile_hit = false;\n- bsd->decimation_modes[i].percentile_always = false;\n- bsd->decimation_tables[i] = nullptr;\n+ decimation_mode_index[i] = -1;\n}\n- bsd->decimation_mode_count = decimation_mode_count;\n-\n+ // Gather all the decimation grids that can be used with the current block.\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\n- const float *percentiles = get_2d_percentile_table(xdim, ydim);\n+ const float *percentiles = get_2d_percentile_table(x_dim, y_dim);\n#endif\n// Construct the list of block formats referencing the decimation tables\n@@ -689,54 +684,75 @@ static void construct_block_size_descriptor_2d(\nbool selected == true;\n#endif\n+ // ASSUMPTION: No compressor will use more weights in a dimension than\n+ // the block has actual texels, because it wastes bits. Decompression\n+ // of an image which violates this assumption will fail, even though it\n+ // is technically permitted by the specification.\n+\n// Skip modes that are invalid, too large, or not selected by heuristic\n- if (!valid || !selected || (x_weights > xdim) || (y_weights > ydim))\n+ if (!valid || !selected || (x_weights > x_dim) || (y_weights > y_dim))\n{\n- bsd->block_mode_to_packed[i] = -1;\n+ bsd.block_mode_to_packed[i] = -1;\ncontinue;\n}\n+ // Allocate and initialize the DT entry if we've not used it yet.\nint decimation_mode = decimation_mode_index[y_weights * 16 + x_weights];\n+ if (decimation_mode == -1)\n+ {\n+ decimation_mode = construct_dt_entry_2d(x_dim, y_dim, x_weights, y_weights, bsd);\n+ decimation_mode_index[y_weights * 16 + x_weights] = decimation_mode;\n+ }\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\n// Flatten the block mode heuristic into some precomputed flags\nif (percentile == 0.0f)\n{\n- bsd->block_modes_packed[packed_idx].percentile_always = true;\n- bsd->decimation_modes[decimation_mode].percentile_always = true;\n+ bsd.block_modes_packed[packed_idx].percentile_always = true;\n+ bsd.decimation_modes[decimation_mode].percentile_always = true;\n- bsd->block_modes_packed[packed_idx].percentile_hit = true;\n- bsd->decimation_modes[decimation_mode].percentile_hit = true;\n+ bsd.block_modes_packed[packed_idx].percentile_hit = true;\n+ bsd.decimation_modes[decimation_mode].percentile_hit = true;\n}\nelse if (percentile <= mode_cutoff)\n{\n- bsd->block_modes_packed[packed_idx].percentile_always = false;\n+ bsd.block_modes_packed[packed_idx].percentile_always = false;\n- bsd->block_modes_packed[packed_idx].percentile_hit = true;\n- bsd->decimation_modes[decimation_mode].percentile_hit = true;\n+ bsd.block_modes_packed[packed_idx].percentile_hit = true;\n+ bsd.decimation_modes[decimation_mode].percentile_hit = true;\n}\n#endif\n- bsd->block_modes_packed[packed_idx].decimation_mode = decimation_mode;\n- bsd->block_modes_packed[packed_idx].quantization_mode = quantization_mode;\n- bsd->block_modes_packed[packed_idx].is_dual_plane = is_dual_plane ? 1 : 0;\n- bsd->block_modes_packed[packed_idx].mode_index = i;\n- bsd->block_mode_to_packed[i] = packed_idx;\n+ bsd.block_modes_packed[packed_idx].decimation_mode = decimation_mode;\n+ bsd.block_modes_packed[packed_idx].quantization_mode = quantization_mode;\n+ bsd.block_modes_packed[packed_idx].is_dual_plane = is_dual_plane ? 1 : 0;\n+ bsd.block_modes_packed[packed_idx].mode_index = i;\n+ bsd.block_mode_to_packed[i] = packed_idx;\n++packed_idx;\n}\n- bsd->block_mode_packed_count = packed_idx;\n+ bsd.block_mode_packed_count = packed_idx;\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\ndelete[] percentiles;\n#endif\n+ // Ensure the end of the array contains valid data (should never get read)\n+ for (int i = bsd.decimation_mode_count; i < MAX_DECIMATION_MODES; i++)\n+ {\n+ bsd.decimation_modes[i].maxprec_1plane = -1;\n+ bsd.decimation_modes[i].maxprec_2planes = -1;\n+ bsd.decimation_modes[i].percentile_hit = false;\n+ bsd.decimation_modes[i].percentile_always = false;\n+ bsd.decimation_tables[i] = nullptr;\n+ }\n+\n// Determine the texels to use for kmeans clustering.\n- if (xdim * ydim <= 64)\n+ if (x_dim * y_dim <= 64)\n{\n- bsd->texelcount_for_bitmap_partitioning = xdim * ydim;\n- for (int i = 0; i < xdim * ydim; i++)\n+ bsd.texelcount_for_bitmap_partitioning = x_dim * y_dim;\n+ for (int i = 0; i < x_dim * y_dim; i++)\n{\n- bsd->texels_for_bitmap_partitioning[i] = i;\n+ bsd.texels_for_bitmap_partitioning[i] = i;\n}\n}\nelse\n@@ -746,7 +762,7 @@ static void construct_block_size_descriptor_2d(\n// pick 64 random texels for use with bitmap partitioning.\nint arr[MAX_TEXELS_PER_BLOCK];\n- for (int i = 0; i < xdim * ydim; i++)\n+ for (int i = 0; i < x_dim * y_dim; i++)\n{\narr[i] = 0;\n}\n@@ -755,7 +771,7 @@ static void construct_block_size_descriptor_2d(\nwhile (arr_elements_set < 64)\n{\nunsigned int idx = (unsigned int)astc::rand(rng_state);\n- idx %= xdim * ydim;\n+ idx %= x_dim * y_dim;\nif (arr[idx] == 0)\n{\narr_elements_set++;\n@@ -769,12 +785,12 @@ static void construct_block_size_descriptor_2d(\n{\nif (arr[idx])\n{\n- bsd->texels_for_bitmap_partitioning[texel_weights_written++] = idx;\n+ bsd.texels_for_bitmap_partitioning[texel_weights_written++] = idx;\n}\nidx++;\n}\n- bsd->texelcount_for_bitmap_partitioning = 64;\n+ bsd.texelcount_for_bitmap_partitioning = 64;\n}\n}\n@@ -960,7 +976,7 @@ void init_block_size_descriptor(\n}\nelse\n{\n- construct_block_size_descriptor_2d(xdim, ydim, can_omit_modes, mode_cutoff, bsd);\n+ construct_block_size_descriptor_2d(xdim, ydim, can_omit_modes, mode_cutoff, *bsd);\n}\ninit_partition_tables(bsd);\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Allocate decimation_table enties only when used
Original code allocated all legal decimation_tables, but then
only referenced a subset from the active block_modes given
the heuristics in the compressor. This commit changes this to
allocate only the DT entries that are actually referenced
by a block mode.
|
61,745 |
02.01.2021 23:25:19
| 0 |
48f59e62443cf5d9a23e4e29e627e6a0454deec0
|
Update to 2021 copyright year ...
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_block_sizes2.cpp",
"new_path": "Source/astcenc_block_sizes2.cpp",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2020 Arm Limited\n+// Copyright 2011-2021 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update to 2021 copyright year ...
|
61,745 |
02.01.2021 23:26:34
| 0 |
151a8c76594be55f49549fed2e65ba1398bb2ef8
|
Add optimization page
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "Docs/OptimizationIdeas.md",
"diff": "+# Optimization ideas\n+\n+This page contains a relatively raw dump of optimization ideas we've had, and\n+areas we want to investigate.\n+\n+Most of these are raw ideas that have not been entirely thought thorough. Some\n+will no doubt turn out to be rubbish ideas that don't work, but hopefully there\n+are a few gems in here =)\n+\n+## Optimizations\n+\n+This section lists specific optimization ideas.\n+\n+### Postpone full iterative refinement\n+\n+Iterative refinement is expensive, and not always beneficial. We currently\n+refine every trial based on estimated error, and then keep the best based on\n+actual error.\n+\n+To reduce the amount of refinement done, but without losing too much quality,\n+we should see if it is possible to reduce the amount of refinement done before\n+candidate selection and then only refine the final one or two candidates (but\n+potentially refine them more than we do today).\n+\n+### Heuristic based on block / weight decimation anisotropy\n+\n+Decimated weight grids can end up quite anisotropic, especially at larger\n+block sizes. For example, the most extreme is a 2x12 grid for a 12x12 block.\n+\n+Gut feel says we should be able to exploit this - either a straight-heuristic\n+to reject very unbalanced block sizes, or an intelligent heuristic which\n+looks at the variability in the input data in each axis to determine which\n+weight decimations to consider. Could also reject very high/low frequency\n+grids, if they are a bad fit, not just anisotropic ones.\n+\n+This will mostly benefit the larger block sizes on `-medium` and `-thorough`\n+compression modes; percentiles tend to filter out the most unbalanced modes.\n+\n+### Block mode and Decimation table sorting\n+\n+The current code in `astcenc_block_sizes2.cpp` builds Block Modes based on the\n+value of the encoded mode index. The decoded block mode behavior is not nicely\n+sequential with either the likely utility of the block, or the use of data\n+resources. This gives poor locality and makes other optimizations harder.\n+\n+- **Option one:** Sort block modes by the decimation entry that they reference,\n+ this will allow better spatial locality when processing sequential block\n+ modes that use the same table. These could be sorted by weight count so that\n+ there is some form of \"ladder\" in terms of weight count bitrate usage.\n+- **Option two:** Sort block modes by their \"usefulness\" centile, and test the\n+ most valuable ones first. This will allow us to build an early-out\n+ mechanism which tests the most useful block modes first. (Today we cut\n+ statically, based on the quality preset, but there is no dynamic trimming).\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add optimization page
|
61,745 |
02.01.2021 23:38:32
| 0 |
45097f766188afa8e836c38aeb57af7d2cfdf919
|
Add optimization idea to docs
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/OptimizationIdeas.md",
"new_path": "Docs/OptimizationIdeas.md",
"diff": "@@ -11,6 +11,13 @@ are a few gems in here =)\nThis section lists specific optimization ideas.\n+### Exploit 1:1 weight modes\n+\n+The current code is generic and assumes reconstruction from multiple weighted\n+color values, due to use of decimated weight grids. For the 4x4 block size\n+we actually get a high percentage of 1:1 weight grids, so it might be worth\n+including a fast-path which can exploit this simplification.\n+\n### Postpone full iterative refinement\nIterative refinement is expensive, and not always beneficial. We currently\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add optimization idea to docs
|
61,745 |
02.01.2021 23:49:11
| 0 |
d165ebdf6edeb2d130d87534366657b196ef4d7a
|
Remove obsolete structure field
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2020 Arm Limited\n+// Copyright 2011-2021 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -868,8 +868,6 @@ static float prepare_error_weight_block(\nctx.config.cw_b_weight,\nctx.config.cw_a_weight);\n- ewb->contains_zeroweight_texels = 0;\n-\nfor (int z = 0; z < bsd->zdim; z++)\n{\nfor (int y = 0; y < bsd->ydim; y++)\n@@ -884,7 +882,6 @@ static float prepare_error_weight_block(\n{\nfloat4 weights = float4(1e-11f);\newb->error_weights[idx] = weights;\n- ewb->contains_zeroweight_texels = 1;\n}\nelse\n{\n@@ -1002,10 +999,6 @@ static float prepare_error_weight_block(\nerror_weight.a /= (derv[idx].a * derv[idx].a * 1e-10f);\newb->error_weights[idx] = error_weight;\n- if (dot(error_weight, float4(1.0f, 1.0f, 1.0f, 1.0f)) < 1e-10f)\n- {\n- ewb->contains_zeroweight_texels = 1;\n- }\n}\nidx++;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2020 Arm Limited\n+// Copyright 2011-2021 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -519,8 +519,6 @@ struct error_weight_block\nfloat texel_weight_g[MAX_TEXELS_PER_BLOCK];\nfloat texel_weight_b[MAX_TEXELS_PER_BLOCK];\nfloat texel_weight_a[MAX_TEXELS_PER_BLOCK];\n-\n- int contains_zeroweight_texels;\n};\n// enumeration of all the quantization methods we support under this format.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove obsolete structure field
|
61,745 |
03.01.2021 00:07:28
| 0 |
e11076e777bf0483f9ac1dfdd228ab5c35e1aef6
|
Remove unused rgb_drop_error metric
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_encoding_choice_error.cpp",
"new_path": "Source/astcenc_encoding_choice_error.cpp",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2020 Arm Limited\n+// Copyright 2011-2021 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -234,16 +234,8 @@ void compute_encoding_choice_errors(\nluminance_rgb_error[i] = compute_error_squared_rgb_single_partition(i, bsd, pi, pb, ewb, &(proc_luminance_lines[i]));\n}\n- // compute the error that arises from just ditching alpha and RGB\n- float alpha_drop_error[4];\n- float rgb_drop_error[4];\n-\n- for (int i = 0; i < partition_count; i++)\n- {\n- alpha_drop_error[i] = 0;\n- rgb_drop_error[i] = 0;\n- }\n-\n+ // Compute the error that arises from just ditching alpha\n+ float alpha_drop_error[4] = { 0 };\nfor (int i = 0; i < texels_per_block; i++)\n{\nint partition = pi->partition_of_texel[i];\n@@ -252,13 +244,6 @@ void compute_encoding_choice_errors(\nfloat omalpha = alpha - default_alpha;\nalpha_drop_error[partition] += omalpha * omalpha * ewb->error_weights[i].a;\n-\n- float red = pb->data_r[i];\n- float green = pb->data_g[i];\n- float blue = pb->data_b[i];\n- rgb_drop_error[partition] += red * red * ewb->error_weights[i].r +\n- green * green * ewb->error_weights[i].g +\n- blue * blue * ewb->error_weights[i].b;\n}\n// check if we are eligible for blue-contraction and offset-encoding\n@@ -273,12 +258,11 @@ void compute_encoding_choice_errors(\n{\nendpoints_and_weights ei1, ei2;\ncompute_endpoints_and_ideal_weights_2_planes(bsd, pi, pb, ewb, separate_component, &ei1, &ei2);\n-\nmerge_endpoints(&(ei1.ep), &(ei2.ep), separate_component, &ep);\n}\n- int eligible_for_offset_encode[4];\n- int eligible_for_blue_contraction[4];\n+ bool can_offset_encode[4] = { 0 };\n+ bool can_blue_contract[4] = { 0 };\nfor (int i = 0; i < partition_count; i++)\n{\nfloat4 endpt0 = ep.endpt0[i];\n@@ -289,11 +273,7 @@ void compute_encoding_choice_errors(\nfabsf(endpt_dif.g) < (0.12f * 65535.0f) &&\nfabsf(endpt_dif.b) < (0.12f * 65535.0f))\n{\n- eligible_for_offset_encode[i] = 1;\n- }\n- else\n- {\n- eligible_for_offset_encode[i] = 0;\n+ can_offset_encode[i] = true;\n}\nendpt0.r += (endpt0.r - endpt0.b);\n@@ -305,11 +285,7 @@ void compute_encoding_choice_errors(\nendpt0.g > (0.01f * 65535.0f) && endpt0.g < (0.99f * 65535.0f) &&\nendpt1.g > (0.01f * 65535.0f) && endpt1.g < (0.99f * 65535.0f))\n{\n- eligible_for_blue_contraction[i] = 1;\n- }\n- else\n- {\n- eligible_for_blue_contraction[i] = 0;\n+ can_blue_contract[i] = true;\n}\n}\n@@ -320,9 +296,8 @@ void compute_encoding_choice_errors(\neci[i].rgb_luma_error = (rgb_luma_error[i] - uncorr_rgb_error[i]) * 1.5f; // wild guess\neci[i].luminance_error = (luminance_rgb_error[i] - uncorr_rgb_error[i]) * 3.0f; // empirical\neci[i].alpha_drop_error = alpha_drop_error[i] * 3.0f;\n- eci[i].rgb_drop_error = rgb_drop_error[i] * 3.0f;\n- eci[i].can_offset_encode = eligible_for_offset_encode[i];\n- eci[i].can_blue_contract = eligible_for_blue_contraction[i];\n+ eci[i].can_offset_encode = can_offset_encode[i];\n+ eci[i].can_blue_contract = can_blue_contract[i];\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1054,13 +1054,18 @@ void unpack_color_endpoints(\nstruct encoding_choice_errors\n{\n- float rgb_scale_error; // error of using LDR RGB-scale instead of complete endpoints.\n- float rgb_luma_error; // error of using HDR RGB-scale instead of complete endpoints.\n- float luminance_error; // error of using luminance instead of RGB\n- float alpha_drop_error; // error of discarding alpha\n- float rgb_drop_error; // error of discarding RGB\n- int can_offset_encode;\n- int can_blue_contract;\n+ // Error of using LDR RGB-scale instead of complete endpoints.\n+ float rgb_scale_error;\n+ // Error of using HDR RGB-scale instead of complete endpoints.\n+ float rgb_luma_error;\n+ // Error of using luminance instead of RGB.\n+ float luminance_error;\n+ // Error of discarding alpha.\n+ float alpha_drop_error;\n+ // Validity of using offset encoding.\n+ bool can_offset_encode;\n+ // Validity of using blue contraction encoding.\n+ bool can_blue_contract;\n};\n// buffers used to store intermediate data in compress_symbolic_block_fixed_partition_*()\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove unused rgb_drop_error metric
|
61,745 |
03.01.2021 22:27:23
| 0 |
dae5e6c90e61862b3bbca1589d7831cefe95f6d1
|
Add specialized recompute_ideal_colors for 1 plane
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -386,7 +386,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\nfor (int l = 0; l < max_refinement_iters; l++)\n{\n- recompute_ideal_colors(weight_quantization_mode, &(eix[decimation_mode].ep), rgbs_colors, rgbo_colors, u8_weight_src, nullptr, -1, pi, it, blk, ewb);\n+ recompute_ideal_colors_1plane(weight_quantization_mode, &(eix[decimation_mode].ep), rgbs_colors, rgbo_colors, u8_weight_src, pi, it, blk, ewb);\n// quantize the chosen color\n@@ -733,7 +733,7 @@ static void compress_symbolic_block_fixed_partition_2_planes(\nfor (int l = 0; l < max_refinement_iters; l++)\n{\n- recompute_ideal_colors(\n+ recompute_ideal_colors_2planes(\nweight_quantization_mode, &epm, rgbs_colors, rgbo_colors,\nu8_weight1_src, u8_weight2_src, separate_component, pi, it, blk, ewb);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astcenc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -1221,7 +1221,7 @@ static inline float4 compute_rgbovec(\n}\n/* for a given weight set, we wish to recompute the colors so that they are optimal for a particular weight set. */\n-void recompute_ideal_colors(\n+void recompute_ideal_colors_2planes(\nint weight_quantization_mode,\nendpoints* ep, // contains the endpoints we wish to update\nfloat4* rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6\n@@ -1653,4 +1653,301 @@ void recompute_ideal_colors(\n}\n}\n+/* for a given weight set, we wish to recompute the colors so that they are optimal for a particular weight set. */\n+void recompute_ideal_colors_1plane(\n+ int weight_quantization_mode,\n+ endpoints* ep, // contains the endpoints we wish to update\n+ float4* rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6\n+ float4* rgbo_vectors, // used to return RGBO-vectors for endpoint mode #7\n+ const uint8_t* weight_set8, // the current set of weight values\n+ const partition_info* pi,\n+ const decimation_table* it,\n+ const imageblock* pb, // picture-block containing the actual data.\n+ const error_weight_block* ewb\n+) {\n+ const quantization_and_transfer_table *qat = &(quant_and_xfer_tables[weight_quantization_mode]);\n+\n+ float weight_set[MAX_WEIGHTS_PER_BLOCK];\n+ for (int i = 0; i < it->num_weights; i++)\n+ {\n+ weight_set[i] = qat->unquantized_value[weight_set8[i]] * (1.0f / 64.0f);\n+ }\n+\n+ int partition_count = pi->partition_count;\n+ for (int i = 0; i < partition_count; i++)\n+ {\n+ float4 rgba_sum = float4(1e-17f);\n+ float4 rgba_weight_sum = float4(1e-17f);\n+\n+ int texelcount = pi->texels_per_partition[i];\n+ const uint8_t *texel_indexes = pi->texels_of_partition[i];\n+ for (int j = 0; j < texelcount; j++)\n+ {\n+ int tix = texel_indexes[j];\n+\n+ float4 rgba = float4(pb->data_r[tix], pb->data_g[tix], pb->data_b[tix], pb->data_a[tix]);\n+ float4 error_weight = float4(ewb->texel_weight_r[tix], ewb->texel_weight_g[tix], ewb->texel_weight_b[tix], ewb->texel_weight_a[tix]);\n+\n+ rgba_sum = rgba_sum + (rgba * error_weight);\n+ rgba_weight_sum = rgba_weight_sum + error_weight;\n+ }\n+\n+ float3 scale_direction = normalize(float3(\n+ rgba_sum.r * (1.0f / rgba_weight_sum.r),\n+ rgba_sum.g * (1.0f / rgba_weight_sum.g),\n+ rgba_sum.b * (1.0f / rgba_weight_sum.b)));\n+\n+ float scale_max = 0.0f;\n+ float scale_min = 1e10f;\n+\n+ float wmin1 = 1.0f;\n+ float wmax1 = 0.0f;\n+\n+ float4 left_sum = float4(0.0f);\n+ float4 middle_sum = float4(0.0f);\n+ float4 right_sum = float4(0.0f);\n+\n+ float3 lmrs_sum = float3(0.0f);\n+\n+ float4 color_vec_x = float4(0.0f);\n+ float4 color_vec_y = float4(0.0f);\n+\n+ float2 scale_vec = float2(0.0f);\n+\n+ float3 weight_weight_sum = float3(1e-17f);\n+ float psum = 1e-17f;\n+\n+ // FIXME: the loop below has too many responsibilities, making it inefficient.\n+ for (int j = 0; j < texelcount; j++)\n+ {\n+ int tix = texel_indexes[j];\n+\n+ float4 rgba = float4(pb->data_r[tix], pb->data_g[tix], pb->data_b[tix], pb->data_a[tix]);\n+ float4 color_weight = float4(ewb->texel_weight_r[tix], ewb->texel_weight_g[tix], ewb->texel_weight_b[tix], ewb->texel_weight_a[tix]);\n+\n+ float3 color_weight3 = float3(color_weight.r, color_weight.g, color_weight.b);\n+ float3 rgb = float3(rgba.r, rgba.g, rgba.b);\n+\n+ // FIXME: move this calculation out to the color block.\n+ float ls_weight = (color_weight.r + color_weight.g + color_weight.b);\n+\n+ const uint8_t *texel_weights = it->texel_weights[tix];\n+ const float *texel_weights_float = it->texel_weights_float[tix];\n+ float idx0 = (weight_set[texel_weights[0]] * texel_weights_float[0]\n+ + weight_set[texel_weights[1]] * texel_weights_float[1])\n+ + (weight_set[texel_weights[2]] * texel_weights_float[2]\n+ + weight_set[texel_weights[3]] * texel_weights_float[3]);\n+\n+ float om_idx0 = 1.0f - idx0;\n+ if (idx0 > wmax1)\n+ {\n+ wmax1 = idx0;\n+ }\n+\n+ if (idx0 < wmin1)\n+ {\n+ wmin1 = idx0;\n+ }\n+\n+ float scale = dot(scale_direction, rgb);\n+ if (scale < scale_min)\n+ {\n+ scale_min = scale;\n+ }\n+\n+ if (scale > scale_max)\n+ {\n+ scale_max = scale;\n+ }\n+\n+ float4 left = color_weight * (om_idx0 * om_idx0);\n+ float4 middle = color_weight * (om_idx0 * idx0);\n+ float4 right = color_weight * (idx0 * idx0);\n+\n+ float3 lmrs = float3(om_idx0 * om_idx0,\n+ om_idx0 * idx0,\n+ idx0 * idx0) * ls_weight;\n+\n+ left_sum = left_sum + left;\n+ middle_sum = middle_sum + middle;\n+ right_sum = right_sum + right;\n+\n+ lmrs_sum = lmrs_sum + lmrs;\n+\n+ float4 color_idx = float4(idx0);\n+ float3 color_idx3 = float3(idx0);\n+\n+ float4 cwprod = color_weight * rgba;\n+ float4 cwiprod = cwprod * color_idx;\n+\n+ color_vec_y = color_vec_y + cwiprod;\n+ color_vec_x = color_vec_x + (cwprod - cwiprod);\n+\n+ scale_vec = scale_vec + float2(om_idx0, idx0) * (ls_weight * scale);\n+\n+ weight_weight_sum = weight_weight_sum + (color_weight3 * color_idx3);\n+\n+ psum += dot(color_weight3 * color_idx3, color_idx3);\n+ }\n+\n+ // calculations specific to mode #7, the HDR RGB-scale mode.\n+ // FIXME: Can we skip this for LDR textures?\n+ float red_sum = color_vec_x.r + color_vec_y.r;\n+ float green_sum = color_vec_x.g + color_vec_y.g;\n+ float blue_sum = color_vec_x.b + color_vec_y.b;\n+ float qsum = color_vec_y.r + color_vec_y.g + color_vec_y.b;\n+\n+ #ifdef DEBUG_CAPTURE_NAN\n+ fedisableexcept(FE_DIVBYZERO | FE_INVALID);\n+ #endif\n+\n+ float4 rgbovec = compute_rgbovec(rgba_weight_sum, weight_weight_sum,\n+ red_sum, green_sum, blue_sum, psum, qsum);\n+ rgbo_vectors[i] = rgbovec;\n+\n+ // We will occasionally get a failure due to the use of a singular\n+ // (non-invertible) matrix. Record whether such a failure has taken\n+ // place; if it did, compute rgbo_vectors[] with a different method\n+ // later on.\n+ float chkval = dot(rgbovec, rgbovec);\n+ int rgbo_fail = chkval != chkval;\n+\n+ // Initialize the luminance and scale vectors with a reasonable\n+ // default, just in case the subsequent calculation blows up.\n+ #ifdef DEBUG_CAPTURE_NAN\n+ fedisableexcept(FE_DIVBYZERO | FE_INVALID);\n+ #endif\n+\n+ float scalediv = scale_min * (1.0f / MAX(scale_max, 1e-10f));\n+ scalediv = astc::clamp1f(scalediv);\n+\n+ #ifdef DEBUG_CAPTURE_NAN\n+ feenableexcept(FE_DIVBYZERO | FE_INVALID);\n+ #endif\n+\n+ float3 sds = scale_direction * scale_max;\n+\n+ rgbs_vectors[i] = float4(sds.r, sds.g, sds.b, scalediv);\n+\n+ if (wmin1 >= wmax1 * 0.999f)\n+ {\n+ // if all weights in the partition were equal, then just take average\n+ // of all colors in the partition and use that as both endpoint colors.\n+ float4 avg = (color_vec_x + color_vec_y) *\n+ float4(1.0f / rgba_weight_sum.r,\n+ 1.0f / rgba_weight_sum.g,\n+ 1.0f / rgba_weight_sum.b,\n+ 1.0f / rgba_weight_sum.a);\n+\n+ if (avg.r == avg.r)\n+ {\n+ ep->endpt0[i].r = ep->endpt1[i].r = avg.r;\n+ }\n+\n+ if (avg.g == avg.g)\n+ {\n+ ep->endpt0[i].g = ep->endpt1[i].g = avg.g;\n+ }\n+\n+ if (avg.b == avg.b)\n+ {\n+ ep->endpt0[i].b = ep->endpt1[i].b = avg.b;\n+ }\n+\n+ if (avg.a == avg.a)\n+ {\n+ ep->endpt0[i].a = ep->endpt1[i].a = avg.a;\n+ }\n+\n+ rgbs_vectors[i] = float4(sds.r, sds.g, sds.b, 1.0f);\n+ }\n+ else\n+ {\n+ // otherwise, complete the analytic calculation of ideal-endpoint-values\n+ // for the given set of texel weights and pixel colors.\n+\n+ #ifdef DEBUG_CAPTURE_NAN\n+ fedisableexcept(FE_DIVBYZERO | FE_INVALID);\n+ #endif\n+\n+ float4 color_det1 = (left_sum * right_sum) - (middle_sum * middle_sum);\n+ float4 color_rdet1 = float4(1.0f / color_det1.r,\n+ 1.0f / color_det1.g,\n+ 1.0f / color_det1.b,\n+ 1.0f / color_det1.a );\n+\n+ float ls_det1 = (lmrs_sum.r * lmrs_sum.b) - (lmrs_sum.g * lmrs_sum.g);\n+ float ls_rdet1 = 1.0f / ls_det1;\n+\n+ float4 color_mss1 = (left_sum * left_sum)\n+ + (2.0f * middle_sum * middle_sum)\n+ + (right_sum * right_sum);\n+\n+ float ls_mss1 = (lmrs_sum.r * lmrs_sum.r)\n+ + (2.0f * lmrs_sum.g * lmrs_sum.g)\n+ + (lmrs_sum.b * lmrs_sum.b);\n+\n+ float4 ep0 = (right_sum * color_vec_x - middle_sum * color_vec_y) * color_rdet1;\n+ float4 ep1 = (left_sum * color_vec_y - middle_sum * color_vec_x) * color_rdet1;\n+\n+ float scale_ep0 = (lmrs_sum.b * scale_vec.r - lmrs_sum.g * scale_vec.g) * ls_rdet1;\n+ float scale_ep1 = (lmrs_sum.r * scale_vec.g - lmrs_sum.g * scale_vec.r) * ls_rdet1;\n+\n+ if (fabsf(color_det1.r) > (color_mss1.r * 1e-4f) && ep0.r == ep0.r && ep1.r == ep1.r)\n+ {\n+ ep->endpt0[i].r = ep0.r;\n+ ep->endpt1[i].r = ep1.r;\n+ }\n+\n+ if (fabsf(color_det1.g) > (color_mss1.g * 1e-4f) && ep0.g == ep0.g && ep1.g == ep1.g)\n+ {\n+ ep->endpt0[i].g = ep0.g;\n+ ep->endpt1[i].g = ep1.g;\n+ }\n+\n+ if (fabsf(color_det1.b) > (color_mss1.b * 1e-4f) && ep0.b == ep0.b && ep1.b == ep1.b)\n+ {\n+ ep->endpt0[i].b = ep0.b;\n+ ep->endpt1[i].b = ep1.b;\n+ }\n+\n+ if (fabsf(color_det1.a) > (color_mss1.a * 1e-4f) && ep0.a == ep0.a && ep1.a == ep1.a)\n+ {\n+ ep->endpt0[i].a = ep0.a;\n+ ep->endpt1[i].a = ep1.a;\n+ }\n+\n+ if (fabsf(ls_det1) > (ls_mss1 * 1e-4f) && scale_ep0 == scale_ep0 && scale_ep1 == scale_ep1 && scale_ep0 < scale_ep1)\n+ {\n+ float scalediv2 = scale_ep0 * (1.0f / scale_ep1);\n+ float3 sdsm = scale_direction * scale_ep1;\n+ rgbs_vectors[i] = float4(sdsm.r, sdsm.g, sdsm.b, scalediv2);\n+ }\n+\n+ #ifdef DEBUG_CAPTURE_NAN\n+ feenableexcept(FE_DIVBYZERO | FE_INVALID);\n+ #endif\n+ }\n+\n+ // if the calculation of an RGB-offset vector failed, try to compute\n+ // a somewhat-sensible value anyway\n+ if (rgbo_fail)\n+ {\n+ float4 v0 = ep->endpt0[i];\n+ float4 v1 = ep->endpt1[i];\n+ float avgdif = ((v1.r - v0.r) + (v1.g - v0.g) + (v1.b - v0.b)) * (1.0f / 3.0f);\n+\n+ if (avgdif <= 0.0f)\n+ {\n+ avgdif = 0.0f;\n+ }\n+\n+ float4 avg = (v0 + v1) * 0.5f;\n+ float4 ep0 = avg - float4(avgdif, avgdif, avgdif, avgdif) * 0.5f;\n+\n+ rgbo_vectors[i] = float4(ep0.r, ep0.g, ep0.b, avgdif);\n+ }\n+ }\n+}\n+\n#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -1113,11 +1113,22 @@ void determine_optimal_set_of_endpoint_formats_to_use(\nint quantization_level[4],\nint quantization_level_mod[4]);\n-void recompute_ideal_colors(\n+void recompute_ideal_colors_1plane(\nint weight_quantization_mode,\nendpoints* ep, // contains the endpoints we wish to update\n- float4* rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6\n- float4* rgbo_vectors, // used to return RGBS-vectors for endpoint mode #7\n+ float4* rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6 (LDR RGB base + scale)\n+ float4* rgbo_vectors, // used to return RGBS-vectors for endpoint mode #7 (HDR RGB base + scale)\n+ const uint8_t* weight_set8, // the current set of weight values\n+ const partition_info* pi,\n+ const decimation_table* it,\n+ const imageblock* pb, // picture-block containing the actual data.\n+ const error_weight_block* ewb);\n+\n+void recompute_ideal_colors_2planes(\n+ int weight_quantization_mode,\n+ endpoints* ep, // contains the endpoints we wish to update\n+ float4* rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6 (LDR RGB base + scale)\n+ float4* rgbo_vectors, // used to return RGBS-vectors for endpoint mode #7 (HDR RGB base + scale)\nconst uint8_t* weight_set8, // the current set of weight values\nconst uint8_t* plane2_weight_set8, // nullptr 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"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add specialized recompute_ideal_colors for 1 plane
|
61,745 |
04.01.2021 12:30:34
| 0 |
433046963e9f1b3b3ffabbce8630da01a8a0d30a
|
Remove obsolete compiler opts
|
[
{
"change_type": "MODIFY",
"old_path": "Source/cmake_core.cmake",
"new_path": "Source/cmake_core.cmake",
"diff": "# SPDX-License-Identifier: Apache-2.0\n# ----------------------------------------------------------------------------\n-# Copyright 2020 Arm Limited\n+# Copyright 2020-2021 Arm Limited\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy\n@@ -115,12 +115,6 @@ if(${ISA_SIMD} MATCHES \"none\")\nASTCENC_AVX=0\nASTCENC_POPCNT=0)\n- if (${ARCH} MATCHES x64)\n- target_compile_options(astcenc-${ISA_SIMD}\n- PRIVATE\n- $<$<CXX_COMPILER_ID:${GNU_LIKE}>:-mfpmath=sse -msse2>)\n- endif()\n-\nelseif(${ISA_SIMD} MATCHES \"neon\")\ntarget_compile_definitions(astcenc-${ISA_SIMD}\nPRIVATE\n@@ -137,10 +131,6 @@ elseif(${ISA_SIMD} MATCHES \"sse2\")\nASTCENC_AVX=0\nASTCENC_POPCNT=0)\n- target_compile_options(astcenc-${ISA_SIMD}\n- PRIVATE\n- $<$<CXX_COMPILER_ID:${GNU_LIKE}>:-mfpmath=sse -msse2>)\n-\nelseif(${ISA_SIMD} MATCHES \"sse4.1\")\ntarget_compile_definitions(astcenc-${ISA_SIMD}\nPRIVATE\n@@ -151,7 +141,7 @@ elseif(${ISA_SIMD} MATCHES \"sse4.1\")\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n- $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mfpmath=sse -msse4.1 -mpopcnt>)\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-msse4.1 -mpopcnt>)\nelseif(${ISA_SIMD} MATCHES \"avx2\")\ntarget_compile_definitions(astcenc-${ISA_SIMD}\n@@ -163,7 +153,7 @@ elseif(${ISA_SIMD} MATCHES \"avx2\")\ntarget_compile_options(astcenc-${ISA_SIMD}\nPRIVATE\n- $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mfpmath=sse -mavx2 -mpopcnt>\n+ $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-mavx2 -mpopcnt>\n$<$<CXX_COMPILER_ID:MSVC>:/arch:AVX2>)\nendif()\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove obsolete compiler opts
|
61,745 |
04.01.2021 12:30:49
| 0 |
62856749b3e30c1162feb8deb1202f757e210c55
|
Support cross-compile on macOS
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -20,16 +20,6 @@ cmake_minimum_required(VERSION 3.15)\ncmake_policy(SET CMP0069 NEW) # LTO support\ncmake_policy(SET CMP0091 NEW) # MSVC runtime support\n-# Project configuration\n-project(astcenc VERSION 2.2.0)\n-\n-set(CMAKE_CXX_STANDARD 14)\n-set(CMAKE_CXX_STANDARD_REQUIRED ON)\n-set(CMAKE_CXX_EXTENSIONS OFF)\n-set(CMAKE_EXPORT_COMPILE_COMMANDS 1)\n-set(PACKAGE_ROOT astcenc)\n-include(CTest)\n-\n# Command line configuration\nfunction(printopt optName optVal optArch tgtArch)\nif(${optVal})\n@@ -87,6 +77,12 @@ else()\nmessage(\" -- No SIMD backend - OFF\")\nendif()\n+if(${ARCH} MATCHES \"aarch64\")\n+ set(CMAKE_OSX_ARCHITECTURES arm64)\n+else()\n+ set(CMAKE_OSX_ARCHITECTURES x86_64)\n+endif()\n+\noption(ISA_INVARIANCE \"Enable builds for ISA invariance\")\nif(${ISA_INVARIANCE})\nmessage(\" -- ISA invariant backend - ON\")\n@@ -105,6 +101,17 @@ if(NOT ${ANY_ISA})\nmessage(FATAL_ERROR \"At least one backend ISA must be enabled\")\nendif()\n+# Project configuration\n+# Must be done after setting CMAKE_OSX_ARCHITECTURES\n+project(astcenc VERSION 2.2.0)\n+\n+set(CMAKE_CXX_STANDARD 14)\n+set(CMAKE_CXX_STANDARD_REQUIRED ON)\n+set(CMAKE_CXX_EXTENSIONS OFF)\n+set(CMAKE_EXPORT_COMPILE_COMMANDS 1)\n+set(PACKAGE_ROOT astcenc)\n+include(CTest)\n+\n# Subcomponents\nadd_subdirectory(Source)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Support cross-compile on macOS
|
61,745 |
04.01.2021 12:40:20
| 0 |
2c8a85244b237a18f9c9c1d0a75b205e1f42015d
|
Trial aarch64 cross-compiles for macOS
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -217,6 +217,57 @@ pipeline {\n}\n}\n}\n+ /* Build for macOS on x86-64 using Clang */\n+ stage('macOS arm64') {\n+ agent {\n+ label 'mac && x86_64 && notarizer'\n+ }\n+ stages {\n+ stage('Clean') {\n+ steps {\n+ sh 'git clean -ffdx'\n+ }\n+ }\n+ stage('Build R') {\n+ steps {\n+ sh '''\n+ mkdir build_rel\n+ cd build_rel\n+ cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_NEON=ON -DARCH=aarch64 ..\n+ make install package -j1\n+ '''\n+ }\n+ }\n+ stage('Sign and notarize') {\n+ environment {\n+ NOTARIZATION_CREDS = credentials('notarization-account')\n+ }\n+ steps {\n+ dir('build_rel') {\n+ withCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n+ keyFileVariable: 'SSH_AUTH_FILE')]) {\n+ sh 'GIT_SSH_COMMAND=\"ssh -i $SSH_AUTH_FILE -o StrictHostKeyChecking=no\" git clone ssh://eu-gerrit-1.euhpc.arm.com:29418/Hive/shared/signing'\n+ }\n+ withCredentials([usernamePassword(credentialsId: 'win-signing',\n+ usernameVariable: 'USERNAME',\n+ passwordVariable: 'PASSWORD')]) {\n+ sh 'python3 ./signing/macos-client-wrapper.py ${USERNAME} *.zip'\n+ sh 'rm -rf ./signing'\n+ }\n+ }\n+ }\n+ }\n+ stage('Stash') {\n+ steps {\n+ dir('build_rel') {\n+ stash name: 'astcenc-macos-aarch64', includes: '*.zip'\n+ stash name: 'astcenc-macos-aarch64-hash', includes: '*.zip.sha256'\n+ }\n+ }\n+ }\n+ // TODO: Currently can't test automatically\n+ }\n+ }\n}\n}\nstage('Artifactory') {\n@@ -245,6 +296,9 @@ pipeline {\ndir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n}\n+ dir('upload/macos-aarch64') {\n+ unstash 'astcenc-macos-aarch64'\n+ }\ndir('upload/windows-x64') {\nunstash 'astcenc-windows-x64'\nwithCredentials([sshUserPrivateKey(credentialsId: 'gerrit-jenkins-ssh',\n@@ -279,7 +333,6 @@ pipeline {\n}\n}\n}\n-\npost {\nfailure {\nscript {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Trial aarch64 cross-compiles for macOS
|
61,745 |
04.01.2021 14:23:41
| 0 |
7d47591c125b5e67fea4a4dcc561dc45c69af57a
|
Retry macos cross-compile
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -20,6 +20,8 @@ cmake_minimum_required(VERSION 3.15)\ncmake_policy(SET CMP0069 NEW) # LTO support\ncmake_policy(SET CMP0091 NEW) # MSVC runtime support\n+project(astcenc VERSION 2.2.0)\n+\n# Command line configuration\nfunction(printopt optName optVal optArch tgtArch)\nif(${optVal})\n@@ -77,12 +79,6 @@ else()\nmessage(\" -- No SIMD backend - OFF\")\nendif()\n-if(${ARCH} MATCHES \"aarch64\")\n- set(CMAKE_OSX_ARCHITECTURES arm64)\n-else()\n- set(CMAKE_OSX_ARCHITECTURES x86_64)\n-endif()\n-\noption(ISA_INVARIANCE \"Enable builds for ISA invariance\")\nif(${ISA_INVARIANCE})\nmessage(\" -- ISA invariant backend - ON\")\n@@ -102,8 +98,14 @@ if(NOT ${ANY_ISA})\nendif()\n# Project configuration\n-# Must be done after setting CMAKE_OSX_ARCHITECTURES\n-project(astcenc VERSION 2.2.0)\n+\n+# Must be done after project() but before compiler settings\n+# or it gets overriden (this contradicts the official docs)\n+if(${ARCH} MATCHES \"aarch64\")\n+ set(CMAKE_OSX_ARCHITECTURES \"arm64\")\n+else()\n+ set(CMAKE_OSX_ARCHITECTURES \"x86_64\")\n+endif()\nset(CMAKE_CXX_STANDARD 14)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Retry macos cross-compile
|
61,745 |
04.01.2021 17:33:16
| 0 |
9bff5087a165159b8d17bb0548d18b63a167f7f6
|
Update for the 2.2 release
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog.md",
"new_path": "Docs/ChangeLog.md",
"diff": "@@ -9,26 +9,26 @@ clocked at 4.2 GHz, running astcenc using 6 threads.\n<!-- ---------------------------------------------------------------------- -->\n## 2.2\n-**Status:** :warning: In development (ETA February 2021)\n+**Status:** Released, January 2021\n-The 2.2 release is the third release in the 2.x series. It includes ...\n+The 2.2 release is the third release in the 2.x series. It includes a number\n+of performance improvements and new features.\nReminder for users of the library interface - the API is not designed to be\nstable across versions, and this release is not compatible with 2.1. Please\nrecompile your client-side code using the updated `astcenc.h` header.\n* **General:**\n- * **Feature:** New Arm aarch64 NEON accelerated vector library. Note that at\n- this time Arm builds must be built from source; pre-built binaries are not\n- provided in this release.\n+ * **Feature:** New Arm aarch64 NEON accelerated vector library support.\n+ * **Improvement:** New CMake build system for all platforms.\n* **Improvement:** SSE4.2 feature profile changed to SSE4.1, which more\naccurately reflects the feature set used.\n- * **Improvement:** Build system changed to use CMake for all platforms.\n* **Binary releases:**\n- * **Improvement:** Linux binaries changed to use use Clang 9.0, which gives\n+ * **Improvement:** Linux binaries changed to use Clang 9.0, which gives\nup to 15% performance improvement.\n- * **Improvement:** Windows binaries are now signed, and macOS binaries are\n- signed and notarized.\n+ * **Improvement:** Windows binaries are now code signed.\n+ * **Improvement:** macOS binaries for arm64 platforms now provided.\n+ * **Improvement:** macOS binaries are now code signed and notarized.\n* **Command Line:**\n* **Feature:** New image preprocess `-pp-normalize` option added. This forces\nnormal vectors to be unit length, which is useful when compressing source\n@@ -56,6 +56,24 @@ recompile your client-side code using the updated `astcenc.h` header.\nproduced via other means may fail to decompress correctly, even if they are\notherwise valid ASTC files.\n+### Performance\n+\n+There is one major set of optimizations in this release, related to the new\n+`ASTCENC_FLG_SELF_DECOMPRESS_ONLY` mode. These allow the compressor to only\n+create data tables it knows that it is going to use, based on its current set\n+of heuristics, rather than needing the full set the format allows.\n+\n+The first benefit of these changes is a reduced context creation time, which\n+can be reduced by up to 250ms on our test machine. This is a significant\n+percentage of the command line utility runtime for a small image when using a\n+quick search preset. Compressing the whole Kodak test suite using the command\n+line utility and the `-fastest` preset is ~30% faster with this release, which\n+is mostly due to faster startup.\n+\n+The reduction in the data table size in this mode also improve the core codec\n+speed. Our test sets show an average of 12% improvement in the codec for\n+`-fastest` mode, and an average of 3% for `-medium` mode.\n+\n<!-- ---------------------------------------------------------------------- -->\n## 2.1\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2020 Arm Limited\n+// Copyright 2011-2021 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n#include \"astcenccli_internal.h\"\nconst char *astcenc_copyright_string =\n-R\"(ASTC codec v2.2-develop, %u-bit %s%s\n-Copyright 2011-2020 Arm Limited, all rights reserved\n+R\"(ASTC codec v2.2, %u-bit %s%s\n+Copyright 2011-2021 Arm Limited, all rights reserved\n)\";\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -238,6 +238,7 @@ pipeline {\n'''\n}\n}\n+ /*\nstage('Sign and notarize') {\nenvironment {\nNOTARIZATION_CREDS = credentials('notarization-account')\n@@ -257,6 +258,7 @@ pipeline {\n}\n}\n}\n+ */\nstage('Stash') {\nsteps {\ndir('build_rel') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update for the 2.2 release
|
61,745 |
04.01.2021 18:12:12
| 0 |
c334d8eff8e5a77abfe9f2425c22060ef8f46b0c
|
Update packging for release builds
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -126,7 +126,7 @@ endif()\nset(PKG_VER ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR})\n-set(CPACK_PACKAGE_FILE_NAME \"astcenc-${PKG_VER}-${PKG_OS}-x64\")\n+set(CPACK_PACKAGE_FILE_NAME \"astcenc-${PKG_VER}-${PKG_OS}-${ARCH}\")\nset(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)\nset(CPACK_PACKAGE_CHECKSUM SHA256)\nset(CPACK_GENERATOR ZIP)\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -238,7 +238,6 @@ pipeline {\n'''\n}\n}\n- /*\nstage('Sign and notarize') {\nenvironment {\nNOTARIZATION_CREDS = credentials('notarization-account')\n@@ -258,7 +257,6 @@ pipeline {\n}\n}\n}\n- */\nstage('Stash') {\nsteps {\ndir('build_rel') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update packging for release builds
|
61,745 |
04.01.2021 18:48:31
| 0 |
804008cacb0557c53139dcb7d1586926604c021f
|
Setup for 2.3 versioning
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -62,7 +62,7 @@ Release build binaries for the `astcenc` stable releases are provided in the\n[GitHub Releases page](https://github.com/ARM-software/astc-encoder/releases).\nBinaries are provided for 64-bit builds on Windows, macOS, and Linux.\n-* Latest stable release: 2.1.\n+* Latest stable release: 2.2.\n* Change log: [2.x series](./Docs/ChangeLog.md)\n## astcenc 2.x binaries\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "#include \"astcenccli_internal.h\"\nconst char *astcenc_copyright_string =\n-R\"(ASTC codec v2.2, %u-bit %s%s\n+R\"(ASTC codec v2.3-develop, %u-bit %s%s\nCopyright 2011-2021 Arm Limited, all rights reserved\n)\";\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Setup for 2.3 versioning
|
61,745 |
04.01.2021 18:51:43
| 0 |
438625747c41185266423deecdf5bcdaae14aa63
|
Correct -verison ISA info
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "@@ -511,8 +511,12 @@ void astcenc_print_header()\nconst char* simdtype = \"avx2\";\n#elif (ASTCENC_SSE == 41)\nconst char* simdtype = \"sse4.1\";\n-#else\n+#elif (ASTCENC_SSE == 20)\nconst char* simdtype = \"sse2\";\n+#elif (ASTCENC_NEON == 1)\n+ const char* simdtype = \"neon\";\n+#else\n+ const char* simdtype = \"none\";\n#endif\n#if (ASTCENC_POPCNT == 1)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Correct -verison ISA info
|
61,745 |
05.01.2021 10:17:12
| 0 |
53135038aecd32709d3ae53d4b9b69ed553e0052
|
Flatten Jenkins artifact directories
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -289,14 +289,10 @@ pipeline {\ndir('upload') {\nunstash 'astcenc-linux-x64-hash'\nunstash 'astcenc-macos-x64-hash'\n- }\n- dir('upload/linux-x64') {\n+ unstash 'astcenc-macos-aarch64-hash'\n+\nunstash 'astcenc-linux-x64'\n- }\n- dir('upload/macos-x64') {\nunstash 'astcenc-macos-x64'\n- }\n- dir('upload/macos-aarch64') {\nunstash 'astcenc-macos-aarch64'\n}\ndir('upload/windows-x64') {\n@@ -310,7 +306,9 @@ pipeline {\npasswordVariable: 'PASSWORD')]) {\nsh 'python3 ./signing/windows-client-wrapper.py ${USERNAME} *.zip'\nsh 'mv *.zip.sha256 ../'\n- sh 'rm -rf ./signing'\n+ sh 'mv *.zip ../'\n+ sh 'cd ..'\n+ sh 'rm -rf ./windows-x64'\n}\n}\ndir('upload') {\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Flatten Jenkins artifact directories
|
61,745 |
05.01.2021 11:12:05
| 0 |
c607a6233505bef3ba85c0f0c30ca5b7dd3c97fa
|
Jenkins: Remove scratch directory in release bundle
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/release.Jenkinsfile",
"new_path": "jenkins/release.Jenkinsfile",
"diff": "@@ -307,11 +307,10 @@ pipeline {\nsh 'python3 ./signing/windows-client-wrapper.py ${USERNAME} *.zip'\nsh 'mv *.zip.sha256 ../'\nsh 'mv *.zip ../'\n- sh 'cd ..'\n- sh 'rm -rf ./windows-x64'\n}\n}\ndir('upload') {\n+ sh 'rm -rf ./windows-x64'\nsh 'cat *.sha256 > release-sha256.txt'\nsh 'rm *.sha256'\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Jenkins: Remove scratch directory in release bundle
|
61,745 |
05.01.2021 22:36:03
| 0 |
1a5fa3d0f266ca5906aaabffa2289c201443ddfe
|
Clean up the block_size_descriptor
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/OptimizationIdeas.md",
"new_path": "Docs/OptimizationIdeas.md",
"diff": "@@ -13,10 +13,17 @@ This section lists specific optimization ideas.\n### Exploit 1:1 weight modes\n-The current code is generic and assumes reconstruction from multiple weighted\n-color values, due to use of decimated weight grids. For the 4x4 block size\n-we actually get a high percentage of 1:1 weight grids, so it might be worth\n-including a fast-path which can exploit this simplification.\n+The current code is generic and assumes bilinear texel reconstruction from\n+multiple weighted color values, due to use of decimated weight grids. For the\n+4x4 block size we actually get a high percentage of 1:1 weight grids, so it\n+might be worth including a fast-path which can exploit this simplification.\n+\n+### Get bsd to store only useful partitions\n+\n+The current BSD stores full partition tables, but at smaller block sizes a high\n+percentage are degenerate. For other data tables we now only store the active\n+ones, so we should consider doing something similar there too to improve\n+cache locality.\n### Postpone full iterative refinement\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_block_sizes2.cpp",
"new_path": "Source/astcenc_block_sizes2.cpp",
"diff": "@@ -692,7 +692,7 @@ static void construct_block_size_descriptor_2d(\n// Skip modes that are invalid, too large, or not selected by heuristic\nif (!valid || !selected || (x_weights > x_dim) || (y_weights > y_dim))\n{\n- bsd.block_mode_to_packed[i] = -1;\n+ bsd.block_mode_packed_index[i] = -1;\ncontinue;\n}\n@@ -708,29 +708,29 @@ static void construct_block_size_descriptor_2d(\n// Flatten the block mode heuristic into some precomputed flags\nif (percentile == 0.0f)\n{\n- bsd.block_modes_packed[packed_idx].percentile_always = true;\n+ bsd.block_modes[packed_idx].percentile_always = true;\nbsd.decimation_modes[decimation_mode].percentile_always = true;\n- bsd.block_modes_packed[packed_idx].percentile_hit = true;\n+ bsd.block_modes[packed_idx].percentile_hit = true;\nbsd.decimation_modes[decimation_mode].percentile_hit = true;\n}\nelse if (percentile <= mode_cutoff)\n{\n- bsd.block_modes_packed[packed_idx].percentile_always = false;\n+ bsd.block_modes[packed_idx].percentile_always = false;\n- bsd.block_modes_packed[packed_idx].percentile_hit = true;\n+ bsd.block_modes[packed_idx].percentile_hit = true;\nbsd.decimation_modes[decimation_mode].percentile_hit = true;\n}\n#endif\n- bsd.block_modes_packed[packed_idx].decimation_mode = decimation_mode;\n- bsd.block_modes_packed[packed_idx].quantization_mode = quantization_mode;\n- bsd.block_modes_packed[packed_idx].is_dual_plane = is_dual_plane ? 1 : 0;\n- bsd.block_modes_packed[packed_idx].mode_index = i;\n- bsd.block_mode_to_packed[i] = packed_idx;\n+ bsd.block_modes[packed_idx].decimation_mode = decimation_mode;\n+ bsd.block_modes[packed_idx].quantization_mode = quantization_mode;\n+ bsd.block_modes[packed_idx].is_dual_plane = is_dual_plane ? 1 : 0;\n+ bsd.block_modes[packed_idx].mode_index = i;\n+ bsd.block_mode_packed_index[i] = packed_idx;\n++packed_idx;\n}\n- bsd.block_mode_packed_count = packed_idx;\n+ bsd.block_mode_count = packed_idx;\n#if !defined(ASTCENC_DECOMPRESS_ONLY)\ndelete[] percentiles;\n@@ -749,10 +749,10 @@ static void construct_block_size_descriptor_2d(\n// Determine the texels to use for kmeans clustering.\nif (x_dim * y_dim <= 64)\n{\n- bsd.texelcount_for_bitmap_partitioning = x_dim * y_dim;\n+ bsd.kmeans_texel_count = x_dim * y_dim;\nfor (int i = 0; i < x_dim * y_dim; i++)\n{\n- bsd.texels_for_bitmap_partitioning[i] = i;\n+ bsd.kmeans_texels[i] = i;\n}\n}\nelse\n@@ -785,12 +785,12 @@ static void construct_block_size_descriptor_2d(\n{\nif (arr[idx])\n{\n- bsd.texels_for_bitmap_partitioning[texel_weights_written++] = idx;\n+ bsd.kmeans_texels[texel_weights_written++] = idx;\n}\nidx++;\n}\n- bsd.texelcount_for_bitmap_partitioning = 64;\n+ bsd.kmeans_texel_count = 64;\n}\n}\n@@ -894,33 +894,33 @@ static void construct_block_size_descriptor_3d(\n{\npermit_encode = 0;\n}\n- bsd->block_mode_to_packed[i] = -1;\n+ bsd->block_mode_packed_index[i] = -1;\nif (!permit_encode)\ncontinue;\nint decimation_mode = decimation_mode_index[z_weights * 64 + y_weights * 8 + x_weights];\n- bsd->block_modes_packed[packed_idx].decimation_mode = decimation_mode;\n- bsd->block_modes_packed[packed_idx].quantization_mode = quantization_mode;\n- bsd->block_modes_packed[packed_idx].is_dual_plane = is_dual_plane ? 1 : 0;\n- bsd->block_modes_packed[packed_idx].mode_index = i;\n+ bsd->block_modes[packed_idx].decimation_mode = decimation_mode;\n+ bsd->block_modes[packed_idx].quantization_mode = quantization_mode;\n+ bsd->block_modes[packed_idx].is_dual_plane = is_dual_plane ? 1 : 0;\n+ bsd->block_modes[packed_idx].mode_index = i;\n// No percentile table, so enable everything all the time ...\n- bsd->block_modes_packed[packed_idx].percentile_hit = true;\n- bsd->block_modes_packed[packed_idx].percentile_always = true;\n+ bsd->block_modes[packed_idx].percentile_hit = true;\n+ bsd->block_modes[packed_idx].percentile_always = true;\nbsd->decimation_modes[decimation_mode].percentile_hit = true;\nbsd->decimation_modes[decimation_mode].percentile_always = true;\n- bsd->block_mode_to_packed[i] = packed_idx;\n+ bsd->block_mode_packed_index[i] = packed_idx;\n++packed_idx;\n}\n- bsd->block_mode_packed_count = packed_idx;\n+ bsd->block_mode_count = packed_idx;\nif (xdim * ydim * zdim <= 64)\n{\n- bsd->texelcount_for_bitmap_partitioning = xdim * ydim * zdim;\n+ bsd->kmeans_texel_count = xdim * ydim * zdim;\nfor (int i = 0; i < xdim * ydim * zdim; i++)\n{\n- bsd->texels_for_bitmap_partitioning[i] = i;\n+ bsd->kmeans_texels[i] = i;\n}\n}\nelse\n@@ -953,11 +953,11 @@ static void construct_block_size_descriptor_3d(\n{\nif (arr[idx])\n{\n- bsd->texels_for_bitmap_partitioning[texel_weights_written++] = idx;\n+ bsd->kmeans_texels[texel_weights_written++] = idx;\n}\nidx++;\n}\n- bsd->texelcount_for_bitmap_partitioning = 64;\n+ bsd->kmeans_texel_count = 64;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -57,9 +57,9 @@ static int realign_weights(\npt += scb->partition_index;\n// Get the quantization table\n- const int packed_index = bsd->block_mode_to_packed[scb->block_mode];\n- assert(packed_index >= 0 && packed_index < bsd->block_mode_packed_count);\n- const block_mode& bm = bsd->block_modes_packed[packed_index];\n+ const int packed_index = bsd->block_mode_packed_index[scb->block_mode];\n+ assert(packed_index >= 0 && packed_index < bsd->block_mode_count);\n+ const block_mode& bm = bsd->block_modes[packed_index];\nint weight_quantization_level = bm.quantization_mode;\nconst quantization_and_transfer_table *qat = &(quant_and_xfer_tables[weight_quantization_level]);\n@@ -304,9 +304,9 @@ static void compress_symbolic_block_fixed_partition_1_plane(\nint qwt_bitcounts[MAX_WEIGHT_MODES];\nfloat qwt_errors[MAX_WEIGHT_MODES];\n- for (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n+ for (int i = 0; i < bsd->block_mode_count; ++i)\n{\n- const block_mode& bm = bsd->block_modes_packed[i];\n+ const block_mode& bm = bsd->block_modes[i];\nif (bm.is_dual_plane || (only_always && !bm.percentile_always) || !bm.percentile_hit)\n{\nqwt_errors[i] = 1e38f;\n@@ -370,8 +370,8 @@ static void compress_symbolic_block_fixed_partition_1_plane(\ncontinue;\n}\n- assert(qw_packed_index >= 0 && qw_packed_index < bsd->block_mode_packed_count);\n- const block_mode& qw_bm = bsd->block_modes_packed[qw_packed_index];\n+ assert(qw_packed_index >= 0 && qw_packed_index < bsd->block_mode_count);\n+ const block_mode& qw_bm = bsd->block_modes[qw_packed_index];\nint decimation_mode = qw_bm.decimation_mode;\nint weight_quantization_mode = qw_bm.quantization_mode;\n@@ -624,9 +624,9 @@ static void compress_symbolic_block_fixed_partition_2_planes(\nint qwt_bitcounts[MAX_WEIGHT_MODES];\nfloat qwt_errors[MAX_WEIGHT_MODES];\n- for (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n+ for (int i = 0; i < bsd->block_mode_count; ++i)\n{\n- const block_mode& bm = bsd->block_modes_packed[i];\n+ const block_mode& bm = bsd->block_modes[i];\nif ((!bm.is_dual_plane) || (only_always && !bm.percentile_always) || !bm.percentile_hit)\n{\nqwt_errors[i] = 1e38f;\n@@ -713,8 +713,8 @@ static void compress_symbolic_block_fixed_partition_2_planes(\nuint8_t *u8_weight2_src;\nint weights_to_copy;\n- assert(qw_packed_index >= 0 && qw_packed_index < bsd->block_mode_packed_count);\n- const block_mode& qw_bm = bsd->block_modes_packed[qw_packed_index];\n+ assert(qw_packed_index >= 0 && qw_packed_index < bsd->block_mode_count);\n+ const block_mode& qw_bm = bsd->block_modes[qw_packed_index];\nint decimation_mode = qw_bm.decimation_mode;\nint weight_quantization_mode = qw_bm.quantization_mode;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_decompress_symbolic.cpp",
"new_path": "Source/astcenc_decompress_symbolic.cpp",
"diff": "@@ -203,9 +203,9 @@ void decompress_symbolic_block(\n// get the appropriate block descriptor\nconst decimation_table *const *ixtab2 = bsd->decimation_tables;\n- const int packed_index = bsd->block_mode_to_packed[scb->block_mode];\n- assert(packed_index >= 0 && packed_index < bsd->block_mode_packed_count);\n- const block_mode& bm = bsd->block_modes_packed[packed_index];\n+ const int packed_index = bsd->block_mode_packed_index[scb->block_mode];\n+ assert(packed_index >= 0 && packed_index < bsd->block_mode_count);\n+ const block_mode& bm = bsd->block_modes[packed_index];\nconst decimation_table *it = ixtab2[bm.decimation_mode];\nint is_dual_plane = bm.is_dual_plane;\n@@ -319,9 +319,9 @@ float compute_symbolic_block_difference(\n// get the appropriate block descriptor\nconst decimation_table *const *ixtab2 = bsd->decimation_tables;\n- const int packed_index = bsd->block_mode_to_packed[scb->block_mode];\n- assert(packed_index >= 0 && packed_index < bsd->block_mode_packed_count);\n- const block_mode& bm = bsd->block_modes_packed[packed_index];\n+ const int packed_index = bsd->block_mode_packed_index[scb->block_mode];\n+ assert(packed_index >= 0 && packed_index < bsd->block_mode_count);\n+ const block_mode& bm = bsd->block_modes[packed_index];\nconst decimation_table *it = ixtab2[bm.decimation_mode];\nint is_dual_plane = bm.is_dual_plane;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -279,7 +279,7 @@ public:\n* @param[out] count Actual number of tasks assigned, or zero if\n* no tasks were assigned.\n*\n- * \\return Task index of the first assigned task; assigned tasks\n+ * @return Task index of the first assigned task; assigned tasks\n* increment from this.\n*/\nunsigned int get_task_assignment(unsigned int granule, unsigned int& count)\n@@ -414,34 +414,71 @@ struct decimation_mode\nuint8_t percentile_always : 1;\n};\n+/**\n+ * @brief Data tables for a single block size.\n+ *\n+ * The decimation tables store the information to apply weight grid dimension\n+ * reductions. We only store the decimation modes that are actually needed by\n+ * the current context; many of the possible modes will be unused (too many\n+ * weights for the current block size or disabled by heuristics). The actual\n+ * number of weights stored is @c decimation_mode_count, and the\n+ * @c decimation_modes and @c decimation_tables arrays store the active modes\n+ * contiguously at the start of the array. These entries are not stored in any\n+ * particuar order.\n+ *\n+ * The block mode tables store the unpacked block mode settings. Block modes\n+ * are stored in the compressed block as an 11 bit field, but for any given\n+ * block size and set of compressor heuristics, only a subset of the block\n+ * modes will be used. The actual number of block modes stored is indicated in\n+ * @c block_mode_count, and the @c block_modes array store the active modes\n+ * contiguously at the start of the array. These entries are stored in\n+ * incrementing \"packed\" value order, which doesn't mean much once unpacked.\n+ * To allow decompressors to reference the packed data efficiently the\n+ * @c block_mode_packed_index array stores the mapping between physical ID and\n+ * the actual remapped array index.\n+ */\nstruct block_size_descriptor\n{\n+ /**< The block X dimension, in texels. */\nint xdim;\n+\n+ /**< The block Y dimension, in texels. */\nint ydim;\n+\n+ /**< The block Z dimension, in texels. */\nint zdim;\n+\n+ /**< The block total texel count. */\nint texel_count;\n+\n+ /**< The number of stored decimation modes. */\nint decimation_mode_count;\n+\n+ /**< The active decimation modes, stored in low indices. */\ndecimation_mode decimation_modes[MAX_DECIMATION_MODES];\n+\n+ /**< The active decimation tables, stored in low indices. */\nconst decimation_table *decimation_tables[MAX_DECIMATION_MODES];\n- // out of all possible 2048 weight modes, only a subset is\n- // actually valid for the current configuration (e.g. 6x6\n- // 2D LDR has 370 valid modes); the valid ones are packed into\n- // block_modes_packed array.\n- block_mode block_modes_packed[MAX_WEIGHT_MODES];\n- int block_mode_packed_count;\n- // get index of block mode inside the block_modes_packed array,\n- // or -1 if mode is not valid for the current configuration.\n- int16_t block_mode_to_packed[MAX_WEIGHT_MODES];\n-\n- // for the k-means bed bitmap partitioning algorithm, we don't\n- // want to consider more than 64 texels; this array specifies\n- // which 64 texels (if that many) to consider.\n- int texelcount_for_bitmap_partitioning;\n- int texels_for_bitmap_partitioning[64];\n-\n- // All the partitioning information for this block size\n+\n+ /**< The number of stored block modes. */\n+ int block_mode_count;\n+\n+ /**< The active block modes, stored in low indices. */\n+ block_mode block_modes[MAX_WEIGHT_MODES];\n+\n+ /**< The block mode array index, or -1 if not valid in current config. */\n+ int16_t block_mode_packed_index[MAX_WEIGHT_MODES];\n+\n+\n+ /**< The texel count for k-means partition selection (max 64). */\n+ int kmeans_texel_count;\n+\n+ /**< The active texels for k-means partition selection. */\n+ int kmeans_texels[64];\n+\n+ /**< The partion tables for all of the possible partitions. */\npartition_info partitions[(3*PARTITION_COUNT)+1];\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_kmeans_partitioning.cpp",
"new_path": "Source/astcenc_kmeans_partitioning.cpp",
"diff": "@@ -502,10 +502,10 @@ void kmeans_compute_partition_ordering(\nbitmaps[i] = 0ULL;\n}\n- int texels_to_process = bsd->texelcount_for_bitmap_partitioning;\n+ int texels_to_process = bsd->kmeans_texel_count;\nfor (int i = 0; i < texels_to_process; i++)\n{\n- int idx = bsd->texels_for_bitmap_partitioning[i];\n+ int idx = bsd->kmeans_texels[i];\nbitmaps[partition_of_texel[idx]] |= 1ULL << i;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_partition_tables.cpp",
"new_path": "Source/astcenc_partition_tables.cpp",
"diff": "@@ -304,10 +304,10 @@ static void generate_one_partition_table(\npt->coverage_bitmaps[i] = 0ULL;\n}\n- int texels_to_process = bsd->texelcount_for_bitmap_partitioning;\n+ int texels_to_process = bsd->kmeans_texel_count;\nfor (int i = 0; i < texels_to_process; i++)\n{\n- int idx = bsd->texels_for_bitmap_partitioning[i];\n+ int idx = bsd->kmeans_texels[i];\npt->coverage_bitmaps[pt->partition_of_texel[idx]] |= 1ULL << i;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"new_path": "Source/astcenc_pick_best_endpoint_format.cpp",
"diff": "@@ -827,7 +827,7 @@ void determine_optimal_set_of_endpoint_formats_to_use(\n#if ASTCENC_SIMD_WIDTH > 1\n// have to ensure that the \"overstep\" of the last iteration in the vectorized\n// loop will contain data that will never be picked as best candidate\n- const int packed_mode_count = bsd->block_mode_packed_count;\n+ const int packed_mode_count = bsd->block_mode_count;\nconst int packed_mode_count_simd_up = (packed_mode_count + ASTCENC_SIMD_WIDTH - 1) / ASTCENC_SIMD_WIDTH * ASTCENC_SIMD_WIDTH;\nfor (int i = packed_mode_count; i < packed_mode_count_simd_up; ++i)\n{\n@@ -843,7 +843,7 @@ void determine_optimal_set_of_endpoint_formats_to_use(\nint best_quantization_level;\nint best_format;\nfloat error_of_best_combination;\n- for (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n+ for (int i = 0; i < bsd->block_mode_count; ++i)\n{\nif (qwt_errors[i] >= 1e29f)\n{\n@@ -877,7 +877,7 @@ void determine_optimal_set_of_endpoint_formats_to_use(\nbest_error, format_of_choice, combined_best_error, formats_of_choice);\n- for (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n+ for (int i = 0; i < bsd->block_mode_count; ++i)\n{\nif (qwt_errors[i] >= 1e29f)\n{\n@@ -913,7 +913,7 @@ void determine_optimal_set_of_endpoint_formats_to_use(\nthree_partitions_find_best_combination_for_every_quantization_and_integer_count(\nbest_error, format_of_choice, combined_best_error, formats_of_choice);\n- for (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n+ for (int i = 0; i < bsd->block_mode_count; ++i)\n{\nif (qwt_errors[i] >= 1e29f)\n{\n@@ -950,7 +950,7 @@ void determine_optimal_set_of_endpoint_formats_to_use(\nfour_partitions_find_best_combination_for_every_quantization_and_integer_count(\nbest_error, format_of_choice, combined_best_error, formats_of_choice);\n- for (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n+ for (int i = 0; i < bsd->block_mode_count; ++i)\n{\nif (qwt_errors[i] >= 1e29f)\n{\n@@ -983,7 +983,7 @@ void determine_optimal_set_of_endpoint_formats_to_use(\n// reference; scalar code\nfloat best_ep_error = 1e30f;\nint best_error_index = -1;\n- for (int j = 0, npack = bsd->block_mode_packed_count; j < npack; ++j)\n+ for (int j = 0, npack = bsd->block_mode_count; j < npack; ++j)\n{\nif (errors_of_best_combination[j] < best_ep_error && best_quantization_levels[j] >= 5)\n{\n@@ -997,7 +997,7 @@ void determine_optimal_set_of_endpoint_formats_to_use(\nvint vbest_error_index(-1);\nvfloat vbest_ep_error(1e30f);\nvint lane_ids = vint::lane_id();\n- for (int j = 0, npack = bsd->block_mode_packed_count; j < npack; j += ASTCENC_SIMD_WIDTH)\n+ for (int j = 0, npack = bsd->block_mode_count; j < npack; j += ASTCENC_SIMD_WIDTH)\n{\nvfloat err = vfloat(&errors_of_best_combination[j]);\nvmask mask1 = err < vbest_ep_error;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_symbolic_physical.cpp",
"new_path": "Source/astcenc_symbolic_physical.cpp",
"diff": "@@ -126,9 +126,9 @@ void symbolic_to_physical(\nconst decimation_table *const *ixtab2 = bsd.decimation_tables;\n- const int packed_index = bsd.block_mode_to_packed[scb.block_mode];\n- assert(packed_index >= 0 && packed_index < bsd.block_mode_packed_count);\n- const block_mode& bm = bsd.block_modes_packed[packed_index];\n+ const int packed_index = bsd.block_mode_packed_index[scb.block_mode];\n+ assert(packed_index >= 0 && packed_index < bsd.block_mode_count);\n+ const block_mode& bm = bsd.block_modes[packed_index];\nint weight_count = ixtab2[bm.decimation_mode]->num_weights;\nint weight_quantization_method = bm.quantization_mode;\n@@ -327,14 +327,14 @@ void physical_to_symbolic(\nreturn;\n}\n- const int packed_index = bsd.block_mode_to_packed[block_mode];\n+ const int packed_index = bsd.block_mode_packed_index[block_mode];\nif (packed_index < 0)\n{\nscb.error_block = 1;\nreturn;\n}\n- assert(packed_index >= 0 && packed_index < bsd.block_mode_packed_count);\n- const struct block_mode& bm = bsd.block_modes_packed[packed_index];\n+ assert(packed_index >= 0 && packed_index < bsd.block_mode_count);\n+ const struct block_mode& bm = bsd.block_modes[packed_index];\nint weight_count = ixtab2[bm.decimation_mode]->num_weights;\nint weight_quantization_method = bm.quantization_mode;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_weight_align.cpp",
"new_path": "Source/astcenc_weight_align.cpp",
"diff": "@@ -393,9 +393,9 @@ void compute_angular_endpoints_1plane(\ndecimated_weights + i * MAX_WEIGHTS_PER_BLOCK, dm.maxprec_1plane, low_values[i], high_values[i]);\n}\n- for (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n+ for (int i = 0; i < bsd->block_mode_count; ++i)\n{\n- const block_mode& bm = bsd->block_modes_packed[i];\n+ const block_mode& bm = bsd->block_modes[i];\nif (bm.is_dual_plane || (only_always && !bm.percentile_always) || !bm.percentile_hit)\n{\ncontinue;\n@@ -443,9 +443,9 @@ void compute_angular_endpoints_2planes(\ndecimated_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK, dm.maxprec_2planes, low_values2[i], high_values2[i]);\n}\n- for (int i = 0, ni = bsd->block_mode_packed_count; i < ni; ++i)\n+ for (int i = 0; i < bsd->block_mode_count; ++i)\n{\n- const block_mode& bm = bsd->block_modes_packed[i];\n+ const block_mode& bm = bsd->block_modes[i];\nif ((!bm.is_dual_plane) || (only_always && !bm.percentile_always) || !bm.percentile_hit)\n{\ncontinue;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Clean up the block_size_descriptor
|
61,745 |
05.01.2021 23:20:51
| 0 |
8d884850cab948112682f3a9f66a90c78e7f1feb
|
Update astc_size_binary for macOS
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_size_binary.py",
"new_path": "Test/astc_size_binary.py",
"diff": "@@ -36,12 +36,13 @@ like this:\nimport argparse\n+import platform\nimport shutil\nimport subprocess as sp\nimport sys\n-def run_size(binary):\n+def run_size_linux(binary):\n\"\"\"\nRun size on a single binary.\n@@ -72,6 +73,64 @@ def run_size(binary):\nreturn (data[\"Code\"], data[\"RO\"], data[\"ZI\"])\n+def run_size_macos(binary):\n+ \"\"\"\n+ Run size on a single binary.\n+\n+ Args:\n+ binary (str): The path of the binary file to process.\n+\n+ Returns:\n+ tuple(int, int, int): A triplet of code size, read-only data size, and\n+ zero-init data size, all in bytes.\n+\n+ Raises:\n+ CalledProcessException: The ``size`` subprocess failed for any reason.\n+ \"\"\"\n+ args = [\"size\", \"-m\", binary]\n+ result = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\n+ check=True, universal_newlines=True)\n+\n+ code = 0\n+ dataRO = 0\n+ dataZI = 0\n+\n+ currentSegment = None\n+\n+ lines = result.stdout.splitlines()\n+ for line in lines:\n+ line = line.strip()\n+\n+ if line.startswith(\"Segment\"):\n+ parts = line.split()\n+ assert(len(parts) == 3)\n+\n+ currentSegment = parts[1]\n+ size = int(parts[2])\n+\n+ if currentSegment == \"__TEXT:\":\n+ code += size\n+\n+ if currentSegment == \"__DATA_CONST:\":\n+ dataRO += size\n+\n+ if currentSegment == \"__DATA:\":\n+ dataZI += size\n+\n+ if line.startswith(\"Section\"):\n+ parts = line.split()\n+ assert(len(parts) == 3)\n+\n+ section = parts[1]\n+ size = int(parts[2])\n+\n+ if currentSegment == \"__TEXT:\" and section == \"__const:\":\n+ code -= size\n+ dataRO += size\n+\n+ return (code, dataRO, dataZI)\n+\n+\ndef parse_command_line():\n\"\"\"\nParse the command line.\n@@ -106,6 +165,11 @@ def main():\nprint(\"ERROR: The 'size' utility is not installed on the PATH\")\nreturn 1\n+ if platform.system() == \"Darwin\":\n+ run_size = run_size_macos\n+ else:\n+ run_size = run_size_linux\n+\n# Collect the data\ntry:\nnewSize = run_size(args.bin.name)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update astc_size_binary for macOS
|
61,745 |
06.01.2021 08:11:58
| 0 |
70177e93bce2caf01db7e56bfb601eabffd2e167
|
Add 2.2 support to reporting scripts
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_image.py",
"new_path": "Test/astc_test_image.py",
"diff": "@@ -284,6 +284,27 @@ def get_encoder_params(encoderName, referenceName, imageSet):\nname = \"reference-2.1-avx2\"\noutDir = \"Test/Images/%s\" % imageSet\nrefName = None\n+ # 2.2 variants\n+ elif encoderName == \"ref-2.2-sse2\":\n+ encoder = te.Encoder2_2(\"sse2\")\n+ name = \"reference-2.2-sse2\"\n+ outDir = \"Test/Images/%s\" % imageSet\n+ refName = None\n+ elif encoderName == \"ref-2.2-sse4.1\":\n+ encoder = te.Encoder2_2(\"sse4.1\")\n+ name = \"reference-2.2-sse4.1\"\n+ outDir = \"Test/Images/%s\" % imageSet\n+ refName = None\n+ elif encoderName == \"ref-2.2-avx2\":\n+ encoder = te.Encoder2_2(\"avx2\")\n+ name = \"reference-2.2-avx2\"\n+ outDir = \"Test/Images/%s\" % imageSet\n+ refName = None\n+ elif encoderName == \"ref-2.2-neon\":\n+ encoder = te.Encoder2_2(\"neon\")\n+ name = \"reference-2.2-neon\"\n+ outDir = \"Test/Images/%s\" % imageSet\n+ refName = None\n# Latest master\nelif encoderName == \"ref-master-neon\":\n# Warning: this option rebuilds a new reference test result for the\n@@ -335,6 +356,7 @@ def parse_command_line():\nrefcoders = [\"ref-1.7\",\n\"ref-2.0-sse2\", \"ref-2.0-sse4.1\", \"ref-2.0-avx2\",\n\"ref-2.1-sse2\", \"ref-2.1-sse4.1\", \"ref-2.1-avx2\",\n+ \"ref-2.2-neon\", \"ref-2.2-sse2\", \"ref-2.2-sse4.1\", \"ref-2.2-avx2\",\n\"ref-master-neon\", \"ref-master-sse2\", \"ref-master-sse4.1\", \"ref-master-avx2\"]\n# All test encoders\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_result_plot.py",
"new_path": "Test/astc_test_result_plot.py",
"diff": "@@ -162,7 +162,7 @@ def plot(results, chartRows, chartCols, blockSizes,\nfor i, row in enumerate(chartRows):\nfor j, col in enumerate(chartCols):\n- if row == \"fastest\" and \"ref-2.1\" not in col:\n+ if row == \"fastest\" and ((\"1.7\" in col) or (\"2.0\" in col)):\nif len(chartCols) == 1:\nfig.delaxes(axs[i])\nelse:\n@@ -258,7 +258,7 @@ def main():\n# --------------------------------------------------------\n# Plot all absolute scores\n[\"thorough\", \"medium\", \"fast\", \"fastest\"],\n- [\"ref-2.0-avx2\", \"ref-2.1-avx2\"],\n+ [\"ref-2.0-avx2\", \"ref-2.1-avx2\", \"ref-2.2-avx2\"],\n[\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\nFalse,\nNone,\n@@ -285,11 +285,21 @@ def main():\nNone,\n\"absolute-2.0-to-2.1.png\",\n(30, None)\n+ ], [\n+ # Plot 2.1 to 2.2 absolute scores\n+ [\"thorough\", \"medium\", \"fast\", \"fastest\"],\n+ [\"ref-2.1-avx2\", \"ref-2.2-avx2\"],\n+ [\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\n+ False,\n+ None,\n+ None,\n+ \"absolute-2.1-to-2.2.png\",\n+ (30, None)\n], [\n# --------------------------------------------------------\n# Plot all relative scores\n[\"thorough\", \"medium\", \"fast\"],\n- [\"ref-2.0-avx2\", \"ref-2.1-avx2\"],\n+ [\"ref-2.0-avx2\", \"ref-2.1-avx2\", \"ref-2.2-avx2\"],\n[\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\nTrue,\n\"ref-1.7\",\n@@ -316,32 +326,60 @@ def main():\nNone,\n\"relative-2.0-to-2.1.png\",\n(None, None)\n+ ], [\n+ # Plot 2.1 to 2.2 relative scores\n+ [\"thorough\", \"medium\", \"fast\", \"fastest\"],\n+ [\"ref-2.2-avx2\"],\n+ [\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\n+ True,\n+ \"ref-2.1-avx2\",\n+ None,\n+ \"relative-2.1-to-2.2.png\",\n+ (None, None),\n], [\n# Plot relative scores of ISAs of latest\n[\"thorough\", \"medium\", \"fast\", \"fastest\"],\n- [\"ref-2.1-sse4.1\", \"ref-2.1-avx2\"],\n+ [\"ref-2.2-sse4.1\", \"ref-2.2-avx2\"],\n[\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\nTrue,\n- \"ref-2.1-sse2\",\n+ \"ref-2.2-sse2\",\nNone,\n- \"relative-2.1-isas.png\",\n+ \"relative-2.2-isas.png\",\n(None, None)\n], [\n# Plot relative scores of qualities of latest\n[\"medium\", \"fast\", \"fastest\"],\n- [\"ref-2.1-avx2\"],\n+ [\"ref-2.2-avx2\"],\n[\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\nTrue,\nNone,\n\"thorough\",\n- \"relative-2.1-qualities.png\",\n+ \"relative-2.2-qualities.png\",\n(None, None)\n]\n]\nresults = find_reference_results()\n+ # Force select is triggered by adding a trailing entry to the argument list\n+ # of the charts that you want rendered; designed for debugging use cases\n+ maxIndex = 0\n+ expectedLength = 8\n+ for chart in charts:\n+ maxIndex = max(maxIndex, len(chart))\n+\nfor chart in charts:\n+ # If force select is enabled then only keep the forced ones\n+ if len(chart) != maxIndex:\n+ print(\"Skipping %s\" % chart[6])\n+ continue\n+ else:\n+ print(\"Generating %s\" % chart[6])\n+\n+ # If force select is enabled then strip the dummy force option\n+ if maxIndex != expectedLength:\n+ chart = chart[:expectedLength]\n+\nplot(results, *chart)\nreturn 0\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/encoder.py",
"new_path": "Test/testlib/encoder.py",
"diff": "@@ -290,6 +290,11 @@ class Encoder2x(EncoderBase):\ncommand.append(\"-a\")\ncommand.append(\"1\")\n+ # Limit core count on NEON builds to avoid test device throttling\n+ if self.variant == \"neon\":\n+ command.append(\"-j\")\n+ command.append(\"2\")\n+\nreturn command\ndef get_psnr_pattern(self, image):\n@@ -336,7 +341,7 @@ class Encoder2_0(Encoder2x):\nclass Encoder2_1(Encoder2x):\n\"\"\"\n- This class wraps the 2.0 series binaries.\n+ This class wraps the 2.1 series binaries.\n\"\"\"\nVERSION = \"2.1\"\n@@ -349,6 +354,21 @@ class Encoder2_1(Encoder2x):\nsuper().__init__(variant, binary)\n+class Encoder2_2(Encoder2x):\n+ \"\"\"\n+ This class wraps the 2.2 series binaries.\n+ \"\"\"\n+ VERSION = \"2.2\"\n+\n+ def __init__(self, variant):\n+ if os.name == 'nt':\n+ binary = \"./Binaries/2.2/astcenc-%s.exe\" % variant\n+ else:\n+ binary = \"./Binaries/2.2/astcenc-%s\" % variant\n+\n+ super().__init__(variant, binary)\n+\n+\nclass Encoder1_7(EncoderBase):\n\"\"\"\nThis class wraps the 1.7 series binaries.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add 2.2 support to reporting scripts
|
61,745 |
06.01.2021 08:26:08
| 0 |
0a2fe5bdaf9b4239e30d366e092a0291ce0f10a1
|
Change graph set build
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_result_plot.py",
"new_path": "Test/astc_test_result_plot.py",
"diff": "@@ -62,6 +62,9 @@ def find_reference_results():\nquality = match.group(2)\nimageSet = os.path.basename(root)\n+ if imageSet == \"Small\":\n+ continue\n+\ntestRef = trs.ResultSet(imageSet)\ntestRef.load_from_file(fullPath)\n@@ -243,16 +246,18 @@ def main():\nint: The process return code.\n\"\"\"\n+ absoluteXLimit = 35\n+\ncharts = [\n[\n- # Plot headline 1.7 to 2.1 scores\n+ # Plot headline 1.7 to 2.2 scores\n[\"medium\"],\n- [\"ref-2.1-avx2\"],\n+ [\"ref-2.2-avx2\"],\n[\"4x4\", \"6x6\", \"8x8\"],\nTrue,\n\"ref-1.7\",\nNone,\n- \"relative-1.7-to-2.1.png\",\n+ \"relative-1.7-to-2.2.png\",\n(8, None)\n], [\n# --------------------------------------------------------\n@@ -264,27 +269,7 @@ def main():\nNone,\nNone,\n\"absolute-all.png\",\n- (30, None)\n- ], [\n- # Plot 1.7 to 2.0 absolute scores\n- [\"thorough\", \"medium\", \"fast\", \"fastest\"],\n- [\"ref-1.7\", \"ref-2.0-avx2\"],\n- [\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\n- False,\n- None,\n- None,\n- \"absolute-1.7-to-2.0.png\",\n- (30, None)\n- ], [\n- # Plot 2.0 to 2.1 absolute scores\n- [\"thorough\", \"medium\", \"fast\", \"fastest\"],\n- [\"ref-2.0-avx2\", \"ref-2.1-avx2\"],\n- [\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\n- False,\n- None,\n- None,\n- \"absolute-2.0-to-2.1.png\",\n- (30, None)\n+ (absoluteXLimit, None)\n], [\n# Plot 2.1 to 2.2 absolute scores\n[\"thorough\", \"medium\", \"fast\", \"fastest\"],\n@@ -294,37 +279,37 @@ def main():\nNone,\nNone,\n\"absolute-2.1-to-2.2.png\",\n- (30, None)\n+ (absoluteXLimit, None)\n], [\n# --------------------------------------------------------\n- # Plot all relative scores\n+ # Plot all relative scores vs 1.7\n[\"thorough\", \"medium\", \"fast\"],\n[\"ref-2.0-avx2\", \"ref-2.1-avx2\", \"ref-2.2-avx2\"],\n[\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\nTrue,\n\"ref-1.7\",\nNone,\n- \"relative-all.png\",\n+ \"relative-allv1.7.png\",\n(None, None)\n], [\n- # Plot 1.7 to 2.0 relative scores\n- [\"thorough\", \"medium\", \"fast\"],\n- [\"ref-2.0-avx2\"],\n+ # Plot all relative scores vs 2.0\n+ [\"thorough\", \"medium\", \"fast\", \"fastest\"],\n+ [\"ref-2.1-avx2\", \"ref-2.2-avx2\"],\n[\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\nTrue,\n- \"ref-1.7\",\n+ \"ref-2.0-avx2\",\nNone,\n- \"relative-1.7-to-2.0.png\",\n+ \"relative-allv2.0.png\",\n(None, None)\n], [\n- # Plot 2.0 to 2.1 relative scores\n+ # Plot 1.7 to 2.2 relative scores\n[\"thorough\", \"medium\", \"fast\"],\n- [\"ref-2.1-avx2\"],\n+ [\"ref-2.2-avx2\"],\n[\"4x4\", \"5x5\", \"6x6\", \"8x8\"],\nTrue,\n- \"ref-2.0-avx2\",\n+ \"ref-1.7\",\nNone,\n- \"relative-2.0-to-2.1.png\",\n+ \"relative-1.7-to-2.2.png\",\n(None, None)\n], [\n# Plot 2.1 to 2.2 relative scores\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Change graph set build
|
61,745 |
06.01.2021 08:27:27
| 0 |
da8a0f517973c352419cc326eb36d04ed73ac843
|
Add 2.2 performance to ChangeLog
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/ChangeLog.md",
"new_path": "Docs/ChangeLog.md",
"diff": "@@ -74,6 +74,20 @@ The reduction in the data table size in this mode also improve the core codec\nspeed. Our test sets show an average of 12% improvement in the codec for\n`-fastest` mode, and an average of 3% for `-medium` mode.\n+Key for performance charts:\n+\n+* Color = block size (see legend).\n+* Letter = image format (N = normal map, G = greyscale, L = LDR, H = HDR).\n+\n+**Absolute performance vs 2.1 release:**\n+\n+\n+\n+**Relative performance vs 2.1 release:**\n+\n+\n+\n+\n<!-- ---------------------------------------------------------------------- -->\n## 2.1\n"
},
{
"change_type": "ADD",
"old_path": "Docs/ChangeLogImg/absolute-2.1-to-2.2.png",
"new_path": "Docs/ChangeLogImg/absolute-2.1-to-2.2.png",
"diff": "Binary files /dev/null and b/Docs/ChangeLogImg/absolute-2.1-to-2.2.png differ\n"
},
{
"change_type": "ADD",
"old_path": "Docs/ChangeLogImg/relative-2.1-to-2.2.png",
"new_path": "Docs/ChangeLogImg/relative-2.1-to-2.2.png",
"diff": "Binary files /dev/null and b/Docs/ChangeLogImg/relative-2.1-to-2.2.png differ\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add 2.2 performance to ChangeLog
|
61,745 |
07.01.2021 10:52:02
| 0 |
6bb84f3db76bc9c1daf0f6560e4a88a1f6e2bc39
|
Correct Windows build instructions
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/Building.md",
"new_path": "Docs/Building.md",
"diff": "@@ -24,12 +24,8 @@ cd build\n# Configure your build of choice, for example:\n-# Arm arch64\n-cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./ \\\n- -DARCH=aarch64 -DISA_NEON=ON ..\n-\n# x86-64\n-cmake -G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./ \\\n+cmake -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./ \\\n-DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON ..\n```\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Correct Windows build instructions
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.