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 |
12.01.2020 17:31:53
| 0 |
240bec3f0fa679639e010ddfb6e7734da38145a7
|
Use a fast approximation of atan2
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_mathlib.h",
"new_path": "Source/astc_mathlib.h",
"diff": "@@ -292,4 +292,42 @@ static inline int popcount(uint64_t p)\n#endif\n}\n+static inline float astc_atan2(float y, float x)\n+{\n+ const float PI = (float)M_PI;\n+ const float PI_2 = PI / 2.f;\n+\n+ // Handle the discontinuity at x == 0\n+ if (x == 0.0f) {\n+ if (y > 0.0f) {\n+ return PI_2;\n+ }\n+ if (y == 0.0f) {\n+ return 0.0f;\n+ }\n+ return -PI_2;\n+ }\n+\n+ float z = y / x;\n+ float z2 = z * z;\n+ if (std::fabs(z) < 1.0f) {\n+ float atan = z / (1.0f + (0.28f * z2));\n+ if (x < 0.0f) {\n+ if (y < 0.0f) {\n+ return atan - PI;\n+ } else {\n+ return atan + PI;\n+ }\n+ }\n+ return atan;\n+ } else {\n+ float atan = PI_2 - (z / (z2 + 0.28f));\n+ if (y < 0.0f) {\n+ return atan - PI;\n+ } else {\n+ return atan;\n+ }\n+ }\n+}\n+\n#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_weight_align.cpp",
"new_path": "Source/astc_weight_align.cpp",
"diff": "@@ -143,7 +143,7 @@ void compute_angular_offsets(\n// post-process the angle-sums\nfor (i = 0; i < max_angular_steps; i++)\n{\n- float angle = atan2(anglesum_y[i], anglesum_x[i]); // positive angle -> positive offset\n+ float angle = astc_atan2(anglesum_y[i], anglesum_x[i]);\noffsets[i] = angle * (stepsizes[i] * (1.0f / (2.0f * (float)M_PI)));\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use a fast approximation of atan2
|
61,745 |
12.01.2020 23:03:50
| 0 |
42b1504406dbc522f4530b6c104ce9a70ac74758
|
Cleanup documentation for new math functions
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "@@ -57,17 +57,18 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -std=c++14 -O3 \\\n+CPPFLAGS = -std=c++14 -O3 -mfpmath=sse \\\n-Wall -Wextra -Wpedantic -Werror -Werror=shadow -Wdouble-promotion\n+# Validate that the VEC parameter is a supported value, and patch CPPFLAGS\nifeq ($(VEC),nointrin)\n-CPPFLAGS += -mfpmath=sse -msse2 -DASTC_SSE=00\n+CPPFLAGS += -msse2 -DASTC_SSE=00\nelse\nifeq ($(VEC),sse2)\n-CPPFLAGS += -mfpmath=sse -msse2 -DASTC_SSE=20\n+CPPFLAGS += -msse2 -DASTC_SSE=20\nelse\nifeq ($(VEC),sse4.2)\n-CPPFLAGS += -mfpmath=sse -msse4.2 -mpopcnt -DASTC_SSE=42\n+CPPFLAGS += -msse4.2 -mpopcnt -DASTC_SSE=42\nelse\n$(error Unsupported VEC target, use VEC=nointrin/sse2/sse4.2)\nendif\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_kmeans_partitioning.cpp",
"new_path": "Source/astc_kmeans_partitioning.cpp",
"diff": "@@ -254,8 +254,8 @@ static inline int partition_mismatch2(\nuint64_t b0,\nuint64_t b1\n) {\n- int v1 = popcount(a0 ^ b0) + popcount(a1 ^ b1);\n- int v2 = popcount(a0 ^ b1) + popcount(a1 ^ b0);\n+ int v1 = astc::popcount(a0 ^ b0) + astc::popcount(a1 ^ b1);\n+ int v2 = astc::popcount(a0 ^ b1) + astc::popcount(a1 ^ b0);\nreturn MIN(v1, v2);\n}\n@@ -268,17 +268,17 @@ static inline int partition_mismatch3(\nuint64_t b1,\nuint64_t b2\n) {\n- int p00 = popcount(a0 ^ b0);\n- int p01 = popcount(a0 ^ b1);\n- int p02 = popcount(a0 ^ b2);\n+ int p00 = astc::popcount(a0 ^ b0);\n+ int p01 = astc::popcount(a0 ^ b1);\n+ int p02 = astc::popcount(a0 ^ b2);\n- int p10 = popcount(a1 ^ b0);\n- int p11 = popcount(a1 ^ b1);\n- int p12 = popcount(a1 ^ b2);\n+ int p10 = astc::popcount(a1 ^ b0);\n+ int p11 = astc::popcount(a1 ^ b1);\n+ int p12 = astc::popcount(a1 ^ b2);\n- int p20 = popcount(a2 ^ b0);\n- int p21 = popcount(a2 ^ b1);\n- int p22 = popcount(a2 ^ b2);\n+ int p20 = astc::popcount(a2 ^ b0);\n+ int p21 = astc::popcount(a2 ^ b1);\n+ int p22 = astc::popcount(a2 ^ b2);\nint s0 = p11 + p22;\nint s1 = p12 + p21;\n@@ -320,25 +320,25 @@ static inline int partition_mismatch4(\nuint64_t b2,\nuint64_t b3\n) {\n- int p00 = popcount(a0 ^ b0);\n- int p01 = popcount(a0 ^ b1);\n- int p02 = popcount(a0 ^ b2);\n- int p03 = popcount(a0 ^ b3);\n-\n- int p10 = popcount(a1 ^ b0);\n- int p11 = popcount(a1 ^ b1);\n- int p12 = popcount(a1 ^ b2);\n- int p13 = popcount(a1 ^ b3);\n-\n- int p20 = popcount(a2 ^ b0);\n- int p21 = popcount(a2 ^ b1);\n- int p22 = popcount(a2 ^ b2);\n- int p23 = popcount(a2 ^ b3);\n-\n- int p30 = popcount(a3 ^ b0);\n- int p31 = popcount(a3 ^ b1);\n- int p32 = popcount(a3 ^ b2);\n- int p33 = popcount(a3 ^ b3);\n+ int p00 = astc::popcount(a0 ^ b0);\n+ int p01 = astc::popcount(a0 ^ b1);\n+ int p02 = astc::popcount(a0 ^ b2);\n+ int p03 = astc::popcount(a0 ^ b3);\n+\n+ int p10 = astc::popcount(a1 ^ b0);\n+ int p11 = astc::popcount(a1 ^ b1);\n+ int p12 = astc::popcount(a1 ^ b2);\n+ int p13 = astc::popcount(a1 ^ b3);\n+\n+ int p20 = astc::popcount(a2 ^ b0);\n+ int p21 = astc::popcount(a2 ^ b1);\n+ int p22 = astc::popcount(a2 ^ b2);\n+ int p23 = astc::popcount(a2 ^ b3);\n+\n+ int p30 = astc::popcount(a3 ^ b0);\n+ int p31 = astc::popcount(a3 ^ b1);\n+ int p32 = astc::popcount(a3 ^ b2);\n+ int p33 = astc::popcount(a3 ^ b3);\nint mx23 = MIN(p22 + p33, p23 + p32);\nint mx13 = MIN(p21 + p33, p23 + p31);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_mathlib.h",
"new_path": "Source/astc_mathlib.h",
"diff": "@@ -244,33 +244,80 @@ mat4 invert(mat4 p);\nFast math library; note that many of the higher-order functions in this set\nuse approximations which are less accurate, but faster, than <cmath> standard\nlibrary equivalents.\n+\n+ Note: Many of these are not necessarily faster than simple C versions when\n+ used on a single scalar value, but are included for testing purposes as most\n+ have an option based on SSE intrinsics and therefore provide an obvious route\n+ to future vectorization.\n============================================================================ */\n+// These are namespaced to avoid colliding with C standard library functions.\n+namespace astc\n+{\n+\n+/**\n+ * @brief SP float absolute value.\n+ *\n+ * @param val The value to make absolute.\n+ *\n+ * @return The absolute value.\n+ */\n+static inline float fabs(float val)\n+{\n+#if ASTC_SSE >= 20\n+ static const union {\n+ uint32_t u[4];\n+ __m128 v;\n+ } mask = { { 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff } };\n+ return _mm_cvtss_f32(_mm_and_ps(_mm_set_ss(val), mask.v));\n+#else\n+ return std::fabs(val);\n+#endif\n+}\n+\n/**\n- * @brief Fast floating-point round-to-nearest integer.\n+ * @brief SP float round-to-nearest.\n+ *\n+ * @param val The value to round.\n+ *\n+ * @return The rounded value.\n*/\n-static inline float ae_rint(float p)\n+static inline float flt_rte(float val)\n{\n// round to integer, round-to-nearest\n#if ASTC_SSE >= 42\nconst int flag = _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC;\n- __m128 tmp = _mm_set_ss(p);\n+ __m128 tmp = _mm_set_ss(val);\ntmp = _mm_round_ss(tmp, tmp, flag);\nreturn _mm_cvtss_f32(tmp);\n#else\n- return floorf(p + 0.5f);\n+ return floorf(val + 0.5f);\n#endif\n}\n-static inline int ae_convert_int_rte(float p)\n+/**\n+ * @brief SP float round-to-nearest and convert to integer.\n+ *\n+ * @param val The value to round.\n+ *\n+ * @return The rounded value.\n+ */\n+static inline int flt2int_rte(float val)\n{ // convert to integer, round-to-nearest\n#if ASTC_SSE >= 20\n- return _mm_cvt_ss2si(_mm_set_ss(p));\n+ return _mm_cvt_ss2si(_mm_set_ss(val));\n#else\n- return (int)(floorf(p + 0.5f));\n+ return (int)(floorf(val + 0.5f));\n#endif\n}\n+/**\n+ * @brief Population bit count.\n+ *\n+ * @param val The value to count.\n+ *\n+ * @return The number of 1 bits.\n+ */\nstatic inline int popcount(uint64_t p)\n{\n#if ASTC_SSE >= 42\n@@ -279,9 +326,6 @@ static inline int popcount(uint64_t p)\nuint64_t mask1 = 0x5555555555555555ULL;\nuint64_t mask2 = 0x3333333333333333ULL;\nuint64_t mask3 = 0x0F0F0F0F0F0F0F0FULL;\n- // best-known algorithm for 64-bit bitcount, assuming 64-bit processor\n- // should probably be adapted for use with 32-bit processors and/or processors\n- // with a POPCNT instruction, but leave that for later.\np -= (p >> 1) & mask1;\np = (p & mask2) + ((p >> 2) & mask2);\np += p >> 4;\n@@ -292,17 +336,33 @@ static inline int popcount(uint64_t p)\n#endif\n}\n-static inline float astc_atan2(float y, float x)\n+/**\n+ * @brief Fast approximation of atan2.\n+ *\n+ * TODO: This implementation is reasonably accurate and a lot faster than the\n+ * standard library, but quite branch heavy which makes it difficult to\n+ * vectorize effectively. If we need to vectorize in future, consider using a\n+ * different approximation algorithm.\n+ *\n+ * @param y The proportion of the Y coordinate.\n+ * @param x The proportion of the X coordinate.\n+ *\n+ * @return The approximation of atan2().\n+ */\n+static inline float atan2(float y, float x)\n{\nconst float PI = (float)M_PI;\nconst float PI_2 = PI / 2.f;\n// Handle the discontinuity at x == 0\n- if (x == 0.0f) {\n- if (y > 0.0f) {\n+ if (x == 0.0f)\n+ {\n+ if (y > 0.0f)\n+ {\nreturn PI_2;\n}\n- if (y == 0.0f) {\n+ else if (y == 0.0f)\n+ {\nreturn 0.0f;\n}\nreturn -PI_2;\n@@ -310,24 +370,36 @@ static inline float astc_atan2(float y, float x)\nfloat z = y / x;\nfloat z2 = z * z;\n- if (std::fabs(z) < 1.0f) {\n+ if (std::fabs(z) < 1.0f)\n+ {\nfloat atan = z / (1.0f + (0.28f * z2));\n- if (x < 0.0f) {\n- if (y < 0.0f) {\n+ if (x < 0.0f)\n+ {\n+ if (y < 0.0f)\n+ {\nreturn atan - PI;\n- } else {\n+ }\n+ else\n+ {\nreturn atan + PI;\n}\n}\nreturn atan;\n- } else {\n+ }\n+ else\n+ {\nfloat atan = PI_2 - (z / (z2 + 0.28f));\n- if (y < 0.0f) {\n+ if (y < 0.0f)\n+ {\nreturn atan - PI;\n- } else {\n+ }\n+ else\n+ {\nreturn atan;\n}\n}\n}\n+}\n+\n#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_weight_align.cpp",
"new_path": "Source/astc_weight_align.cpp",
"diff": "@@ -143,7 +143,7 @@ void compute_angular_offsets(\n// post-process the angle-sums\nfor (i = 0; i < max_angular_steps; i++)\n{\n- float angle = astc_atan2(anglesum_y[i], anglesum_x[i]);\n+ float angle = astc::atan2(anglesum_y[i], anglesum_x[i]);\noffsets[i] = angle * (stepsizes[i] * (1.0f / (2.0f * (float)M_PI)));\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Cleanup documentation for new math functions
|
61,745 |
13.01.2020 22:32:15
| 0 |
e4be3932357bb1777a29b5d571a30f6eee8dfc30
|
Move block derivatives out of imageblock struct
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -168,7 +168,6 @@ struct imageblock\n{\nfloat orig_data[MAX_TEXELS_PER_BLOCK * 4]; // original input data\nfloat work_data[MAX_TEXELS_PER_BLOCK * 4]; // the data that we will compress, either linear or LNS (0..65535 in both cases)\n- float deriv_data[MAX_TEXELS_PER_BLOCK * 4]; // derivative of the conversion function used, used to modify error weighting\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\n@@ -911,6 +910,11 @@ void expand_block_artifact_suppression(\n// functions pertaining to weight alignment\nvoid prepare_angular_tables(void);\n+void imageblock_initialize_deriv(\n+ const imageblock* pb,\n+ int pixelcount,\n+ float4* dptr);\n+\nvoid compute_angular_endpoints_1plane(\nfloat mode_cutoff,\nconst block_size_descriptor* bsd,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -788,6 +788,8 @@ static float prepare_error_weight_block(\newp->rgb_mean_weight != 0.0f || ewp->rgb_stdev_weight != 0.0f || \\\newp->alpha_mean_weight != 0.0f || ewp->alpha_stdev_weight != 0.0f;\n+ float4 derv[MAX_TEXELS_PER_BLOCK];\n+ imageblock_initialize_deriv(blk, bsd->texel_count, derv);\nfloat4 color_weights = float4(ewp->rgba_weights[0],\newp->rgba_weights[1],\newp->rgba_weights[2],\n@@ -938,10 +940,10 @@ static float prepare_error_weight_block(\newbo->error_weights[idx] = error_weight;\n- error_weight.x /= (blk->deriv_data[4 * idx] * blk->deriv_data[4 * idx] * 1e-10f);\n- error_weight.y /= (blk->deriv_data[4 * idx + 1] * blk->deriv_data[4 * idx + 1] * 1e-10f);\n- error_weight.z /= (blk->deriv_data[4 * idx + 2] * blk->deriv_data[4 * idx + 2] * 1e-10f);\n- error_weight.w /= (blk->deriv_data[4 * idx + 3] * blk->deriv_data[4 * idx + 3] * 1e-10f);\n+ error_weight.x /= (derv[idx].x * derv[idx].x * 1e-10f);\n+ error_weight.y /= (derv[idx].y * derv[idx].y * 1e-10f);\n+ error_weight.z /= (derv[idx].z * derv[idx].z * 1e-10f);\n+ error_weight.w /= (derv[idx].w * derv[idx].w * 1e-10f);\newb->error_weights[idx] = error_weight;\nif (dot(error_weight, float4(1, 1, 1, 1)) < 1e-10f)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_image_load_store.cpp",
"new_path": "Source/astc_image_load_store.cpp",
"diff": "@@ -349,15 +349,15 @@ uint16_t unorm16_to_sf16(uint16_t p)\nreturn p;\n}\n-void imageblock_initialize_deriv_from_work_and_orig(\n- imageblock* pb,\n- int pixelcount\n+void imageblock_initialize_deriv(\n+ const imageblock* pb,\n+ int pixelcount,\n+ float4* dptr\n) {\nint i;\nconst float *fptr = pb->orig_data;\nconst float *wptr = pb->work_data;\n- float *dptr = pb->deriv_data;\nfor (i = 0; i < pixelcount; i++)\n{\n@@ -389,15 +389,15 @@ void imageblock_initialize_deriv_from_work_and_orig(\nelse if (bderiv > 33554432.0f)\nbderiv = 33554432.0f;\n- dptr[0] = rderiv;\n- dptr[1] = gderiv;\n- dptr[2] = bderiv;\n+ dptr->x = rderiv;\n+ dptr->y = gderiv;\n+ dptr->z = bderiv;\n}\nelse\n{\n- dptr[0] = 65535.0f;\n- dptr[1] = 65535.0f;\n- dptr[2] = 65535.0f;\n+ dptr->x = 65535.0f;\n+ dptr->y = 65535.0f;\n+ dptr->z = 65535.0f;\n}\n// then compute derivatives for Alpha\n@@ -412,16 +412,16 @@ void imageblock_initialize_deriv_from_work_and_orig(\nelse if (aderiv > 33554432.0f)\naderiv = 33554432.0f;\n- dptr[3] = aderiv;\n+ dptr->w = aderiv;\n}\nelse\n{\n- dptr[3] = 65535.0f;\n+ dptr->w = 65535.0f;\n}\nfptr += 4;\nwptr += 4;\n- dptr += 4;\n+ dptr += 1;\n}\n}\n@@ -461,8 +461,6 @@ void imageblock_initialize_work_from_orig(\nfptr += 4;\nwptr += 4;\n}\n-\n- imageblock_initialize_deriv_from_work_and_orig(pb, pixelcount);\n}\n// helper function to initialize the orig-data from the work-data\n@@ -501,8 +499,6 @@ void imageblock_initialize_orig_from_work(\nfptr += 4;\nwptr += 4;\n}\n-\n- imageblock_initialize_deriv_from_work_and_orig(pb, pixelcount);\n}\n// fetch an imageblock from the input file.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Move block derivatives out of imageblock struct
|
61,745 |
15.01.2020 00:38:32
| 0 |
83d57a1cdec97366d53113e5245c0ff1705f13eb
|
Add SSE4.2 version of compute_lowest_and_highest_weight
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_weight_align.cpp",
"new_path": "Source/astc_weight_align.cpp",
"diff": "#include \"astc_codec_internals.h\"\n#include <stdio.h>\n+#include <cassert>\nstatic const float angular_steppings[44] = {\n1.0f, 1.25f, 1.5f, 1.75f,\n@@ -159,37 +160,94 @@ static void compute_lowest_and_highest_weight(\nint max_angular_steps,\nint max_quantization_steps,\nconst float *offsets,\n- int8_t * lowest_weight,\n- int8_t * weight_span,\n+ int32_t * lowest_weight,\n+ int32_t * weight_span,\nfloat *error,\nfloat *cut_low_weight_error,\nfloat *cut_high_weight_error\n) {\n- // weight + 12\n- static const unsigned int idxtab[128] = {\n- 12, 13, 14, 15, 16, 17, 18, 19,\n- 20, 21, 22, 23, 24, 25, 26, 27,\n- 28, 29, 30, 31, 32, 33, 34, 35,\n- 36, 37, 38, 39, 40, 41, 42, 43,\n- 44, 45, 46, 47, 48, 49, 50, 51,\n- 52, 53, 54, 55, 55, 55, 55, 55,\n- 55, 55, 55, 55, 55, 55, 55, 55,\n- 55, 55, 55, 55, 55, 55, 55, 55,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 0, 0, 0,\n- 0, 0, 0, 0, 0, 1, 2, 3,\n- 4, 5, 6, 7, 8, 9, 10, 11\n- };\n+// TODO: Add AVX2 version of this; SSE4.2 vectorizes almost perfectly in terms\n+// of user-visible speedup. Might need to change the length of max_angular\n+// steps to be a multiple of 8 though ...\n+#if ASTC_SSE >= 42\n+ // Arrays are always multiple of 4, so this is safe even if overshoot max\n+ for (int sp = 0; sp < max_angular_steps; sp += 4)\n+ {\n+ __m128i minidx = _mm_set1_epi32(128);\n+ __m128i maxidx = _mm_set1_epi32(-128);\n+ __m128 errval = _mm_setzero_ps();\n+ __m128 cut_low_weight_err = _mm_setzero_ps();\n+ __m128 cut_high_weight_err = _mm_setzero_ps();\n+\n+ __m128 rcp_stepsize = _mm_load_ps(&angular_steppings[sp]);\n+ __m128 offset = _mm_load_ps(&offsets[sp]);\n+ __m128 scaled_offset = _mm_mul_ps(rcp_stepsize, offset);\n+ for (int j = 0; j < samplecount; j++)\n+ {\n+ __m128 wt = _mm_load_ps1(&sample_weights[j]);\n+ __m128 sval = _mm_mul_ps(_mm_load_ps1(&samples[j]), rcp_stepsize);\n+ sval = _mm_sub_ps(sval, scaled_offset);\n+ const int flag = _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC;\n+ __m128 svalrte = _mm_round_ps(sval, flag);\n+ __m128i idxv = _mm_cvtps_epi32(svalrte);\n+\n+ __m128 dif = _mm_sub_ps(sval, svalrte);\n+ __m128 dwt = _mm_mul_ps(dif, wt);\n+ errval = _mm_add_ps(errval, _mm_mul_ps(dwt, dif));\n+\n+ __m128i mask;\n+ __m128 maskf;\n+ __m128 accum;\n+\n+ /* Reset tracker on min hit. */\n+ mask = _mm_cmplt_epi32(idxv, minidx);\n+ minidx = _mm_blendv_epi8(minidx, idxv, mask);\n+ maskf = _mm_castsi128_ps(mask);\n+ cut_low_weight_err = _mm_blendv_ps(cut_low_weight_err, _mm_setzero_ps(), maskf);\n+\n+ /* Accumulate on min hit. */\n+ mask = _mm_cmpeq_epi32(idxv, minidx);\n+ maskf = _mm_castsi128_ps(mask);\n+ accum = _mm_add_ps(cut_low_weight_err, _mm_sub_ps(wt, _mm_mul_ps(_mm_set_ps1(2.0f), dwt)));\n+ cut_low_weight_err = _mm_blendv_ps(cut_low_weight_err, accum, maskf);\n+\n+ /* Reset tracker on max hit. */\n+ mask = _mm_cmpgt_epi32(idxv, maxidx);\n+ maxidx = _mm_blendv_epi8(maxidx, idxv, mask);\n+ maskf = _mm_castsi128_ps(mask);\n+ cut_high_weight_err = _mm_blendv_ps(cut_high_weight_err, _mm_setzero_ps(), maskf);\n+\n+ /* Accumulate on max hit. */\n+ mask = _mm_cmpeq_epi32(idxv, maxidx);\n+ maskf = _mm_castsi128_ps(mask);\n+ accum = _mm_add_ps(cut_high_weight_err, _mm_add_ps(wt, _mm_mul_ps(_mm_set_ps1(2.0f), dwt)));\n+ cut_high_weight_err = _mm_blendv_ps(cut_high_weight_err, accum, maskf);\n+ }\n+\n+ __m128i span = _mm_add_epi32(_mm_sub_epi32(maxidx, minidx), _mm_set1_epi32(1));\n+ __m128i spanmin = _mm_set1_epi32(2);\n+ span = _mm_max_epi32(span, spanmin);\n+ __m128i spanmax = _mm_set1_epi32(max_quantization_steps + 3);\n+ span = _mm_min_epi32(span, spanmax);\n+\n+ // Write out min weight and weight span; clamp span to a usable range\n+ _mm_store_si128((__m128i*)&lowest_weight[sp], minidx);\n+ _mm_store_si128((__m128i*)&weight_span[sp], span);\n+\n+ // The cut_(lowest/highest)_weight_error indicate the error that\n+ // results from forcing samples that should have had the weight value\n+ // one step (up/down).\n+ __m128 errscale = _mm_load_ps(&stepsizes_sqr[sp]);\n+ _mm_store_ps(&error[sp], _mm_mul_ps(errval, errscale));\n+ _mm_store_ps(&cut_low_weight_error[sp], _mm_mul_ps(cut_low_weight_err, errscale));\n+ _mm_store_ps(&cut_high_weight_error[sp], _mm_mul_ps(cut_high_weight_err, errscale));\n+ }\n+#else\nfor (int sp = 0; sp < max_angular_steps; sp++)\n{\n- unsigned int minidx_bias12 = 55;\n- unsigned int maxidx_bias12 = 0;\n-\n+ int minidx = 128;\n+ int maxidx = -128;\nfloat errval = 0.0f;\nfloat cut_low_weight_err = 0.0f;\nfloat cut_high_weight_err = 0.0f;\n@@ -202,63 +260,49 @@ static void compute_lowest_and_highest_weight(\nfor (int j = 0; j < samplecount; j++)\n{\nfloat wt = sample_weights[j];\n- if32 p;\nfloat sval = (samples[j] * rcp_stepsize) - scaled_offset;\n- p.f = sval + 12582912.0f; // FP representation abuse to avoid floor() and float->int conversion\n- float isval = p.f - 12582912.0f;\n-\n- float dif = sval - isval;\n+ int idxv = (int)(std::floor(sval + 0.5f));\n+ float dif = sval - std::floor(sval + 0.5f);\nfloat dwt = dif * wt;\nerrval += dwt * dif;\n- unsigned int idx_bias12 = idxtab[p.u & 0x7F];\n-\n- if (idx_bias12 < minidx_bias12)\n+ if (idxv < minidx)\n{\n- minidx_bias12 = idx_bias12;\n+ minidx = idxv;\ncut_low_weight_err = wt - 2.0f * dwt;\n}\n- else if (idx_bias12 == minidx_bias12)\n+ else if (idxv == minidx)\n{\ncut_low_weight_err += wt - 2.0f * dwt;\n}\n- if (idx_bias12 > maxidx_bias12)\n+ if (idxv > maxidx)\n{\n- maxidx_bias12 = idx_bias12;\n+ maxidx = idxv;\ncut_high_weight_err = wt + 2.0f * dwt;\n}\n- else if (idx_bias12 == maxidx_bias12)\n+ else if (idxv == maxidx)\n{\ncut_high_weight_err += wt + 2.0f * dwt;\n}\n}\n- int minIndex = minidx_bias12 - 12;\n- int maxIndex = maxidx_bias12 - 12;\n- int span = maxIndex - minIndex + 1;\n-\n- // Clamp the span to a usable range\n+ // Write out min weight and weight span; clamp span to a usable range\n+ int span = maxidx - minidx + 1;\nspan = MIN(span, max_quantization_steps + 3);\nspan = MAX(span, 2);\n- lowest_weight[sp] = (int)minidx_bias12 - 12;\n+ lowest_weight[sp] = minidx;\nweight_span[sp] = span;\n- error[sp] = errval;\n- // the cut_(lowest/highest)_weight_error indicate the error that results from\n- // forcing samples that should have had the (lowest/highest) weight value\n+ // The cut_(lowest/highest)_weight_error indicate the error that\n+ // results from forcing samples that should have had the weight value\n// one step (up/down).\n- cut_low_weight_error[sp] = cut_low_weight_err;\n- cut_high_weight_error[sp] = cut_high_weight_err;\n- }\n-\n- for (int sp = 0; sp < max_angular_steps; sp++)\n- {\nfloat errscale = stepsizes_sqr[sp];\n- error[sp] *= errscale;\n- cut_low_weight_error[sp] *= errscale;\n- cut_high_weight_error[sp] *= errscale;\n+ error[sp] = errval * errscale;\n+ cut_low_weight_error[sp] = cut_low_weight_err * errscale;\n+ cut_high_weight_error[sp] = cut_high_weight_err * errscale;\n}\n+#endif\n}\n// main function for running the angular algorithm.\n@@ -276,17 +320,15 @@ void compute_angular_endpoints_for_quantization_levels(\nint max_quantization_steps = quantization_steps_for_level[max_quantization_level + 1];\n- float angular_offsets[ANGULAR_STEPS];\n+ alignas(32) float angular_offsets[ANGULAR_STEPS];\nint max_angular_steps = max_angular_steps_needed_for_quant_level[max_quantization_level];\ncompute_angular_offsets(samplecount, samples, sample_weights, max_angular_steps, angular_offsets);\n- // the +4 offsets are to allow for vectorization within compute_lowest_and_highest_weight().\n- int8_t lowest_weight[ANGULAR_STEPS + 4];\n- int8_t weight_span[ANGULAR_STEPS + 4];\n- float error[ANGULAR_STEPS + 4];\n-\n- float cut_low_weight_error[ANGULAR_STEPS + 4];\n- float cut_high_weight_error[ANGULAR_STEPS + 4];\n+ alignas(32) int32_t lowest_weight[ANGULAR_STEPS];\n+ alignas(32) int32_t weight_span[ANGULAR_STEPS];\n+ alignas(32) float error[ANGULAR_STEPS];\n+ alignas(32) float cut_low_weight_error[ANGULAR_STEPS];\n+ alignas(32) float cut_high_weight_error[ANGULAR_STEPS];\ncompute_lowest_and_highest_weight(samplecount, samples, sample_weights,\nmax_angular_steps, max_quantization_steps,\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add SSE4.2 version of compute_lowest_and_highest_weight
|
61,745 |
18.01.2020 21:39:24
| 0 |
d7eb1663e319cc04bdb575cfae9a817923b68574
|
Add placeholder for avx2 implementation
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "# Configure the vectorization intrinsics support; valid values are:\n#\n# * nointrin - allow use of sse2 by the compiler, but no manual instrinsics\n-# * see2 - allow use of sse2 by the compiler and instrinsics\n-# * see4.2 - allow use of sse4.2 and popcnt by the compiler and instrinsics\n+# * sse2 - allow use of sse2\n+# * sse4.2 - allow use of sse4.2 and popcnt\n+# * avx2 - allow use of avx2, sse4.2, and popcnt\n#\n# Note that we always enable at least sse2 support for compiler generated code,\n-# as it is guaranteed to be present in x86-64, but we allow disabling of\n-# our manually written instrinsic functions.\n+# as it is guaranteed to be present in x86-64, we only allow disabling of our\n+# manually written instrinsic functions.\n#\n# Also note that we currently assume that sse4.2 implies support for popcnt,\n# which is the default GCC behavior and true on currently shipping hardware.\n-VEC?=sse2\n+VEC?=avx2\nSOURCES = \\\nastc_averages_and_directions.cpp \\\n@@ -62,15 +63,19 @@ CPPFLAGS = -std=c++14 -O3 -mfpmath=sse \\\n# Validate that the VEC parameter is a supported value, and patch CPPFLAGS\nifeq ($(VEC),nointrin)\n-CPPFLAGS += -msse2 -DASTC_SSE=00\n+CPPFLAGS += -msse2 -DASTC_SSE=0 -DASTC_AVX=0 -DASTC_POPCNT=0\nelse\nifeq ($(VEC),sse2)\n-CPPFLAGS += -msse2 -DASTC_SSE=20\n+CPPFLAGS += -msse2 -DASTC_SSE=20 -DASTC_AVX=0 -DASTC_POPCNT=0\nelse\nifeq ($(VEC),sse4.2)\n-CPPFLAGS += -msse4.2 -mpopcnt -DASTC_SSE=42\n+CPPFLAGS += -msse4.2 -mpopcnt -DASTC_SSE=42 -DASTC_AVX=0 -DASTC_POPCNT=0\nelse\n-$(error Unsupported VEC target, use VEC=nointrin/sse2/sse4.2)\n+ifeq ($(VEC),avx2)\n+CPPFLAGS += -mavx2 -mpopcnt -DASTC_SSE=42 -DASTC_AVX=2 -DASTC_POPCNT=1\n+else\n+$(error Unsupported VEC target, use VEC=nointrin/sse2/sse4.2/avx2)\n+endif\nendif\nendif\nendif\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_mathlib.h",
"new_path": "Source/astc_mathlib.h",
"diff": "@@ -282,7 +282,7 @@ static inline int flt2int_rte(float val)\n*/\nstatic inline int popcount(uint64_t p)\n{\n-#if ASTC_SSE >= 42\n+#if ASTC_POPCNT >= 1\nreturn (int)_mm_popcnt_u64(p);\n#else\nuint64_t mask1 = 0x5555555555555555ULL;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add placeholder for avx2 implementation
|
61,745 |
18.01.2020 23:50:10
| 0 |
f13626c44ea38b909a88bc042bbb758b8a8d6ea1
|
Replace std::rand with a local PRNG
This will ensure portability across platforms, and stability
across multiple runs, so the same input will always produce
the same output.
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_block_sizes2.cpp",
"new_path": "Source/astc_block_sizes2.cpp",
"diff": "@@ -677,6 +677,9 @@ static void construct_block_size_descriptor_2d(\n}\nelse\n{\n+ uint64_t rng_state[2];\n+ astc::rand_init(rng_state);\n+\n// pick 64 random texels for use with bitmap partitioning.\nint arr[MAX_TEXELS_PER_BLOCK];\nfor (int i = 0; i < xdim * ydim; i++)\n@@ -687,7 +690,7 @@ static void construct_block_size_descriptor_2d(\nint arr_elements_set = 0;\nwhile (arr_elements_set < 64)\n{\n- int idx = rand() % (xdim * ydim);\n+ int idx = ((int)astc::rand(rng_state)) % (xdim * ydim);\nif (arr[idx] == 0)\n{\narr_elements_set++;\n@@ -839,6 +842,9 @@ static void construct_block_size_descriptor_3d(\n}\nelse\n{\n+ uint64_t rng_state[2];\n+ astc::rand_init(rng_state);\n+\n// pick 64 random texels for use with bitmap partitioning.\nint arr[MAX_TEXELS_PER_BLOCK];\nfor (int i = 0; i < xdim * ydim * zdim; i++)\n@@ -849,7 +855,7 @@ static void construct_block_size_descriptor_3d(\nint arr_elements_set = 0;\nwhile (arr_elements_set < 64)\n{\n- int idx = rand() % (xdim * ydim * zdim);\n+ int idx = ((int)astc::rand(rng_state)) % (xdim * ydim * zdim);\nif (arr[idx] == 0)\n{\narr_elements_set++;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_mathlib.cpp",
"new_path": "Source/astc_mathlib.cpp",
"diff": "@@ -173,3 +173,33 @@ float astc::atan2(float y, float x)\n}\n}\n}\n+\n+/**\n+ * @brief 64-bit rotate left.\n+ *\n+ * @param val The value to rotate.\n+ * @param count The rotation, in bits.\n+ */\n+static inline uint64_t rotl(uint64_t val, int count)\n+{\n+ return (val << count) | (val >> (64 - count));\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+void astc::rand_init(uint64_t state[2])\n+{\n+ state[0] = 0xfaf9e171cea1ec6bULL;\n+ state[1] = 0xf1b318cc06af5d71ULL;\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+uint64_t astc::rand(uint64_t state[2])\n+{\n+ uint64_t s0 = state[0];\n+ uint64_t s1 = state[1];\n+ uint64_t res = s0 + s1;\n+ s1 ^= s0;\n+ state[0] = rotl(s0, 24) ^ s1 ^ (s1 << 16);\n+ state[1] = rotl(s1, 37);\n+ return res;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_mathlib.h",
"new_path": "Source/astc_mathlib.h",
"diff": "@@ -264,12 +264,28 @@ static inline float flt_rte(float val)\n*\n* @return The rounded value.\n*/\n-static inline int flt2int_rte(float val)\n+static inline int flt2int_rtn(float val)\n{\n#if (ASTC_SSE >= 42) && USE_SCALAR_SSE\nreturn _mm_cvt_ss2si(_mm_set_ss(val));\n#else\n- return (int)(std::floor(val + 0.5f));\n+ return (int)(val + 0.5f);\n+#endif\n+}\n+\n+/**\n+ * @brief SP float round down and convert to integer.\n+ *\n+ * @param val The value to round.\n+ *\n+ * @return The rounded value.\n+ */\n+static inline int flt2int_rd(float val)\n+{\n+#if (ASTC_SSE >= 42) && USE_SCALAR_SSE\n+ return _mm_cvt_ss2si(_mm_set_ss(val));\n+#else\n+ return (int)(val);\n#endif\n}\n@@ -365,6 +381,30 @@ static inline float xlog2(float val)\nreturn -15.44269504088896340735f + val * 23637.11554992477646609062f;\n}\n+/**\n+ * @brief Initialize the seed structure for a random number generator.\n+ *\n+ * Important note: For the purposes of ASTC we want sets of random numbers to\n+ * use the codec, but we want the same seed value across instances and threads\n+ * to ensure that image output is stable across compressor runs and across\n+ * platforms. Every PRNG created by this call will therefore return the same\n+ * sequence of values ...\n+ *\n+ * @param state The state structure to initialize.\n+ */\n+void rand_init(uint64_t state[2]);\n+\n+/**\n+ * @brief Return the next random number from the generator.\n+ *\n+ * This RNG is an implementation of the \"xoroshoro-128+ 1.0\" PRNG, based on the\n+ * public-domain implementation given by David Blackman & Sebastiano Vigna at\n+ * http://vigna.di.unimi.it/xorshift/xoroshiro128plus.c\n+ *\n+ * @param state The state structure to use/update.\n+ */\n+uint64_t rand(uint64_t state[2]);\n+\n}\n/* ============================================================================\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Replace std::rand with a local PRNG
This will ensure portability across platforms, and stability
across multiple runs, so the same input will always produce
the same output.
|
61,745 |
18.01.2020 23:51:47
| 0 |
b421d2f6855f88c3b7789e135c913641c1efad38
|
Replace all uses of std:floor
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_color_quantize.cpp",
"new_path": "Source/astc_color_quantize.cpp",
"diff": "@@ -61,12 +61,12 @@ void quantize_rgb(\nint iters = 0;\ndo\n{\n- ri0 = cqt_lookup(quantization_level, (int)floor(r0 + rgb0_addon));\n- gi0 = cqt_lookup(quantization_level, (int)floor(g0 + rgb0_addon));\n- bi0 = cqt_lookup(quantization_level, (int)floor(b0 + rgb0_addon));\n- ri1 = cqt_lookup(quantization_level, (int)floor(r1 + rgb1_addon));\n- gi1 = cqt_lookup(quantization_level, (int)floor(g1 + rgb1_addon));\n- bi1 = cqt_lookup(quantization_level, (int)floor(b1 + rgb1_addon));\n+ ri0 = cqt_lookup(quantization_level, astc::flt2int_rd(r0 + rgb0_addon));\n+ gi0 = cqt_lookup(quantization_level, astc::flt2int_rd(g0 + rgb0_addon));\n+ bi0 = cqt_lookup(quantization_level, astc::flt2int_rd(b0 + rgb0_addon));\n+ ri1 = cqt_lookup(quantization_level, astc::flt2int_rd(r1 + rgb1_addon));\n+ gi1 = cqt_lookup(quantization_level, astc::flt2int_rd(g1 + rgb1_addon));\n+ bi1 = cqt_lookup(quantization_level, astc::flt2int_rd(b1 + rgb1_addon));\nri0b = color_unquantization_tables[quantization_level][ri0];\ngi0b = color_unquantization_tables[quantization_level][gi0];\n@@ -100,8 +100,8 @@ void quantize_rgba(\nfloat a0 = astc::clamp255f(color0.w);\nfloat a1 = astc::clamp255f(color1.w);\n- int ai0 = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)];\n- int ai1 = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)];\n+ int ai0 = color_quantization_tables[quantization_level][astc::flt2int_rtn(a0)];\n+ int ai1 = color_quantization_tables[quantization_level][astc::flt2int_rtn(a1)];\noutput[6] = ai0;\noutput[7] = ai1;\n@@ -146,12 +146,12 @@ int try_quantize_rgb_blue_contract(\n}\n// quantize the inverse-blue-contracted color\n- int ri0 = color_quantization_tables[quantization_level][(int)floor(r0 + 0.5f)];\n- int gi0 = color_quantization_tables[quantization_level][(int)floor(g0 + 0.5f)];\n- int bi0 = color_quantization_tables[quantization_level][(int)floor(b0 + 0.5f)];\n- int ri1 = color_quantization_tables[quantization_level][(int)floor(r1 + 0.5f)];\n- int gi1 = color_quantization_tables[quantization_level][(int)floor(g1 + 0.5f)];\n- int bi1 = color_quantization_tables[quantization_level][(int)floor(b1 + 0.5f)];\n+ int ri0 = color_quantization_tables[quantization_level][astc::flt2int_rtn(r0)];\n+ int gi0 = color_quantization_tables[quantization_level][astc::flt2int_rtn(g0)];\n+ int bi0 = color_quantization_tables[quantization_level][astc::flt2int_rtn(b0)];\n+ int ri1 = color_quantization_tables[quantization_level][astc::flt2int_rtn(r1)];\n+ int gi1 = color_quantization_tables[quantization_level][astc::flt2int_rtn(g1)];\n+ int bi1 = color_quantization_tables[quantization_level][astc::flt2int_rtn(b1)];\n// then unquantize again\nint ru0 = color_unquantization_tables[quantization_level][ri0];\n@@ -190,8 +190,8 @@ int try_quantize_rgba_blue_contract(\nfloat a0 = astc::clamp255f(color0.w);\nfloat a1 = astc::clamp255f(color1.w);\n- output[7] = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)];\n- output[6] = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)];\n+ output[7] = color_quantization_tables[quantization_level][astc::flt2int_rtn(a0)];\n+ output[6] = color_quantization_tables[quantization_level][astc::flt2int_rtn(a1)];\nreturn try_quantize_rgb_blue_contract(color0, color1, output, quantization_level);\n}\n@@ -227,9 +227,9 @@ int try_quantize_rgb_delta(\nfloat b1 = astc::clamp255f(color1.z);\n// transform r0 to unorm9\n- int r0a = (int)floor(r0 + 0.5f);\n- int g0a = (int)floor(g0 + 0.5f);\n- int b0a = (int)floor(b0 + 0.5f);\n+ int r0a = astc::flt2int_rtn(r0);\n+ int g0a = astc::flt2int_rtn(g0);\n+ int b0a = astc::flt2int_rtn(b0);\nr0a <<= 1;\ng0a <<= 1;\nb0a <<= 1;\n@@ -253,9 +253,9 @@ int try_quantize_rgb_delta(\nb0b |= b0a & 0x100;\n// then, get hold of the second value\n- int r1d = (int)floor(r1 + 0.5f);\n- int g1d = (int)floor(g1 + 0.5f);\n- int b1d = (int)floor(b1 + 0.5f);\n+ int r1d = astc::flt2int_rtn(r1);\n+ int g1d = astc::flt2int_rtn(g1);\n+ int b1d = astc::flt2int_rtn(b1);\nr1d <<= 1;\ng1d <<= 1;\n@@ -357,9 +357,9 @@ int try_quantize_rgb_delta_blue_contract(\nreturn 0;\n// transform r0 to unorm9\n- int r0a = (int)floor(r0 + 0.5f);\n- int g0a = (int)floor(g0 + 0.5f);\n- int b0a = (int)floor(b0 + 0.5f);\n+ int r0a = astc::flt2int_rtn(r0);\n+ int g0a = astc::flt2int_rtn(g0);\n+ int b0a = astc::flt2int_rtn(b0);\nr0a <<= 1;\ng0a <<= 1;\nb0a <<= 1;\n@@ -383,9 +383,9 @@ int try_quantize_rgb_delta_blue_contract(\nb0b |= b0a & 0x100;\n// then, get hold of the second value\n- int r1d = (int)floor(r1 + 0.5f);\n- int g1d = (int)floor(g1 + 0.5f);\n- int b1d = (int)floor(b1 + 0.5f);\n+ int r1d = astc::flt2int_rtn(r1);\n+ int g1d = astc::flt2int_rtn(g1);\n+ int b1d = astc::flt2int_rtn(b1);\nr1d <<= 1;\ng1d <<= 1;\n@@ -468,13 +468,13 @@ int try_quantize_alpha_delta(\nfloat a0 = astc::clamp255f(color0.w);\nfloat a1 = astc::clamp255f(color1.w);\n- int a0a = (int)floor(a0 + 0.5f);\n+ int a0a = astc::flt2int_rtn(a0);\na0a <<= 1;\nint a0b = a0a & 0xFF;\nint a0be = color_quantization_tables[quantization_level][a0b];\na0b = color_unquantization_tables[quantization_level][a0be];\na0b |= a0a & 0x100;\n- int a1d = (int)floor(a1 + 0.5f);\n+ int a1d = astc::flt2int_rtn(a1);\na1d <<= 1;\na1d -= a0b;\nif (a1d > 63 || a1d < -64)\n@@ -507,8 +507,8 @@ int try_quantize_luminance_alpha_delta(\nfloat a0 = astc::clamp255f(color0.w * (1.0f / 257.0f));\nfloat a1 = astc::clamp255f(color1.w * (1.0f / 257.0f));\n- int l0a = (int)floor(l0 + 0.5f);\n- int a0a = (int)floor(a0 + 0.5f);\n+ int l0a = astc::flt2int_rtn(l0);\n+ int a0a = astc::flt2int_rtn(a0);\nl0a <<= 1;\na0a <<= 1;\nint l0b = l0a & 0xFF;\n@@ -519,8 +519,8 @@ int try_quantize_luminance_alpha_delta(\na0b = color_unquantization_tables[quantization_level][a0be];\nl0b |= l0a & 0x100;\na0b |= a0a & 0x100;\n- int l1d = (int)floor(l1 + 0.5f);\n- int a1d = (int)floor(a1 + 0.5f);\n+ int l1d = astc::flt2int_rtn(l1);\n+ int a1d = astc::flt2int_rtn(a1);\nl1d <<= 1;\na1d <<= 1;\nl1d -= l0b;\n@@ -605,9 +605,9 @@ void quantize_rgbs_new(\nfloat g = astc::clamp255f(rgbs_color.y);\nfloat b = astc::clamp255f(rgbs_color.z);\n- int ri = color_quantization_tables[quantization_level][(int)floor(r + 0.5f)];\n- int gi = color_quantization_tables[quantization_level][(int)floor(g + 0.5f)];\n- int bi = color_quantization_tables[quantization_level][(int)floor(b + 0.5f)];\n+ int ri = color_quantization_tables[quantization_level][astc::flt2int_rtn(r)];\n+ int gi = color_quantization_tables[quantization_level][astc::flt2int_rtn(g)];\n+ int bi = color_quantization_tables[quantization_level][astc::flt2int_rtn(b)];\nint ru = color_unquantization_tables[quantization_level][ri];\nint gu = color_unquantization_tables[quantization_level][gi];\n@@ -617,13 +617,8 @@ void quantize_rgbs_new(\nfloat newcolorsum = (float)(ru + gu + bu);\nfloat scale = astc::clamp1f(rgbs_color.w * (oldcolorsum + 1e-10f) / (newcolorsum + 1e-10f));\n-\n- int scale_idx = (int)floor(scale * 256.0f + 0.5f);\n-\n- if (scale_idx < 0)\n- scale_idx = 0;\n- else if (scale_idx > 255)\n- scale_idx = 255;\n+ int scale_idx = astc::flt2int_rtn(scale * 256.0f);\n+ scale_idx = astc::clampi(scale_idx, 0, 255);\noutput[0] = ri;\noutput[1] = gi;\n@@ -644,8 +639,8 @@ void quantize_rgbs_alpha_new(\nfloat a0 = astc::clamp255f(color0.w);\nfloat a1 = astc::clamp255f(color1.w);\n- int ai0 = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)];\n- int ai1 = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)];\n+ int ai0 = color_quantization_tables[quantization_level][astc::flt2int_rtn(a0)];\n+ int ai1 = color_quantization_tables[quantization_level][astc::flt2int_rtn(a1)];\noutput[4] = ai0;\noutput[5] = ai1;\n@@ -677,8 +672,8 @@ void quantize_luminance(\nlum1 = avg;\n}\n- output[0] = color_quantization_tables[quantization_level][(int)floor(lum0 + 0.5f)];\n- output[1] = color_quantization_tables[quantization_level][(int)floor(lum1 + 0.5f)];\n+ output[0] = color_quantization_tables[quantization_level][astc::flt2int_rtn(lum0)];\n+ output[1] = color_quantization_tables[quantization_level][astc::flt2int_rtn(lum1)];\n}\nvoid quantize_luminance_alpha(\n@@ -728,11 +723,10 @@ void quantize_luminance_alpha(\na1 = astc::clamp255f(a1);\n}\n-\n- output[0] = color_quantization_tables[quantization_level][(int)floor(lum0 + 0.5f)];\n- output[1] = color_quantization_tables[quantization_level][(int)floor(lum1 + 0.5f)];\n- output[2] = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)];\n- output[3] = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)];\n+ output[0] = color_quantization_tables[quantization_level][astc::flt2int_rtn(lum0)];\n+ output[1] = color_quantization_tables[quantization_level][astc::flt2int_rtn(lum1)];\n+ output[2] = color_quantization_tables[quantization_level][astc::flt2int_rtn(a0)];\n+ output[3] = color_quantization_tables[quantization_level][astc::flt2int_rtn(a1)];\n}\n// quantize and unquantize a number, wile making sure to retain the top two bits.\n@@ -916,7 +910,7 @@ void quantize_hdr_rgbo3(\nint s_intcutoff = 1 << mode_bits[mode][2];\n// first, quantize and unquantize R.\n- int r_intval = (int)floor(r_base * mode_scale + 0.5f);\n+ int r_intval = astc::flt2int_rtn(r_base * mode_scale);\nint r_lowbits = r_intval & 0x3f;\n@@ -941,8 +935,8 @@ void quantize_hdr_rgbo3(\nelse if (b_fval > 65535.0f)\nb_fval = 65535.0f;\n- int g_intval = (int)floor(g_fval * mode_scale + 0.5f);\n- int b_intval = (int)floor(b_fval * mode_scale + 0.5f);\n+ int g_intval = astc::flt2int_rtn(g_fval * mode_scale);\n+ int b_intval = astc::flt2int_rtn(b_fval * mode_scale);\nif (g_intval >= gb_intcutoff || b_intval >= gb_intcutoff)\n@@ -1054,7 +1048,7 @@ void quantize_hdr_rgbo3(\nelse if (s_fval > 1e9f)\ns_fval = 1e9f;\n- int s_intval = (int)floor(s_fval * mode_scale + 0.5f);\n+ int s_intval = astc::flt2int_rtn(s_fval * mode_scale);\nif (s_intval >= s_intcutoff)\n{\n@@ -1138,7 +1132,7 @@ void quantize_hdr_rgbo3(\nelse if (vals[i] > 65020.0f)\nvals[i] = 65020.0f;\n- ivals[i] = (int)floor(vals[i] * (1.0f / 512.0f) + 0.5f);\n+ ivals[i] = astc::flt2int_rtn(vals[i] * (1.0f / 512.0f));\ncvals[i] = ivals[i] * 512.0f;\n}\n@@ -1150,7 +1144,7 @@ void quantize_hdr_rgbo3(\nelse if (vals[3] > 65020.0f)\nvals[3] = 65020.0f;\n- ivals[3] = (int)floor(vals[3] * (1.0f / 512.0f) + 0.5f);\n+ ivals[3] = astc::flt2int_rtn(vals[3] * (1.0f / 512.0f));\nint encvals[4];\n@@ -1314,7 +1308,7 @@ void quantize_hdr_rgb3(\nint d_intcutoff = 1 << (mode_bits[mode][3] - 1);\n// first, quantize and unquantize A, with the assumption that its high bits can be handled safely.\n- int a_intval = (int)floor(a_base * mode_scale + 0.5f);\n+ int a_intval = astc::flt2int_rtn(a_base * mode_scale);\nint a_lowbits = a_intval & 0xFF;\nint a_quantval = color_quantization_tables[quantization_level][a_lowbits];\n@@ -1329,7 +1323,7 @@ void quantize_hdr_rgb3(\nelse if (c_fval > 65535.0f)\nc_fval = 65535.0f;\n- int c_intval = (int)floor(c_fval * mode_scale + 0.5f);\n+ int c_intval = astc::flt2int_rtn(c_fval * mode_scale);\nif (c_intval >= c_intcutoff)\n{\n@@ -1359,8 +1353,8 @@ void quantize_hdr_rgb3(\nelse if (b1_fval > 65535.0f)\nb1_fval = 65535.0f;\n- int b0_intval = (int)floor(b0_fval * mode_scale + 0.5f);\n- int b1_intval = (int)floor(b1_fval * mode_scale + 0.5f);\n+ int b0_intval = astc::flt2int_rtn(b0_fval * mode_scale);\n+ int b1_intval = astc::flt2int_rtn(b1_fval * mode_scale);\nif (b0_intval >= b_intcutoff || b1_intval >= b_intcutoff)\n{\n@@ -1440,8 +1434,8 @@ void quantize_hdr_rgb3(\nelse if (d1_fval > 65535.0f)\nd1_fval = 65535.0f;\n- int d0_intval = (int)floor(d0_fval * mode_scale + 0.5f);\n- int d1_intval = (int)floor(d1_fval * mode_scale + 0.5f);\n+ int d0_intval = astc::flt2int_rtn(d0_fval * mode_scale);\n+ int d1_intval = astc::flt2int_rtn(d1_fval * mode_scale);\nif (abs(d0_intval) >= d_intcutoff || abs(d1_intval) >= d_intcutoff)\ncontinue;\n@@ -1554,13 +1548,13 @@ void quantize_hdr_rgb3(\n}\nfor (i = 0; i < 4; i++)\n{\n- int idx = (int)floor(vals[i] * 1.0f / 256.0f + 0.5f);\n+ int idx = astc::flt2int_rtn(vals[i] * 1.0f / 256.0f);\noutput[i] = color_quantization_tables[quantization_level][idx];\n}\nfor (i = 4; i < 6; i++)\n{\nint dummy;\n- int idx = (int)floor(vals[i] * 1.0f / 512.0f + 0.5f) + 128;\n+ int idx = astc::flt2int_rtn(vals[i] * 1.0f / 512.0f) + 128;\nquantize_and_unquantize_retain_top_two_bits(quantization_level, idx, &(output[i]), &dummy);\n}\n@@ -1580,8 +1574,8 @@ void quantize_hdr_rgb_ldr_alpha3(\nfloat a0 = astc::clamp255f(color0.w);\nfloat a1 = astc::clamp255f(color1.w);\n- int ai0 = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)];\n- int ai1 = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)];\n+ int ai0 = color_quantization_tables[quantization_level][astc::flt2int_rtn(a0)];\n+ int ai1 = color_quantization_tables[quantization_level][astc::flt2int_rtn(a1)];\noutput[6] = ai0;\noutput[7] = ai1;\n@@ -1604,8 +1598,8 @@ void quantize_hdr_luminance_large_range3(\nlum1 = avg;\n}\n- int ilum1 = static_cast < int >(floor(lum1 + 0.5f));\n- int ilum0 = static_cast < int >(floor(lum0 + 0.5f));\n+ int ilum1 = astc::flt2int_rtn(lum1);\n+ int ilum0 = astc::flt2int_rtn(lum0);\n// find the closest encodable point in the upper half of the code-point space\nint upper_v0 = (ilum0 + 128) >> 8;\n@@ -1682,8 +1676,8 @@ int try_quantize_hdr_luminance_small_range3(\nlum1 = avg;\n}\n- int ilum1 = static_cast < int >(floor(lum1 + 0.5f));\n- int ilum0 = static_cast < int >(floor(lum0 + 0.5f));\n+ int ilum1 = astc::flt2int_rtn(lum1);\n+ int ilum0 = astc::flt2int_rtn(lum0);\n// difference of more than a factor-of-2 results in immediate failure.\nif (ilum1 - ilum0 > 2048)\n@@ -1784,8 +1778,8 @@ void quantize_hdr_alpha3(\nelse if (alpha1 > 65280)\nalpha1 = 65280;\n- int ialpha0 = static_cast < int >(floor(alpha0 + 0.5f));\n- int ialpha1 = static_cast < int >(floor(alpha1 + 0.5f));\n+ int ialpha0 = astc::flt2int_rtn(alpha0);\n+ int ialpha1 = astc::flt2int_rtn(alpha1);\nint val0, val1, diffval;\nint v6, v7;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -141,9 +141,9 @@ static int realign_weights(\nint partition = pt->partition_of_texel[texel];\nweight_base = weight_base + 0.5f;\n- float plane_weight = floorf(weight_base );\n- float plane_up_weight = floorf(weight_base + uqw_next_dif * twf0) - plane_weight;\n- float plane_down_weight = floorf(weight_base + uqw_prev_dif * twf0) - plane_weight;\n+ float plane_weight = astc::flt2int_rd(weight_base);\n+ float plane_up_weight = astc::flt2int_rd(weight_base + uqw_next_dif * twf0) - plane_weight;\n+ float plane_down_weight = astc::flt2int_rd(weight_base + uqw_prev_dif * twf0) - plane_weight;\nfloat4 color_offset = offset[partition];\nfloat4 color_base = endpnt0f[partition];\n@@ -1167,26 +1167,31 @@ float compress_symbolic_block(\nfloat green = blk->orig_data[1];\nfloat blue = blk->orig_data[2];\nfloat alpha = blk->orig_data[3];\n+\nif (red < 0)\nred = 0;\nelse if (red > 1)\nred = 1;\n+\nif (green < 0)\ngreen = 0;\nelse if (green > 1)\ngreen = 1;\n+\nif (blue < 0)\nblue = 0;\nelse if (blue > 1)\nblue = 1;\n+\nif (alpha < 0)\nalpha = 0;\nelse if (alpha > 1)\nalpha = 1;\n- scb->constant_color[0] = (int)floor(red * 65535.0f + 0.5f);\n- scb->constant_color[1] = (int)floor(green * 65535.0f + 0.5f);\n- scb->constant_color[2] = (int)floor(blue * 65535.0f + 0.5f);\n- scb->constant_color[3] = (int)floor(alpha * 65535.0f + 0.5f);\n+\n+ scb->constant_color[0] = astc::flt2int_rtn(red * 65535.0f);\n+ scb->constant_color[1] = astc::flt2int_rtn(green * 65535.0f);\n+ scb->constant_color[2] = astc::flt2int_rtn(blue * 65535.0f);\n+ scb->constant_color[3] = astc::flt2int_rtn(alpha * 65535.0f);\n}\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -1087,7 +1087,7 @@ void compute_ideal_weights_for_decimation_table(\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_diagnostics)\n{\n- int blockdim = (int)floor(sqrt((float)it->num_texels) + 0.5f);\n+ int blockdim = astc::flt2int_rtn(sqrt((float)it->num_texels));\nprintf(\"%s : decimation from %d to %d weights\\n\\n\", __func__, it->num_texels, it->num_weights);\nprintf(\"Input weight set:\\n\");\nfor (i = 0; i < it->num_texels; i++)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_image_load_store.cpp",
"new_path": "Source/astc_image_load_store.cpp",
"diff": "@@ -822,10 +822,10 @@ void write_imageblock(\ndata[3] = 1.0f;\n// pack the data\n- int ri = static_cast < int >(floor(data[swz.r] * 255.0f + 0.5f));\n- int gi = static_cast < int >(floor(data[swz.g] * 255.0f + 0.5f));\n- int bi = static_cast < int >(floor(data[swz.b] * 255.0f + 0.5f));\n- int ai = static_cast < int >(floor(data[swz.a] * 255.0f + 0.5f));\n+ int ri = astc::flt2int_rtn(data[swz.r] * 255.0f);\n+ int gi = astc::flt2int_rtn(data[swz.g] * 255.0f);\n+ int bi = astc::flt2int_rtn(data[swz.b] * 255.0f);\n+ int ai = astc::flt2int_rtn(data[swz.a] * 255.0f);\nimg->data8[zi][yi][4 * xi] = ri;\nimg->data8[zi][yi][4 * xi + 1] = gi;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_weight_align.cpp",
"new_path": "Source/astc_weight_align.cpp",
"diff": "@@ -85,7 +85,7 @@ void prepare_angular_tables()\ncos_table[j][i] = static_cast<float>(cosf((2.0f * (float)M_PI / (SINCOS_STEPS - 1.0f)) * angular_steppings[i] * j));\n}\n- int p = static_cast < int >(floor(angular_steppings[i])) + 1;\n+ int p = astc::flt2int_rd(angular_steppings[i]) + 1;\nmax_angular_steps_needed_for_quant_steps[p] = MIN(i + 1, ANGULAR_STEPS - 1);\n}\n@@ -261,8 +261,8 @@ static void compute_lowest_and_highest_weight(\n{\nfloat wt = sample_weights[j];\nfloat sval = (samples[j] * rcp_stepsize) - scaled_offset;\n- int idxv = (int)(std::floor(sval + 0.5f));\n- float dif = sval - std::floor(sval + 0.5f);\n+ int idxv = astc::flt2int_rtn(sval);\n+ float dif = sval - astc::flt2int_rtn(sval);\nfloat dwt = dif * wt;\nerrval += dwt * dif;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Replace all uses of std:floor
|
61,745 |
19.01.2020 12:15:44
| 0 |
cea2e9e5172777f001c0d02c28ca3107c6524f2a
|
Add wrapper for float->floor
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -141,9 +141,9 @@ static int realign_weights(\nint partition = pt->partition_of_texel[texel];\nweight_base = weight_base + 0.5f;\n- float plane_weight = astc::flt2int_rd(weight_base);\n- float plane_up_weight = astc::flt2int_rd(weight_base + uqw_next_dif * twf0) - plane_weight;\n- float plane_down_weight = astc::flt2int_rd(weight_base + uqw_prev_dif * twf0) - plane_weight;\n+ float plane_weight = astc::flt_rd(weight_base);\n+ float plane_up_weight = astc::flt_rd(weight_base + uqw_next_dif * twf0) - plane_weight;\n+ float plane_down_weight = astc::flt_rd(weight_base + uqw_prev_dif * twf0) - plane_weight;\nfloat4 color_offset = offset[partition];\nfloat4 color_base = endpnt0f[partition];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_mathlib.h",
"new_path": "Source/astc_mathlib.h",
"diff": "@@ -257,6 +257,25 @@ static inline float flt_rte(float val)\n#endif\n}\n+/**\n+ * @brief SP float round-down.\n+ *\n+ * @param val The value to round.\n+ *\n+ * @return The rounded value.\n+ */\n+static inline float flt_rd(float val)\n+{\n+#if (ASTC_SSE >= 42) && USE_SCALAR_SSE\n+ const int flag = _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC;\n+ __m128 tmp = _mm_set_ss(val);\n+ tmp = _mm_round_ss(tmp, tmp, flag);\n+ return _mm_cvtss_f32(tmp);\n+#else\n+ return std::floor(val);\n+#endif\n+}\n+\n/**\n* @brief SP float round-to-nearest and convert to integer.\n*\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add wrapper for float->floor
|
61,745 |
20.01.2020 21:40:30
| 0 |
0d7a14aa393a0e59933a11183e2c1b7767b18753
|
Test suite update
Fix tests for sRGB to use "-ts", not "-t -srgb"
Enable 12x12 support in the test runner
Rebuild reference scores
|
[
{
"change_type": "MODIFY",
"old_path": "Test/Small_Images/astc_test_reference.csv",
"new_path": "Test/Small_Images/astc_test_reference.csv",
"diff": "Name,Block Size,PSNR (dB),Time (s)\nhdr-rgb-00,4x4,32.586,1.050\n-ldr-rgb-00,4x4,39.193,1.010\n-ldr-rgb-01,4x4,40.370,0.910\n-ldr-rgb-02,4x4,35.458,0.820\n-ldr-rgb-03,4x4,47.483,1.060\n+ldr-rgb-00,4x4,39.193,1.020\n+ldr-rgb-01,4x4,40.370,0.950\n+ldr-rgb-02,4x4,35.458,0.850\n+ldr-rgb-03,4x4,47.483,1.080\nldr-rgb-04,4x4,42.300,0.800\n-ldr-rgb-05,4x4,38.003,0.910\n-ldr-rgb-06,4x4,35.452,0.810\n-ldr-rgb-07,4x4,39.762,1.200\n-ldr-rgb-08,4x4,45.781,1.070\n-ldr-rgb-09,4x4,42.162,0.950\n-ldr-rgba-00,4x4,37.064,1.200\n-ldr-rgba-01,4x4,39.032,1.010\n-ldr-rgba-02,4x4,35.024,1.290\n-ldr-srgba-00,4x4,33.296,1.170\n-ldr-srgba-01,4x4,37.532,1.010\n-ldr-srgba-02,4x4,31.055,1.400\n-ldr-xy-00,4x4,34.063,0.880\n-ldr-xy-01,4x4,34.733,1.050\n-ldr-xy-02,4x4,54.330,1.260\n-hdr-rgb-00,5x5,27.739,1.190\n-ldr-rgb-00,5x5,35.387,1.250\n-ldr-rgb-01,5x5,36.544,1.110\n-ldr-rgb-02,5x5,31.189,1.040\n-ldr-rgb-03,5x5,44.547,1.210\n-ldr-rgb-04,5x5,37.947,0.960\n-ldr-rgb-05,5x5,33.761,1.130\n-ldr-rgb-06,5x5,31.156,0.980\n-ldr-rgb-07,5x5,36.717,1.410\n-ldr-rgb-08,5x5,42.299,1.340\n-ldr-rgb-09,5x5,37.709,1.030\n-ldr-rgba-00,5x5,33.490,1.370\n-ldr-rgba-01,5x5,35.381,1.200\n-ldr-rgba-02,5x5,31.184,1.760\n-ldr-srgba-00,5x5,30.281,1.450\n-ldr-srgba-01,5x5,34.163,1.240\n-ldr-srgba-02,5x5,27.373,1.780\n+ldr-rgb-05,4x4,38.003,0.900\n+ldr-rgb-06,4x4,35.452,0.770\n+ldr-rgb-07,4x4,39.762,1.150\n+ldr-rgb-08,4x4,45.781,1.120\n+ldr-rgb-09,4x4,42.162,0.900\n+ldr-rgba-00,4x4,37.064,1.130\n+ldr-rgba-01,4x4,39.032,0.970\n+ldr-rgba-02,4x4,35.024,1.300\n+ldr-srgba-00,4x4,37.052,1.150\n+ldr-srgba-01,4x4,39.063,1.010\n+ldr-srgba-02,4x4,35.029,1.310\n+ldr-xy-00,4x4,34.063,0.900\n+ldr-xy-01,4x4,34.733,1.060\n+ldr-xy-02,4x4,54.330,1.340\n+hdr-rgb-00,5x5,27.739,1.240\n+ldr-rgb-00,5x5,35.387,1.260\n+ldr-rgb-01,5x5,36.544,1.130\n+ldr-rgb-02,5x5,31.189,1.020\n+ldr-rgb-03,5x5,44.547,1.220\n+ldr-rgb-04,5x5,37.947,1.010\n+ldr-rgb-05,5x5,33.761,1.120\n+ldr-rgb-06,5x5,31.156,0.960\n+ldr-rgb-07,5x5,36.717,1.360\n+ldr-rgb-08,5x5,42.299,1.240\n+ldr-rgb-09,5x5,37.709,1.070\n+ldr-rgba-00,5x5,33.490,1.380\n+ldr-rgba-01,5x5,35.381,1.180\n+ldr-rgba-02,5x5,31.184,1.710\n+ldr-srgba-00,5x5,33.486,1.390\n+ldr-srgba-01,5x5,35.389,1.220\n+ldr-srgba-02,5x5,31.186,1.740\nldr-xy-00,5x5,33.898,0.820\nldr-xy-01,5x5,34.370,1.380\n-ldr-xy-02,5x5,51.346,1.630\n-hdr-rgb-00,6x6,25.086,1.190\n-ldr-rgb-00,6x6,32.739,1.590\n+ldr-xy-02,5x5,51.346,1.530\n+hdr-rgb-00,6x6,25.086,1.200\n+ldr-rgb-00,6x6,32.739,1.580\nldr-rgb-01,6x6,33.245,1.600\n-ldr-rgb-02,6x6,27.569,1.700\n+ldr-rgb-02,6x6,27.569,1.730\nldr-rgb-03,6x6,42.527,0.870\n-ldr-rgb-04,6x6,34.496,1.580\n-ldr-rgb-05,6x6,30.444,1.680\n-ldr-rgb-06,6x6,27.572,1.710\n-ldr-rgb-07,6x6,34.548,1.620\n+ldr-rgb-04,6x6,34.496,1.610\n+ldr-rgb-05,6x6,30.444,1.660\n+ldr-rgb-06,6x6,27.572,1.700\n+ldr-rgb-07,6x6,34.548,1.640\nldr-rgb-08,6x6,39.939,0.910\n-ldr-rgb-09,6x6,33.861,1.520\n-ldr-rgba-00,6x6,30.959,1.620\n+ldr-rgb-09,6x6,33.861,1.540\n+ldr-rgba-00,6x6,30.959,1.630\nldr-rgba-01,6x6,32.344,1.340\n-ldr-rgba-02,6x6,27.900,1.960\n-ldr-srgba-00,6x6,28.263,1.680\n-ldr-srgba-01,6x6,31.434,1.520\n-ldr-srgba-02,6x6,24.612,1.910\n-ldr-xy-00,6x6,33.530,0.660\n+ldr-rgba-02,6x6,27.900,1.980\n+ldr-srgba-00,6x6,30.960,1.670\n+ldr-srgba-01,6x6,32.351,1.350\n+ldr-srgba-02,6x6,27.901,2.090\n+ldr-xy-00,6x6,33.530,0.670\nldr-xy-01,6x6,33.740,1.230\nldr-xy-02,6x6,48.674,1.480\n-hdr-rgb-00,8x8,21.838,1.190\n-ldr-rgb-00,8x8,29.097,1.630\n-ldr-rgb-01,8x8,29.136,1.510\n-ldr-rgb-02,8x8,23.224,1.700\n-ldr-rgb-03,8x8,39.344,0.350\n-ldr-rgb-04,8x8,29.876,1.580\n-ldr-rgb-05,8x8,26.151,1.750\n-ldr-rgb-06,8x8,23.326,1.740\n-ldr-rgb-07,8x8,31.297,1.920\n-ldr-rgb-08,8x8,36.574,0.810\n-ldr-rgb-09,8x8,29.174,2.450\n-ldr-rgba-00,8x8,26.892,2.040\n-ldr-rgba-01,8x8,28.520,1.380\n-ldr-rgba-02,8x8,23.989,1.830\n-ldr-srgba-00,8x8,24.409,1.680\n-ldr-srgba-01,8x8,27.814,1.480\n-ldr-srgba-02,8x8,21.547,1.820\n-ldr-xy-00,8x8,32.378,0.650\n-ldr-xy-01,8x8,32.551,0.670\n+hdr-rgb-00,8x8,21.838,1.210\n+ldr-rgb-00,8x8,29.097,1.610\n+ldr-rgb-01,8x8,29.136,1.520\n+ldr-rgb-02,8x8,23.224,1.730\n+ldr-rgb-03,8x8,39.344,0.330\n+ldr-rgb-04,8x8,29.876,1.590\n+ldr-rgb-05,8x8,26.151,1.700\n+ldr-rgb-06,8x8,23.326,1.710\n+ldr-rgb-07,8x8,31.297,1.690\n+ldr-rgb-08,8x8,36.574,0.620\n+ldr-rgb-09,8x8,29.174,1.290\n+ldr-rgba-00,8x8,26.892,1.660\n+ldr-rgba-01,8x8,28.520,1.310\n+ldr-rgba-02,8x8,23.989,1.860\n+ldr-srgba-00,8x8,26.892,1.670\n+ldr-srgba-01,8x8,28.526,1.340\n+ldr-srgba-02,8x8,23.990,1.850\n+ldr-xy-00,8x8,32.378,0.680\n+ldr-xy-01,8x8,32.551,0.710\nldr-xy-02,8x8,44.944,0.640\n+hdr-rgb-00,12x12,19.001,1.100\n+ldr-rgb-00,12x12,25.125,1.730\n+ldr-rgb-01,12x12,25.285,1.750\n+ldr-rgb-02,12x12,19.360,1.680\n+ldr-rgb-03,12x12,35.796,0.280\n+ldr-rgb-04,12x12,25.099,1.450\n+ldr-rgb-05,12x12,21.804,1.650\n+ldr-rgb-06,12x12,19.395,1.700\n+ldr-rgb-07,12x12,27.271,1.520\n+ldr-rgb-08,12x12,32.702,0.530\n+ldr-rgb-09,12x12,24.409,1.280\n+ldr-rgba-00,12x12,22.417,1.620\n+ldr-rgba-01,12x12,24.833,1.250\n+ldr-rgba-02,12x12,20.265,1.380\n+ldr-srgba-00,12x12,22.417,1.640\n+ldr-srgba-01,12x12,24.835,1.300\n+ldr-srgba-02,12x12,20.265,1.400\n+ldr-xy-00,12x12,29.981,0.750\n+ldr-xy-01,12x12,30.515,0.480\n+ldr-xy-02,12x12,39.699,0.160\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_run.py",
"new_path": "Test/astc_test_run.py",
"diff": "@@ -21,7 +21,7 @@ import sys\nLOG_CLI = False\n-TEST_BLOCK_SIZES = [\"4x4\", \"5x5\", \"6x6\", \"8x8\"]\n+TEST_BLOCK_SIZES = [\"4x4\", \"5x5\", \"6x6\", \"8x8\", \"12x12\"]\nTEST_EXTENSIONS = [\".png\", \".hdr\"]\nclass TestReference():\n@@ -120,17 +120,20 @@ class TestImage():\noutFile = pathParts[3].replace(\".png\", \"-out.png\")\noutFilePath2 = os.path.join(outDir, outFile)\n+ # Switch sRGB images into sRGB mode\n+ if self.format in (\"srgb\", \"srgba\"):\n+ opmode = \"-ts\"\n+ else:\n+ opmode = \"-t\"\n+\n# Run the compressor\n- args = [testBinary, \"-t\", self.filePath, outFilePath,\n+ args = [testBinary, opmode, self.filePath, outFilePath,\nblockSize, \"-thorough\", \"-time\", \"-showpsnr\", \"-silentmode\"]\n# Switch normal maps into angular error metrics\nif self.format == \"xy\":\nargs.append(\"-normal_psnr\")\n- # Switch sRGB images into sRGB mode\n- if self.format == \"srgba\":\n- args.append(\"-srgb\")\n# Switch HDR data formats into HDR compression mode; note that this\n# mode assumes that the alpha channel is non-correlated\n@@ -448,7 +451,7 @@ def run_reference_rebuild(args, testSet, testRef):\n# Run the test\ndat = (curCount, maxCount, test.name, blockSize)\nprint(\"Running %u/%u: %s @ %s\" % dat)\n- test.run(binary, blockSize)\n+ test.run(binary, blockSize, 0)\nrunPSNR = \"%0.3f\" % test.runPSNR[blockSize]\nrunTime = \"%0.3f\" % test.runTime[blockSize]\n@@ -497,7 +500,7 @@ def run_reference_update(args, testSet, testRef):\nelse:\ndat = (curCount, maxCount, test.name, blockSize)\nprint(\"Running %u/%u: %s @ %s\" % dat)\n- test.run(binary, blockSize)\n+ test.run(binary, blockSize, 0)\nrunPSNR = \"%0.3f\" % test.runPSNR[blockSize]\nrunTime = \"%0.3f\" % test.runTime[blockSize]\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Test suite update
- Fix tests for sRGB to use "-ts", not "-t -srgb"
- Enable 12x12 support in the test runner
- Rebuild reference scores
|
61,745 |
20.01.2020 22:15:56
| 0 |
5330553812ffbd0161eed5b3f6961e482a1aa099
|
Fix PRNG code returning negative array offsets
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_block_sizes2.cpp",
"new_path": "Source/astc_block_sizes2.cpp",
"diff": "@@ -690,7 +690,8 @@ static void construct_block_size_descriptor_2d(\nint arr_elements_set = 0;\nwhile (arr_elements_set < 64)\n{\n- int idx = ((int)astc::rand(rng_state)) % (xdim * ydim);\n+ unsigned int idx = (unsigned int)astc::rand(rng_state);\n+ idx %= xdim * ydim;\nif (arr[idx] == 0)\n{\narr_elements_set++;\n@@ -855,7 +856,8 @@ static void construct_block_size_descriptor_3d(\nint arr_elements_set = 0;\nwhile (arr_elements_set < 64)\n{\n- int idx = ((int)astc::rand(rng_state)) % (xdim * ydim * zdim);\n+ unsigned int idx = (unsigned int)astc::rand(rng_state);\n+ idx %= xdim * ydim * zdim;\nif (arr[idx] == 0)\n{\narr_elements_set++;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix PRNG code returning negative array offsets
|
61,745 |
22.01.2020 22:26:04
| 0 |
d30af45cd50334f2e5b289b3657f5e469bdae0ff
|
Add basic 3D image support to test suite
|
[
{
"change_type": "ADD",
"old_path": "Test/Small_Images/LDR-3DL/ldr-l-00-s3.dds",
"new_path": "Test/Small_Images/LDR-3DL/ldr-l-00-s3.dds",
"diff": "Binary files /dev/null and b/Test/Small_Images/LDR-3DL/ldr-l-00-s3.dds differ\n"
},
{
"change_type": "ADD",
"old_path": "Test/Small_Images/LDR-3DL/ldr-l-01-3.dds",
"new_path": "Test/Small_Images/LDR-3DL/ldr-l-01-3.dds",
"diff": "Binary files /dev/null and b/Test/Small_Images/LDR-3DL/ldr-l-01-3.dds differ\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Small_Images/astc_test_reference.csv",
"new_path": "Test/Small_Images/astc_test_reference.csv",
"diff": "Name,Block Size,PSNR (dB),Time (s)\n-hdr-rgb-00,4x4,32.586,1.050\n+hdr-rgb-00,4x4,32.586,1.070\nldr-rgb-00,4x4,39.193,1.020\n-ldr-rgb-01,4x4,40.370,0.950\n-ldr-rgb-02,4x4,35.458,0.850\n-ldr-rgb-03,4x4,47.483,1.080\n-ldr-rgb-04,4x4,42.300,0.800\n-ldr-rgb-05,4x4,38.003,0.900\n-ldr-rgb-06,4x4,35.452,0.770\n-ldr-rgb-07,4x4,39.762,1.150\n-ldr-rgb-08,4x4,45.781,1.120\n-ldr-rgb-09,4x4,42.162,0.900\n-ldr-rgba-00,4x4,37.064,1.130\n-ldr-rgba-01,4x4,39.032,0.970\n-ldr-rgba-02,4x4,35.024,1.300\n-ldr-srgba-00,4x4,37.052,1.150\n-ldr-srgba-01,4x4,39.063,1.010\n-ldr-srgba-02,4x4,35.029,1.310\n-ldr-xy-00,4x4,34.063,0.900\n-ldr-xy-01,4x4,34.733,1.060\n-ldr-xy-02,4x4,54.330,1.340\n-hdr-rgb-00,5x5,27.739,1.240\n-ldr-rgb-00,5x5,35.387,1.260\n-ldr-rgb-01,5x5,36.544,1.130\n-ldr-rgb-02,5x5,31.189,1.020\n-ldr-rgb-03,5x5,44.547,1.220\n-ldr-rgb-04,5x5,37.947,1.010\n-ldr-rgb-05,5x5,33.761,1.120\n-ldr-rgb-06,5x5,31.156,0.960\n-ldr-rgb-07,5x5,36.717,1.360\n-ldr-rgb-08,5x5,42.299,1.240\n-ldr-rgb-09,5x5,37.709,1.070\n-ldr-rgba-00,5x5,33.490,1.380\n-ldr-rgba-01,5x5,35.381,1.180\n-ldr-rgba-02,5x5,31.184,1.710\n-ldr-srgba-00,5x5,33.486,1.390\n-ldr-srgba-01,5x5,35.389,1.220\n-ldr-srgba-02,5x5,31.186,1.740\n-ldr-xy-00,5x5,33.898,0.820\n-ldr-xy-01,5x5,34.370,1.380\n-ldr-xy-02,5x5,51.346,1.530\n-hdr-rgb-00,6x6,25.086,1.200\n-ldr-rgb-00,6x6,32.739,1.580\n-ldr-rgb-01,6x6,33.245,1.600\n-ldr-rgb-02,6x6,27.569,1.730\n-ldr-rgb-03,6x6,42.527,0.870\n-ldr-rgb-04,6x6,34.496,1.610\n-ldr-rgb-05,6x6,30.444,1.660\n-ldr-rgb-06,6x6,27.572,1.700\n-ldr-rgb-07,6x6,34.548,1.640\n-ldr-rgb-08,6x6,39.939,0.910\n-ldr-rgb-09,6x6,33.861,1.540\n+ldr-rgb-01,4x4,40.370,0.920\n+ldr-rgb-02,4x4,35.458,0.824\n+ldr-rgb-03,4x4,47.483,1.084\n+ldr-rgb-04,4x4,42.300,0.826\n+ldr-rgb-05,4x4,38.003,0.916\n+ldr-rgb-06,4x4,35.452,0.776\n+ldr-rgb-07,4x4,39.762,1.160\n+ldr-rgb-08,4x4,45.781,1.074\n+ldr-rgb-09,4x4,42.162,0.902\n+ldr-rgba-00,4x4,37.064,1.124\n+ldr-rgba-01,4x4,39.032,0.974\n+ldr-rgba-02,4x4,35.024,1.322\n+ldr-srgba-00,4x4,37.052,1.116\n+ldr-srgba-01,4x4,39.063,0.982\n+ldr-srgba-02,4x4,35.029,1.322\n+ldr-xy-00,4x4,34.063,0.902\n+ldr-xy-01,4x4,34.733,1.126\n+ldr-xy-02,4x4,54.330,1.272\n+hdr-rgb-00,5x5,27.739,1.198\n+ldr-rgb-00,5x5,35.387,1.264\n+ldr-rgb-01,5x5,36.544,1.116\n+ldr-rgb-02,5x5,31.189,1.024\n+ldr-rgb-03,5x5,44.547,1.204\n+ldr-rgb-04,5x5,37.947,0.978\n+ldr-rgb-05,5x5,33.761,1.130\n+ldr-rgb-06,5x5,31.156,0.972\n+ldr-rgb-07,5x5,36.717,1.398\n+ldr-rgb-08,5x5,42.299,1.272\n+ldr-rgb-09,5x5,37.709,1.038\n+ldr-rgba-00,5x5,33.490,1.382\n+ldr-rgba-01,5x5,35.381,1.190\n+ldr-rgba-02,5x5,31.184,1.732\n+ldr-srgba-00,5x5,33.486,1.396\n+ldr-srgba-01,5x5,35.389,1.198\n+ldr-srgba-02,5x5,31.186,1.748\n+ldr-xy-00,5x5,33.898,0.804\n+ldr-xy-01,5x5,34.370,1.366\n+ldr-xy-02,5x5,51.346,1.514\n+hdr-rgb-00,6x6,25.086,1.212\n+ldr-rgb-00,6x6,32.739,1.594\n+ldr-rgb-01,6x6,33.245,1.576\n+ldr-rgb-02,6x6,27.569,1.704\n+ldr-rgb-03,6x6,42.527,0.878\n+ldr-rgb-04,6x6,34.496,1.622\n+ldr-rgb-05,6x6,30.444,1.684\n+ldr-rgb-06,6x6,27.572,1.688\n+ldr-rgb-07,6x6,34.548,1.650\n+ldr-rgb-08,6x6,39.939,0.930\n+ldr-rgb-09,6x6,33.861,1.566\nldr-rgba-00,6x6,30.959,1.630\n-ldr-rgba-01,6x6,32.344,1.340\n-ldr-rgba-02,6x6,27.900,1.980\n-ldr-srgba-00,6x6,30.960,1.670\n-ldr-srgba-01,6x6,32.351,1.350\n-ldr-srgba-02,6x6,27.901,2.090\n-ldr-xy-00,6x6,33.530,0.670\n-ldr-xy-01,6x6,33.740,1.230\n-ldr-xy-02,6x6,48.674,1.480\n-hdr-rgb-00,8x8,21.838,1.210\n-ldr-rgb-00,8x8,29.097,1.610\n-ldr-rgb-01,8x8,29.136,1.520\n-ldr-rgb-02,8x8,23.224,1.730\n+ldr-rgba-01,6x6,32.344,1.312\n+ldr-rgba-02,6x6,27.900,1.966\n+ldr-srgba-00,6x6,30.960,1.638\n+ldr-srgba-01,6x6,32.351,1.332\n+ldr-srgba-02,6x6,27.901,1.940\n+ldr-xy-00,6x6,33.530,0.678\n+ldr-xy-01,6x6,33.740,1.210\n+ldr-xy-02,6x6,48.674,1.470\n+hdr-rgb-00,8x8,21.838,1.146\n+ldr-rgb-00,8x8,29.097,1.648\n+ldr-rgb-01,8x8,29.136,1.546\n+ldr-rgb-02,8x8,23.224,1.728\nldr-rgb-03,8x8,39.344,0.330\n-ldr-rgb-04,8x8,29.876,1.590\n-ldr-rgb-05,8x8,26.151,1.700\n-ldr-rgb-06,8x8,23.326,1.710\n-ldr-rgb-07,8x8,31.297,1.690\n-ldr-rgb-08,8x8,36.574,0.620\n-ldr-rgb-09,8x8,29.174,1.290\n-ldr-rgba-00,8x8,26.892,1.660\n-ldr-rgba-01,8x8,28.520,1.310\n-ldr-rgba-02,8x8,23.989,1.860\n-ldr-srgba-00,8x8,26.892,1.670\n-ldr-srgba-01,8x8,28.526,1.340\n-ldr-srgba-02,8x8,23.990,1.850\n-ldr-xy-00,8x8,32.378,0.680\n-ldr-xy-01,8x8,32.551,0.710\n-ldr-xy-02,8x8,44.944,0.640\n-hdr-rgb-00,12x12,19.001,1.100\n-ldr-rgb-00,12x12,25.125,1.730\n-ldr-rgb-01,12x12,25.285,1.750\n-ldr-rgb-02,12x12,19.360,1.680\n-ldr-rgb-03,12x12,35.796,0.280\n-ldr-rgb-04,12x12,25.099,1.450\n-ldr-rgb-05,12x12,21.804,1.650\n-ldr-rgb-06,12x12,19.395,1.700\n-ldr-rgb-07,12x12,27.271,1.520\n-ldr-rgb-08,12x12,32.702,0.530\n-ldr-rgb-09,12x12,24.409,1.280\n-ldr-rgba-00,12x12,22.417,1.620\n-ldr-rgba-01,12x12,24.833,1.250\n-ldr-rgba-02,12x12,20.265,1.380\n-ldr-srgba-00,12x12,22.417,1.640\n-ldr-srgba-01,12x12,24.835,1.300\n-ldr-srgba-02,12x12,20.265,1.400\n-ldr-xy-00,12x12,29.981,0.750\n-ldr-xy-01,12x12,30.515,0.480\n-ldr-xy-02,12x12,39.699,0.160\n+ldr-rgb-04,8x8,29.876,1.574\n+ldr-rgb-05,8x8,26.151,1.712\n+ldr-rgb-06,8x8,23.326,1.728\n+ldr-rgb-07,8x8,31.297,1.606\n+ldr-rgb-08,8x8,36.574,0.636\n+ldr-rgb-09,8x8,29.174,1.314\n+ldr-rgba-00,8x8,26.892,1.688\n+ldr-rgba-01,8x8,28.520,1.300\n+ldr-rgba-02,8x8,23.989,1.828\n+ldr-srgba-00,8x8,26.892,1.710\n+ldr-srgba-01,8x8,28.526,1.306\n+ldr-srgba-02,8x8,23.990,1.842\n+ldr-xy-00,8x8,32.378,0.676\n+ldr-xy-01,8x8,32.551,0.686\n+ldr-xy-02,8x8,44.944,0.624\n+hdr-rgb-00,12x12,19.001,1.092\n+ldr-rgb-00,12x12,25.125,1.584\n+ldr-rgb-01,12x12,25.285,1.396\n+ldr-rgb-02,12x12,19.360,1.686\n+ldr-rgb-03,12x12,35.796,0.282\n+ldr-rgb-04,12x12,25.099,1.528\n+ldr-rgb-05,12x12,21.804,1.638\n+ldr-rgb-06,12x12,19.395,1.674\n+ldr-rgb-07,12x12,27.271,1.552\n+ldr-rgb-08,12x12,32.702,0.576\n+ldr-rgb-09,12x12,24.409,1.286\n+ldr-rgba-00,12x12,22.417,1.600\n+ldr-rgba-01,12x12,24.833,1.238\n+ldr-rgba-02,12x12,20.265,1.362\n+ldr-srgba-00,12x12,22.417,1.632\n+ldr-srgba-01,12x12,24.835,1.240\n+ldr-srgba-02,12x12,20.265,1.374\n+ldr-xy-00,12x12,29.981,0.738\n+ldr-xy-01,12x12,30.515,0.492\n+ldr-xy-02,12x12,39.699,0.166\n+ldr-l-00,3x3x3,52.595,0.390\n+ldr-l-01,3x3x3,55.732,0.162\n+ldr-l-00,6x6x6,33.245,0.734\n+ldr-l-01,6x6x6,42.307,0.142\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_run.py",
"new_path": "Test/astc_test_run.py",
"diff": "@@ -21,8 +21,9 @@ import sys\nLOG_CLI = False\n-TEST_BLOCK_SIZES = [\"4x4\", \"5x5\", \"6x6\", \"8x8\", \"12x12\"]\n-TEST_EXTENSIONS = [\".png\", \".hdr\"]\n+TEST_BLOCK_SIZES = [\"4x4\", \"5x5\", \"6x6\", \"8x8\", \"12x12\",\n+ \"3x3x3\", \"6x6x6\"]\n+TEST_EXTENSIONS = [\".png\", \".hdr\", \".dds\"]\nclass TestReference():\n\"\"\"\n@@ -58,6 +59,7 @@ class TestImage():\nself.useLevel = [\"all\"]\nself.useFormat = [\"all\"]\nself.useRange = [\"all\"]\n+ self.is2D = True\n# Tokenize the file name\nnameParts = self.name.split(\"-\")\n@@ -67,6 +69,8 @@ class TestImage():\nself.useLevel.append(\"smoke\")\nif \"x\" in nameParts[3]:\nself.useLevel = []\n+ if \"3\" in nameParts[3]:\n+ self.is2D = False\n# Name of the test excludes flags from the file name\nself.name = \"-\".join(nameParts[0:3])\n@@ -98,7 +102,7 @@ class TestImage():\nself.runPSNR = dict()\nself.status = dict()\n- def run_once(self, testBinary, blockSize, firstRun):\n+ def run_once(self, testBinary, blockSize, firstRun, rebuild):\n\"\"\"\nRun a single compression pass.\n\"\"\"\n@@ -123,6 +127,8 @@ class TestImage():\n# Switch sRGB images into sRGB mode\nif self.format in (\"srgb\", \"srgba\"):\nopmode = \"-ts\"\n+ elif self.dynamicRange == \"ldr\":\n+ opmode = \"-tl\"\nelse:\nopmode = \"-t\"\n@@ -142,6 +148,11 @@ class TestImage():\nif LOG_CLI:\nprint(\" + %s \" % \" \".join(args))\n+ # For reference runs we need to translate the command line back\n+ # to the old format\n+ if rebuild:\n+ args = self.rewrite_args_for_old_cli(args)\n+\ntry:\nresult = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\ncheck=True, universal_newlines=True)\n@@ -151,25 +162,26 @@ class TestImage():\nsys.exit(1)\n# Convert the TGA to PNG and delete the TGA (LDR only)\n- if self.dynamicRange == \"ldr\":\n+ if self.dynamicRange == \"ldr\" and self.is2D:\nim = Image.open(outFilePath)\nim.save(outFilePath2)\nos.remove(outFilePath)\n+\n# TODO: Convert the HTGA to EXR or HDR (HDR only)\n# Create log parsing patterns\nif self.dynamicRange == \"ldr\":\n- if self.format in (\"rgb\", \"xy\"):\n+ if self.format in (\"rgb\", \"xy\", \"l\"):\npatternPSNR = r\"PSNR \\(LDR-RGB\\):\\s*([0-9.]*) dB\"\nelif self.format in (\"srgba\", \"rgba\"):\npatternPSNR = r\"PSNR \\(LDR-RGBA\\):\\s*([0-9.]*) dB\"\nelse:\nassert False, \"Unsupported LDR color format %s\" % self.format\nelse:\n- patternPSNR = r\"mPSNR \\(RGB\\):\\s*([0-9.]*) dB .*\"\n+ patternPSNR = r\"mPSNR \\(RGB\\)(?: \\[.*?\\] )?:\\s*([0-9.]*) dB.*\"\npatternPSNR = re.compile(patternPSNR)\n- patternTime = re.compile(\"Coding time:\\s*([0-9.]*) s\")\n+ patternTime = re.compile(\".*[Cc]oding time:\\s*([0-9.]*) s.*\")\n# Extract results from the log\nrunPSNR = None\n@@ -189,7 +201,27 @@ class TestImage():\nreturn (runPSNR, runTime)\n- def run(self, testBinary, blockSize, failureDiff):\n+ def rewrite_args_for_old_cli(self, args):\n+ replacements = [\n+ (\"-silent\", \"-silentmode\")\n+ ]\n+\n+ extensions = [\n+ (\"-t\", (\"-showpsnr\", \"-time\")),\n+ (\"-tl\", (\"-showpsnr\", \"-time\")),\n+ (\"-ts\", (\"-showpsnr\", \"-time\"))\n+ ]\n+\n+ for new, old in replacements:\n+ args = [old if x == new else x for x in args]\n+\n+ for new, exts in extensions:\n+ if new in args:\n+ args.extend(exts)\n+\n+ return args\n+\n+ def run(self, testBinary, blockSize, failureDiff, rebuild=False):\n\"\"\"\nRun the test scenario including N warmup passes and M run passes.\n@@ -197,10 +229,10 @@ class TestImage():\n\"\"\"\nresults = []\nfor i in range(0, self.warmupRuns):\n- self.run_once(testBinary, blockSize, False)\n+ self.run_once(testBinary, blockSize, False, rebuild)\nfor i in range(0, self.testRuns):\n- result = self.run_once(testBinary, blockSize, i == 0)\n+ result = self.run_once(testBinary, blockSize, i == 0, rebuild)\nresults.append(result)\nlistPSNR, timeList = list(zip(*results))\n@@ -220,14 +252,10 @@ class TestImage():\nrefTime = float(self.referenceTime[blockSize])\nspeedup = ((refTime / self.runTime[blockSize]) - 1.0) * 100.0\n-\n- # Pass if PSNR matches to 3dp rounding\n- if float(\"%0.3f\" % listPSNR[0]) == self.referencePSNR[blockSize]:\n- self.status[blockSize] = \"pass | \"\n- # Pass if PSNR is better\n- elif (listPSNR[0] >= refPSNR) or (diffPSNR >= failureDiff):\n+ # Pass if PSNR is better or above threshold\n+ if (listPSNR[0] >= refPSNR) or (diffPSNR >= failureDiff):\nself.status[blockSize] = \"pass | PSNR % 0.3f dB\" % diffPSNR\n- # Else we got worse so it's a fail ...\n+ # Else we got worse by at least threshold so it's a fail ...\nelse:\nself.status[blockSize] = \"fail | PSNR % 0.3f dB\" % diffPSNR\n@@ -235,7 +263,7 @@ class TestImage():\ndef skip_run(self, blockSize):\n\"\"\"\n- Skip the test scenario, but proagate results from reference.\n+ Skip the test scenario, but propagate results from reference\n\"\"\"\nself.runPSNR[blockSize] = self.referencePSNR[blockSize]\nself.runTime[blockSize] = self.referenceTime[blockSize]\n@@ -349,16 +377,23 @@ def run_tests(args, testSet, testRef, failureDiff):\nsuite = None\nsuiteFormat = None\n- # Run tests\n- maxCount = len(args.testBlockSize) * len(testList)\n- curCount = 0\n-\nstatRun = 0\nstatSkip = 0\nstatPass = 0\n- for blockSize in args.testBlockSize:\n+ # Build a list of valid pairings of block size and test\n+ tests = []\n+ for blockSize in TEST_BLOCK_SIZES:\nfor test in testList:\n+ is2DBlock = (blockSize.count(\"x\") == 1)\n+ is2DTest = test.is2D\n+ if is2DBlock == is2DTest:\n+ tests.append((blockSize, test))\n+\n+ maxCount = len(tests)\n+ curCount = 0\n+\n+ for blockSize, test in tests:\ncurCount += 1\n# Skip tests not enabled for the current testing throughness level\n@@ -423,54 +458,41 @@ def run_tests(args, testSet, testRef, failureDiff):\njuxml.TestSuite.to_file(fileHandle, suites)\n-def run_reference_rebuild(args, testSet, testRef):\n- \"\"\"\n- Run the reference test generator rebuild process.\n- \"\"\"\n- TestImage.testRuns = args.testRepeats\n- TestImage.warmupRuns = args.testWarmups\n-\n- # Delete and recreate test output location\n- if os.path.exists(\"TestOutput\"):\n- shutil.rmtree(\"TestOutput\")\n- os.mkdir(\"TestOutput\")\n- # Load test resources\n- binary = get_reference_binary()\n- testList = get_test_listing(None, testSet)\n+def run_rebuild(binary, testList, canSkip):\n+ # Build a list of valid pairings of block size and test\n+ tests = []\n+ for blockSize in TEST_BLOCK_SIZES:\n+ for test in testList:\n+ is2DBlock = (blockSize.count(\"x\") == 1)\n+ is2DTest = test.is2D\n+ if is2DBlock == is2DTest:\n+ tests.append((blockSize, test))\n- # Run tests\n- maxCount = len(TEST_BLOCK_SIZES) * len(testList)\ncurCount = 0\n+ maxCount = len(tests)\n- for blockSize in TEST_BLOCK_SIZES:\n- for test in testList:\n+ for blockSize, test in tests:\ncurCount += 1\n+ if canSkip and (blockSize in test.referencePSNR):\n+ dat = (curCount, maxCount, test.name, blockSize)\n+ print(\"Skipping %u/%u: %s @ %s\" % dat)\n+ test.skip_run(blockSize)\n+ else:\n# Run the test\ndat = (curCount, maxCount, test.name, blockSize)\nprint(\"Running %u/%u: %s @ %s\" % dat)\n- test.run(binary, blockSize, 0)\n+ test.run(binary, blockSize, 0, True)\nrunPSNR = \"%0.3f\" % test.runPSNR[blockSize]\nrunTime = \"%0.3f\" % test.runTime[blockSize]\nprint(\" + %s dB / %s s\" % (runPSNR, runTime))\n- # Write CSV\n- with open(testRef, \"w\", newline=\"\") as fileHandle:\n- writer = csv.writer(fileHandle)\n- writer.writerow([\"Name\", \"Block Size\", \"PSNR (dB)\", \"Time (s)\"])\n- for blockSize in TEST_BLOCK_SIZES:\n- for test in testList:\n- row = (test.name, blockSize,\n- \"%0.3f\" % test.runPSNR[blockSize],\n- \"%0.3f\" % test.runTime[blockSize])\n- writer.writerow(row)\n-\n-def run_reference_update(args, testSet, testRef):\n+def run_reference_rebuild(args, testSet, testRef, canSkip=False):\n\"\"\"\n- Run the reference test generator update process.\n+ Run the reference test generator rebuild process.\n\"\"\"\nTestImage.testRuns = args.testRepeats\nTestImage.warmupRuns = args.testWarmups\n@@ -482,28 +504,12 @@ def run_reference_update(args, testSet, testRef):\n# Load test resources\nbinary = get_reference_binary()\n- reference = get_test_reference_scores(testRef)\n- testList = get_test_listing(reference, testSet, True)\n-\n- # Run tests\n- maxCount = len(TEST_BLOCK_SIZES) * len(testList)\n- curCount = 0\n-\n- for blockSize in TEST_BLOCK_SIZES:\n- for test in testList:\n- curCount += 1\n- if blockSize in test.referencePSNR:\n- dat = (curCount, maxCount, test.name, blockSize)\n- print(\"Skipping %u/%u: %s @ %s\" % dat)\n- test.skip_run(blockSize)\n- else:\n- dat = (curCount, maxCount, test.name, blockSize)\n- print(\"Running %u/%u: %s @ %s\" % dat)\n- test.run(binary, blockSize, 0)\n+ refData = None\n+ if canSkip:\n+ refData = get_test_reference_scores(testRef)\n+ testList = get_test_listing(refData, testSet, refData != None)\n- runPSNR = \"%0.3f\" % test.runPSNR[blockSize]\n- runTime = \"%0.3f\" % test.runTime[blockSize]\n- print(\" + %s dB / %s s\" % (runPSNR, runTime))\n+ run_rebuild(binary, testList, canSkip)\n# Write CSV\nwith open(testRef, \"w\", newline=\"\") as fileHandle:\n@@ -511,9 +517,15 @@ def run_reference_update(args, testSet, testRef):\nwriter.writerow([\"Name\", \"Block Size\", \"PSNR (dB)\", \"Time (s)\"])\nfor blockSize in TEST_BLOCK_SIZES:\nfor test in testList:\n+ is2DBlock = (blockSize.count(\"x\") == 1)\n+ is2DTest = test.is2D\n+ if is2DBlock != is2DTest:\n+ continue\n+\nrow = (test.name, blockSize,\n\"%0.3f\" % test.runPSNR[blockSize],\n\"%0.3f\" % test.runTime[blockSize])\n+\nwriter.writerow(row)\n@@ -521,7 +533,6 @@ def parse_command_line():\n\"\"\"\nParse the command line.\n\"\"\"\n-\nparser = argparse.ArgumentParser()\nparser.add_argument(\"--test-level\", dest=\"testLevel\", default=\"smoke\",\n@@ -582,7 +593,7 @@ def main():\nif args.refRebuild:\nrun_reference_rebuild(args, imageSet, testRef)\nelif args.refUpdate:\n- run_reference_update(args, imageSet, testRef)\n+ run_reference_rebuild(args, imageSet, testRef, True)\nelse:\nrun_tests(args, imageSet, testRef, args.failureDiff)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add basic 3D image support to test suite
|
61,745 |
22.01.2020 22:50:38
| 0 |
c98d85d30b3571dd1290bd63119eb4c38caa8b4b
|
Add support for new CLI to run helper
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_run.py",
"new_path": "Test/astc_run.py",
"diff": "@@ -37,7 +37,27 @@ class TestImage():\nself.dynamicRange = nameParts[0]\nself.format = nameParts[1]\n- def run_once(self, testBinary, blockSize, profile, verbose=False):\n+ def rewrite_args_for_old_cli(self, args):\n+ replacements = [\n+ (\"-silent\", \"-silentmode\")\n+ ]\n+\n+ extensions = [\n+ (\"-t\", (\"-showpsnr\", \"-time\")),\n+ (\"-tl\", (\"-showpsnr\", \"-time\")),\n+ (\"-ts\", (\"-showpsnr\", \"-time\"))\n+ ]\n+\n+ for new, old in replacements:\n+ args = [old if x == new else x for x in args]\n+\n+ for new, exts in extensions:\n+ if new in args:\n+ args.extend(exts)\n+\n+ return args\n+\n+ def run_once(self, testBinary, blockSize, profile, verbose, newCLI):\n\"\"\"\nRun a single compression pass.\n\"\"\"\n@@ -57,18 +77,22 @@ class TestImage():\noutFile = pathParts[-1].replace(\".png\", \"-out.png\")\noutFilePath2 = os.path.join(outDir, outFile)\n+ # Switch sRGB images into sRGB mode\n+ if self.format in (\"srgb\", \"srgba\"):\n+ opmode = \"-ts\"\n+ elif self.dynamicRange == \"ldr\":\n+ opmode = \"-tl\"\n+ else:\n+ opmode = \"-t\"\n+\n# Run the compressor\n- args = [testBinary, \"-t\", self.filePath, outFilePath,\n- blockSize, \"-thorough\", \"-time\", \"-showpsnr\", \"-silentmode\"]\n+ args = [testBinary, opmode, self.filePath, outFilePath,\n+ blockSize, \"-thorough\", \"-silent\"]\n# Switch normal maps into angular error metrics\nif self.format == \"xy\":\nargs.append(\"-normal_psnr\")\n- # Switch sRGB images into sRGB mode\n- if self.format == \"srgba\":\n- args.append(\"-srgb\")\n-\n# Switch HDR data formats into HDR compression mode; note that this\n# mode assumes that the alpha channel is non-correlated\nif self.dynamicRange == \"hdr\":\n@@ -90,6 +114,10 @@ class TestImage():\nif os.path.exists(\"callgrind.png\"):\nos.remove(\"callgrind.png\")\n+\n+ if not newCLI:\n+ args = self.rewrite_args_for_old_cli(args)\n+\ntry:\nresult = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE,\ncheck=True, universal_newlines=True)\n@@ -112,17 +140,17 @@ class TestImage():\n# Create log parsing patterns\nif self.dynamicRange == \"ldr\":\n- if self.format in (\"rgb\", \"xy\"):\n- patternPSNR = \"PSNR \\\\(LDR-RGB\\\\): ([0-9.]*) dB\"\n+ if self.format in (\"rgb\", \"xy\", \"l\"):\n+ patternPSNR = r\"PSNR \\(LDR-RGB\\):\\s*([0-9.]*) dB\"\nelif self.format in (\"srgba\", \"rgba\"):\n- patternPSNR = \"PSNR \\\\(LDR-RGBA\\\\): ([0-9.]*) dB\"\n+ patternPSNR = r\"PSNR \\(LDR-RGBA\\):\\s*([0-9.]*) dB\"\nelse:\nassert False, \"Unsupported LDR color format %s\" % self.format\nelse:\npatternPSNR = r\"mPSNR \\(RGB\\) .*: ([0-9.]*) dB\"\npatternPSNR = re.compile(patternPSNR)\n- patternTime = re.compile(\".*: ([0-9.]*) .*: ([0-9.]*)\")\n+ patternTime = re.compile(\".*[Cc]oding time:\\s*([0-9.]*) s.*\")\n# Extract results from the log\nrunPSNR = None\n@@ -136,7 +164,7 @@ class TestImage():\nmatch = patternTime.match(line)\nif match:\nallTime = float(match.group(1))\n- runTime = float(match.group(2))\n+ runTime = float(match.group(1))\n# Convert the callgrind log to an image\nif profile:\n@@ -249,7 +277,8 @@ def main():\ncodeTimes = []\nfor _ in range(0, args.testRepeats + args.testWarmups):\npsnr, codeSecs, allSecs, output = \\\n- image.run_once(app, args.block, args.profile, args.verbose)\n+ image.run_once(app, args.block, args.profile, args.verbose,\n+ args.useBinary == \"new\")\ncodeTimes.append(codeSecs)\nallTimes.append(allSecs)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add support for new CLI to run helper
|
61,745 |
22.01.2020 22:51:01
| 0 |
144609137809c7f1190a07680b82c0e5540e65e7
|
Move all dbg tools under DEBUG_PRINT_DIAGNOSTICS
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -57,10 +57,10 @@ NORETURN void astc_codec_internal_error(const char *filename, int linenumber);\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nextern int print_diagnostics;\n-#endif\n-\nextern int print_tile_errors;\nextern int print_statistics;\n+#endif\n+\nextern int perform_srgb_transform;\nextern int rgb_force_use_of_hdr;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -1101,7 +1101,9 @@ static void prepare_block_statistics(\n*is_normal_map = nf_sum < (0.2f * (float)texels_per_block);\n}\n+#ifdef DEBUG_PRINT_DIAGNOSTICS\nint block_mode_histogram[2048];\n+#endif\nfloat compress_symbolic_block(\nconst astc_codec_image* input_image,\n@@ -1199,10 +1201,10 @@ float compress_symbolic_block(\n{\nprintf(\"Block is single-color <%4.4X %4.4X %4.4X %4.4X>\\n\", scb->constant_color[0], scb->constant_color[1], scb->constant_color[2], scb->constant_color[3]);\n}\n- #endif\nif (print_tile_errors)\nprintf(\"0\\n\");\n+ #endif\nphysical_compressed_block psb = symbolic_to_physical(bsd, scb);\nphysical_to_symbolic(bsd, psb, scb);\n@@ -1505,17 +1507,18 @@ float compress_symbolic_block(\nEND_OF_TESTS:\n+ #ifdef DEBUG_PRINT_DIAGNOSTICS\nif (scb->block_mode >= 0)\nblock_mode_histogram[scb->block_mode & 0x7ff]++;\n+ if (print_tile_errors)\n+ printf(\"%g\\n\", (double)error_of_best_block);\n+ #endif\n+\n// compress/decompress to a physical block\nphysical_compressed_block psb = symbolic_to_physical(bsd, scb);\nphysical_to_symbolic(bsd, psb, scb);\n-\n- if (print_tile_errors)\n- printf(\"%g\\n\", (double)error_of_best_block);\n-\n// mean squared error per color component.\nreturn error_of_best_block / ((float)(bsd->xdim * bsd->ydim * bsd->zdim));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "#include <fenv.h>\n#endif\n-extern int block_mode_histogram[2048];\n-\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nint print_diagnostics = 0;\nint diagnostics_tile = -1;\n+ int print_tile_errors = 0;\n+ int print_statistics = 0;\n+ extern int block_mode_histogram[2048];\n#endif\n-int print_tile_errors = 0;\n-int print_statistics = 0;\nint progress_counter_divider = 1;\n@@ -661,7 +660,9 @@ int astc_main(\nint target_bitrate_set = 0;\nfloat target_bitrate = 0;\n+ #ifdef DEBUG_PRINT_DIAGNOSTICS\nint print_block_mode_histogram = 0;\n+ #endif\nfloat log10_texels_2d = 0.0f;\nfloat log10_texels_3d = 0.0f;\n@@ -1271,6 +1272,7 @@ int astc_main(\nreturn 1;\n}\n}\n+ #ifdef DEBUG_PRINT_DIAGNOSTICS\nelse if (!strcmp(argv[argidx], \"-diag\"))\n{\nargidx += 2;\n@@ -1280,12 +1282,7 @@ int astc_main(\nreturn 1;\n}\n- #ifdef DEBUG_PRINT_DIAGNOSTICS\ndiagnostics_tile = atoi(argv[argidx - 1]);\n- #else\n- printf(\"-diag switch given, but codec has been compiled without\\n\" \"DEBUG_PRINT_DIAGNOSTICS enabled; please recompile.\\n\");\n- return 1;\n- #endif\n}\nelse if (!strcmp(argv[argidx], \"-bmstat\"))\n{\n@@ -1302,6 +1299,7 @@ int astc_main(\nargidx++;\nprint_statistics = 1;\n}\n+ #endif\n// Option: Encode a 3D image from an array of 2D images.\nelse if (!strcmp(argv[argidx], \"-array\"))\n{\n@@ -1381,24 +1379,18 @@ int astc_main(\newp.partition_1_to_2_limit = oplimit;\newp.lowest_correlation_cutoff = mincorrel;\n-\n- if (partitions_to_test < 1)\n- partitions_to_test = 1;\n- else if (partitions_to_test > PARTITION_COUNT)\n- partitions_to_test = PARTITION_COUNT;\n-\n- ewp.partition_search_limit = partitions_to_test;\n+ ewp.partition_search_limit = astc::clampi(partitions_to_test, 1, PARTITION_COUNT);\n// if diagnostics are run, force the thread count to 1.\n- if (\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n- diagnostics_tile >= 0 ||\n- #endif\n- print_tile_errors > 0 || print_statistics > 0)\n+ if (diagnostics_tile >= 0 ||\n+ print_tile_errors > 0 ||\n+ print_statistics > 0)\n{\nthread_count = 1;\nthread_count_autodetected = 0;\n}\n+ #endif\nif (thread_count < 1)\n{\n@@ -1682,6 +1674,7 @@ int astc_main(\ndestroy_image(input_image);\n+ #ifdef DEBUG_PRINT_DIAGNOSTICS\nif (print_block_mode_histogram)\n{\nprintf(\"%s \", argv[2]);\n@@ -1692,6 +1685,7 @@ int astc_main(\n}\nprintf(\"\\n\");\n}\n+ #endif\nend_time = get_time();\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Move all dbg tools under DEBUG_PRINT_DIAGNOSTICS
|
61,745 |
22.01.2020 23:29:09
| 0 |
e0f4ea2261854ce83e9c760333c00c8d54fcd0bd
|
Allow HDR tests to run with new CLI
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_run.py",
"new_path": "Test/astc_run.py",
"diff": "@@ -147,7 +147,7 @@ class TestImage():\nelse:\nassert False, \"Unsupported LDR color format %s\" % self.format\nelse:\n- patternPSNR = r\"mPSNR \\(RGB\\) .*: ([0-9.]*) dB\"\n+ patternPSNR = r\"mPSNR \\(RGB\\)(?: \\[.*?\\] )?:\\s*([0-9.]*) dB.*\"\npatternPSNR = re.compile(patternPSNR)\npatternTime = re.compile(\".*[Cc]oding time:\\s*([0-9.]*) s.*\")\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Allow HDR tests to run with new CLI
|
61,745 |
23.01.2020 00:16:25
| 0 |
394a9b01d732f4a31c17af0aeb428ae88b6b187c
|
Add DBG build option to the Makefile
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "# which is the default GCC behavior and true on currently shipping hardware.\nVEC?=avx2\n+DBG?=0\n+\nSOURCES = \\\nastc_averages_and_directions.cpp \\\nastc_block_sizes2.cpp \\\n@@ -60,9 +62,16 @@ HEADERS = \\\nOBJECTS = $(SOURCES:.cpp=.o)\n-CPPFLAGS = -std=c++14 -O3 -mfpmath=sse \\\n+CPPFLAGS = -std=c++14 -mfpmath=sse \\\n-Wall -Wextra -Wpedantic -Werror -Werror=shadow -Wdouble-promotion\n+# Validate that the VEC parameter is a supported value, and patch CPPFLAGS\n+ifeq ($(DBG),0)\n+CPPFLAGS += -O3\n+else\n+CPPFLAGS += -O0 -g\n+endif\n+\n# Validate that the VEC parameter is a supported value, and patch CPPFLAGS\nifeq ($(VEC),nointrin)\nCPPFLAGS += -msse2 -DASTC_SSE=0 -DASTC_AVX=0 -DASTC_POPCNT=0\n@@ -84,7 +93,7 @@ endif\nastcenc: $(OBJECTS)\n@g++ -o $@ $^ $(CPPFLAGS) -lpthread\n- @echo \"[Link] $@ (using $(VEC))\"\n+ @echo \"[Link] $@ (using $(VEC), debug=$(DBG))\"\n$(OBJECTS): %.o: %.cpp $(HEADERS)\n@g++ -c -o $@ $< $(CPPFLAGS)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add DBG build option to the Makefile
|
61,745 |
23.01.2020 19:47:34
| 0 |
374bad6327d1959fefb41893eb1fca20db86515e
|
Replace work_data with SOA structure
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_averages_and_directions.cpp",
"new_path": "Source/astc_averages_and_directions.cpp",
"diff": "@@ -49,10 +49,10 @@ void compute_averages_and_directions_rgba(\n{\nint iwt = weights[i];\nfloat weight = ewb->texel_weight[iwt];\n- float4 texel_datum = float4(blk->work_data[4 * iwt],\n- blk->work_data[4 * iwt + 1],\n- blk->work_data[4 * iwt + 2],\n- blk->work_data[4 * iwt + 3]) * weight;\n+ float4 texel_datum = float4(blk->data_r[iwt],\n+ blk->data_g[iwt],\n+ blk->data_b[iwt],\n+ blk->data_a[iwt]) * weight;\npartition_weight += weight;\nbase_sum = base_sum + texel_datum;\n@@ -70,10 +70,10 @@ void compute_averages_and_directions_rgba(\n{\nint iwt = weights[i];\nfloat weight = ewb->texel_weight[iwt];\n- float4 texel_datum = float4(blk->work_data[4 * iwt],\n- blk->work_data[4 * iwt + 1],\n- blk->work_data[4 * iwt + 2],\n- blk->work_data[4 * iwt + 3]);\n+ float4 texel_datum = float4(blk->data_r[iwt],\n+ blk->data_g[iwt],\n+ blk->data_b[iwt],\n+ blk->data_a[iwt]);\ntexel_datum = (texel_datum - average) * weight;\nif (texel_datum.x > 0.0f)\n@@ -139,9 +139,9 @@ void compute_averages_and_directions_rgb(\n{\nint iwt = weights[i];\nfloat weight = texel_weights[iwt];\n- float3 texel_datum = float3(blk->work_data[4 * iwt],\n- blk->work_data[4 * iwt + 1],\n- blk->work_data[4 * iwt + 2]) * weight;\n+ float3 texel_datum = float3(blk->data_r[iwt],\n+ blk->data_g[iwt],\n+ blk->data_b[iwt]) * weight;\npartition_weight += weight;\nbase_sum = base_sum + texel_datum;\n@@ -159,9 +159,9 @@ void compute_averages_and_directions_rgb(\n{\nint iwt = weights[i];\nfloat weight = texel_weights[iwt];\n- float3 texel_datum = float3(blk->work_data[4 * iwt],\n- blk->work_data[4 * iwt + 1],\n- blk->work_data[4 * iwt + 2]);\n+ float3 texel_datum = float3(blk->data_r[iwt],\n+ blk->data_g[iwt],\n+ blk->data_b[iwt]);\ntexel_datum = (texel_datum - average) * weight;\nif (texel_datum.x > 0.0f)\n@@ -209,14 +209,37 @@ void compute_averages_and_directions_3_components(\nint partition;\nconst float *texel_weights;\n+ const float* data_vr;\n+ const float* data_vg;\n+ const float* data_vb;\nif (component1 == 1 && component2 == 2 && component3 == 3)\n+ {\ntexel_weights = ewb->texel_weight_gba;\n+ data_vr = blk->data_g;\n+ data_vg = blk->data_b;\n+ data_vb = blk->data_a;\n+ }\nelse if (component1 == 0 && component2 == 2 && component3 == 3)\n+ {\ntexel_weights = ewb->texel_weight_rba;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_b;\n+ data_vb = blk->data_a;\n+ }\nelse if (component1 == 0 && component2 == 1 && component3 == 3)\n+ {\ntexel_weights = ewb->texel_weight_rga;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_g;\n+ data_vb = blk->data_a;\n+ }\nelse if (component1 == 0 && component2 == 1 && component3 == 2)\n+ {\ntexel_weights = ewb->texel_weight_rgb;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_g;\n+ data_vb = blk->data_b;\n+ }\nelse\n{\nASTC_CODEC_INTERNAL_ERROR();\n@@ -234,9 +257,9 @@ void compute_averages_and_directions_3_components(\n{\nint iwt = weights[i];\nfloat weight = texel_weights[iwt];\n- float3 texel_datum = float3(blk->work_data[4 * iwt + component1],\n- blk->work_data[4 * iwt + component2],\n- blk->work_data[4 * iwt + component3]) * weight;\n+ float3 texel_datum = float3(data_vr[iwt],\n+ data_vg[iwt],\n+ data_vb[iwt]) * weight;\npartition_weight += weight;\nbase_sum = base_sum + texel_datum;\n@@ -256,9 +279,9 @@ void compute_averages_and_directions_3_components(\n{\nint iwt = weights[i];\nfloat weight = texel_weights[iwt];\n- float3 texel_datum = float3(blk->work_data[4 * iwt + component1],\n- blk->work_data[4 * iwt + component2],\n- blk->work_data[4 * iwt + component3]);\n+ float3 texel_datum = float3(data_vr[iwt],\n+ data_vg[iwt],\n+ data_vb[iwt]);\ntexel_datum = (texel_datum - average) * weight;\nif (texel_datum.x > 0.0f)\n@@ -308,12 +331,26 @@ void compute_averages_and_directions_2_components(\nint partition;\nconst float *texel_weights;\n+ const float* data_vr = nullptr;\n+ const float* data_vg = nullptr;\nif (component1 == 0 && component2 == 1)\n+ {\ntexel_weights = ewb->texel_weight_rg;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_g;\n+ }\nelse if (component1 == 0 && component2 == 2)\n+ {\ntexel_weights = ewb->texel_weight_rb;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_b;\n+ }\nelse if (component1 == 1 && component2 == 2)\n+ {\ntexel_weights = ewb->texel_weight_gb;\n+ data_vr = blk->data_g;\n+ data_vg = blk->data_b;\n+ }\nelse\n{\nASTC_CODEC_INTERNAL_ERROR();\n@@ -331,8 +368,7 @@ void compute_averages_and_directions_2_components(\n{\nint iwt = weights[i];\nfloat weight = texel_weights[iwt];\n- float2 texel_datum = float2(blk->work_data[4 * iwt + component1],\n- blk->work_data[4 * iwt + component2]) * weight;\n+ float2 texel_datum = float2(data_vr[iwt], data_vg[iwt]) * weight;\npartition_weight += weight;\nbase_sum = base_sum + texel_datum;\n@@ -350,8 +386,7 @@ void compute_averages_and_directions_2_components(\n{\nint iwt = weights[i];\nfloat weight = texel_weights[iwt];\n- float2 texel_datum = float2(blk->work_data[4 * iwt + component1],\n- blk->work_data[4 * iwt + component2]);\n+ float2 texel_datum = float2(data_vr[iwt], data_vg[iwt]);\ntexel_datum = (texel_datum - average) * weight;\nif (texel_datum.x > 0.0f)\n@@ -431,10 +466,10 @@ void compute_error_squared_rgba(\nfloat texel_weight_rgba = ewb->texel_weight[iwt];\nif(texel_weight_rgba > 1e-20f)\n{\n- float4 dat = float4(blk->work_data[4 * iwt],\n- blk->work_data[4 * iwt + 1],\n- blk->work_data[4 * iwt + 2],\n- blk->work_data[4 * iwt + 3]);\n+ float4 dat = float4(blk->data_r[iwt],\n+ blk->data_g[iwt],\n+ blk->data_b[iwt],\n+ blk->data_a[iwt]);\nfloat4 ews = ewb->error_weights[iwt];\n@@ -562,9 +597,9 @@ void compute_error_squared_rgb(\nfloat texel_weight_rgb = ewb->texel_weight_rgb[iwt];\nif (texel_weight_rgb > 1e-20f)\n{\n- float3 dat = float3(blk->work_data[4 * iwt],\n- blk->work_data[4 * iwt + 1],\n- blk->work_data[4 * iwt + 2]);\n+ float3 dat = float3(blk->data_r[iwt],\n+ blk->data_g[iwt],\n+ blk->data_b[iwt]);\nfloat3 ews = float3(ewb->error_weights[iwt].x,\newb->error_weights[iwt].y,\n@@ -656,9 +691,9 @@ float compute_error_squared_rgb_single_partition(\nif (partition != partition_to_test || texel_weight < 1e-20f)\ncontinue;\n- float3 point = float3(blk->work_data[4 * i],\n- blk->work_data[4 * i + 1],\n- blk->work_data[4 * i + 2]);\n+ float3 point = float3(blk->data_r[i],\n+ blk->data_g[i],\n+ blk->data_b[i]);\nfloat param = dot(point, lin->bs);\nfloat3 rp1 = lin->amod + param * lin->bis;\nfloat3 dist = rp1 - point;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -167,7 +167,10 @@ struct block_size_descriptor\nstruct imageblock\n{\nfloat orig_data[MAX_TEXELS_PER_BLOCK * 4]; // original input data\n- float work_data[MAX_TEXELS_PER_BLOCK * 4]; // the data that we will compress, either linear or LNS (0..65535 in both cases)\n+ float data_r[MAX_TEXELS_PER_BLOCK]; // the data that we will compress, either linear or LNS (0..65535 in both cases)\n+ float data_g[MAX_TEXELS_PER_BLOCK];\n+ float data_b[MAX_TEXELS_PER_BLOCK];\n+ float data_a[MAX_TEXELS_PER_BLOCK];\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\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -150,8 +150,8 @@ static int realign_weights(\nfloat4 color = color_base + color_offset * plane_weight;\n- float4 origcolor = float4(blk->work_data[4 * texel] , blk->work_data[4 * texel + 1],\n- blk->work_data[4 * texel + 2], blk->work_data[4 * texel + 3]);\n+ float4 origcolor = float4(blk->data_r[texel], blk->data_g[texel],\n+ blk->data_b[texel], blk->data_a[texel]);\nfloat4 error_weight = float4(ewb->texel_weight_r[texel], ewb->texel_weight_g[texel],\newb->texel_weight_b[texel], ewb->texel_weight_a[texel]);\n@@ -1016,10 +1016,10 @@ static void prepare_block_statistics(\nASTC_CODEC_INTERNAL_ERROR();\nweight_sum += weight;\n- float r = blk->work_data[4 * i];\n- float g = blk->work_data[4 * i + 1];\n- float b = blk->work_data[4 * i + 2];\n- float a = blk->work_data[4 * i + 3];\n+ float r = blk->data_r[i];\n+ float g = blk->data_g[i];\n+ float b = blk->data_b[i];\n+ float a = blk->data_a[i];\nfloat rw = r * weight;\nrs += rw;\n@@ -1139,8 +1139,8 @@ float compress_symbolic_block(\nint idx = ((z * ydim + y) * xdim + x) * 4;\nprintf(\"Texel (%d %d %d) : orig=< %g, %g, %g, %g >, work=< %g, %g, %g, %g >\\n\",\nx, y, z,\n- blk->orig_data[idx],\n- blk->orig_data[idx + 1], blk->orig_data[idx + 2], blk->orig_data[idx + 3], blk->work_data[idx], blk->work_data[idx + 1], blk->work_data[idx + 2], blk->work_data[idx + 3]);\n+ blk->orig_data[idx], blk->orig_data[idx + 1], blk->orig_data[idx + 2], blk->orig_data[idx + 3],\n+ blk->data_r[idx], blk->data_g[idx], blk->data_b[idx], blk->data_a[idx]);\n}\nprintf(\"\\n\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_decompress_symbolic.cpp",
"new_path": "Source/astc_decompress_symbolic.cpp",
"diff": "@@ -272,10 +272,10 @@ void decompress_symbolic_block(\nblk->alpha_lns[i] = alpha_hdr_endpoint[partition];\nblk->nan_texel[i] = nan_endpoint[partition];\n- blk->work_data[4 * i ] = (float)color.x;\n- blk->work_data[4 * i + 1] = (float)color.y;\n- blk->work_data[4 * i + 2] = (float)color.z;\n- blk->work_data[4 * i + 3] = (float)color.w;\n+ blk->data_r[i] = (float)color.x;\n+ blk->data_g[i] = (float)color.y;\n+ blk->data_b[i] = (float)color.z;\n+ blk->data_a[i] = (float)color.w;\n}\nimageblock_initialize_orig_from_work(blk, bsd->texel_count);\n@@ -291,15 +291,13 @@ float compute_imageblock_difference(\n) {\nint texels_per_block = bsd->texel_count;\nfloat summa = 0.0f;\n- const float *f1 = p1->work_data;\n- const float *f2 = p2->work_data;\nfor (int i = 0; i < texels_per_block; i++)\n{\n- float rdiff = fabsf(f1[4 * i] - f2[4 * i]);\n- float gdiff = fabsf(f1[4 * i + 1] - f2[4 * i + 1]);\n- float bdiff = fabsf(f1[4 * i + 2] - f2[4 * i + 2]);\n- float adiff = fabsf(f1[4 * i + 3] - f2[4 * i + 3]);\n+ float rdiff = fabsf(p1->data_r[i] - p2->data_r[i]);\n+ float gdiff = fabsf(p1->data_g[i] - p2->data_g[i]);\n+ float bdiff = fabsf(p1->data_b[i] - p2->data_b[i]);\n+ float adiff = fabsf(p1->data_a[i] - p2->data_a[i]);\nrdiff = MIN(rdiff, 1e15f);\ngdiff = MIN(gdiff, 1e15f);\nbdiff = MIN(bdiff, 1e15f);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_encoding_choice_error.cpp",
"new_path": "Source/astc_encoding_choice_error.cpp",
"diff": "@@ -226,14 +226,14 @@ void compute_encoding_choice_errors(\nfor (i = 0; i < texels_per_block; i++)\n{\nint partition = pi->partition_of_texel[i];\n- float alpha = pb->work_data[4 * i + 3];\n+ float alpha = pb->data_a[i];\nfloat default_alpha = pb->alpha_lns[i] ? (float)0x7800 : (float)0xFFFF;\nfloat omalpha = alpha - default_alpha;\nalpha_drop_error[partition] += omalpha * omalpha * ewb->error_weights[i].w;\n- float red = pb->work_data[4 * i];\n- float green = pb->work_data[4 * i + 1];\n- float blue = pb->work_data[4 * i + 2];\n+ float red = pb->data_r[i];\n+ float green = pb->data_g[i];\n+ float blue = pb->data_b[i];\nrgb_drop_error[partition] += red * red * ewb->error_weights[i].x + green * green * ewb->error_weights[i].y + blue * blue * ewb->error_weights[i].z;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_find_best_partitioning.cpp",
"new_path": "Source/astc_find_best_partitioning.cpp",
"diff": "@@ -74,7 +74,7 @@ static void compute_alpha_minmax(\nif (ewb->texel_weight[i] > 1e-10f)\n{\nint partition = pt->partition_of_texel[i];\n- float alphaval = blk->work_data[4 * i + 3];\n+ float alphaval = blk->data_a[i];\nif (alphaval > alpha_max[partition])\nalpha_max[partition] = alphaval;\nif (alphaval < alpha_min[partition])\n@@ -122,9 +122,9 @@ static void compute_rgb_minmax(\nif (ewb->texel_weight[i] > 1e-10f)\n{\nint partition = pt->partition_of_texel[i];\n- float redval = blk->work_data[4 * i];\n- float greenval = blk->work_data[4 * i + 1];\n- float blueval = blk->work_data[4 * i + 2];\n+ float redval = blk->data_r[i];\n+ float greenval = blk->data_g[i];\n+ float blueval = blk->data_b[i];\nif (redval > red_max[partition])\nred_max[partition] = redval;\nif (redval < red_min[partition])\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -45,19 +45,24 @@ static void compute_endpoints_and_ideal_weights_1_component(\nint texels_per_block = bsd->texel_count;\nconst float *error_weights;\n+ const float* data_vr = nullptr;\nswitch (component)\n{\ncase 0:\nerror_weights = ewb->texel_weight_r;\n+ data_vr = blk->data_r;\nbreak;\ncase 1:\nerror_weights = ewb->texel_weight_g;\n+ data_vr = blk->data_g;\nbreak;\ncase 2:\nerror_weights = ewb->texel_weight_b;\n+ data_vr = blk->data_b;\nbreak;\ncase 3:\nerror_weights = ewb->texel_weight_a;\n+ data_vr = blk->data_a;\nbreak;\ndefault:\nASTC_CODEC_INTERNAL_ERROR();\n@@ -73,7 +78,7 @@ static void compute_endpoints_and_ideal_weights_1_component(\n{\nif (error_weights[i] > 1e-10f)\n{\n- float value = blk->work_data[4 * i + component];\n+ float value = data_vr[i];\nint partition = pt->partition_of_texel[i];\nif (value < lowvalues[partition])\nlowvalues[partition] = value;\n@@ -98,7 +103,7 @@ static void compute_endpoints_and_ideal_weights_1_component(\nfor (i = 0; i < texels_per_block; i++)\n{\n- float value = blk->work_data[4 * i + component];\n+ float value = data_vr[i];\nint partition = pt->partition_of_texel[i];\nvalue -= lowvalues[partition];\nvalue *= linelengths_rcp[partition];\n@@ -182,12 +187,26 @@ static void compute_endpoints_and_ideal_weights_2_components(\nfloat2 scalefactors[4];\nconst float *error_weights;\n+ const float* data_vr = nullptr;\n+ const float* data_vg = nullptr;\nif (component1 == 0 && component2 == 1)\n+ {\nerror_weights = ewb->texel_weight_rg;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_g;\n+ }\nelse if (component1 == 0 && component2 == 2)\n+ {\nerror_weights = ewb->texel_weight_rb;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_b;\n+ }\nelse if (component1 == 1 && component2 == 2)\n+ {\nerror_weights = ewb->texel_weight_gb;\n+ data_vr = blk->data_g;\n+ data_vg = blk->data_b;\n+ }\nelse\n{\nASTC_CODEC_INTERNAL_ERROR();\n@@ -272,7 +291,7 @@ static void compute_endpoints_and_ideal_weights_2_components(\nif (error_weights[i] > 1e-10f)\n{\nint partition = pt->partition_of_texel[i];\n- float2 point = float2(blk->work_data[4 * i + component1], blk->work_data[4 * i + component2]) * scalefactors[partition];\n+ float2 point = float2(data_vr[i], data_vg[i]) * scalefactors[partition];\nline2 l = lines[partition];\nfloat param = dot(point - l.a, l.b);\nei->weights[i] = param;\n@@ -432,14 +451,37 @@ static void compute_endpoints_and_ideal_weights_3_components(\nint texels_per_block = bsd->texel_count;\nconst float *error_weights;\n+ const float* data_vr = nullptr;\n+ const float* data_vg = nullptr;\n+ const float* data_vb = nullptr;\nif (component1 == 1 && component2 == 2 && component3 == 3)\n+ {\nerror_weights = ewb->texel_weight_gba;\n+ data_vr = blk->data_g;\n+ data_vg = blk->data_b;\n+ data_vb = blk->data_a;\n+ }\nelse if (component1 == 0 && component2 == 2 && component3 == 3)\n+ {\nerror_weights = ewb->texel_weight_rba;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_b;\n+ data_vb = blk->data_a;\n+ }\nelse if (component1 == 0 && component2 == 1 && component3 == 3)\n+ {\nerror_weights = ewb->texel_weight_rga;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_g;\n+ data_vb = blk->data_a;\n+ }\nelse if (component1 == 0 && component2 == 1 && component3 == 2)\n+ {\nerror_weights = ewb->texel_weight_rgb;\n+ data_vr = blk->data_r;\n+ data_vg = blk->data_g;\n+ data_vb = blk->data_b;\n+ }\nelse\n{\nASTC_CODEC_INTERNAL_ERROR();\n@@ -538,7 +580,7 @@ static void compute_endpoints_and_ideal_weights_3_components(\nif (error_weights[i] > 1e-10f)\n{\nint partition = pt->partition_of_texel[i];\n- float3 point = float3(blk->work_data[4 * i + component1], blk->work_data[4 * i + component2], blk->work_data[4 * i + component3]) * scalefactors[partition];\n+ float3 point = float3(data_vr[i], data_vg[i], data_vb[i]) * scalefactors[partition];\nline3 l = lines[partition];\nfloat param = dot(point - l.a, l.b);\nei->weights[i] = param;\n@@ -774,7 +816,7 @@ static void compute_endpoints_and_ideal_weights_rgba(\n{\nint partition = pt->partition_of_texel[i];\n- float4 point = float4(blk->work_data[4 * i], blk->work_data[4 * i + 1], blk->work_data[4 * i + 2], blk->work_data[4 * i + 3]) * scalefactors[partition];\n+ float4 point = float4(blk->data_r[i], blk->data_g[i], blk->data_b[i], blk->data_a[i]) * scalefactors[partition];\nline4 l = lines[partition];\nfloat param = dot(point - l.a, l.b);\n@@ -1481,7 +1523,7 @@ void recompute_ideal_colors(\nfor (i = 0; i < texels_per_block; i++)\n{\n- float3 rgb = float3(pb->work_data[4 * i], pb->work_data[4 * i + 1], pb->work_data[4 * i + 2]);\n+ float3 rgb = float3(pb->data_r[i], pb->data_g[i], pb->data_b[i]);\nfloat3 rgb_weight = float3(ewb->texel_weight_r[i],\newb->texel_weight_g[i],\newb->texel_weight_b[i]);\n@@ -1503,10 +1545,10 @@ void recompute_ideal_colors(\nfor (i = 0; i < texels_per_block; i++)\n{\n- float r = pb->work_data[4 * i];\n- float g = pb->work_data[4 * i + 1];\n- float b = pb->work_data[4 * i + 2];\n- float a = pb->work_data[4 * i + 3];\n+ float r = pb->data_r[i];\n+ float g = pb->data_g[i];\n+ float b = pb->data_b[i];\n+ float a = pb->data_a[i];\nint part = pi->partition_of_texel[i];\nfloat idx0 = it ? compute_value_of_texel_flt(i, it, weight_set) : weight_set[i];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_image_load_store.cpp",
"new_path": "Source/astc_image_load_store.cpp",
"diff": "@@ -427,36 +427,33 @@ void imageblock_initialize_work_from_orig(\nimageblock* pb,\nint pixelcount\n) {\n- int i;\nfloat *fptr = pb->orig_data;\n- float *wptr = pb->work_data;\n- for (i = 0; i < pixelcount; i++)\n+ for (int i = 0; i < pixelcount; i++)\n{\nif (pb->rgb_lns[i])\n{\n- wptr[0] = float_to_lns(fptr[0]);\n- wptr[1] = float_to_lns(fptr[1]);\n- wptr[2] = float_to_lns(fptr[2]);\n+ pb->data_r[i] = float_to_lns(fptr[0]);\n+ pb->data_g[i] = float_to_lns(fptr[1]);\n+ pb->data_b[i] = float_to_lns(fptr[2]);\n}\nelse\n{\n- wptr[0] = fptr[0] * 65535.0f;\n- wptr[1] = fptr[1] * 65535.0f;\n- wptr[2] = fptr[2] * 65535.0f;\n+ pb->data_r[i] = fptr[0] * 65535.0f;\n+ pb->data_g[i] = fptr[1] * 65535.0f;\n+ pb->data_b[i] = fptr[2] * 65535.0f;\n}\nif (pb->alpha_lns[i])\n{\n- wptr[3] = float_to_lns(fptr[3]);\n+ pb->data_a[i] = float_to_lns(fptr[3]);\n}\nelse\n{\n- wptr[3] = fptr[3] * 65535.0f;\n+ pb->data_a[i] = fptr[3] * 65535.0f;\n}\nfptr += 4;\n- wptr += 4;\n}\n}\n@@ -465,36 +462,33 @@ void imageblock_initialize_orig_from_work(\nimageblock* pb,\nint pixelcount\n) {\n- int i;\nfloat *fptr = pb->orig_data;\n- float *wptr = pb->work_data;\n- for (i = 0; i < pixelcount; i++)\n+ for (int i = 0; i < pixelcount; i++)\n{\nif (pb->rgb_lns[i])\n{\n- fptr[0] = sf16_to_float(lns_to_sf16((uint16_t) wptr[0]));\n- fptr[1] = sf16_to_float(lns_to_sf16((uint16_t) wptr[1]));\n- fptr[2] = sf16_to_float(lns_to_sf16((uint16_t) wptr[2]));\n+ fptr[0] = sf16_to_float(lns_to_sf16((uint16_t)pb->data_r[i]));\n+ fptr[1] = sf16_to_float(lns_to_sf16((uint16_t)pb->data_g[i]));\n+ fptr[2] = sf16_to_float(lns_to_sf16((uint16_t)pb->data_b[i]));\n}\nelse\n{\n- fptr[0] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[0]));\n- fptr[1] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[1]));\n- fptr[2] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[2]));\n+ fptr[0] = sf16_to_float(unorm16_to_sf16((uint16_t)pb->data_r[i]));\n+ fptr[1] = sf16_to_float(unorm16_to_sf16((uint16_t)pb->data_g[i]));\n+ fptr[2] = sf16_to_float(unorm16_to_sf16((uint16_t)pb->data_b[i]));\n}\nif (pb->alpha_lns[i])\n{\n- fptr[3] = sf16_to_float(lns_to_sf16((uint16_t) wptr[3]));\n+ fptr[3] = sf16_to_float(lns_to_sf16((uint16_t)pb->data_a[i]));\n}\nelse\n{\n- fptr[3] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[3]));\n+ fptr[3] = sf16_to_float(unorm16_to_sf16((uint16_t)pb->data_a[i]));\n}\nfptr += 4;\n- wptr += 4;\n}\n}\n@@ -919,7 +913,7 @@ void write_imageblock(\n/*\nFor an imageblock, update its flags.\n- The updating is done based on work_data, not orig_data.\n+ The updating is done based on data, not orig_data.\n*/\nvoid update_imageblock_flags(\nimageblock* pb,\n@@ -939,10 +933,10 @@ void update_imageblock_flags(\nfor (i = 0; i < texels_per_block; i++)\n{\n- float red = pb->work_data[4 * i];\n- float green = pb->work_data[4 * i + 1];\n- float blue = pb->work_data[4 * i + 2];\n- float alpha = pb->work_data[4 * i + 3];\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];\nif (red < red_min)\nred_min = red;\nif (red > red_max)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_kmeans_partitioning.cpp",
"new_path": "Source/astc_kmeans_partitioning.cpp",
"diff": "@@ -48,18 +48,18 @@ void kpp_initialize(\n// compute the distance to the first point.\nint sample = cluster_center_samples[0];\n- float4 center_color = float4(blk->work_data[4 * sample],\n- blk->work_data[4 * sample + 1],\n- blk->work_data[4 * sample + 2],\n- blk->work_data[4 * sample + 3]);\n+ float4 center_color = float4(blk->data_r[sample],\n+ blk->data_g[sample],\n+ blk->data_b[sample],\n+ blk->data_a[sample]);\nfloat distance_sum = 0.0f;\nfor (i = 0; i < texels_per_block; i++)\n{\n- float4 color = float4(blk->work_data[4 * i],\n- blk->work_data[4 * i + 1],\n- blk->work_data[4 * i + 2],\n- blk->work_data[4 * i + 3]);\n+ float4 color = float4(blk->data_r[i],\n+ blk->data_g[i],\n+ blk->data_b[i],\n+ blk->data_a[i]);\nfloat4 diff = color - center_color;\nfloat distance = dot(diff, diff);\ndistance_sum += distance;\n@@ -96,15 +96,18 @@ void kpp_initialize(\nbreak;\n// update the distances with the new point.\n- center_color = float4(blk->work_data[4 * sample], blk->work_data[4 * sample + 1], blk->work_data[4 * sample + 2], blk->work_data[4 * sample + 3]);\n+ center_color = float4(blk->data_r[sample],\n+ blk->data_g[sample],\n+ blk->data_b[sample],\n+ blk->data_a[sample]);\ndistance_sum = 0.0f;\nfor (i = 0; i < texels_per_block; i++)\n{\n- float4 color = float4(blk->work_data[4 * i],\n- blk->work_data[4 * i + 1],\n- blk->work_data[4 * i + 2],\n- blk->work_data[4 * i + 3]);\n+ float4 color = float4(blk->data_r[i],\n+ blk->data_g[i],\n+ blk->data_b[i],\n+ blk->data_a[i]);\nfloat4 diff = color - center_color;\nfloat distance = dot(diff, diff);\ndistance = MIN(distance, distances[i]);\n@@ -117,10 +120,10 @@ void kpp_initialize(\nfor (i = 0; i < partition_count; i++)\n{\nint center_sample = cluster_center_samples[i];\n- float4 color = float4(blk->work_data[4 * center_sample],\n- blk->work_data[4 * center_sample + 1],\n- blk->work_data[4 * center_sample + 2],\n- blk->work_data[4 * center_sample + 3]);\n+ float4 color = float4(blk->data_r[center_sample],\n+ blk->data_g[center_sample],\n+ blk->data_b[center_sample],\n+ blk->data_a[center_sample]);\ncluster_centers[i] = color;\n}\n}\n@@ -150,10 +153,10 @@ void basic_kmeans_assign_pass(\nfor (i = 0; i < texels_per_block; i++)\n{\n- float4 color = float4(blk->work_data[4 * i],\n- blk->work_data[4 * i + 1],\n- blk->work_data[4 * i + 2],\n- blk->work_data[4 * i + 3]);\n+ float4 color = float4(blk->data_r[i],\n+ blk->data_g[i],\n+ blk->data_b[i],\n+ blk->data_a[i]);\nfloat4 diff = color - cluster_centers[0];\nfloat distance = dot(diff, diff);\ndistances[i] = distance;\n@@ -166,10 +169,10 @@ void basic_kmeans_assign_pass(\nfor (i = 0; i < texels_per_block; i++)\n{\n- float4 color = float4(blk->work_data[4 * i],\n- blk->work_data[4 * i + 1],\n- blk->work_data[4 * i + 2],\n- blk->work_data[4 * i + 3]);\n+ float4 color = float4(blk->data_r[i],\n+ blk->data_g[i],\n+ blk->data_b[i],\n+ blk->data_a[i]);\nfloat4 diff = color - center_color;\nfloat distance = dot(diff, diff);\nif (distance < distances[i])\n@@ -232,10 +235,10 @@ void basic_kmeans_update(\n// first, find the center-of-gravity in each cluster\nfor (i = 0; i < texels_per_block; i++)\n{\n- float4 color = float4(blk->work_data[4 * i],\n- blk->work_data[4 * i + 1],\n- blk->work_data[4 * i + 2],\n- blk->work_data[4 * i + 3]);\n+ float4 color = float4(blk->data_r[i],\n+ blk->data_g[i],\n+ blk->data_b[i],\n+ blk->data_a[i]);\nint part = partition_of_texel[i];\ncolor_sum[part] = color_sum[part] + color;\nweight_sum[part]++;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Replace work_data with SOA structure
|
61,745 |
24.01.2020 00:36:48
| 0 |
7f2b47d37a0e472e67038de7a1ec5dd265b5a8aa
|
AVX2 compute_ideal_quantized_weights_for_decimation_table
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -326,9 +326,11 @@ struct quantization_and_transfer_table\n/** The quantization level used */\nquantization_method method;\n/** The unscrambled unquantized value. */\n- uint8_t unquantized_value_unsc[33];\n+ // TODO: Converted to floats to support AVX gathers\n+ float unquantized_value_unsc[33];\n/** The scrambling order: value[map[i]] == value_unsc[i] */\n- uint8_t scramble_map[32];\n+ // TODO: Converted to u32 to support AVX gathers\n+ int32_t scramble_map[32];\n/** The scrambled unquantized values. */\nuint8_t unquantized_value[32];\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -214,7 +214,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\nconst partition_info *pi = get_partition_table(bsd, partition_count);\npi += partition_index;\n- // first, compute ideal weights and endpoint colors, under thre assumption that\n+ // first, compute ideal weights and endpoint colors, under the assumption that\n// there is no quantization or decimation going on.\nendpoints_and_weights *ei = tmpbuf->ei1;\nendpoints_and_weights *eix = tmpbuf->eix1;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -1246,10 +1246,51 @@ void compute_ideal_quantized_weights_for_decimation_table(\nfloat scaled_low_bound = low_bound * scale;\nrscale *= 1.0f / 64.0f;\n- // Rescale the weights so that\n- // low_bound -> 0, high_bound -> 1\n- // and quantize the weight set\n- for (int i = 0; i < weight_count; i++)\n+ int i = 0;\n+\n+#if ASTC_AVX >= 2\n+ // TODO: This is currently 4-wide. Could try 8?\n+ int clipped_weight_count = weight_count & ~3;\n+ __m128i shuf = _mm_set_epi8(-1, -1, -1, -1, -1, -1, -1, -1,\n+ -1, -1, -1, -1, 12, 8, 4, 0);\n+ __m128 scalev = _mm_set1_ps(scale);\n+ __m128 scaled_low_boundv = _mm_set1_ps(scaled_low_bound);\n+ for (/* Loop vector */; i < clipped_weight_count; i += 4)\n+ {\n+ __m128 ix = _mm_load_ps(&weight_set_in[i]);\n+ ix = _mm_mul_ps(ix, scalev);\n+ ix = _mm_sub_ps(ix, scaled_low_boundv);\n+\n+ ix = _mm_max_ps(ix, _mm_setzero_ps());\n+ ix = _mm_min_ps(ix, _mm_set1_ps(1.0f));\n+\n+ __m128 ix1 = _mm_mul_ps(ix, _mm_set1_ps(quant_level_m1));\n+ __m128i weight = _mm_cvtps_epi32(ix1);\n+ __m128 ixl = _mm_i32gather_ps(qat->unquantized_value_unsc, weight, 4);\n+\n+ __m128i weight1 = _mm_add_epi32(weight, _mm_set1_epi32(1));\n+ __m128 ixh = _mm_i32gather_ps(qat->unquantized_value_unsc, weight1, 4);\n+\n+ __m128 lhs = _mm_add_ps(ixl, ixh);\n+ __m128 rhs = _mm_mul_ps(ix, _mm_set1_ps(128.0f));\n+ __m128i mask = _mm_castps_si128(_mm_cmplt_ps(lhs, rhs));\n+ weight = _mm_blendv_epi8(weight, weight1, mask);\n+ ixl = _mm_blendv_ps(ixl, ixh, _mm_castsi128_ps(mask));\n+\n+ // Invert the weight-scaling that was done initially\n+ __m128 wso = _mm_mul_ps(ixl, _mm_set1_ps(rscale));\n+ wso = _mm_add_ps(wso, _mm_set1_ps(low_bound));\n+ _mm_storeu_ps(&weight_set_out[i], wso);\n+\n+ __m128i scm = _mm_i32gather_epi32(qat->scramble_map, weight, 4);\n+ __m128i scn = _mm_shuffle_epi8(scm, shuf);\n+\n+ // This is a hack because _mm_storeu_si32 is still not implemented ...\n+ _mm_store_ss((float*)&quantized_weight_set[i], _mm_castsi128_ps(scn));\n+ }\n+#endif\n+\n+ for (/*Loop tail */; i < weight_count; i++)\n{\nfloat ix = (weight_set_in[i] * scale) - scaled_low_bound;\nif (ix < 0.0f)\n@@ -1271,7 +1312,7 @@ void compute_ideal_quantized_weights_for_decimation_table(\n// Invert the weight-scaling that was done initially\nweight_set_out[i] = (ixl * rscale) + low_bound;\n- quantized_weight_set[i] = qat->scramble_map[weight];\n+ quantized_weight_set[i] = (uint8_t)qat->scramble_map[weight];\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
AVX2 compute_ideal_quantized_weights_for_decimation_table
|
61,745 |
24.01.2020 01:04:32
| 0 |
a6c78bc07ee6c69951e6e9f372493f9a00856e3b
|
[IQLoss] Rework compute_ideal_weights_for_decimation_table
Removed second iteration of refinement, for ~0.04dB IQ loss,
but 10% performance improvement
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -1004,47 +1004,6 @@ static inline float compute_error_of_texel(\nreturn valuedif * valuedif * eai->weight_error_scale[texel_to_get];\n}\n-/*\n- helper function: given\n- * for each texel, an ideal weight and an error-modifier these are contained\n- in an endpoints_and_weights data structure.\n- * a weight_table data structure\n- * for each weight, its current value\n- compute the change to overall error that results from adding N to the weight\n-*/\n-static void compute_two_error_changes_from_perturbing_weight_infill(\n- const endpoints_and_weights* eai,\n- const decimation_table* it,\n- float* infilled_weights,\n- int weight_to_perturb,\n- float perturbation1,\n- float perturbation2,\n- float* res1,\n- float* res2\n-) {\n- int num_weights = it->weight_num_texels[weight_to_perturb];\n- float error_change0 = 0.0f;\n- float error_change1 = 0.0f;\n-\n- const uint8_t *weight_texel_ptr = it->weight_texel[weight_to_perturb];\n- const float *weights_ptr = it->weights_flt[weight_to_perturb];\n- for (int i = num_weights - 1; i >= 0; i--)\n- {\n- uint8_t weight_texel = weight_texel_ptr[i];\n- float weights = weights_ptr[i];\n-\n- float scale = eai->weight_error_scale[weight_texel] * weights;\n- float old_weight = infilled_weights[weight_texel];\n- float ideal_weight = eai->weights[weight_texel];\n-\n- error_change0 += weights * scale;\n- error_change1 += (old_weight - ideal_weight) * scale;\n- }\n-\n- *res1 = error_change0 * (perturbation1 * perturbation1 * (1.0f / (TEXEL_WEIGHT_SUM * TEXEL_WEIGHT_SUM))) + error_change1 * (perturbation1 * (2.0f / TEXEL_WEIGHT_SUM));\n- *res2 = error_change0 * (perturbation2 * perturbation2 * (1.0f / (TEXEL_WEIGHT_SUM * TEXEL_WEIGHT_SUM))) + error_change1 * (perturbation2 * (2.0f / TEXEL_WEIGHT_SUM));\n-}\n-\nfloat compute_error_of_weight_set(\nconst endpoints_and_weights* eai,\nconst decimation_table* it,\n@@ -1084,7 +1043,7 @@ void compute_ideal_weights_for_decimation_table(\n}\n// if the shortcut is not available, we will instead compute a simple estimate\n- // and perform three rounds of refinement on that estimate.\n+ // and perform a single iteration of refinement on that estimate.\nfloat infilled_weights[MAX_TEXELS_PER_BLOCK];\n// compute an initial average for each weight.\n@@ -1109,83 +1068,54 @@ void compute_ideal_weights_for_decimation_table(\nfor (int i = 0; i < texels_per_block; i++)\n{\n- infilled_weights[i] = compute_value_of_texel_flt(i, it, weight_set);\n+ const uint8_t *texel_weights = it->texel_weights[i];\n+ const float *texel_weights_float = it->texel_weights_float[i];\n+ infilled_weights[i] = (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- const float stepsizes[2] = { 0.25f, 0.125f };\n+ constexpr float stepsize = 0.25f;\n+ constexpr float ch0_scale = 4.0f * (stepsize * stepsize * (1.0f / (TEXEL_WEIGHT_SUM * TEXEL_WEIGHT_SUM)));\n+ constexpr float ch1_scale = -2.0f * (stepsize * (2.0f / TEXEL_WEIGHT_SUM));\n+ constexpr float chd_scale = (ch1_scale / ch0_scale) * stepsize;\n- for (int j = 0; j < 2; j++)\n- {\n- float stepsize = stepsizes[j];\nfor (int i = 0; i < weight_count; i++)\n{\nfloat weight_val = weight_set[i];\n- float error_change_up, error_change_down;\n- compute_two_error_changes_from_perturbing_weight_infill(eai, it, infilled_weights, i, stepsize, -stepsize, &error_change_up, &error_change_down);\n- /*\n- assume that the error-change function behaves like a quadratic function in the interval examined,\n- with \"error_change_up\" and \"error_change_down\" defining the function at the endpoints\n- of the interval. Then, find the position where the function's derivative is zero.\n-\n- The \"fabs(b) >= a\" check tests several conditions in one:\n- if a is negative, then the 2nd derivative of the function is negative;\n- in this case, f'(x)=0 will maximize error.\n- If fabs(b) > fabs(a), then f'(x)=0 will lie outside the interval altogether.\n- If a and b are both 0, then set step to 0;\n- otherwise, we end up computing 0/0, which produces a lethal NaN.\n- We can get an a=b=0 situation if an error weight is 0 in the wrong place.\n- */\n+ const uint8_t *weight_texel_ptr = it->weight_texel[i];\n+ const float *weights_ptr = it->weights_flt[i];\n- float step;\n- float a = (error_change_up + error_change_down) * 2.0f;\n- float b = error_change_down - error_change_up;\n- if (fabsf(b) >= a)\n- {\n- if (a <= 0.0f)\n- {\n- if (error_change_up < error_change_down)\n- step = 1.0f;\n- else if (error_change_up > error_change_down)\n- step = -1.0f;\n- else\n- step = 0.0f;\n- }\n- else\n- {\n- if (a < 1e-10f)\n- a = 1e-10f;\n+ // compute the two error changes that can occur from perturbing the current index.\n+ int num_weights = it->weight_num_texels[i];\n- step = b / a;\n+ float error_change0 = 1e-10f; // done in order to ensure that this value isn't 0, in order to avoid a possible divide by zero later.\n+ float error_change1 = 0.0f;\n- if (step < -1.0f)\n- step = -1.0f;\n- else if (step > 1.0f)\n- step = 1.0f;\n- }\n- }\n- else\n+ for (int k = 0; k < num_weights; k++)\n{\n- step = b / a;\n+ uint8_t weight_texel = weight_texel_ptr[k];\n+ float weights2 = weights_ptr[k];\n+\n+ float scale = eai->weight_error_scale[weight_texel] * weights2;\n+ float old_weight = infilled_weights[weight_texel];\n+ float ideal_weight = eai->weights[weight_texel];\n+\n+ error_change0 += weights2 * scale;\n+ error_change1 += (old_weight - ideal_weight) * scale;\n}\n- step *= stepsize;\n- float new_weight_val = weight_val + step;\n+ float step = (error_change1 * chd_scale) / error_change0;\n+ // clamp the step-value.\n+ if (step < -stepsize )\n+ step = -stepsize;\n+ else if(step > stepsize)\n+ step = stepsize;\n// update the weight\n- weight_set[i] = new_weight_val;\n- // update the infilled-weights\n- int num_weights = it->weight_num_texels[i];\n- float perturbation = (new_weight_val - weight_val) * (1.0f / TEXEL_WEIGHT_SUM);\n- const uint8_t *weight_texel_ptr = it->weight_texel[i];\n- const float *weights_ptr = it->weights_flt[i];\n- for (int k = 0; k < num_weights; k++)\n- {\n- uint8_t weight_texel = weight_texel_ptr[k];\n- float weight_weight = weights_ptr[k];\n- infilled_weights[weight_texel] += perturbation * weight_weight;\n- }\n- }\n+ weight_set[i] = weight_val + step;\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
[IQLoss] Rework compute_ideal_weights_for_decimation_table
Removed second iteration of refinement, for ~0.04dB IQ loss,
but 10% performance improvement
|
61,745 |
24.01.2020 20:20:04
| 0 |
ac450db0a217d0b2cadc215fcbed6dea18f8f733
|
Split long help literal to build on VS
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel_help.cpp",
"new_path": "Source/astc_toplevel_help.cpp",
"diff": "@@ -415,7 +415,10 @@ 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+ image quality.)\"\n+// This split in the literals is needed for Visual Studio; the compiler\n+// will concatenate these two strings together ...\n+R\"(\nFILE FORMATS\nThe following formats are supported as compression inputs:\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Split long help literal to build on VS
|
61,750 |
07.02.2020 21:20:44
| 0 |
5ebc8ac6f55bf547b56ac4f3ece0f17edf6728e6
|
Upload build artefacts to Artifactory
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "+def dsgArtifactoryUpload(String sourcePattern, String target) {\n+ rtBuildInfo (\n+ // Maximum builds to keep in Artifactory.\n+ maxBuilds: 10,\n+ // Also delete the build artifacts when deleting a build.\n+ deleteBuildArtifacts: true\n+ )\n+ rtUpload (\n+ serverId: 'dsg-artifactory',\n+ spec: \"\"\"\n+ {\n+ \"files\": [\n+ {\n+ \"pattern\": \"${sourcePattern}\",\n+ \"target\": \"${target}\"\n+ }\n+ ]\n+ }\n+ \"\"\"\n+ )\n+ rtPublishBuildInfo (\n+ serverId: 'dsg-artifactory'\n+ )\n+}\n+\npipeline {\nagent none\noptions {\n@@ -20,7 +45,12 @@ pipeline {\n}\n}\nstages {\n- stage('Build') {\n+ stage('Clean workspace') {\n+ steps {\n+ sh 'git clean -fdx'\n+ }\n+ }\n+ stage('Linux Build') {\nsteps {\nsh '''\ncd ./Source/\n@@ -28,31 +58,34 @@ pipeline {\n'''\n}\n}\n- stage('Archive Artefacts') {\n+ stage('Stash Artefacts') {\nsteps {\n- archiveArtifacts(artifacts: 'Source/astcenc', onlyIfSuccessful: true)\n+ dir('Source') {\n+ stash name: 'astcenc-linux', includes: 'astcenc'\n+ }\n}\n}\n- stage('Test') {\n+ stage('Linux Tests') {\nsteps {\nsh 'python3 ./Test/astc_test_run.py'\n- }\n- }\n- }\n- post {\n- always {\nperfReport(sourceDataFiles:'TestOutput/results.xml')\njunit(testResults: 'TestOutput/results.xml')\n}\n}\n}\n+ }\n/* Build for Windows on x86_64 */\nstage('Windows-x86_64') {\nagent {\nlabel 'Windows && x86_64'\n}\nstages {\n- stage('Release') {\n+ stage('Clean workspace') {\n+ steps {\n+ bat 'git clean -fdx'\n+ }\n+ }\n+ stage('Windows Release Build') {\nsteps {\nbat '''\ncall c:\\\\progra~2\\\\micros~1\\\\2017\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n@@ -60,7 +93,7 @@ pipeline {\n'''\n}\n}\n- stage('Debug') {\n+ stage('Windows Debug Build') {\nsteps {\nbat '''\ncall c:\\\\progra~2\\\\micros~1\\\\2017\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n@@ -68,35 +101,37 @@ pipeline {\n'''\n}\n}\n- stage('Archive Artefacts') {\n+ stage('Stash Artefacts') {\nsteps {\n- archiveArtifacts(artifacts: 'Source\\\\VS2017\\\\Release\\\\astcenc.exe', onlyIfSuccessful: true)\n- archiveArtifacts(artifacts: 'Source\\\\VS2017\\\\Debug\\\\astcenc.exe', onlyIfSuccessful: true)\n+ dir('Source\\\\VS2017\\\\Release') {\n+ stash name: 'astcenc-win-release', includes: 'astcenc.exe'\n+ }\n}\n}\n- stage('Test') {\n+ stage('Windows Tests') {\nsteps {\nbat '''\nset Path=c:\\\\Python38;c:\\\\Python38\\\\Scripts;%Path%\ncall python ./Test/astc_test_run.py\n'''\n- }\n- }\n- }\n- post {\n- always {\nperfReport(sourceDataFiles:'TestOutput\\\\results.xml')\njunit(testResults: 'TestOutput\\\\results.xml')\n}\n}\n}\n+ }\n/* Build for Mac on x86_64 */\nstage('MacOS-x86_64') {\nagent {\nlabel 'mac && x86_64'\n}\nstages {\n- stage('Build') {\n+ stage('Clean workspace') {\n+ steps {\n+ sh 'git clean -fdx'\n+ }\n+ }\n+ stage('MacOS Build') {\nsteps {\nsh '''\ncd ./Source/\n@@ -104,27 +139,61 @@ pipeline {\n'''\n}\n}\n- stage('Archive Artefacts') {\n+ stage('Stash Artefacts') {\nsteps {\n- archiveArtifacts(artifacts: 'Source/astcenc', onlyIfSuccessful: true)\n+ dir('Source') {\n+ stash name: 'astcenc-mac', includes: 'astcenc'\n}\n}\n- stage('Test') {\n+ }\n+ stage('MacOS Tests') {\nsteps {\nsh '''\nexport PATH=$PATH:/usr/local/bin\npython3 ./Test/astc_test_run.py\n'''\n+ perfReport(sourceDataFiles:'TestOutput/results.xml')\n+ junit(testResults: 'TestOutput/results.xml')\n}\n}\n}\n- post {\n- always {\n- perfReport(sourceDataFiles:'TestOutput/results.xml')\n- junit(testResults: 'TestOutput/results.xml')\n}\n}\n}\n+ stage('Upload to Artifactory') {\n+ agent {\n+ docker {\n+ image 'mobilestudio/astcenc:0.1.0'\n+ registryUrl 'https://registry.k8s.dsg.arm.com'\n+ registryCredentialsId 'harbor'\n+ label 'docker'\n+ alwaysPull true\n+ }\n+ }\n+ options {\n+ skipDefaultCheckout true\n+ }\n+ stages {\n+ stage('Unstash artefacts') {\n+ steps {\n+ deleteDir()\n+ dir('upload/Linux-x86_64') {\n+ unstash 'astcenc-linux'\n+ }\n+ dir('upload/Windows-x86_64') {\n+ unstash 'astcenc-win-release'\n+ }\n+ dir('upload/MacOS-x86_64') {\n+ unstash 'astcenc-mac'\n+ }\n+ }\n+ }\n+ stage('Upload to Artifactory') {\n+ steps {\n+ zip zipFile: 'astcenc.zip', dir: 'upload', archive: false\n+ dsgArtifactoryUpload('*.zip', \"astc-encoder/build/${currentBuild.number}/\")\n+ }\n+ }\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Upload build artefacts to Artifactory (#86)
|
61,755 |
07.02.2020 21:21:27
| 0 |
28055f59cdcaf057beb441ffd52cb6414c232e04
|
Guard STB_IMAGE_IMPLEMENTATION
This is to avoid re-defining stb_image.h implementation when using
astc as a library in a project that also includes stb_image.h
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_stb_tga.cpp",
"new_path": "Source/astc_stb_tga.cpp",
"diff": "#include \"softfloat.h\"\n#include <stdio.h>\n-#define STB_IMAGE_IMPLEMENTATION\n#define STBI_NO_PSD\n#define STBI_NO_PIC\n#define STBI_NO_PNM\n+#ifndef NO_STB_IMAGE_IMPLEMENTATION\n+#define STB_IMAGE_IMPLEMENTATION\n+#endif\n#include \"stb_image.h\"\nastc_codec_image * load_image_with_stb(const char *filename, int padding, int *result)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Guard STB_IMAGE_IMPLEMENTATION (#84)
This is to avoid re-defining stb_image.h implementation when using
astc as a library in a project that also includes stb_image.h
|
61,745 |
15.02.2020 11:11:57
| 0 |
56bf0c9e7c916a14916666e002b9b8043d00523b
|
Use new stb_image build settings
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "@@ -35,7 +35,6 @@ DBG?=0\nSOURCES = \\\nastc_averages_and_directions.cpp \\\nastc_block_sizes2.cpp \\\n- astc_codec_image.cpp \\\nastc_color_quantize.cpp \\\nastc_color_unquantize.cpp \\\nastc_compress_symbolic.cpp \\\n@@ -44,10 +43,11 @@ SOURCES = \\\nastc_encoding_choice_error.cpp \\\nastc_error_metrics.cpp \\\nastc_find_best_partitioning.cpp \\\n- astc_file_load_store.cpp \\\nastc_ideal_endpoints_and_weights.cpp \\\n+ astc_image_load_store.cpp \\\nastc_integer_sequence.cpp \\\nastc_kmeans_partitioning.cpp \\\n+ astc_ktx_dds.cpp \\\nastc_main.cpp \\\nastc_mathlib.cpp \\\nastc_mathlib_softfloat.cpp \\\n@@ -56,6 +56,7 @@ SOURCES = \\\nastc_pick_best_endpoint_format.cpp \\\nastc_platform_dependents.cpp \\\nastc_quantization.cpp \\\n+ astc_stb_tga.cpp \\\nastc_symbolic_physical.cpp \\\nastc_toplevel.cpp \\\nastc_toplevel_help.cpp \\\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_stb_tga.cpp",
"new_path": "Source/astc_stb_tga.cpp",
"diff": "#include <stdio.h>\n-#define STBI_NO_PSD\n-#define STBI_NO_PIC\n-#define STBI_NO_PNM\n-#ifndef NO_STB_IMAGE_IMPLEMENTATION\n-#define STB_IMAGE_IMPLEMENTATION\n-#endif\n#include \"stb_image.h\"\nastc_codec_image* load_image_with_stb(\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use new stb_image build settings
|
61,745 |
15.02.2020 11:22:52
| 0 |
0cb3684d9a15e5187893e6b30cf7cd739c7d8256
|
Update Readme for master, and remove Binaries
|
[
{
"change_type": "DELETE",
"old_path": "Binary/linux-x64/astcenc",
"new_path": "Binary/linux-x64/astcenc",
"diff": "Binary files a/Binary/linux-x64/astcenc and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Binary/mac-x64/astcenc",
"new_path": "Binary/mac-x64/astcenc",
"diff": "Binary files a/Binary/mac-x64/astcenc and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "Binary/windows-x64/astcenc.exe",
"new_path": "Binary/windows-x64/astcenc.exe",
"diff": "Binary files a/Binary/windows-x64/astcenc.exe and /dev/null differ\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update Readme for master, and remove Binaries
|
61,745 |
15.02.2020 11:38:08
| 0 |
40c9c3e59bfa99f551cfcd1a998b8401b960ced1
|
Update release binary in Readme.txt
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -63,13 +63,9 @@ options ranging from 0.89 bits/pixel up to 8 bits/pixel.\n# Prebuilt binaries\n-Prebuilt release build binaries for Windows (x86 and x64), Linux (x86 and x64),\n-and macOS (x64) are available here:\n-\n-* [Binary directory](/Binary/).\n-\n- These binaries are built from the latest stable tag, and therefore do not\n- necessarily represent the current state of the `master` branch source code.\n+Prebuilt release build binaries for 64-bit Linux, macOS, and Windows are\n+available in the GitHub Releases page. Note currently, no 2.x series binaries\n+are available.\n# Getting started\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update release binary in Readme.txt
|
61,745 |
15.02.2020 14:18:28
| 0 |
63e4a9edb0f2ac1285eec33e4ce8a08ee84f271b
|
Remove -veryfast from README.md
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -122,10 +122,10 @@ recommend experimenting with the block footprint to find the optimum balance\nbetween size and quality, as the finely adjustable compression ratio is one of\nmajor strengths of the ASTC format.\n-The compression speed can be controlled from `-veryfast`, through `-fast`,\n-`-medium` and `-thorough`, up to `-exhaustive`. In general, the more time the\n-encoder has to spend looking for good encodings the better the results, but it\n-does result in increasingly small improvements for the amount of time required.\n+The compression speed can be controlled from `-fast`, through `-medium` and\n+`-thorough`, up to `-exhaustive`. In general, the more time the encoder has to\n+spend looking for good encodings the better the results, but it does result in\n+increasingly small improvements for the amount of time required.\nThere are many other command line options for tuning the encoder parameters\nwhich can be used to fine tune the compression algorithm. See the command line\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove -veryfast from README.md
|
61,745 |
15.02.2020 14:40:09
| 0 |
f26b1fd5dd4c7a94d3ba5f0aafc176448780c20d
|
Make download reference a link
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -63,9 +63,10 @@ options ranging from 0.89 bits/pixel up to 8 bits/pixel.\n# Prebuilt binaries\n-Prebuilt release build binaries for 64-bit Linux, macOS, and Windows are\n-available in the GitHub Releases page. Note currently, no 2.x series binaries\n-are available.\n+Prebuilt release build binaries of `astcenc` for 64-bit Linux, macOS, and\n+Windows are available in the\n+[GitHub Releases page](https://github.com/ARM-software/astc-encoder/releases).\n+Note that currently no 2.x series pre-built binaries are available.\n# Getting started\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Make download reference a link
|
61,745 |
15.02.2020 17:09:28
| 0 |
4959d00d3b039d1a25dfdd2c559c92919b2e7def
|
Change some uses of std::sqrt with astc::sqrt
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -771,7 +771,7 @@ void expand_block_artifact_suppression(\nfloat zdif = (z - centerpos_z) / zdim;\nfloat wdif = 0.36f;\n- float dist = sqrtf(xdif * xdif + ydif * ydif + zdif * zdif + wdif * wdif);\n+ float dist = astc::sqrt(xdif * xdif + ydif * ydif + zdif * zdif + wdif * wdif);\n*bef = powf(dist, ewp->block_artifact_suppression);\nbef++;\n}\n@@ -860,10 +860,10 @@ static float prepare_error_weight_block(\nvariance.y = fvar * mixing + variance.y * (1.0f - mixing);\nvariance.z = fvar * mixing + variance.z * (1.0f - mixing);\n- float4 stdev = float4(sqrtf(MAX(variance.x, 0.0f)),\n- sqrtf(MAX(variance.y, 0.0f)),\n- sqrtf(MAX(variance.z, 0.0f)),\n- sqrtf(MAX(variance.w, 0.0f)));\n+ float4 stdev = float4(astc::sqrt(MAX(variance.x, 0.0f)),\n+ astc::sqrt(MAX(variance.y, 0.0f)),\n+ astc::sqrt(MAX(variance.z, 0.0f)),\n+ astc::sqrt(MAX(variance.w, 0.0f)));\navg.x *= ewp->rgb_mean_weight;\navg.y *= ewp->rgb_mean_weight;\n@@ -1068,13 +1068,12 @@ static void prepare_block_statistics(\naa_var -= as * (as * rpt);\n-\n- rg_cov *= 1.0f / sqrtf(MAX(rr_var * gg_var, 1e-30f));\n- rb_cov *= 1.0f / sqrtf(MAX(rr_var * bb_var, 1e-30f));\n- ra_cov *= 1.0f / sqrtf(MAX(rr_var * aa_var, 1e-30f));\n- gb_cov *= 1.0f / sqrtf(MAX(gg_var * bb_var, 1e-30f));\n- ga_cov *= 1.0f / sqrtf(MAX(gg_var * aa_var, 1e-30f));\n- ba_cov *= 1.0f / sqrtf(MAX(bb_var * aa_var, 1e-30f));\n+ rg_cov *= astc::rsqrt(MAX(rr_var * gg_var, 1e-30f));\n+ rb_cov *= astc::rsqrt(MAX(rr_var * bb_var, 1e-30f));\n+ ra_cov *= astc::rsqrt(MAX(rr_var * aa_var, 1e-30f));\n+ gb_cov *= astc::rsqrt(MAX(gg_var * bb_var, 1e-30f));\n+ ga_cov *= astc::rsqrt(MAX(gg_var * aa_var, 1e-30f));\n+ ba_cov *= astc::rsqrt(MAX(bb_var * aa_var, 1e-30f));\nif (astc::isnan(rg_cov)) rg_cov = 1.0f;\nif (astc::isnan(rb_cov)) rb_cov = 1.0f;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_error_metrics.cpp",
"new_path": "Source/astc_error_metrics.cpp",
"diff": "@@ -348,7 +348,7 @@ void compute_error_metrics(\nprintf(\"mPSNR (RGB): %9.6f dB (fstops %+d to %+d)\\n\",\n(double)mpsnr, fstop_lo, fstop_hi);\n- float logrmse = sqrt(log_num / pixels);\n+ float logrmse = astc::sqrt(log_num / pixels);\nprintf(\"LogRMSE (RGB): %9.6f\\n\", (double)logrmse);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_find_best_partitioning.cpp",
"new_path": "Source/astc_find_best_partitioning.cpp",
"diff": "@@ -191,10 +191,10 @@ void compute_partition_error_color_weightings(\nfor (int i = 0; i < pcnt; i++)\n{\n- color_scalefactors[i].x = sqrt(error_weightings[i].x);\n- color_scalefactors[i].y = sqrt(error_weightings[i].y);\n- color_scalefactors[i].z = sqrt(error_weightings[i].z);\n- color_scalefactors[i].w = sqrt(error_weightings[i].w);\n+ color_scalefactors[i].x = astc::sqrt(error_weightings[i].x);\n+ color_scalefactors[i].y = astc::sqrt(error_weightings[i].y);\n+ color_scalefactors[i].z = astc::sqrt(error_weightings[i].z);\n+ color_scalefactors[i].w = astc::sqrt(error_weightings[i].w);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -1278,8 +1278,6 @@ void recompute_ideal_colors(\nconst imageblock* pb, // picture-block containing the actual data.\nconst error_weight_block* ewb\n) {\n- int i, j;\n-\nint texels_per_block = bsd->texel_count;\nconst quantization_and_transfer_table *qat = &(quant_and_xfer_tables[weight_quantization_mode]);\n@@ -1287,14 +1285,14 @@ void recompute_ideal_colors(\nfloat weight_set[MAX_WEIGHTS_PER_BLOCK];\nfloat plane2_weight_set[MAX_WEIGHTS_PER_BLOCK];\n- for (i = 0; i < it->num_weights; i++)\n+ for (int i = 0; i < it->num_weights; i++)\n{\nweight_set[i] = qat->unquantized_value[weight_set8[i]] * (1.0f / 64.0f);;\n}\nif (plane2_weight_set8)\n{\n- for (i = 0; i < it->num_weights; i++)\n+ for (int i = 0; i < it->num_weights; i++)\nplane2_weight_set[i] = qat->unquantized_value[plane2_weight_set8[i]] * (1.0f / 64.0f);\n}\n@@ -1322,9 +1320,9 @@ void recompute_ideal_colors(\nfloat2 alpha_vec[4];\nfloat2 scale_vec[4];\n- for (i = 0; i < partition_count; i++)\n+ for (int i = 0; i < partition_count; i++)\n{\n- for (j = 0; j < 2; j++)\n+ for (int j = 0; j < 2; j++)\n{\npmat1_red[i].v[j] = float2(0, 0);\npmat2_red[i].v[j] = float2(0, 0);\n@@ -1359,7 +1357,7 @@ void recompute_ideal_colors(\nfloat psum[4]; // sum of (weight * qweight^2) across (red,green,blue)\nfloat qsum[4]; // sum of (weight * qweight * texelval) across (red,green,blue)\n- for (i = 0; i < partition_count; i++)\n+ for (int i = 0; i < partition_count; i++)\n{\nwmin1[i] = 1.0f;\nwmax1[i] = 0.0f;\n@@ -1387,13 +1385,13 @@ void recompute_ideal_colors(\nfloat scale_min[4];\nfloat scale_max[4];\n- for (i = 0; i < partition_count; i++)\n+ for (int i = 0; i < partition_count; i++)\n{\nrgb_sum[i] = float3(1e-17f, 1e-17f, 1e-17f);\nrgb_weight_sum[i] = float3(1e-17f, 1e-17f, 1e-17f);\n}\n- for (i = 0; i < texels_per_block; i++)\n+ for (int i = 0; i < texels_per_block; i++)\n{\nfloat3 rgb = float3(pb->data_r[i], pb->data_g[i], pb->data_b[i]);\nfloat3 rgb_weight = float3(ewb->texel_weight_r[i],\n@@ -1405,7 +1403,7 @@ void recompute_ideal_colors(\nrgb_weight_sum[part] = rgb_weight_sum[part] + rgb_weight;\n}\n- for (i = 0; i < partition_count; i++)\n+ for (int i = 0; i < partition_count; i++)\n{\nfloat3 tmp = float3(rgb_sum[i].x / rgb_weight_sum[i].x,\nrgb_sum[i].y / rgb_weight_sum[i].y,\n@@ -1415,7 +1413,7 @@ void recompute_ideal_colors(\nscale_min[i] = 1e10f;\n}\n- for (i = 0; i < texels_per_block; i++)\n+ for (int i = 0; i < texels_per_block; i++)\n{\nfloat r = pb->data_r[i];\nfloat g = pb->data_g[i];\n@@ -1536,7 +1534,7 @@ void recompute_ideal_colors(\nfloat green_sum[4];\nfloat blue_sum[4];\n- for (i = 0; i < partition_count; i++)\n+ for (int i = 0; i < partition_count; i++)\n{\nred_sum[i] = red_vec[i].x + red_vec[i].y;\ngreen_sum[i] = green_vec[i].x + green_vec[i].y;\n@@ -1547,7 +1545,7 @@ void recompute_ideal_colors(\n// RGB+offset for HDR endpoint mode #7\nint rgbo_fail[4];\n- for (i = 0; i < partition_count; i++)\n+ for (int i = 0; i < partition_count; i++)\n{\nmat4 mod7_mat;\nmod7_mat.v[0] = float4(red_weight_sum[i], 0.0f, 0.0f, red_weight_weight_sum[i]);\n@@ -1578,7 +1576,7 @@ void recompute_ideal_colors(\n// initialize the luminance and scale vectors with a reasonable default,\n// just in case the subsequent calculation blows up.\n- for (i = 0; i < partition_count; i++)\n+ for (int i = 0; i < partition_count; i++)\n{\n#ifdef DEBUG_CAPTURE_NAN\nfedisableexcept(FE_DIVBYZERO | FE_INVALID);\n@@ -1601,7 +1599,7 @@ void recompute_ideal_colors(\nscalediv);\n}\n- for (i = 0; i < partition_count; i++)\n+ for (int i = 0; i < partition_count; i++)\n{\nif (wmin1[i] >= wmax1[i] * 0.999f)\n{\n@@ -1794,7 +1792,7 @@ void recompute_ideal_colors(\n// if the calculation of an RGB-offset vector failed, try to compute\n// a somewhat-sensible value anyway\n- for (i = 0; i < partition_count; i++)\n+ for (int i = 0; i < partition_count; i++)\n{\nif (rgbo_fail[i])\n{\n@@ -1816,10 +1814,18 @@ void recompute_ideal_colors(\nprintf(\"Post-adjustment endpoint-colors: \\n\");\nfor (i = 0; i < partition_count; i++)\n{\n- printf(\"%d Low <%g %g %g %g>\\n\", i, ep->endpt0[i].x, ep->endpt0[i].y, ep->endpt0[i].z, ep->endpt0[i].w);\n- printf(\"%d High <%g %g %g %g>\\n\", i, ep->endpt1[i].x, ep->endpt1[i].y, ep->endpt1[i].z, ep->endpt1[i].w);\n- printf(\"%d RGBS: <%g %g %g %g>\\n\", i, rgbs_vectors[i].x, rgbs_vectors[i].y, rgbs_vectors[i].z, rgbs_vectors[i].w);\n- printf(\"%d RGBO <%g %g %g %g>\\n\", i, rgbo_vectors[i].x, rgbo_vectors[i].y, rgbo_vectors[i].z, rgbo_vectors[i].w);\n+ printf(\"%d Low <%g %g %g %g>\\n\", i,\n+ (double)ep->endpt0[i].x, (double)ep->endpt0[i].y,\n+ (double)ep->endpt0[i].z, (double)ep->endpt0[i].w);\n+ printf(\"%d High <%g %g %g %g>\\n\", i,\n+ (double)ep->endpt1[i].x, (double)ep->endpt1[i].y,\n+ (double)ep->endpt1[i].z, (double)ep->endpt1[i].w);\n+ printf(\"%d RGBS: <%g %g %g %g>\\n\", i,\n+ (double)rgbs_vectors[i].x, (double)rgbs_vectors[i].y,\n+ (double)rgbs_vectors[i].z, (double)rgbs_vectors[i].w);\n+ printf(\"%d RGBO <%g %g %g %g>\\n\", i,\n+ (double)rgbo_vectors[i].x, (double)rgbo_vectors[i].y,\n+ (double)rgbo_vectors[i].z, (double)rgbo_vectors[i].w);\n}\n}\n#endif\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Change some uses of std::sqrt with astc::sqrt
|
61,745 |
16.02.2020 22:11:06
| 0 |
0e910a7de003ed8e3ff90ef725eda1ffc8826012
|
Add runtime errors if host doesn't support ISA extensions
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "@@ -54,6 +54,7 @@ SOURCES = \\\nastc_partition_tables.cpp \\\nastc_percentile_tables.cpp \\\nastc_pick_best_endpoint_format.cpp \\\n+ astc_platform_isa_detection.cpp \\\nastc_platform_dependents.cpp \\\nastc_quantization.cpp \\\nastc_stb_tga.cpp \\\n@@ -90,7 +91,7 @@ ifeq ($(VEC),sse2)\nCPPFLAGS += -msse2 -DASTC_SSE=20 -DASTC_AVX=0 -DASTC_POPCNT=0\nelse\nifeq ($(VEC),sse4.2)\n-CPPFLAGS += -msse4.2 -mpopcnt -DASTC_SSE=42 -DASTC_AVX=0 -DASTC_POPCNT=0\n+CPPFLAGS += -msse4.2 -mpopcnt -DASTC_SSE=42 -DASTC_AVX=0 -DASTC_POPCNT=1\nelse\nifeq ($(VEC),avx2)\nCPPFLAGS += -mavx2 -mpopcnt -DASTC_SSE=42 -DASTC_AVX=2 -DASTC_POPCNT=1\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -1029,6 +1029,24 @@ void launch_threads(\nvoid (*func)(int, int, void*),\nvoid *payload);\n+/**\n+ * @brief Run-time detection if the host CPU supports SSE 4.2.\n+ * @returns Zero if not supported, positive value if it is.\n+ */\n+int cpu_supports_sse42();\n+\n+/**\n+ * @brief Run-time detection if the host CPU supports popcnt.\n+ * @returns Zero if not supported, positive value if it is.\n+ */\n+int cpu_supports_popcnt();\n+\n+/**\n+ * @brief Run-time detection if the host CPU supports avx2.\n+ * @returns Zero if not supported, positive value if it is.\n+ */\n+int cpu_supports_avx2();\n+\n/**\n* @brief The main entry point.\n*\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "Source/astc_platform_isa_detection.cpp",
"diff": "+// ----------------------------------------------------------------------------\n+// This confidential and proprietary software may be used only as authorised\n+// by a licensing agreement from Arm Limited.\n+// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n+// The entire notice above must be reproduced on all authorised copies and\n+// copies may only be made to the extent permitted by a licensing agreement\n+// from Arm Limited.\n+// ----------------------------------------------------------------------------\n+\n+/**\n+ * @brief Platform-specific function implementations.\n+ *\n+ * This module contains functions with strongly OS-dependent implementations:\n+ *\n+ * * CPU count queries\n+ * * Threading\n+ * * Time\n+ *\n+ * In addition to the basic thread abstraction (which is native pthreads on\n+ * all platforms, except Windows where it is an emulation of pthreads), a\n+ * utility function to create N threads and wait for them to complete a batch\n+ * task has also been provided.\n+ */\n+\n+#include \"astc_codec_internals.h\"\n+\n+static int g_cpu_has_sse42 = -1;\n+static int g_cpu_has_avx2 = -1;\n+static int g_cpu_has_popcnt = -1;\n+\n+/* ============================================================================\n+ Platform code for Visual Studio\n+============================================================================ */\n+#if defined(_MSC_VER)\n+#include <intrin.h>\n+\n+static void detect_cpu_isa()\n+{\n+ int data[4];\n+\n+ __cpuid(data, 0);\n+ int num_id = data[0];\n+\n+ if (num_id >= 1)\n+ {\n+ __cpuidex(data, 1, 0);\n+ // SSE42 = Bank 1, ECX, bit 20\n+ g_cpu_has_sse42 = data[2] & (1 << 20) ? 1 : 0;\n+ // POPCNT = Bank 1, ECX, bit 23\n+ g_cpu_has_popcnt = data[2] & (1 << 23) ? 1 : 0;\n+ }\n+\n+ if (num_id >= 7) {\n+ __cpuidex(data, 7, 0);\n+ // AVX2 = Bank 7, EBX, bit 5\n+ g_cpu_has_avx2 = data[1] & (1 << 5) ? 1 : 0;\n+ }\n+}\n+\n+/* ============================================================================\n+ Platform code for GCC and Clang\n+============================================================================ */\n+#else\n+static void detect_cpu_isa()\n+{\n+ g_cpu_has_sse42 = __builtin_cpu_supports(\"sse4.2\") ? 1 : 0;\n+ g_cpu_has_popcnt = __builtin_cpu_supports(\"popcnt\") ? 1 : 0;\n+ g_cpu_has_avx2 = __builtin_cpu_supports(\"avx2\") ? 1 : 0;\n+}\n+#endif\n+\n+/* Public function, see header file for detailed documentation */\n+int cpu_supports_sse42()\n+{\n+ if (g_cpu_has_sse42 == -1)\n+ detect_cpu_isa();\n+\n+ return g_cpu_has_sse42;\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+int cpu_supports_popcnt()\n+{\n+ if (g_cpu_has_popcnt == -1)\n+ detect_cpu_isa();\n+\n+ return g_cpu_has_popcnt;\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+int cpu_supports_avx2()\n+{\n+ if (g_cpu_has_avx2 == -1)\n+ detect_cpu_isa();\n+\n+ return g_cpu_has_avx2;\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -475,16 +475,47 @@ static void test_inappropriate_extended_precision()\nfloat q = p.f - 12582912.0f;\nif (q != 3.0f)\n{\n- printf(\"Single-precision test failed; please recompile with proper IEEE-754 support.\\n\");\n+ printf(\"CPU support error: float math is not IEEE-754 compliant.\\n\");\n+ printf(\" Please recompile with IEEE-754 support.\\n\");\nexit(1);\n}\n}\n+static void test_inappropriate_cpu_extensions()\n+{\n+ #if ASTC_SSE >= 42\n+ if (!cpu_supports_sse42()) {\n+ printf(\"CPU support error: host lacks SSE 4.2 support.\\n\");\n+ printf(\" Please recompile with VEC=sse2.\\n\");\n+ exit(1);\n+ }\n+ #endif\n+\n+ #if ASTC_POPCNT >= 1\n+ if (!cpu_supports_popcnt()) {\n+ printf(\"CPU support error: host lacks POPCNT support.\\n\");\n+ printf(\" Please recompile with VEC=sse2.\\n\");\n+ exit(1);\n+ }\n+ #endif\n+\n+ #if ASTC_AVX >= 2\n+ if (!cpu_supports_avx2()) {\n+ printf(\"CPU support error: host lacks AVX2 support.\\n\");\n+ printf(\" Please recompile with VEC=sse4.2 or VEC=sse2.\\n\");\n+ exit(1);\n+ }\n+ #endif\n+}\n+\nint astc_main(\nint argc,\nchar **argv\n) {\ntest_inappropriate_extended_precision();\n+\n+ test_inappropriate_cpu_extensions();\n+\n// initialization routines\nprepare_angular_tables();\nbuild_quantization_mode_table();\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add runtime errors if host doesn't support ISA extensions
|
61,745 |
16.02.2020 22:12:41
| 0 |
afc20b763d1695e422844bf7b89fa890b6878a02
|
Cleanup platform ISA help text and header
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_platform_isa_detection.cpp",
"new_path": "Source/astc_platform_isa_detection.cpp",
"diff": "+// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// This confidential and proprietary software may be used only as authorised\n-// by a licensing agreement from Arm Limited.\n-// (C) COPYRIGHT 2011-2020 Arm Limited, ALL RIGHTS RESERVED\n-// The entire notice above must be reproduced on all authorised copies and\n-// copies may only be made to the extent permitted by a licensing agreement\n-// from Arm Limited.\n+// Copyright 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* @brief Platform-specific function implementations.\n*\n- * This module contains functions with strongly OS-dependent implementations:\n- *\n- * * CPU count queries\n- * * Threading\n- * * Time\n- *\n- * In addition to the basic thread abstraction (which is native pthreads on\n- * all platforms, except Windows where it is an emulation of pthreads), a\n- * utility function to create N threads and wait for them to complete a batch\n- * task has also been provided.\n+ * This module contains functions for querying the host extended ISA support.\n*/\n#include \"astc_codec_internals.h\"\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Cleanup platform ISA help text and header
|
61,745 |
17.02.2020 00:18:01
| 0 |
2e92ce168f0a417c3c26b6e65e3c68f69e1d6a6c
|
Provide multiple SIMD builds
The current SIMD selection is done statically at compile time to
enable better test coverage. This isn't the end goal for this
release, but this patch updates Make and VS builds to support
building multiple SIMD variants in parallel.
Also updates to VS2019, as that is widely available now.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": ".vscode\n*.log\n*.diff\n+*.user\nSource/*.o\n-Source/astcenc\n-Source/VS2017/.vs\n-Source/VS2017/Release\n-Source/VS2017/Debug\n-Source/VS2017/astcenc.vcxproj.user\n+Source/astcenc-*\n+Source/astcenc-*\n+Source/VS2019/*Release\n+Source/VS2019/*Debug\nTest/Kodak_Images\nTestOutput\n"
},
{
"change_type": "MODIFY",
"old_path": "Docs/Building.md",
"new_path": "Docs/Building.md",
"diff": "This page provides instructions for building `astcenc` from the sources in\nthis repository.\n+**Note:** The current `master` branch is configured to statically build\n+binaries which each use a specific level of SIMD support (SSE2, SSE4.2,\n+or AVX2) selected at compile time. Binaries are produced with a name postfix\n+indicating the SIMD type in use; e.g. `astcenc-avx2` for the AVX2 binary.\n+\n## Windows\n-Builds for Windows use Visual Studio 2017, using the solution file located in\n-the `Source/VS2017/` directory. To compile a release build from the command\n-line, it is possible to use the `msbuild` utility from the Visual Studio 2017\n-installation:\n+Builds for Windows use Visual Studio 2019, using the solution and/or project\n+files located in the `Source/VS2019/` directory.\n+\n+### Single variants\n+\n+To compile a single SIMD variant from the command line, it is possible to use\n+the `msbuild` utility from the Visual Studio installation, targeting the\n+specific project for the variant desired.\n+\n+```\n+msbuild astcenc-<variant>.vcxproj /p:Configuration=Release /p:Platform=x64\n+```\n+\n+### Multiple variants\n+\n+To compile all supported SIMD variants from the command line, it is possible\n+to use the `msbuild` utility from the Visual Studio installation, targeting the\n+solution.\n```\n-msbuild .\\Source\\VS2017\\astcenc.sln /p:Configuration=Release /p:Platform=x64\n+msbuild astcenc.sln /p:Configuration=Release /p:Platform=x64\n```\n-## macOS\n+## macOS and Linux\n+\n+Builds for macOS and Linux use GCC and Make, and are tested with GCC 7.4 and\n+GNU Make 3.82.\n+\n+### Single variants\n-Builds for macOS use GCC and Make, and are tested with GCC 4.6 and GNU Make\n-3.82.\n+To compile a single SIMD variant compile with:\n```\n-cd Source\n-make\n+make -sC Source VEC=[nointrin|sse2|sse4.2|avx2] -j8\n```\n-## Linux\n+... and use:\n-Builds for Linux use GCC and Make, and are tested with GCC 4.6 and GNU Make\n-3.82.\n+```\n+make -sC Source VEC=[nointrin|sse2|sse4.2|avx2] clean\n+```\n+\n+... to clean the build.\n+\n+### All variants\n+\n+To compile all supported SIMD variants compile with:\n```\n-cd Source\n-make\n+make -sC Source batchbuild -j8\n```\n+... and use:\n+\n+```\n+make -sC Source batchclean -j8\n+```\n+\n+... to clean the build.\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "@@ -64,6 +64,11 @@ SOURCES = \\\nastc_weight_align.cpp \\\nastc_weight_quant_xfer_tables.cpp\n+EXTERNAL_SOURCES = \\\n+ stb_image.h \\\n+ stb_image_write.h \\\n+ tinyexr.h\n+\nHEADERS = \\\nastc_codec_internals.h \\\nastc_mathlib.h \\\n@@ -71,30 +76,34 @@ HEADERS = \\\nstb_image_write.h \\\ntinyexr.h\n-OBJECTS = $(SOURCES:.cpp=.o)\n+OBJECTS = $(SOURCES:.cpp=-$(VEC).o)\n-CPPFLAGS = -std=c++14 -mfpmath=sse \\\n+EXTERNAL_OBJECTS = $(EXTERNAL_SOURCES:.h=-$(VEC).o)\n+\n+BINARY = astcenc-$(VEC)\n+\n+CXXFLAGS = -std=c++14 -mfpmath=sse \\\n-Wall -Wextra -Wpedantic -Werror -Werror=shadow -Wdouble-promotion\n-# Validate that the VEC parameter is a supported value, and patch CPPFLAGS\n+# Validate that the DBG parameter is a supported value, and patch CXXFLAGS\nifeq ($(DBG),0)\n-CPPFLAGS += -O3\n+CXXFLAGS += -O3\nelse\n-CPPFLAGS += -O0 -g\n+CXXFLAGS += -O0 -g\nendif\n-# Validate that the VEC parameter is a supported value, and patch CPPFLAGS\n+# Validate that the VEC parameter is a supported value, and patch CXXFLAGS\nifeq ($(VEC),nointrin)\n-CPPFLAGS += -msse2 -DASTC_SSE=0 -DASTC_AVX=0 -DASTC_POPCNT=0\n+CXXFLAGS += -msse2 -DASTC_SSE=0 -DASTC_AVX=0 -DASTC_POPCNT=0\nelse\nifeq ($(VEC),sse2)\n-CPPFLAGS += -msse2 -DASTC_SSE=20 -DASTC_AVX=0 -DASTC_POPCNT=0\n+CXXFLAGS += -msse2 -DASTC_SSE=20 -DASTC_AVX=0 -DASTC_POPCNT=0\nelse\nifeq ($(VEC),sse4.2)\n-CPPFLAGS += -msse4.2 -mpopcnt -DASTC_SSE=42 -DASTC_AVX=0 -DASTC_POPCNT=1\n+CXXFLAGS += -msse4.2 -mpopcnt -DASTC_SSE=42 -DASTC_AVX=0 -DASTC_POPCNT=1\nelse\nifeq ($(VEC),avx2)\n-CPPFLAGS += -mavx2 -mpopcnt -DASTC_SSE=42 -DASTC_AVX=2 -DASTC_POPCNT=1\n+CXXFLAGS += -mavx2 -mpopcnt -DASTC_SSE=42 -DASTC_AVX=2 -DASTC_POPCNT=1\nelse\n$(error Unsupported VEC target, use VEC=nointrin/sse2/sse4.2/avx2)\nendif\n@@ -102,31 +111,48 @@ endif\nendif\nendif\n-CPPFLAGS_EXTERNAL = $(CPPFLAGS) -Wno-unused-parameter -Wno-double-promotion -fno-strict-aliasing\n+# Disable necessary optimizations and warnings for third-party source files\n+CXXFLAGS_EXTERNAL = \\\n+ $(CXXFLAGS) \\\n+ -Wno-unused-parameter \\\n+ -Wno-double-promotion \\\n+ -fno-strict-aliasing\n-astcenc: stb_image.o stb_image_write.o tinyexr.o $(OBJECTS)\n- @g++ -o $@ $^ $(CPPFLAGS) -lpthread\n+$(BINARY): $(EXTERNAL_OBJECTS) $(OBJECTS)\n+ @g++ -o $@ $^ $(CXXFLAGS) -lpthread\n@echo \"[Link] $@ (using $(VEC), debug=$(DBG))\"\n-stb_image.o: stb_image.h\n- @g++ -c -x c++ -o $@ $< $(CPPFLAGS_EXTERNAL) -DSTB_IMAGE_IMPLEMENTATION\n+stb_image-$(VEC).o: stb_image.h\n+ @g++ -c -x c++ -o $@ $< $(CXXFLAGS_EXTERNAL) -DSTB_IMAGE_IMPLEMENTATION\n@echo \"[C++] $<\"\n-stb_image_write.o: stb_image_write.h\n- @g++ -c -x c++ -o $@ $< $(CPPFLAGS_EXTERNAL) -DSTB_IMAGE_WRITE_IMPLEMENTATION\n+stb_image_write-$(VEC).o: stb_image_write.h\n+ @g++ -c -x c++ -o $@ $< $(CXXFLAGS_EXTERNAL) -DSTB_IMAGE_WRITE_IMPLEMENTATION\n@echo \"[C++] $<\"\n-tinyexr.o: tinyexr.h\n- @g++ -c -x c++ -o $@ $< $(CPPFLAGS) -DTINYEXR_IMPLEMENTATION\n+tinyexr-$(VEC).o: tinyexr.h\n+ @g++ -c -x c++ -o $@ $< $(CXXFLAGS) -DTINYEXR_IMPLEMENTATION\n@echo \"[C++] $<\"\n-$(OBJECTS): %.o: %.cpp $(HEADERS)\n- @g++ -c -o $@ $< $(CPPFLAGS)\n+$(OBJECTS): %-$(VEC).o: %.cpp $(HEADERS)\n+ @g++ -c -o $@ $< $(CXXFLAGS)\n@echo \"[C++] $<\"\nclean:\n- @rm -f *.o\n- @rm -f *.obj\n- @rm -f astcenc\n- @rm -f astcenc.exe\n- @echo \"[Clean] Removing build outputs\"\n+ @rm -f *-$(VEC).o\n+ @rm -f *-$(VEC).obj\n+ @rm -f $(BINARY)\n+ @rm -f $(BINARY).exe\n+ @echo \"[Clean] Removing $(VEC) build outputs\"\n+\n+batchbuild:\n+ @+$(MAKE) -s VEC=nointrin\n+ @+$(MAKE) -s VEC=sse2\n+ @+$(MAKE) -s VEC=sse4.2\n+ @+$(MAKE) -s VEC=avx2\n+\n+batchclean:\n+ @+$(MAKE) -s clean VEC=nointrin\n+ @+$(MAKE) -s clean VEC=sse2\n+ @+$(MAKE) -s clean VEC=sse4.2\n+ @+$(MAKE) -s clean VEC=avx2\n"
},
{
"change_type": "RENAME",
"old_path": "Source/VS2017/astcenc.vcxproj.filters",
"new_path": "Source/VS2019/astcenc-avx2.filters",
"diff": "<ClCompile Include=\"..\\astc_toplevel_help.cpp\">\n<Filter>Source Files</Filter>\n</ClCompile>\n+ <ClCompile Include=\"..\\astc_platform_isa_detection.cpp\">\n+ <Filter>Source Files</Filter>\n+ </ClCompile>\n</ItemGroup>\n<ItemGroup>\n<ClInclude Include=\"..\\astc_codec_internals.h\">\n"
},
{
"change_type": "RENAME",
"old_path": "Source/VS2017/astcenc.vcxproj",
"new_path": "Source/VS2019/astcenc-sse4.2.vcxproj",
"diff": "<ClCompile Include=\"..\\astc_percentile_tables.cpp\" />\n<ClCompile Include=\"..\\astc_pick_best_endpoint_format.cpp\" />\n<ClCompile Include=\"..\\astc_platform_dependents.cpp\" />\n+ <ClCompile Include=\"..\\astc_platform_isa_detection.cpp\" />\n<ClCompile Include=\"..\\astc_quantization.cpp\" />\n<ClCompile Include=\"..\\astc_stb_tga.cpp\" />\n<ClCompile Include=\"..\\astc_symbolic_physical.cpp\" />\n<ClInclude Include=\"..\\stb_image.h\" />\n</ItemGroup>\n<PropertyGroup Label=\"Globals\">\n- <ProjectGuid>{D6D60D86-0502-446A-8498-888F78B869C2}</ProjectGuid>\n+ <ProjectGuid>{9FB06FB7-F57D-4B12-9AE9-91CD50FD4879}</ProjectGuid>\n<RootNamespace>astcenc</RootNamespace>\n<Keyword>Win32Proj</Keyword>\n<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\n+ <ProjectName>astcenc-sse4.2</ProjectName>\n</PropertyGroup>\n<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\n<LinkIncremental Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">false</LinkIncremental>\n</PropertyGroup>\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n- <OutDir>$(SolutionDir)$(Configuration)\\</OutDir>\n- <IntDir>$(Configuration)\\Intermediates\\</IntDir>\n+ <OutDir>$(SolutionDir)$(ProjectName)-$(Configuration)\\</OutDir>\n+ <IntDir>$(ProjectName)-$(Configuration)\\Intermediates\\</IntDir>\n</PropertyGroup>\n<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n- <OutDir>$(SolutionDir)$(Configuration)\\</OutDir>\n- <IntDir>$(Configuration)\\Intermediates\\</IntDir>\n+ <OutDir>$(SolutionDir)$(ProjectName)-$(Configuration)\\</OutDir>\n+ <IntDir>$(ProjectName)-$(Configuration)\\Intermediates\\</IntDir>\n</PropertyGroup>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n<ClCompile>\n<Optimization>Disabled</Optimization>\n<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n- <PreprocessorDefinitions>WIN32;ASTC_SSE=42;ASTC_AVX=2;ASTC_POPCNT=1;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n+ <PreprocessorDefinitions>WIN32;ASTC_SSE=42;ASTC_AVX=0;ASTC_POPCNT=1;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>\n<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\n<ClCompile>\n<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n- <PreprocessorDefinitions>WIN32;ASTC_SSE=42;ASTC_AVX=2;ASTC_POPCNT=1;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n+ <PreprocessorDefinitions>WIN32;ASTC_SSE=42;ASTC_AVX=0;ASTC_POPCNT=1;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n<BufferSecurityCheck>false</BufferSecurityCheck>\n<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_stb_tga.cpp",
"new_path": "Source/astc_stb_tga.cpp",
"diff": "#include <stdio.h>\n+// On Visual Studio, include the implementation here, not just the header.\n+#ifdef _MSC_VER\n+ #define STB_IMAGE_IMPLEMENTATION\n+ #define STBI_MSC_SECURE_CRT\n+#endif\n+\n#include \"stb_image.h\"\nastc_codec_image* load_image_with_stb(\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Provide multiple SIMD builds
The current SIMD selection is done statically at compile time to
enable better test coverage. This isn't the end goal for this
release, but this patch updates Make and VS builds to support
building multiple SIMD variants in parallel.
Also updates to VS2019, as that is widely available now.
|
61,745 |
20.02.2020 21:45:53
| 0 |
81989ba70c2170c52a431608ab6514dc63069e7d
|
Change Makefile to use default CXX variable for compiler
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "@@ -119,23 +119,23 @@ CXXFLAGS_EXTERNAL = \\\n-fno-strict-aliasing\n$(BINARY): $(EXTERNAL_OBJECTS) $(OBJECTS)\n- @g++ -o $@ $^ $(CXXFLAGS) -lpthread\n+ @$(CXX) -o $@ $^ $(CXXFLAGS) -lpthread\n@echo \"[Link] $@ (using $(VEC), debug=$(DBG))\"\nstb_image-$(VEC).o: stb_image.h\n- @g++ -c -x c++ -o $@ $< $(CXXFLAGS_EXTERNAL) -DSTB_IMAGE_IMPLEMENTATION\n+ @$(CXX) -c -x c++ -o $@ $< $(CXXFLAGS_EXTERNAL) -DSTB_IMAGE_IMPLEMENTATION\n@echo \"[C++] $<\"\nstb_image_write-$(VEC).o: stb_image_write.h\n- @g++ -c -x c++ -o $@ $< $(CXXFLAGS_EXTERNAL) -DSTB_IMAGE_WRITE_IMPLEMENTATION\n+ @$(CXX) -c -x c++ -o $@ $< $(CXXFLAGS_EXTERNAL) -DSTB_IMAGE_WRITE_IMPLEMENTATION\n@echo \"[C++] $<\"\ntinyexr-$(VEC).o: tinyexr.h\n- @g++ -c -x c++ -o $@ $< $(CXXFLAGS) -DTINYEXR_IMPLEMENTATION\n+ @$(CXX) -c -x c++ -o $@ $< $(CXXFLAGS) -DTINYEXR_IMPLEMENTATION\n@echo \"[C++] $<\"\n$(OBJECTS): %-$(VEC).o: %.cpp $(HEADERS)\n- @g++ -c -o $@ $< $(CXXFLAGS)\n+ @$(CXX) -c -o $@ $< $(CXXFLAGS)\n@echo \"[C++] $<\"\nclean:\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Change Makefile to use default CXX variable for compiler
|
61,745 |
20.02.2020 21:46:17
| 0 |
57571778111661baa59501cff98e82639fd5b093
|
Add explicit assignment operator to fix GCC9 -Werror issues
Implicit assignment deprecated in C++14, and we use -Werror.
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_mathlib.h",
"new_path": "Source/astc_mathlib.h",
"diff": "@@ -445,6 +445,11 @@ public:\nvtype2() {};\nvtype2(T p, T q) : x(p), y(q) {};\nvtype2(const vtype2 & p) : x(p.x), y(p.y) {};\n+ vtype2 &operator =(const vtype2 &s) {\n+ this->x = s.x;\n+ this->y = s.y;\n+ return *this;\n+ }\n};\ntemplate <typename T> class vtype3\n@@ -454,6 +459,12 @@ public:\nvtype3() {};\nvtype3(T p, T q, T r) : x(p), y(q), z(r) {};\nvtype3(const vtype3 & p) : x(p.x), y(p.y), z(p.z) {};\n+ vtype3 &operator =(const vtype3 &s) {\n+ this->x = s.x;\n+ this->y = s.y;\n+ this->z = s.z;\n+ return *this;\n+ }\n};\ntemplate <typename T> class vtype4\n@@ -463,6 +474,13 @@ public:\nvtype4() {};\nvtype4(T p, T q, T r, T s) : x(p), y(q), z(r), w(s) {};\nvtype4(const vtype4 & p) : x(p.x), y(p.y), z(p.z), w(p.w) {};\n+ vtype4 &operator =(const vtype4 &s) {\n+ this->x = s.x;\n+ this->y = s.y;\n+ this->z = s.z;\n+ this->w = s.w;\n+ return *this;\n+ }\n};\ntypedef vtype2<float> float2;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add explicit assignment operator to fix GCC9 -Werror issues
Implicit assignment deprecated in C++14, and we use -Werror.
|
61,745 |
20.02.2020 21:47:23
| 0 |
291994e3b85135d89405aecf3838777effbb1151
|
Zero initialize some members to fix GCC 9 errors
Note there is no actually bug here; this is just GCC being
conservative and -Werror forcing the issue ...
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_compute_variance.cpp",
"new_path": "Source/astc_compute_variance.cpp",
"diff": "@@ -633,6 +633,13 @@ void compute_averages_and_variances(\n// Perform block-wise averages-and-variances calculations across the image\nstruct pixel_region_variance_args arg;\n+\n+ // Initialize fields which are not populated until later\n+ arg.size = int3(0, 0, 0);\n+ arg.src_offset = int3(0, 0, 0);\n+ arg.dst_offset = int3(0, 0, 0);\n+ arg.work_memory = nullptr;\n+\narg.img = img;\narg.rgb_power = rgb_power;\narg.alpha_power = alpha_power;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Zero initialize some members to fix GCC 9 errors
Note there is no actually bug here; this is just GCC being
conservative and -Werror forcing the issue ...
|
61,745 |
20.02.2020 22:01:38
| 0 |
e23a99564881176533d16a91fbe24e5f0b59c476
|
Explicitly use floating point stdlib math functions
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_image_load_store.cpp",
"new_path": "Source/astc_image_load_store.cpp",
"diff": "@@ -296,7 +296,7 @@ float float_to_lns(float p)\n}\nint expo;\n- float normfrac = frexp(p, &expo);\n+ float normfrac = frexpf(p, &expo);\nfloat p1;\nif (expo < -13)\n{\n@@ -647,17 +647,17 @@ void fetch_imageblock(\nif (r <= 0.04045f)\nr = r * (1.0f / 12.92f);\nelse if (r <= 1)\n- r = pow((r + 0.055f) * (1.0f / 1.055f), 2.4f);\n+ r = powf((r + 0.055f) * (1.0f / 1.055f), 2.4f);\nif (g <= 0.04045f)\ng = g * (1.0f / 12.92f);\nelse if (g <= 1)\n- g = pow((g + 0.055f) * (1.0f / 1.055f), 2.4f);\n+ g = powf((g + 0.055f) * (1.0f / 1.055f), 2.4f);\nif (b <= 0.04045f)\nb = b * (1.0f / 12.92f);\nelse if (b <= 1)\n- b = pow((b + 0.055f) * (1.0f / 1.055f), 2.4f);\n+ b = powf((b + 0.055f) * (1.0f / 1.055f), 2.4f);\nfptr[0] = r;\nfptr[1] = g;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -739,8 +739,8 @@ int astc_main(\nxdim_2d = xdim_3d;\nydim_2d = ydim_3d;\n- log10_texels_2d = log((float)(xdim_2d * ydim_2d)) / log(10.0f);\n- log10_texels_3d = log((float)(xdim_3d * ydim_3d * zdim_3d)) / log(10.0f);\n+ log10_texels_2d = logf((float)(xdim_2d * ydim_2d)) / logf(10.0f);\n+ log10_texels_3d = logf((float)(xdim_3d * ydim_3d * zdim_3d)) / logf(10.0f);\nargidx = 5;\n}\nelse\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Explicitly use floating point stdlib math functions
|
61,745 |
20.02.2020 22:05:17
| 0 |
8b4142a855bf540aaacfd7f7900cd914578a94c8
|
Use more braces in static initializers (clang++ fix)
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_percentile_tables.cpp",
"new_path": "Source/astc_percentile_tables.cpp",
"diff": "@@ -74,10 +74,10 @@ static const uint16_t percentile_arr_4x4_1[84] = {\nstatic const packed_percentile_table block_pcd_4x4 =\n{\n4, 4,\n- 61, 84,\n- 184, 141,\n- 0, 53,\n- percentile_arr_4x4_0, percentile_arr_4x4_1\n+ { 61, 84 },\n+ { 184, 141 },\n+ { 0, 53 },\n+ { percentile_arr_4x4_0, percentile_arr_4x4_1 }\n};\nstatic const uint16_t percentile_arr_5x4_0[91] = {\n@@ -114,10 +114,10 @@ static const uint16_t percentile_arr_5x4_1[104] = {\nstatic const packed_percentile_table block_pcd_5x4 =\n{\n5, 4,\n- 91, 104,\n- 322, 464,\n- 0, 202,\n- percentile_arr_5x4_0, percentile_arr_5x4_1\n+ { 91, 104 },\n+ { 322, 464 },\n+ { 0, 202 },\n+ { percentile_arr_5x4_0, percentile_arr_5x4_1 }\n};\nstatic const uint16_t percentile_arr_5x5_0[129] = {\n@@ -162,10 +162,10 @@ static const uint16_t percentile_arr_5x5_1[126] = {\nstatic const packed_percentile_table block_pcd_5x5 =\n{\n5, 5,\n- 129, 126,\n- 258, 291,\n- 0, 116,\n- percentile_arr_5x5_0, percentile_arr_5x5_1\n+ { 129, 126 },\n+ { 258, 291 },\n+ { 0, 116 },\n+ { percentile_arr_5x5_0, percentile_arr_5x5_1 }\n};\nstatic const uint16_t percentile_arr_6x5_0[165] = {\n@@ -217,10 +217,10 @@ static const uint16_t percentile_arr_6x5_1[145] = {\nstatic const packed_percentile_table block_pcd_6x5 =\n{\n6, 5,\n- 165, 145,\n- 388, 405,\n- 0, 156,\n- percentile_arr_6x5_0, percentile_arr_6x5_1\n+ { 165, 145 },\n+ { 388, 405 },\n+ { 0, 156 },\n+ { percentile_arr_6x5_0, percentile_arr_6x5_1 }\n};\nstatic const uint16_t percentile_arr_6x6_0[206] = {\n@@ -279,10 +279,10 @@ static const uint16_t percentile_arr_6x6_1[164] = {\nstatic const packed_percentile_table block_pcd_6x6 =\n{\n6, 6,\n- 206, 164,\n- 769, 644,\n- 0, 256,\n- percentile_arr_6x6_0, percentile_arr_6x6_1\n+ { 206, 164 },\n+ { 769, 644 },\n+ { 0, 256 },\n+ { percentile_arr_6x6_0, percentile_arr_6x6_1 }\n};\nstatic const uint16_t percentile_arr_8x5_0[226] = {\n@@ -344,10 +344,10 @@ static const uint16_t percentile_arr_8x5_1[167] = {\nstatic const packed_percentile_table block_pcd_8x5 =\n{\n8, 5,\n- 226, 167,\n- 763, 517,\n- 0, 178,\n- percentile_arr_8x5_0, percentile_arr_8x5_1\n+ { 226, 167 },\n+ { 763, 517 },\n+ { 0, 178 },\n+ { percentile_arr_8x5_0, percentile_arr_8x5_1 }\n};\nstatic const uint16_t percentile_arr_8x6_0[273] = {\n@@ -418,10 +418,10 @@ static const uint16_t percentile_arr_8x6_1[186] = {\nstatic const packed_percentile_table block_pcd_8x6 =\n{\n8, 6,\n- 273, 186,\n- 880, 300,\n- 0, 64,\n- percentile_arr_8x6_0, percentile_arr_8x6_1\n+ { 273, 186 },\n+ { 880, 300 },\n+ { 0, 64 },\n+ { percentile_arr_8x6_0, percentile_arr_8x6_1 }\n};\nstatic const uint16_t percentile_arr_8x8_0[347] = {\n@@ -503,10 +503,10 @@ static const uint16_t percentile_arr_8x8_1[208] = {\nstatic const packed_percentile_table block_pcd_8x8 =\n{\n8, 8,\n- 347, 208,\n- 1144, 267,\n- 0, 38,\n- percentile_arr_8x8_0, percentile_arr_8x8_1\n+ { 347, 208 },\n+ { 1144, 267 },\n+ { 0, 38 },\n+ { percentile_arr_8x8_0, percentile_arr_8x8_1 }\n};\nstatic const uint16_t percentile_arr_10x5_0[274] = {\n@@ -576,10 +576,10 @@ static const uint16_t percentile_arr_10x5_1[180] = {\nstatic const packed_percentile_table block_pcd_10x5 =\n{\n10, 5,\n- 274, 180,\n- 954, 324,\n- 0, 79,\n- percentile_arr_10x5_0, percentile_arr_10x5_1\n+ { 274, 180 },\n+ { 954, 324 },\n+ { 0, 79 },\n+ { percentile_arr_10x5_0, percentile_arr_10x5_1 }\n};\nstatic const uint16_t percentile_arr_10x6_0[325] = {\n@@ -657,10 +657,10 @@ static const uint16_t percentile_arr_10x6_1[199] = {\nstatic const packed_percentile_table block_pcd_10x6 =\n{\n10, 6,\n- 325, 199,\n- 922, 381,\n- 0, 78,\n- percentile_arr_10x6_0, percentile_arr_10x6_1\n+ { 325, 199 },\n+ { 922, 381 },\n+ { 0, 78 },\n+ { percentile_arr_10x6_0, percentile_arr_10x6_1 }\n};\nstatic const uint16_t percentile_arr_10x8_0[400] = {\n@@ -750,10 +750,10 @@ static const uint16_t percentile_arr_10x8_1[221] = {\nstatic const packed_percentile_table block_pcd_10x8 =\n{\n10, 8,\n- 400, 221,\n- 1119, 376,\n- 0, 52,\n- percentile_arr_10x8_0, percentile_arr_10x8_1\n+ { 400, 221 },\n+ { 1119, 376 },\n+ { 0, 52 },\n+ { percentile_arr_10x8_0, percentile_arr_10x8_1 }\n};\nstatic const uint16_t percentile_arr_10x10_0[453] = {\n@@ -852,10 +852,10 @@ static const uint16_t percentile_arr_10x10_1[234] = {\nstatic const packed_percentile_table block_pcd_10x10 =\n{\n10, 10,\n- 453, 234,\n- 1095, 472,\n- 0, 70,\n- percentile_arr_10x10_0, percentile_arr_10x10_1\n+ { 453, 234 },\n+ { 1095, 472 },\n+ { 0, 70 },\n+ { percentile_arr_10x10_0, percentile_arr_10x10_1 }\n};\nstatic const uint16_t percentile_arr_12x10_0[491] = {\n@@ -959,10 +959,10 @@ static const uint16_t percentile_arr_12x10_1[240] = {\nstatic const packed_percentile_table block_pcd_12x10 =\n{\n12, 10,\n- 491, 240,\n- 1099, 341,\n- 0, 23,\n- percentile_arr_12x10_0, percentile_arr_12x10_1\n+ { 491, 240 },\n+ { 1099, 341 },\n+ { 0, 23 },\n+ { percentile_arr_12x10_0, percentile_arr_12x10_1 }\n};\nstatic const uint16_t percentile_arr_12x12_0[529] = {\n@@ -1072,10 +1072,10 @@ static const uint16_t percentile_arr_12x12_1[246] = {\nstatic const packed_percentile_table block_pcd_12x12 =\n{\n12, 12,\n- 529, 246,\n- 1435, 335,\n- 0, 22,\n- percentile_arr_12x12_0, percentile_arr_12x12_1\n+ { 529, 246 },\n+ { 1435, 335 },\n+ { 0, 22 },\n+ { percentile_arr_12x12_0, percentile_arr_12x12_1 }\n};\n/**\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use more braces in static initializers (clang++ fix)
|
61,745 |
24.02.2020 09:26:31
| 0 |
0316ba63f7957cd4c1e1371395936b1477c02ffc
|
Update Jenkins to AVX2 build and VS2019
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -45,7 +45,7 @@ pipeline {\n}\n}\nstages {\n- stage('Clean workspace') {\n+ stage('Clean') {\nsteps {\nsh 'git clean -fdx'\n}\n@@ -54,14 +54,14 @@ pipeline {\nsteps {\nsh '''\ncd ./Source/\n- make\n+ make VEC=avx2\n'''\n}\n}\nstage('Stash Artefacts') {\nsteps {\ndir('Source') {\n- stash name: 'astcenc-linux', includes: 'astcenc'\n+ stash name: 'astcenc-linux', includes: 'astcenc-*'\n}\n}\n}\n@@ -88,23 +88,23 @@ pipeline {\nstage('Windows Release Build') {\nsteps {\nbat '''\n- call c:\\\\progra~2\\\\micros~1\\\\2017\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n- call msbuild .\\\\Source\\\\VS2017\\\\astcenc.sln /p:Configuration=Release /p:Platform=x64\n+ call c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n+ call msbuild .\\\\Source\\\\VS2019\\\\astcenc.sln /p:Configuration=Release /p:Platform=x64\n'''\n}\n}\nstage('Windows Debug Build') {\nsteps {\nbat '''\n- call c:\\\\progra~2\\\\micros~1\\\\2017\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n- call msbuild .\\\\Source\\\\VS2017\\\\astcenc.sln /p:Configuration=Debug /p:Platform=x64\n+ call c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n+ call msbuild .\\\\Source\\\\VS2019\\\\astcenc-avx2.vcxproj /p:Configuration=Debug /p:Platform=x64\n'''\n}\n}\nstage('Stash Artefacts') {\nsteps {\n- dir('Source\\\\VS2017\\\\Release') {\n- stash name: 'astcenc-win-release', includes: 'astcenc.exe'\n+ dir('Source\\\\VS2019\\\\Release') {\n+ stash name: 'astcenc-win-release', includes: 'astcenc-*.exe'\n}\n}\n}\n@@ -121,32 +121,32 @@ pipeline {\n}\n}\n/* Build for Mac on x86_64 */\n- stage('MacOS-x86_64') {\n+ stage('macOS-x86_64') {\nagent {\nlabel 'mac && x86_64'\n}\nstages {\n- stage('Clean workspace') {\n+ stage('Clean') {\nsteps {\nsh 'git clean -fdx'\n}\n}\n- stage('MacOS Build') {\n+ stage('macOS Build') {\nsteps {\nsh '''\ncd ./Source/\n- make\n+ make VEC=avx2\n'''\n}\n}\nstage('Stash Artefacts') {\nsteps {\ndir('Source') {\n- stash name: 'astcenc-mac', includes: 'astcenc'\n+ stash name: 'astcenc-mac', includes: 'astcenc-*'\n}\n}\n}\n- stage('MacOS Tests') {\n+ stage('macOS Tests') {\nsteps {\nsh '''\nexport PATH=$PATH:/usr/local/bin\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update Jenkins to AVX2 build and VS2019
|
61,745 |
24.02.2020 09:37:25
| 0 |
8cf461f52cce2920590277cd917894acdc5bfd23
|
Change Linux Jenkins builds to use clang++
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Dockerfile",
"new_path": "jenkins/build.Dockerfile",
"diff": "FROM ubuntu:18.04\n-LABEL build.environment.version=\"0.1.0\"\n+LABEL build.environment.version=\"0.2.0\"\nRUN useradd -u 1001 -U -m -c Jenkins jenkins\nRUN apt update && apt-get install -y \\\n+ clang \\\ng++ \\\ngcc \\\ngit \\\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -34,10 +34,10 @@ pipeline {\nstage('Build All') {\nparallel {\n/* Build for Linux on x86_64 */\n- stage('Linux-x86_64') {\n+ stage('Linux') {\nagent {\ndocker {\n- image 'mobilestudio/astcenc:0.1.0'\n+ image 'mobilestudio/astcenc:0.2.0'\nregistryUrl 'https://registry.k8s.dsg.arm.com'\nregistryCredentialsId 'harbor'\nlabel 'docker'\n@@ -50,22 +50,22 @@ pipeline {\nsh 'git clean -fdx'\n}\n}\n- stage('Linux Build') {\n+ stage('Build') {\nsteps {\nsh '''\ncd ./Source/\n- make VEC=avx2\n+ make CXX=clang++ VEC=avx2\n'''\n}\n}\n- stage('Stash Artefacts') {\n+ stage('Stash') {\nsteps {\ndir('Source') {\nstash name: 'astcenc-linux', includes: 'astcenc-*'\n}\n}\n}\n- stage('Linux Tests') {\n+ stage('Test') {\nsteps {\nsh 'python3 ./Test/astc_test_run.py'\nperfReport(sourceDataFiles:'TestOutput/results.xml')\n@@ -75,17 +75,17 @@ pipeline {\n}\n}\n/* Build for Windows on x86_64 */\n- stage('Windows-x86_64') {\n+ stage('Windows') {\nagent {\nlabel 'Windows && x86_64'\n}\nstages {\n- stage('Clean workspace') {\n+ stage('Clean') {\nsteps {\nbat 'git clean -fdx'\n}\n}\n- stage('Windows Release Build') {\n+ stage('Build R') {\nsteps {\nbat '''\ncall c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n@@ -93,7 +93,7 @@ pipeline {\n'''\n}\n}\n- stage('Windows Debug Build') {\n+ stage('Build D') {\nsteps {\nbat '''\ncall c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n@@ -101,14 +101,14 @@ pipeline {\n'''\n}\n}\n- stage('Stash Artefacts') {\n+ stage('Stash') {\nsteps {\ndir('Source\\\\VS2019\\\\Release') {\nstash name: 'astcenc-win-release', includes: 'astcenc-*.exe'\n}\n}\n}\n- stage('Windows Tests') {\n+ stage('Test') {\nsteps {\nbat '''\nset Path=c:\\\\Python38;c:\\\\Python38\\\\Scripts;%Path%\n@@ -121,7 +121,7 @@ pipeline {\n}\n}\n/* Build for Mac on x86_64 */\n- stage('macOS-x86_64') {\n+ stage('macOS') {\nagent {\nlabel 'mac && x86_64'\n}\n@@ -131,7 +131,7 @@ pipeline {\nsh 'git clean -fdx'\n}\n}\n- stage('macOS Build') {\n+ stage('Build') {\nsteps {\nsh '''\ncd ./Source/\n@@ -139,14 +139,14 @@ pipeline {\n'''\n}\n}\n- stage('Stash Artefacts') {\n+ stage('Stash') {\nsteps {\ndir('Source') {\nstash name: 'astcenc-mac', includes: 'astcenc-*'\n}\n}\n}\n- stage('macOS Tests') {\n+ stage('Test') {\nsteps {\nsh '''\nexport PATH=$PATH:/usr/local/bin\n@@ -160,10 +160,10 @@ pipeline {\n}\n}\n}\n- stage('Upload to Artifactory') {\n+ stage('Artifactory') {\nagent {\ndocker {\n- image 'mobilestudio/astcenc:0.1.0'\n+ image 'mobilestudio/astcenc:0.2.0'\nregistryUrl 'https://registry.k8s.dsg.arm.com'\nregistryCredentialsId 'harbor'\nlabel 'docker'\n@@ -174,7 +174,7 @@ pipeline {\nskipDefaultCheckout true\n}\nstages {\n- stage('Unstash artefacts') {\n+ stage('Unstash') {\nsteps {\ndeleteDir()\ndir('upload/Linux-x86_64') {\n@@ -188,7 +188,7 @@ pipeline {\n}\n}\n}\n- stage('Upload to Artifactory') {\n+ stage('Upload') {\nsteps {\nzip zipFile: 'astcenc.zip', dir: 'upload', archive: false\ndsgArtifactoryUpload('*.zip', \"astc-encoder/build/${currentBuild.number}/\")\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Change Linux Jenkins builds to use clang++
|
61,745 |
24.02.2020 10:04:42
| 0 |
5ef0229484b735d6258f56d55664cee324a852c9
|
Update Jenkins to VS2019
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -89,7 +89,7 @@ pipeline {\nsteps {\nbat '''\ncall c:\\\\progra~2\\\\micros~1\\\\2019\\\\buildtools\\\\vc\\\\auxiliary\\\\build\\\\vcvars64.bat\n- call msbuild .\\\\Source\\\\VS2019\\\\astcenc.sln /p:Configuration=Release /p:Platform=x64\n+ call msbuild .\\\\Source\\\\VS2019\\\\astcenc-avx2.vcxproj /p:Configuration=Release /p:Platform=x64\n'''\n}\n}\n@@ -103,8 +103,8 @@ pipeline {\n}\nstage('Stash') {\nsteps {\n- dir('Source\\\\VS2019\\\\Release') {\n- stash name: 'astcenc-win-release', includes: 'astcenc-*.exe'\n+ dir('Source\\\\VS2019\\\\astcenc-avx2-Release') {\n+ stash name: 'astcenc-win-release', includes: 'astcenc-avx2.exe'\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update Jenkins to VS2019
|
61,745 |
24.02.2020 13:18:53
| 0 |
59c438287f196667e228d77506f460aab47ad09d
|
Remove reference to "very fast" preset
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -42,7 +42,7 @@ format output images. The encoder supports decompression of ASTC input images\ninto TGA or KTX format output images.\nThe encoder allows control over the compression time/quality tradeoff with\n-`exhaustive`, `thorough`, `medium`, `fast`, and `very fast` encoding speeds.\n+`exhaustive`, `thorough`, `medium`, and `fast` encoding quality presets.\nThe encoder allows compression time and quality analysis by reporting the\ncompression time, and the Peak Signal-to-Noise Ratio (PSNR) between the input\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove reference to "very fast" preset
|
61,745 |
24.02.2020 13:43:40
| 0 |
1858bf5945fda7b9af3cb260f198b7f37f99ae44
|
Update README summary instructions
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -71,7 +71,7 @@ Note that currently no 2.x series pre-built binaries are available.\n# Getting started\nOpen a terminal, change to the appropriate directory for your system, and run\n-the astcenc encoder program, like this on Linux or Mac OS:\n+the astcenc encoder program, like this on Linux or macOS:\n./astcenc\n@@ -80,37 +80,45 @@ the astcenc encoder program, like this on Linux or Mac OS:\nastcenc\nInvoking the tool with no arguments gives an extensive help message, including\n-usage instructions, and details of all the available command line options.\n+usage instructions, and details of all the available command line options. A\n+summary of the main encoder options are shown below.\n## Compressing an image\n-Compress an image using the `-c` option:\n+Compress an image using the `-cl` \\ `-cs` \\ `-ch` options. For example:\n- astcenc -c example.png example.astc 6x6 -medium\n+ astcenc -cl example.png example.astc 6x6 -medium\n-This compresses `example.png` using the 6x6 block footprint (3.55 bits/pixel)\n-and a `medium` compression speed, storing the compressed output in the linear\n-color space to `example.astc`.\n+This compresses `example.png` using the LDR color profile and a 6x6 block\n+footprint (3.55 bits/pixel). The `-medium` quality preset gives a reasonable\n+image quality for a relatively fast compression speed. The output is stored to\n+a linear color space compressed image, `example.astc`. The other modes are\n+`-cs`, which compresses using the LDR sRGB color profile, and `-ch`, which\n+compresses using the HDR color profile.\n## Decompressing an image\n-Decompress an image using the `-d` option:\n+Decompress an image using the `-dl` \\ `-ds` \\ `-dh` options. For example:\n- astcenc -d example.astc example.tga\n+ astcenc -dh example.astc example.tga\n-This decompresses `example.astc` storing the decompressed output to\n-`example.tga`.\n+This decompresses `example.astc` using the full HDR feature profile, storing\n+the decompressed output to `example.tga`. The other modes are `-dl`, which\n+compresses using the LDR profile, and `-ds`, which decompresses using the LDR\n+sRGB color profile.\n## Measuring image quality\n-Review the compression quality using the `-t` option:\n+Review the compression quality using the `-tl` \\ `-ts` \\ -`th` options. For\n+example:\n- astcenc -t example.png example.tga\n+ astcenc -tl example.png example.tga 5x5 -thorough\n-This is equivalent to compressing and then immediately decompressing the\n-image, allowing a visual inspection of the decompression quality. In addition\n-this mode also prints out the PSNR quality of the compressed image to the\n-console.\n+This is equivalent to using using the LDR color profile and a 5x5 block size\n+to compress the image, using the `-thorough` quality preset, and then\n+immediately decompressing the image and saving the result. This can be used\n+to enable a visual inspection of the decompression quality. In addition\n+this mode also prints out some image quality metrics to the console.\n## Experimenting\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update README summary instructions
|
61,745 |
24.02.2020 13:45:10
| 0 |
54dae20afe3c3e5876908ac06cb46219bbb2db26
|
Update Encoding.md -c -> -cl
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/Encoding.md",
"new_path": "Docs/Encoding.md",
"diff": "@@ -176,7 +176,7 @@ luminance.\nFor color data it is nearly always a perceptual quality win to use sRGB input\nsource textures that are then compressed using the ASTC sRGB compression mode\n-(compress using the `-cs` command line option rather than the `-c` command\n+(compress using the `-cs` command line option rather than the `-cl` command\nline option). Note that sRGB gamma correction is only applied to the RGB\nchannels during decode; the alpha channel is always treated as linear encoded\ndata.\n"
},
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -104,8 +104,7 @@ Decompress an image using the `-dl` \\ `-ds` \\ `-dh` options. For example:\nThis decompresses `example.astc` using the full HDR feature profile, storing\nthe decompressed output to `example.tga`. The other modes are `-dl`, which\n-compresses using the LDR profile, and `-ds`, which decompresses using the LDR\n-sRGB color profile.\n+decompresses using the LDR profile, and `-ds`, which decompresses using the LDR sRGB color profile.\n## Measuring image quality\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update Encoding.md -c -> -cl
|
61,761 |
26.02.2020 17:26:56
| 18,000 |
5e3d3ff70784393cfc9f3d181dcc5fd12bfa1fa4
|
Some cleanups
Fixed memory leak related to decimation_tables being
allocated and never deallocated
Reduced size of decimation_tables array to remove
unused last element
Made hdr_rgb_hdr_alpha_unpack3() static
Removed spurious semicolons in vtypeX classes
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_block_sizes2.cpp",
"new_path": "Source/astc_block_sizes2.cpp",
"diff": "@@ -899,3 +899,12 @@ void init_block_size_descriptor(\ninit_partition_tables(bsd);\n}\n+\n+void deinit_block_size_descriptor(\n+ block_size_descriptor* bsd)\n+{\n+ for(int i = 0; i < bsd->decimation_mode_count; i++)\n+ {\n+ delete bsd->decimation_tables[i];\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -156,7 +156,7 @@ struct block_size_descriptor\nint decimation_mode_maxprec_2planes[MAX_DECIMATION_MODES];\nfloat decimation_mode_percentile[MAX_DECIMATION_MODES];\nint permit_encode[MAX_DECIMATION_MODES];\n- const decimation_table *decimation_tables[MAX_DECIMATION_MODES + 1];\n+ const decimation_table *decimation_tables[MAX_DECIMATION_MODES];\nblock_mode block_modes[MAX_WEIGHT_MODES];\n// for the k-means bed bitmap partitioning algorithm, we don't\n@@ -425,6 +425,9 @@ void init_block_size_descriptor(\nint zdim,\nblock_size_descriptor* bsd);\n+void deinit_block_size_descriptor(\n+ block_size_descriptor* bsd);\n+\n/**\n* @brief Populate the partition tables for the target block size.\n*\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_color_unquantize.cpp",
"new_path": "Source/astc_color_unquantize.cpp",
"diff": "@@ -779,7 +779,7 @@ static void hdr_alpha_unpack(\n*a1 <<= 4;\n}\n-void hdr_rgb_hdr_alpha_unpack3(\n+static void hdr_rgb_hdr_alpha_unpack3(\nconst int input[8],\nint quantization_level,\nuint4* output0,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_mathlib.h",
"new_path": "Source/astc_mathlib.h",
"diff": "@@ -442,9 +442,9 @@ template <typename T> class vtype2\n{\npublic:\nT x, y;\n- vtype2() {};\n- vtype2(T p, T q) : x(p), y(q) {};\n- vtype2(const vtype2 & p) : x(p.x), y(p.y) {};\n+ vtype2() {}\n+ vtype2(T p, T q) : x(p), y(q) {}\n+ vtype2(const vtype2 & p) : x(p.x), y(p.y) {}\nvtype2 &operator =(const vtype2 &s) {\nthis->x = s.x;\nthis->y = s.y;\n@@ -456,9 +456,9 @@ template <typename T> class vtype3\n{\npublic:\nT x, y, z;\n- vtype3() {};\n- vtype3(T p, T q, T r) : x(p), y(q), z(r) {};\n- vtype3(const vtype3 & p) : x(p.x), y(p.y), z(p.z) {};\n+ vtype3() {}\n+ vtype3(T p, T q, T r) : x(p), y(q), z(r) {}\n+ vtype3(const vtype3 & p) : x(p.x), y(p.y), z(p.z) {}\nvtype3 &operator =(const vtype3 &s) {\nthis->x = s.x;\nthis->y = s.y;\n@@ -471,9 +471,9 @@ template <typename T> class vtype4\n{\npublic:\nT x, y, z, w;\n- vtype4() {};\n- vtype4(T p, T q, T r, T s) : x(p), y(q), z(r), w(s) {};\n- vtype4(const vtype4 & p) : x(p.x), y(p.y), z(p.z), w(p.w) {};\n+ vtype4() {}\n+ vtype4(T p, T q, T r, T s) : x(p), y(q), z(r), w(s) {}\n+ vtype4(const vtype4 & p) : x(p.x), y(p.y), z(p.z), w(p.w) {}\nvtype4 &operator =(const vtype4 &s) {\nthis->x = s.x;\nthis->y = s.y;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -175,6 +175,7 @@ astc_codec_image *load_astc_file(\nwrite_imageblock(img, &pb, &bsd, x * xdim, y * ydim, z * zdim, swz_decode);\n}\n+ deinit_block_size_descriptor(&bsd);\nfree(buffer);\nreturn img;\n}\n@@ -330,6 +331,7 @@ static void encode_astc_image(\nai.output_image = output_image;\nlaunch_threads(threadcount, encode_astc_image_threadfunc, &ai);\n+ deinit_block_size_descriptor(bsd);\ndelete bsd;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Some cleanups (#91)
- Fixed memory leak related to decimation_tables being
allocated and never deallocated
- Reduced size of decimation_tables array to remove
unused last element
- Made hdr_rgb_hdr_alpha_unpack3() static
- Removed spurious semicolons in vtypeX classes
|
61,745 |
22.02.2020 14:51:26
| 0 |
509cb0bfe5a486c8a5574efd6fe23991c2b361b8
|
Standardize on no type promotion in vec constructors
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_averages_and_directions.cpp",
"new_path": "Source/astc_averages_and_directions.cpp",
"diff": "/**\n* @brief Functions for finding dominant direction of a set of colors.\n- *\n- * Uses Arm patent pending method.\n*/\n#include \"astc_codec_internals.h\"\n@@ -50,7 +48,7 @@ void compute_averages_and_directions_rgba(\nconst uint8_t *weights = pt->texels_of_partition[partition];\nint texelcount = pt->texels_per_partition[partition];\n- float4 base_sum = float4(0, 0, 0, 0);\n+ float4 base_sum = float4(0.0f, 0.0f, 0.0f, 0.0f);\nfloat partition_weight = 0.0f;\nfor (int i = 0; i < texelcount; i++)\n@@ -69,10 +67,10 @@ void compute_averages_and_directions_rgba(\nfloat4 average = base_sum * (1.0f / MAX(partition_weight, 1e-7f));\naverages[partition] = average * color_scalefactors[partition];\n- float4 sum_xp = float4(0, 0, 0, 0);\n- float4 sum_yp = float4(0, 0, 0, 0);\n- float4 sum_zp = float4(0, 0, 0, 0);\n- float4 sum_wp = float4(0, 0, 0, 0);\n+ float4 sum_xp = float4(0.0f, 0.0f, 0.0f, 0.0f);\n+ float4 sum_yp = float4(0.0f, 0.0f, 0.0f, 0.0f);\n+ float4 sum_zp = float4(0.0f, 0.0f, 0.0f, 0.0f);\n+ float4 sum_wp = float4(0.0f, 0.0f, 0.0f, 0.0f);\nfor (int i = 0; i < texelcount; i++)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -954,7 +954,7 @@ static float prepare_error_weight_block(\nerror_weight.w /= (derv[idx].w * derv[idx].w * 1e-10f);\newb->error_weights[idx] = error_weight;\n- if (dot(error_weight, float4(1, 1, 1, 1)) < 1e-10f)\n+ if (dot(error_weight, float4(1.0f, 1.0f, 1.0f, 1.0f)) < 1e-10f)\newb->contains_zeroweight_texels = 1;\n}\nidx++;\n@@ -962,7 +962,7 @@ static float prepare_error_weight_block(\n}\n}\n- float4 error_weight_sum = float4(0, 0, 0, 0);\n+ float4 error_weight_sum = float4(0.0f, 0.0f, 0.0f, 0.0f);\nint texels_per_block = bsd->texel_count;\nfor (int i = 0; i < texels_per_block; i++)\n{\n@@ -985,7 +985,7 @@ static float prepare_error_weight_block(\newb->texel_weight[i] = (ewb->error_weights[i].x + ewb->error_weights[i].y + ewb->error_weights[i].z + ewb->error_weights[i].w) * 0.25f;\n}\n- return dot(error_weight_sum, float4(1, 1, 1, 1));\n+ return dot(error_weight_sum, float4(1.0f, 1.0f, 1.0f, 1.0f));\n}\nstatic void prepare_block_statistics(\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compute_variance.cpp",
"new_path": "Source/astc_compute_variance.cpp",
"diff": "@@ -322,7 +322,7 @@ static void compute_pixel_region_variance(\n}\n// Pad with an extra layer of 0s; this forms the edge of the SAT tables\n- float4 vbz = float4(0, 0, 0, 0);\n+ float4 vbz = float4(0.0f, 0.0f, 0.0f, 0.0f);\nfor (int z = 0; z < padsize_z; z++)\n{\nfor (int y = 0; y < padsize_y; y++)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_find_best_partitioning.cpp",
"new_path": "Source/astc_find_best_partitioning.cpp",
"diff": "@@ -347,7 +347,7 @@ void find_best_partitionings(\nproc_uncorr_lines[j].bs = (uncorr_lines[j].b * color_scalefactors[j]);\nproc_uncorr_lines[j].bis = (uncorr_lines[j].b * inverse_color_scalefactors[j]);\n- samechroma_lines[j].a = float4(0, 0, 0, 0);\n+ samechroma_lines[j].a = float4(0.0f, 0.0f, 0.0f, 0.0f);\nif (dot(averages[j], averages[j]) == 0.0f)\nsamechroma_lines[j].b = normalize(float4(1.0f, 1.0f, 1.0f, 1.0f));\nelse\n@@ -360,28 +360,28 @@ void find_best_partitionings(\nseparate_red_lines[j].a = float3(averages[j].y, averages[j].z, averages[j].w);\nfloat3 dirs_gba = float3(directions_rgba[j].y, directions_rgba[j].z, directions_rgba[j].w);\nif (dot(dirs_gba, dirs_gba) == 0.0f)\n- separate_red_lines[j].b = normalize(float3(1, 1, 1));\n+ separate_red_lines[j].b = normalize(float3(1.0f, 1.0f, 1.0f));\nelse\nseparate_red_lines[j].b = normalize(dirs_gba);\nseparate_green_lines[j].a = float3(averages[j].x, averages[j].z, averages[j].w);\nfloat3 dirs_rba = float3(directions_rgba[j].x, directions_rgba[j].z, directions_rgba[j].w);\nif (dot(dirs_rba, dirs_rba) == 0.0f)\n- separate_green_lines[j].b = normalize(float3(1, 1, 1));\n+ separate_green_lines[j].b = normalize(float3(1.0f, 1.0f, 1.0f));\nelse\nseparate_green_lines[j].b = normalize(dirs_rba);\nseparate_blue_lines[j].a = float3(averages[j].x, averages[j].y, averages[j].w);\nfloat3 dirs_rga = float3(directions_rgba[j].x, directions_rgba[j].y, directions_rgba[j].w);\nif (dot(dirs_rga, dirs_rga) == 0.0f)\n- separate_blue_lines[j].b = normalize(float3(1, 1, 1));\n+ separate_blue_lines[j].b = normalize(float3(1.0f, 1.0f, 1.0f));\nelse\nseparate_blue_lines[j].b = normalize(dirs_rga);\nseparate_alpha_lines[j].a = float3(averages[j].x, averages[j].y, averages[j].z);\nfloat3 dirs_rgb = float3(directions_rgba[j].x, directions_rgba[j].y, directions_rgba[j].z);\nif (dot(dirs_rgb, dirs_rgb) == 0.0f)\n- separate_alpha_lines[j].b = normalize(float3(1, 1, 1));\n+ separate_alpha_lines[j].b = normalize(float3(1.0f, 1.0f, 1.0f));\nelse\nseparate_alpha_lines[j].b = normalize(dirs_rgb);\n@@ -602,21 +602,21 @@ void find_best_partitionings(\nseparate_red_lines[j].a = float2(averages[j].y, averages[j].z);\nfloat2 dirs_gb = float2(directions_rgb[j].y, directions_rgb[j].z);\nif (dot(dirs_gb, dirs_gb) == 0.0f)\n- separate_red_lines[j].b = normalize(float2(1, 1));\n+ separate_red_lines[j].b = normalize(float2(1.0f, 1.0f));\nelse\nseparate_red_lines[j].b = normalize(dirs_gb);\nseparate_green_lines[j].a = float2(averages[j].x, averages[j].z);\nfloat2 dirs_rb = float2(directions_rgb[j].x, directions_rgb[j].z);\nif (dot(dirs_rb, dirs_rb) == 0.0f)\n- separate_green_lines[j].b = normalize(float2(1, 1));\n+ separate_green_lines[j].b = normalize(float2(1.0f, 1.0f));\nelse\nseparate_green_lines[j].b = normalize(dirs_rb);\nseparate_blue_lines[j].a = float2(averages[j].x, averages[j].y);\nfloat2 dirs_rg = float2(directions_rgb[j].x, directions_rgb[j].y);\nif (dot(dirs_rg, dirs_rg) == 0.0f)\n- separate_blue_lines[j].b = normalize(float2(1, 1));\n+ separate_blue_lines[j].b = normalize(float2(1.0f, 1.0f));\nelse\nseparate_blue_lines[j].b = normalize(dirs_rg);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -282,14 +282,14 @@ static void compute_endpoints_and_ideal_weights_2_components(\n{\nfloat2 egv = directions[i];\nif (egv.x + egv.y < 0.0f)\n- directions[i] = float2(0, 0) - egv;\n+ directions[i] = float2(0.0f, 0.0f) - egv;\n}\nfor (i = 0; i < partition_count; i++)\n{\nlines[i].a = averages[i];\nif (dot(directions[i], directions[i]) == 0.0f)\n- lines[i].b = normalize(float2(1, 1));\n+ lines[i].b = normalize(float2(1.0f, 1.0f));\nelse\nlines[i].b = normalize(directions[i]);\n}\n@@ -549,7 +549,7 @@ static void compute_endpoints_and_ideal_weights_3_components(\n{\nlines[i].a = averages[i];\nif (dot(directions[i], directions[i]) == 0.0f)\n- lines[i].b = normalize(float3(1, 1, 1));\n+ lines[i].b = normalize(float3(1.0f, 1.0f, 1.0f));\nelse\nlines[i].b = normalize(directions[i]);\n}\n@@ -740,14 +740,14 @@ static void compute_endpoints_and_ideal_weights_rgba(\n{\nfloat4 direc = directions_rgba[i];\nif (direc.x + direc.y + direc.z < 0.0f)\n- directions_rgba[i] = float4(0, 0, 0, 0) - direc;\n+ directions_rgba[i] = float4(0.0f, 0.0f, 0.0f, 0.0f) - direc;\n}\nfor (i = 0; i < partition_count; i++)\n{\nlines[i].a = averages[i];\nif (dot(directions_rgba[i], directions_rgba[i]) == 0.0f)\n- lines[i].b = normalize(float4(1, 1, 1, 1));\n+ lines[i].b = normalize(float4(1.0f, 1.0f, 1.0f, 1.0f));\nelse\nlines[i].b = normalize(directions_rgba[i]);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_kmeans_partitioning.cpp",
"new_path": "Source/astc_kmeans_partitioning.cpp",
"diff": "@@ -236,7 +236,7 @@ static void basic_kmeans_update(\nfor (i = 0; i < partition_count; i++)\n{\n- color_sum[i] = float4(0, 0, 0, 0);\n+ color_sum[i] = float4(0.0f, 0.0f, 0.0f, 0.0f);\nweight_sum[i] = 0;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Standardize on no type promotion in vec constructors
|
61,745 |
26.02.2020 22:30:06
| 0 |
81a5e50741b4c8302cf7d78f314a53e44ee68e1f
|
Rename deinit_<foo> to term_<foo>
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_block_sizes2.cpp",
"new_path": "Source/astc_block_sizes2.cpp",
"diff": "@@ -900,7 +900,7 @@ void init_block_size_descriptor(\ninit_partition_tables(bsd);\n}\n-void deinit_block_size_descriptor(\n+void term_block_size_descriptor(\nblock_size_descriptor* bsd)\n{\nfor(int i = 0; i < bsd->decimation_mode_count; i++)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -425,7 +425,7 @@ void init_block_size_descriptor(\nint zdim,\nblock_size_descriptor* bsd);\n-void deinit_block_size_descriptor(\n+void term_block_size_descriptor(\nblock_size_descriptor* bsd);\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -175,7 +175,7 @@ astc_codec_image *load_astc_file(\nwrite_imageblock(img, &pb, &bsd, x * xdim, y * ydim, z * zdim, swz_decode);\n}\n- deinit_block_size_descriptor(&bsd);\n+ term_block_size_descriptor(&bsd);\nfree(buffer);\nreturn img;\n}\n@@ -331,7 +331,8 @@ static void encode_astc_image(\nai.output_image = output_image;\nlaunch_threads(threadcount, encode_astc_image_threadfunc, &ai);\n- deinit_block_size_descriptor(bsd);\n+\n+ term_block_size_descriptor(bsd);\ndelete bsd;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Rename deinit_<foo> to term_<foo>
|
61,745 |
29.02.2020 16:03:01
| 0 |
1a5e260137a3a804876690020521c6fe30ebb69e
|
Fix argument order in help message
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel_help.cpp",
"new_path": "Source/astc_toplevel_help.cpp",
"diff": "@@ -256,7 +256,7 @@ ADVANCED COMPRESSION\ne.g. a power of 0.5 causes the codec to take the square root\nof every input pixel value.\n- -va <base> <power> <avg> <stdev>\n+ -va <power> <base> <avg> <stdev>\nCompute the per-texel relative error weighting for the alpha\nchannel, when used in conjunction with -v. See documentation for\n-v for parameter documentation.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix argument order in help message
|
61,745 |
29.02.2020 21:13:42
| 0 |
6106ce7e96cd424da0fc2513ee64d06de300b476
|
Remove DECODE from the uncompressed load path
Fixes
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -1482,7 +1482,7 @@ int astc_main(\nint input_image_is_hdr = 0;\n// load image\n- if (op_mode == ASTC_ENCODE || op_mode == ASTC_DECODE || op_mode == ASTC_ENCODE_AND_DECODE)\n+ if (op_mode == ASTC_ENCODE || op_mode == ASTC_ENCODE_AND_DECODE)\n{\n// Allocate arrays for image data and load results.\nload_results = new int[array_size];\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove DECODE from the uncompressed load path
Fixes #92
|
61,745 |
01.03.2020 01:22:44
| 0 |
81e91b77aa7ba60b8fc3eea0273843d1c1deace0
|
Enable test suite on Windows builds
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/Testing.md",
"new_path": "Docs/Testing.md",
"diff": "-# Testing ASTC Encoder\n+# Testing astcenc\n-The repository contains a small suite of application tests, which can be used\n-to sanity check source code changes to the compressor. It must be noted that\n-this test suite is relatively limited in scope and does not cover every feature\n-or bitrate of the standard.\n+The repository contains a small suite of tests which can be used to sanity\n+check source code changes to the compressor. It must be noted that this test\n+suite is relatively limited in scope and does not cover every feature or\n+bitrate of the standard.\n-# Required Software\n+# Required software\n-Running the tests requires Python 3.7 to be installed on the host machine, with\n-the following packages installed:\n+Running the tests requires Python 3.7 to be installed on the host machine.\n- python3 -m pip install junit_xml\n- python3 -m pip install pillow\n-\n-# Running the Test Suite\n+# Running the test suite\nTo run the full test suite first build the 64-bit release configuration of\n`astcenc` for the host OS, and then run the following command from the root of\ndirectory of the repository:\n- python3 ./Test/runner.py\n-\n-This will run though a series of image compression tests, comparing the\n-resulting PSNR against the reference results from the last stable release. The\n-test will fail if any reduction in PSNR is detected.\n+ python3 ./Test/astc_run_image_tests.py\n-All decompressed test output images are stored in the `TestOutput` directory,\n-as is a summary result report in JUnit XML format which also includes test\n-compression time. Note that while compression speed is reported by the test\n-suite, a performance regression will not cause a test to fail.\n+This will run though a series of image compression tests, comparing the image\n+PSNR against a set of reference results from the last stable release. The test\n+will fail if any reduction in PSNR above a set threshold is detected. Note that\n+performance information is reported, but regressions will not flag a failure.\n-## Smoke tests\n+For debug purposes, all decompressed test output images and result CSV files\n+are stored in the `TestOutput` directory, using the same test set structure as\n+the `Test/Images` folder.\n-To quickly sanity check changes you can run a smaller test list, but that\n-stills runs a few tests from each image category, using the following commands:\n+## Test selection\n- python3 ./Test/runner.py --test-level smoke\n+The runner supports a number of options to filter down what is run, enabling\n+developers to focus local testing on the parts of the code they are working on.\n-You can further filter tests by selecting runs for specific profiles, data\n-formats, or block sizes. See the following options in the `--help` for\n-more details:\n-\n-* `--dynamic-range` : select a single set of either LDR or HDR tests.\n-* `--format` : select a single input data format.\n-* `--block-size` : select a single block size.\n+* `--block-size` selects which block size to run. By default a range of\n+ block sizes (2D and 3D) are used.\n+* `--test-set` selects which image set to run. By default the `Small` image\n+ test set is selected, which aims to provide basic coverage of many different\n+ color formats and color profiles.\n+* `--color-profile` selects which color profiles from the standard should be\n+ used (LDR, LDR sRGB, or HDR) to select images. By default all are selected.\n+* `--color-format` selects which color formats should be used (L, XY, RGB,\n+ RGBA) to select images. By default all are selected.\n## Performance tests\n-To provide less noisy performance results the test suite supports running each\n-compression pass multiple times and returning the average performance. To\n+To provide less noisy performance results the test suite supports compressing\n+each image multiple times and returning the best measured performance. To\nenable this mode use the following two options:\n* `--warmup <N>` : Run N warmup compression passes which are not timed.\n* `--repeats <M>` : Run M test compression passes which are timed.\n**Note:** The reference CSV contains performance results measured on an Intel\n-Core i5 9600K running at 4.3GHz, running each test 10 times after a single\n+Core i5 9600K running at 4.3GHz, running each test 5 times after a single\nwarmup pass.\n-# Updating Reference Scores\n-\n-The pass and fail conditions are stored in a reference result CSV, which is\n-based on the image quality and performance of the latest stable tag. The\n-runner can be used to regenerate the CSV file using the 64-bit release build\n-binary in the [Binary directory](/Binary/).\n+# Updating reference data\n-* `--rebuild-ref-csv` : regenerate the whole reference, rerunning all tests.\n-* `--update-ref-csv` : patch the reference to add new test images, but keep\n- any existing results.\n+The reference PSNR and performance scores are stored in CSVs committed to the\n+repository. This data is created by running the tests using the last stable\n+release on a standard test machine we use for performance testing builds.\n-# Known limitations\n+It can be useful for developers to rebuild the reference results for their\n+local machine, in particular for measuring performance improvements. To build\n+new reference CSVs, download the current reference binary (1.7) from GitHub\n+for your host OS and place it in to the `./Binaries/1.7/` directory. Once this\n+is done, run the command:\n-The current test suite is viewed as a set of bare-essentials, but has a number\n-of significant omissions:\n+ python3 ./Test/astc_run_image_tests.py --encoder 1.7 \\\n+ --test-set all --warmup 1 --repeats 5\n-* Only square block sizes from 4x4 (8bpp) up to 8x8 (2pp) are tested.\n-* Only `-thorough` compression speed tested.\n-* Few optional compressor options are tested other than the use of\n- `-normal_psnr` for the `xy` data test set.\n-* No LDR profile coverage of luminance-only input textures.\n-* Limited HDR profile coverage of HDR input textures.\n-* No Full profile coverage of 3D input textures.\n+... to regenerate the reference CSV files.\n-It is intended that pair-wise test coverage should be used in future to allow\n-us to have have wider coverage without excessive test runtime.\n+**WARNING:** This can take some hours to complete, and it is best done when the\n+test suite gets exclusive use of the machine to avoid other processing slowing\n+down the compression and disturbing the performance data. It is recommended to\n+shutdown or disable any background applications that are running.\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_run_image_tests.py",
"new_path": "Test/astc_run_image_tests.py",
"diff": "@@ -39,6 +39,8 @@ RESULT_THRESHOLD_WARN = -0.1\nRESULT_THRESHOLD_FAIL = -0.2\n+RESULT_THRESHOLD_3D_FAIL = -0.6\n+\nTEST_BLOCK_SIZES = [\"4x4\", \"5x5\", \"6x6\", \"8x8\", \"12x12\",\n\"3x3x3\", \"6x6x6\"]\n@@ -73,11 +75,12 @@ def count_test_set(testSet, blockSizes):\nreturn count\n-def determine_result(reference, result):\n+def determine_result(image, reference, result):\n\"\"\"\nDetermine a test result against a reference and thresholds.\nArgs:\n+ image: The image being compressed.\nreference: The reference result to compare against.\nresult: The test result.\n@@ -86,7 +89,10 @@ def determine_result(reference, result):\n\"\"\"\ndPSNR = result.psnr - reference.psnr\n- if dPSNR < RESULT_THRESHOLD_FAIL:\n+ if (dPSNR < RESULT_THRESHOLD_FAIL) and (not image.is3D):\n+ return trs.Result.FAIL\n+\n+ if (dPSNR < RESULT_THRESHOLD_3D_FAIL) and image.is3D:\nreturn trs.Result.FAIL\nif dPSNR < RESULT_THRESHOLD_WARN:\n@@ -138,7 +144,7 @@ def format_result(image, reference, result):\ntPSNR = \"%2.3f dB (% 1.3f dB)\" % (result.psnr, dPSNR)\ntTTime = \"%.2f s (%1.1fx)\" % (result.tTime, sTTime)\ntCTime = \"%.2f s (%1.1fx)\" % (result.cTime, sCTime)\n- result = determine_result(reference, result)\n+ result = determine_result(image, reference, result)\nreturn \"%-32s | %22s | %14s | %14s | %s\" % \\\n(name, tPSNR, tTTime, tCTime, result.name)\n@@ -185,7 +191,7 @@ def run_test_set(encoder, testRef, testSet, blockSizes, warmupRuns, testRuns):\nif testRef:\nrefResult = testRef.get_matching_record(res)\n- res.set_status(determine_result(refResult, res))\n+ res.set_status(determine_result(image, refResult, res))\nres = format_result(image, refResult, res)\nelse:\nres = format_solo_result(image, res)\n@@ -206,30 +212,29 @@ def parse_command_line():\nparser.add_argument(\"--encoder\", dest=\"encoders\", default=\"avx2\",\nchoices=coders, help=\"test encoder variant\")\n- parser.add_argument(\"--color-profile\", dest=\"testRange\", default=\"all\",\n- choices=[\"ldr\", \"ldrs\", \"hdr\", \"all\"],\n- help=\"test dynamic range\")\n+ astcProfile = [\"ldr\", \"ldrs\", \"hdr\", \"all\"]\n+ parser.add_argument(\"--color-profile\", dest=\"profiles\", default=\"all\",\n+ choices=astcProfile, help=\"test color profile\")\n- parser.add_argument(\"--color-format\", dest=\"testFormat\", default=\"all\",\n- choices=[\"l\", \"xy\", \"rgb\", \"rgba\", \"all\"],\n- help=\"test color format\")\n+ imgFormat = [\"l\", \"xy\", \"rgb\", \"rgba\", \"all\"]\n+ parser.add_argument(\"--color-format\", dest=\"formats\", default=\"all\",\n+ choices=imgFormat, help=\"test color format\")\nchoices = list(TEST_BLOCK_SIZES) + [\"all\"]\n- parser.add_argument(\"--block-size\", dest=\"testBlockSizes\", default=\"all\",\n+ parser.add_argument(\"--block-size\", dest=\"blockSizes\", default=\"all\",\nchoices=choices, help=\"test block size\")\ntestDir = os.path.dirname(__file__)\ntestDir = os.path.join(testDir, \"Images\")\n- imageChoices = []\n+ testSets = []\nfor path in os.listdir(testDir):\nfqPath = os.path.join(testDir, path)\nif os.path.isdir(fqPath):\n- imageChoices.append(path)\n+ testSets.append(path)\n+ testSets.append(\"all\")\n- imageChoices.append(\"all\")\n-\n- parser.add_argument(\"--test-set\", dest=\"testSet\", default=\"Small\",\n- choices=imageChoices, help=\"test image test set\")\n+ parser.add_argument(\"--test-set\", dest=\"testSets\", default=\"Small\",\n+ choices=testSets, help=\"test image test set\")\nparser.add_argument(\"--warmup\", dest=\"testWarmups\", default=0,\ntype=int, help=\"test warmup count\")\n@@ -240,20 +245,20 @@ def parse_command_line():\nargs = parser.parse_args()\n# Turn things into canonical format lists\n- if args.testBlockSizes == \"all\":\n- args.testBlockSizes = TEST_BLOCK_SIZES\n- else:\n- args.testBlockSizes = [args.testBlockSizes]\n+ args.encoders = testcoders if args.encoders == \"all\" \\\n+ else [args.encoders]\n- if args.testSet == \"all\":\n- args.testSet = imageChoices[:-1]\n- else:\n- args.testSet = [args.testSet]\n+ args.blockSizes = TEST_BLOCK_SIZES if args.blockSizes == \"all\" \\\n+ else [args.blockSizes]\n- if args.encoders == \"all\":\n- args.encoders = testcoders\n- else:\n- args.encoders = [args.encoders]\n+ args.testSets = testSets[:-1] if args.testSets == \"all\" \\\n+ else [args.testSets]\n+\n+ args.profiles = astcProfile[:-1] if args.profiles == \"all\" \\\n+ else [args.profiles]\n+\n+ args.formats = imgFormat[:-1] if args.formats == \"all\" \\\n+ else [args.formats]\nreturn args\n@@ -268,7 +273,7 @@ def main():\ntestSetCount = 0\nworstResult = trs.Result.NOTRUN\n- for imageSet in args.testSet:\n+ for imageSet in args.testSets:\nfor encoderName in args.encoders:\nif encoderName == \"1.7\":\nencoder = te.Encoder1x()\n@@ -296,10 +301,11 @@ def main():\ntestRef.load_from_file(testRefPath)\ntestSetCount += 1\n- testSet = tts.TestSet(imageSet, testDir)\n+ testSet = tts.TestSet(imageSet, testDir,\n+ args.profiles, args.formats)\nresultSet = run_test_set(encoder, testRef, testSet,\n- args.testBlockSizes,\n+ args.blockSizes,\nargs.testWarmups, args.testRepeats)\nresultSet.save_to_file(testRes)\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/encoder.py",
"new_path": "Test/testlib/encoder.py",
"diff": "@@ -228,6 +228,10 @@ class Encoder2x(EncoderBase):\ndef __init__(self, variant):\nname = \"astcenc-%s (%s)\" % (variant, self.VERSION)\n+ if os.name == 'nt':\n+ dat = (variant, variant)\n+ binary = \"./Source/VS2019/astcenc-%s-Release/astcenc-%s.exe\" % dat\n+ else:\nbinary = \"./Source/astcenc-%s\" % variant\nsuper().__init__(name, variant, binary)\n@@ -296,6 +300,9 @@ class Encoder1x(EncoderBase):\ndef __init__(self):\nname = \"astcenc (%s)\" % self.VERSION\n+ if os.name == 'nt':\n+ binary = \"./Binaries/1.7/astcenc.exe\"\n+ else:\nbinary = \"./Binaries/1.7/astcenc\"\nsuper().__init__(name, None, binary)\n@@ -358,5 +365,6 @@ class EncoderProto(Encoder1x):\ndef __init__(self):\nname = \"astcenc (%s)\" % self.VERSION\n+ assert os.name != 'nt', \"Windows builds not available\"\nbinary = \"./Binaries/Prototype/astcenc\"\nsuper().__init__(name, None, binary)\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/testset.py",
"new_path": "Test/testlib/testset.py",
"diff": "@@ -47,13 +47,15 @@ class TestSet():\ntests: The list of TestImages forming the set.\n\"\"\"\n- def __init__(self, name, rootDir):\n+ def __init__(self, name, rootDir, profiles, formats):\n\"\"\"\nCreate a new TestSet through reflection.\nArgs:\nname: The name of the test set.\nrootDir: The root directory of the test set.\n+ profiles: The ASTC profiles to allow.\n+ formats: The image formats to allow.\n\"\"\"\nself.name = name\n@@ -72,6 +74,14 @@ class TestSet():\n# Create the TestImage for each file on disk\nfilePath = os.path.join(dirPath, fileName)\nimage = TestImage(filePath)\n+\n+ # Filter out the ones we don't want to allow\n+ if image.colorProfile not in profiles:\n+ continue\n+\n+ if image.colorFormat not in formats:\n+ continue\n+\nself.tests.append((filePath, image))\n# Sort the TestImages so they are in a stable order\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Enable test suite on Windows builds
|
61,745 |
05.03.2020 22:41:54
| 0 |
d3f9a58989cab69212e98f1a29fcafae4e10271b
|
Test: Remove -warmpups (not used) and add ISPC
|
[
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "@@ -11,5 +11,5 @@ Source/astcenc-*\nSource/VS2019/*Release\nSource/VS2019/*Debug\nTest/Images/Kodak\n-Test/Images/Scratch\n+Test/Images/Scratch*\nTestOutput\n"
},
{
"change_type": "MODIFY",
"old_path": "Docs/Testing.md",
"new_path": "Docs/Testing.md",
"diff": "@@ -45,14 +45,12 @@ developers to focus local testing on the parts of the code they are working on.\nTo provide less noisy performance results the test suite supports compressing\neach image multiple times and returning the best measured performance. To\n-enable this mode use the following two options:\n+enable this mode use the following options:\n-* `--warmup <N>` : Run N warmup compression passes which are not timed.\n* `--repeats <M>` : Run M test compression passes which are timed.\n**Note:** The reference CSV contains performance results measured on an Intel\n-Core i5 9600K running at 4.3GHz, running each test 5 times after a single\n-warmup pass.\n+Core i5 9600K running at 4.3GHz, running each test 5 times.\n# Updating reference data\n@@ -67,7 +65,7 @@ for your host OS and place it in to the `./Binaries/1.7/` directory. Once this\nis done, run the command:\npython3 ./Test/astc_run_image_tests.py --encoder 1.7 \\\n- --test-set all --warmup 1 --repeats 5\n+ --test-set all --repeats 5\n... to regenerate the reference CSV files.\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_run_image_tests.py",
"new_path": "Test/astc_run_image_tests.py",
"diff": "@@ -150,7 +150,7 @@ def format_result(image, reference, result):\n(name, tPSNR, tTTime, tCTime, result.name)\n-def run_test_set(encoder, testRef, testSet, blockSizes, warmupRuns, testRuns):\n+def run_test_set(encoder, testRef, testSet, blockSizes, testRuns):\n\"\"\"\nExecute all tests in the test set.\n@@ -159,7 +159,6 @@ def run_test_set(encoder, testRef, testSet, blockSizes, warmupRuns, testRuns):\ntestRef: The test reference results.\ntestSet: The test set.\nblockSizes: The block sizes to execute each test against.\n- warmupRuns: The number of warmup runs.\ntestRuns: The number of test runs.\nReturn:\n@@ -184,8 +183,7 @@ def run_test_set(encoder, testRef, testSet, blockSizes, warmupRuns, testRuns):\ndat = (curCount, maxCount, blkSz, image.testFile)\nprint(\"Running %u/%u %s %s ... \" % dat, end='', flush=True)\n- res = encoder.run_test(image, blkSz, \"-thorough\",\n- warmupRuns, testRuns)\n+ res = encoder.run_test(image, blkSz, \"-thorough\", testRuns)\nres = trs.Record(blkSz, image.testFile, res[0], res[1], res[2])\nresultSet.add_record(res)\n@@ -201,14 +199,47 @@ def run_test_set(encoder, testRef, testSet, blockSizes, warmupRuns, testRuns):\nreturn resultSet\n+def get_encoder_params(encoderName, imageSet):\n+ \"\"\"\n+ The the encoder and image set parameters for a test run.\n+\n+ Args:\n+ encoderName: the encoder name from the command line.\n+ imageSet: the test image set.\n+ \"\"\"\n+ if encoderName == \"1.7\":\n+ encoder = te.Encoder1x()\n+ name = \"reference-1.7\"\n+ outDir = \"Test/Images/%s\" % imageSet\n+ refName = None\n+ elif encoderName == \"prototype\":\n+ encoder = te.EncoderProto()\n+ name = \"reference-prototype\"\n+ outDir = \"Test/Images/%s\" % imageSet\n+ refName = None\n+ elif encoderName == \"intelispc\":\n+ encoder = te.EncoderISPC()\n+ name = \"reference-intelispc\"\n+ outDir = \"Test/Images/%s\" % imageSet\n+ refName = None\n+ else:\n+ encoder = te.Encoder2x(encoderName)\n+ name = \"develop-%s\" % encoderName\n+ outDir = \"TestOutput/%s\" % imageSet\n+ refName = \"reference-1.7\"\n+\n+ return (encoder, name, outDir, refName)\n+\n+\ndef parse_command_line():\n\"\"\"\nParse the command line.\n\"\"\"\nparser = argparse.ArgumentParser()\n- coders = (\"nointrin\", \"sse2\", \"sse4.2\", \"avx2\", \"prototype\", \"1.7\", \"all\")\n- testcoders = (\"nointrin\", \"sse2\", \"sse4.2\", \"avx2\")\n+ refcoders = [\"1.7\", \"prototype\", \"intelispc\"]\n+ testcoders = [\"nointrin\", \"sse2\", \"sse4.2\", \"avx2\"]\n+ coders = refcoders + testcoders + [\"all\"]\nparser.add_argument(\"--encoder\", dest=\"encoders\", default=\"avx2\",\nchoices=coders, help=\"test encoder variant\")\n@@ -221,8 +252,9 @@ def parse_command_line():\nchoices=imgFormat, help=\"test color format\")\nchoices = list(TEST_BLOCK_SIZES) + [\"all\"]\n- parser.add_argument(\"--block-size\", dest=\"blockSizes\", default=\"all\",\n- choices=choices, help=\"test block size\")\n+ parser.add_argument(\"--block-size\", dest=\"blockSizes\",\n+ action=\"append\", choices=choices,\n+ help=\"test block size\")\ntestDir = os.path.dirname(__file__)\ntestDir = os.path.join(testDir, \"Images\")\n@@ -236,9 +268,6 @@ def parse_command_line():\nparser.add_argument(\"--test-set\", dest=\"testSets\", default=\"Small\",\nchoices=testSets, help=\"test image test set\")\n- parser.add_argument(\"--warmup\", dest=\"testWarmups\", default=0,\n- type=int, help=\"test warmup count\")\n-\nparser.add_argument(\"--repeats\", dest=\"testRepeats\", default=1,\ntype=int, help=\"test iteration count\")\n@@ -248,8 +277,8 @@ def parse_command_line():\nargs.encoders = testcoders if args.encoders == \"all\" \\\nelse [args.encoders]\n- args.blockSizes = TEST_BLOCK_SIZES if args.blockSizes == \"all\" \\\n- else [args.blockSizes]\n+ if not args.blockSizes or (\"all\" in args.blockSizes):\n+ args.blockSizes = TEST_BLOCK_SIZES\nargs.testSets = testSets[:-1] if args.testSets == \"all\" \\\nelse [args.testSets]\n@@ -275,21 +304,8 @@ def main():\nfor imageSet in args.testSets:\nfor encoderName in args.encoders:\n- if encoderName == \"1.7\":\n- encoder = te.Encoder1x()\n- name = \"reference-1.7\"\n- outDir = \"Test/Images/%s\" % imageSet\n- refName = None\n- elif encoderName == \"prototype\":\n- encoder = te.EncoderProto()\n- name = \"reference-prototype\"\n- outDir = \"Test/Images/%s\" % imageSet\n- refName = None\n- else:\n- encoder = te.Encoder2x(encoderName)\n- name = \"develop-%s\" % encoderName\n- outDir = \"TestOutput/%s\" % imageSet\n- refName = \"reference-1.7\"\n+ (encoder, name, outDir, refName) = \\\n+ get_encoder_params(encoderName, imageSet)\ntestDir = \"Test/Images/%s\" % imageSet\ntestRes = \"%s/astc_%s_results.csv\" % (outDir, name)\n@@ -305,8 +321,7 @@ def main():\nargs.profiles, args.formats)\nresultSet = run_test_set(encoder, testRef, testSet,\n- args.blockSizes,\n- args.testWarmups, args.testRepeats)\n+ args.blockSizes, args.testRepeats)\nresultSet.save_to_file(testRes)\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/encoder.py",
"new_path": "Test/testlib/encoder.py",
"diff": "@@ -75,8 +75,7 @@ class EncoderBase():\n# pylint: disable=unused-argument,no-self-use\nassert False, \"Missing subclass implementation\"\n- @staticmethod\n- def execute(command):\n+ def execute(self, command):\n\"\"\"\nRun a subprocess with the specified command.\n@@ -86,6 +85,7 @@ class EncoderBase():\nReturn:\nThe output log (stdout) split into lines.\n\"\"\"\n+ # pylint: disable=no-self-use\ntry:\nresult = sp.run(command, stdout=sp.PIPE, stderr=sp.PIPE,\ncheck=True, universal_newlines=True)\n@@ -172,7 +172,7 @@ class EncoderBase():\n# pylint: disable=unused-argument,no-self-use\nassert False, \"Missing subclass implementation\"\n- def run_test(self, image, blockSize, preset, warmupRuns, testRuns):\n+ def run_test(self, image, blockSize, preset, testRuns):\n\"\"\"\nRun the test N times.\n@@ -180,19 +180,15 @@ class EncoderBase():\nimage: The test image to compress.\nblockSize: The block size to use.\npreset: The quality-performance preset to use.\n- warmupRuns: The number of warmup runs.\ntestRuns: The number of test runs.\nReturn:\nReturns the best results from the N test runs.\nTuple: (bestPSNR, bestTotalTime, bestCodingTime)\n\"\"\"\n+ # pylint: disable=assignment-from-no-return\ncommand = self.build_cli(image, blockSize, preset)\n- # Execute warmup runs\n- for _ in range(0, warmupRuns):\n- self.execute(command)\n-\n# Execute test runs\nbestPSNR = 0\nbestTTime = sys.float_info.max\n@@ -227,7 +223,7 @@ class Encoder2x(EncoderBase):\n}\ndef __init__(self, variant):\n- name = \"astcenc-%s (%s)\" % (variant, self.VERSION)\n+ name = \"astcenc-%s-%s\" % (variant, self.VERSION)\nif os.name == 'nt':\ndat = (variant, variant)\nbinary = \"./Source/VS2019/astcenc-%s-Release/astcenc-%s.exe\" % dat\n@@ -238,7 +234,11 @@ class Encoder2x(EncoderBase):\ndef build_cli(self, image, blockSize=\"6x6\", preset=\"-thorough\"):\nopmode = self.SWITCHES[image.colorProfile]\nsrcPath = image.filePath\n+\ndstPath = image.outFilePath + self.OUTPUTS[image.colorProfile]\n+ dstDir = os.path.dirname(dstPath)\n+ dstFile = os.path.basename(dstPath)\n+ dstPath = os.path.join(dstDir, self.name, blockSize, dstFile)\ndstDir = os.path.dirname(dstPath)\nos.makedirs(dstDir, exist_ok=True)\n@@ -299,7 +299,7 @@ class Encoder1x(EncoderBase):\n}\ndef __init__(self):\n- name = \"astcenc (%s)\" % self.VERSION\n+ name = \"astcenc-%s\" % self.VERSION\nif os.name == 'nt':\nbinary = \"./Binaries/1.7/astcenc.exe\"\nelse:\n@@ -309,7 +309,11 @@ class Encoder1x(EncoderBase):\ndef build_cli(self, image, blockSize=\"6x6\", preset=\"-thorough\"):\nopmode = self.SWITCHES[image.colorProfile]\nsrcPath = image.filePath\n+\ndstPath = image.outFilePath + self.OUTPUTS[image.colorProfile]\n+ dstDir = os.path.dirname(dstPath)\n+ dstFile = os.path.basename(dstPath)\n+ dstPath = os.path.join(dstDir, self.name, blockSize, dstFile)\ndstDir = os.path.dirname(dstPath)\nos.makedirs(dstDir, exist_ok=True)\n@@ -364,7 +368,130 @@ class EncoderProto(Encoder1x):\n}\ndef __init__(self):\n- name = \"astcenc (%s)\" % self.VERSION\n+ name = \"astcenc-%s\" % self.VERSION\nassert os.name != 'nt', \"Windows builds not available\"\nbinary = \"./Binaries/Prototype/astcenc\"\nsuper().__init__(name, None, binary)\n+\n+\n+class EncoderISPC(EncoderBase):\n+ \"\"\"\n+ This class wraps the Intel ISPC compressor, which is widely used due to its\n+ good performance (although with worse quality).\n+\n+ Note that the compressor does not support all features of ASTC (only a\n+ subset of 2D block sizes, only LDR color profile), and doesn't support\n+ decode at all. For round-trip analysis we use `astcenc` to provide the\n+ decompression and image comparisons.\n+ \"\"\"\n+\n+ VERSION = \"IntelISPC\"\n+\n+ def __init__(self):\n+ \"\"\"\n+ Create a new encoder instance.\n+ \"\"\"\n+ binary = \"./Binaries/ispc/astcispc\"\n+ super().__init__(\"intel-ispc\", None, binary)\n+ self.decodeBinary = \"./Binaries/1.7/astcenc\"\n+\n+ def get_psnr_pattern(self, image):\n+ if image.colorFormat != \"rgba\":\n+ patternPSNR = r\"PSNR \\(LDR-RGB\\):\\s*([0-9.]*) dB\"\n+ else:\n+ patternPSNR = r\"PSNR \\(LDR-RGBA\\):\\s*([0-9.]*) dB\"\n+\n+ return patternPSNR\n+\n+ def get_total_time_pattern(self):\n+ return r\"Total time:\\s*([0-9.]*) s\"\n+\n+ def get_coding_time_pattern(self):\n+ return r\"Coding time:\\s*([0-9.]*) s\"\n+\n+ def execute(self, command):\n+ \"\"\"\n+ Run a subprocess with the specified command.\n+\n+ Args:\n+ command: The list of command line arguments.\n+\n+ Return:\n+ The output log (stdout) split into lines.\n+ \"\"\"\n+ command = \" \".join(command)\n+ try:\n+ result = sp.run(command, stdout=sp.PIPE, stderr=sp.PIPE,\n+ shell=True, check=True, universal_newlines=True)\n+ except OSError:\n+ print(\"ERROR: Test run failed (binary not found)\")\n+ print(\" + %s\" % command)\n+ sys.exit(1)\n+ except sp.CalledProcessError:\n+ print(\"ERROR: Test run failed\")\n+ print(\" + %s\" % command)\n+ sys.exit(1)\n+\n+ return result.stdout.splitlines()\n+\n+ def run_test(self, image, blockSize, preset, testRuns):\n+ \"\"\"\n+ Run the test N times.\n+\n+ Args:\n+ image: The test image to compress.\n+ blockSize: The block size to use.\n+ preset: (Unused - we always use ISPC's slow preset to have vaguely\n+ usable image quality)\n+ testRuns: The number of test runs.\n+\n+ Return:\n+ Returns the best results from the N test runs.\n+ Tuple: (bestPSNR, bestTotalTime, bestCodingTime)\n+ \"\"\"\n+ dstDir = os.path.dirname(image.outFilePath)\n+ dstFile = os.path.basename(image.outFilePath)\n+ dstDir = os.path.join(dstDir, self.name, blockSize)\n+ dstPath = os.path.join(dstDir, dstFile)\n+\n+ compressCommand = [\n+ \"env\",\n+ \"LD_LIBRARY_PATH=./Binaries/ispc\",\n+ self.binary,\n+ image.filePath,\n+ dstPath + \".astc\",\n+ blockSize\n+ ]\n+\n+ decompressCommand = [\n+ self.decodeBinary,\n+ \"-dl\",\n+ dstPath + \".astc\",\n+ dstPath + \".tga\"\n+ ]\n+\n+ compareCommand = [\n+ self.decodeBinary,\n+ \"-compare\",\n+ image.filePath,\n+ dstPath + \".tga\",\n+ \"-showpsnr\"\n+ ]\n+\n+ os.makedirs(dstDir, exist_ok=True)\n+\n+ # Execute test runs\n+ bestPSNR = 0\n+ bestTTime = sys.float_info.max\n+ bestCTime = sys.float_info.max\n+ for _ in range(0, testRuns):\n+ output = self.execute(compressCommand)\n+ self.execute(decompressCommand)\n+ output += self.execute(compareCommand)\n+\n+ output = self.parse_output(image, output)\n+ bestPSNR = max(bestPSNR, output[0])\n+ bestTTime = min(bestTTime, output[1])\n+ bestCTime = min(bestCTime, output[2])\n+\n+ return (bestPSNR, bestTTime, bestCTime)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Test: Remove -warmpups (not used) and add ISPC
|
61,745 |
05.03.2020 23:16:55
| 0 |
aeef1230a1da2cbf2d3ffffe3e689f9806035cb1
|
Standardize on "nullptr" rather than "NULL"
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -686,7 +686,7 @@ void compute_averages_and_variances(\n/*\nFunctions to load image from file.\nIf successful, return an astc_codec_image object.\n- If unsuccessful, returns NULL.\n+ If unsuccessful, returns nullptr.\n*result is used to return a result. In case of a successfully loaded image, bits[2:0]\nof *result indicate how many components are present, and bit[7] indicate whether\n@@ -914,7 +914,7 @@ void recompute_ideal_colors(\nfloat4* rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6\nfloat4* rgbo_vectors, // used to return RGBS-vectors for endpoint mode #7\nconst uint8_t* weight_set8, // the current set of weight values\n- const uint8_t* plane2_weight_set8, // NULL if plane 2 is not actually used.\n+ const 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\nconst partition_info* pi,\nconst decimation_table* it,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -382,7 +382,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\nint l;\nfor (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, NULL, -1, pi, it, blk, ewb);\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// quantize the chosen color\n@@ -441,7 +441,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\nbsd,\nblk, ewb, scb,\nu8_weight_src,\n- NULL);\n+ nullptr);\nif (adjustments == 0)\nbreak;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"new_path": "Source/astc_ideal_endpoints_and_weights.cpp",
"diff": "@@ -1325,7 +1325,7 @@ void recompute_ideal_colors(\nfloat4* rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6\nfloat4* rgbo_vectors, // used to return RGBO-vectors for endpoint mode #7\nconst uint8_t* weight_set8, // the current set of weight values\n- const uint8_t* plane2_weight_set8, // NULL if plane 2 is not actually used.\n+ const 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\nconst partition_info* pi,\nconst decimation_table* it,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_image_load_store.cpp",
"new_path": "Source/astc_image_load_store.cpp",
"diff": "void destroy_image(astc_codec_image * img)\n{\n- if (img == NULL)\n+ if (img == nullptr)\nreturn;\nif (img->data8)\n@@ -68,9 +68,9 @@ astc_codec_image *allocate_image(\nimg->zsize = zsize;\nimg->padding = padding;\n- img->input_averages = NULL;\n- img->input_variances = NULL;\n- img->input_alpha_averages = NULL;\n+ img->input_averages = nullptr;\n+ img->input_variances = nullptr;\n+ img->input_alpha_averages = nullptr;\nint exsize = xsize + 2 * padding;\nint eysize = ysize + 2 * padding;\n@@ -90,7 +90,7 @@ astc_codec_image *allocate_image(\nfor (j = 1; j < eysize; j++)\nimg->data8[i][j] = img->data8[i][0] + 4 * j * exsize;\n- img->data16 = NULL;\n+ img->data16 = nullptr;\n}\nelse if (bitness == 16)\n{\n@@ -106,7 +106,7 @@ astc_codec_image *allocate_image(\nfor (j = 1; j < eysize; j++)\nimg->data16[i][j] = img->data16[i][0] + 4 * j * exsize;\n- img->data8 = NULL;\n+ img->data8 = nullptr;\n}\nelse\n{\n@@ -1063,7 +1063,7 @@ astc_codec_image *astc_codec_load_image(\nint get_output_filename_enforced_bitness(const char *output_filename)\n{\n- if (output_filename == NULL)\n+ if (output_filename == nullptr)\nreturn -1;\nsize_t filename_len = strlen(output_filename);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_ktx_dds.cpp",
"new_path": "Source/astc_ktx_dds.cpp",
"diff": "@@ -452,7 +452,7 @@ astc_codec_image* load_ktx_uncompressed_image(\n{\nprintf(\"Failed to open file %s\\n\", filename);\n*result = -1;\n- return NULL;\n+ return nullptr;\n}\nktx_header hdr;\n@@ -463,7 +463,7 @@ astc_codec_image* load_ktx_uncompressed_image(\nprintf(\"Failed to read header of KTX file %s\\n\", filename);\nfclose(f);\n*result = -2;\n- return NULL;\n+ return nullptr;\n}\nif (memcmp(hdr.magic, ktx_magic, 12) != 0 || (hdr.endianness != 0x04030201 && hdr.endianness != 0x01020304))\n@@ -471,7 +471,7 @@ astc_codec_image* load_ktx_uncompressed_image(\nprintf(\"File %s does not have a valid KTX header\\n\", filename);\nfclose(f);\n*result = -3;\n- return NULL;\n+ return nullptr;\n}\nint switch_endianness = 0;\n@@ -486,7 +486,7 @@ astc_codec_image* load_ktx_uncompressed_image(\nprintf(\"File %s appears to be compressed, not supported as input\\n\", filename);\nfclose(f);\n*result = -4;\n- return NULL;\n+ return nullptr;\n}\n// the formats we support are:\n@@ -524,7 +524,7 @@ astc_codec_image* load_ktx_uncompressed_image(\nprintf(\"KTX file %s has unsupported GL type\\n\", filename);\nfclose(f);\n*result = -5;\n- return NULL;\n+ return nullptr;\n};\n// Although these are set up later, we include a default initializer to remove warnings\n@@ -670,7 +670,7 @@ astc_codec_image* load_ktx_uncompressed_image(\nprintf(\"KTX file %s has unsupported GL format\\n\", filename);\nfclose(f);\n*result = -5;\n- return NULL;\n+ return nullptr;\n}\nif (hdr.number_of_mipmap_levels > 1)\n@@ -702,7 +702,7 @@ astc_codec_image* load_ktx_uncompressed_image(\nprintf(\"Failed to read header of KTX file %s\\n\", filename);\nfclose(f);\n*result = -2;\n- return NULL;\n+ return nullptr;\n}\nif (switch_endianness)\n@@ -717,7 +717,7 @@ astc_codec_image* load_ktx_uncompressed_image(\nfclose(f);\nprintf(\"%s: KTX file inconsistency: computed surface size is %d bytes, but specified size is %d bytes\\n\", filename, computed_bytes_of_surface, specified_bytes_of_surface);\n*result = -5;\n- return NULL;\n+ return nullptr;\n}\nuint8_t *buf = (uint8_t *) malloc(specified_bytes_of_surface);\n@@ -728,7 +728,7 @@ astc_codec_image* load_ktx_uncompressed_image(\nfree(buf);\nprintf(\"Failed to read file %s\\n\", filename);\n*result = -6;\n- return NULL;\n+ return nullptr;\n}\n// perform an endianness swap on the surface if needed.\n@@ -800,8 +800,8 @@ int store_ktx_uncompressed_image(\nhdr.bytes_of_key_value_data = 0;\n// collect image data to write\n- uint8_t ***row_pointers8 = NULL;\n- uint16_t ***row_pointers16 = NULL;\n+ uint8_t ***row_pointers8 = nullptr;\n+ uint16_t ***row_pointers16 = nullptr;\nif (bitness == 8)\n{\nrow_pointers8 = new uint8_t **[zsize];\n@@ -1052,7 +1052,7 @@ astc_codec_image* load_dds_uncompressed_image(\n{\nprintf(\"Failed to open file %s\\n\", filename);\n*result = -1;\n- return NULL;\n+ return nullptr;\n}\nuint8_t magic[4];\n@@ -1065,7 +1065,7 @@ astc_codec_image* load_dds_uncompressed_image(\nprintf(\"Failed to read header of DDS file %s\\n\", filename);\nfclose(f);\n*result = -2;\n- return NULL;\n+ return nullptr;\n}\nuint32_t magicx = magic[0] | (magic[1] << 8) | (magic[2] << 16) | (magic[3] << 24);\n@@ -1075,7 +1075,7 @@ astc_codec_image* load_dds_uncompressed_image(\nprintf(\"File %s does not have a valid DDS header\\n\", filename);\nfclose(f);\n*result = -3;\n- return NULL;\n+ return nullptr;\n}\nint use_dx10_header = 0;\n@@ -1090,7 +1090,7 @@ astc_codec_image* load_dds_uncompressed_image(\nprintf(\"DDS file %s is compressed, not supported\\n\", filename);\nfclose(f);\n*result = -4;\n- return NULL;\n+ return nullptr;\n}\n}\n@@ -1103,7 +1103,7 @@ astc_codec_image* load_dds_uncompressed_image(\nprintf(\"Failed to read header of DDS file %s\\n\", filename);\nfclose(f);\n*result = -2;\n- return NULL;\n+ return nullptr;\n}\n}\n@@ -1183,7 +1183,7 @@ astc_codec_image* load_dds_uncompressed_image(\nprintf(\"DDS file %s: DXGI format not supported by codec\\n\", filename);\nfclose(f);\n*result = -4;\n- return NULL;\n+ return nullptr;\n}\n}\nelse\n@@ -1272,7 +1272,7 @@ astc_codec_image* load_dds_uncompressed_image(\nprintf(\"DDS file %s: Non-DXGI format not supported by codec\\n\", filename);\nfclose(f);\n*result = -4;\n- return NULL;\n+ return nullptr;\n}\nbitness = bytes_per_component * 8;\n@@ -1291,7 +1291,7 @@ astc_codec_image* load_dds_uncompressed_image(\nfree(buf);\nprintf(\"Failed to read file %s\\n\", filename);\n*result = -6;\n- return NULL;\n+ return nullptr;\n}\n// then transfer data from the surface to our own image-data-structure.\n@@ -1387,8 +1387,8 @@ int store_dds_uncompressed_image(\ndx10.reserved = 0;\n// collect image data to write\n- uint8_t ***row_pointers8 = NULL;\n- uint16_t ***row_pointers16 = NULL;\n+ uint8_t ***row_pointers8 = nullptr;\n+ uint16_t ***row_pointers16 = nullptr;\nif (bitness == 8)\n{\nrow_pointers8 = new uint8_t **[zsize];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_stb_tga.cpp",
"new_path": "Source/astc_stb_tga.cpp",
"diff": "@@ -42,13 +42,13 @@ astc_codec_image* load_image_with_stb(\nint y_flip = 1;\nint x, y;\n- astc_codec_image* astc_img = NULL;\n+ astc_codec_image* astc_img = nullptr;\nif (stbi_is_hdr(filename))\n{\nfloat *image = stbi_loadf(filename, &xsize, &ysize, &components, STBI_rgb_alpha);\n- if (image != NULL)\n+ if (image != nullptr)\n{\nastc_img = allocate_image(16, xsize, ysize, 1, padding);\nfor (y = 0; y < ysize; y++)\n@@ -78,7 +78,7 @@ astc_codec_image* load_image_with_stb(\nuint8_t *imageptr = (uint8_t *) image;\n- if (image != NULL)\n+ if (image != nullptr)\n{\nastc_img = allocate_image(8, xsize, ysize, 1, padding);\nfor (y = 0; y < ysize; y++)\n@@ -107,7 +107,7 @@ astc_codec_image* load_image_with_stb(\nprintf(\"Failed to load image %s\\nReason: %s\\n\", filename, stbi_failure_reason());\n*result = -1;\n- return NULL;\n+ return nullptr;\n}\n/*\n@@ -187,7 +187,7 @@ astc_codec_image* load_tga_image(\nif (!f)\n{\n*result = TGA_ERROR_OPEN;\n- return NULL;\n+ return nullptr;\n}\ntga_header hdr;\n@@ -196,14 +196,14 @@ astc_codec_image* load_tga_image(\n{\nfclose(f);\n*result = TGA_ERROR_READ;\n- return NULL;\n+ return nullptr;\n}\nif (hdr.colormaptype != 0)\n{\nfclose(f);\n*result = TGA_ERROR_COLORMAP;\n- return NULL;\n+ return nullptr;\n}\n// do a quick test for RLE-pictures so that we reject them\n@@ -212,7 +212,7 @@ astc_codec_image* load_tga_image(\nfclose(f);\nprintf(\"TGA image %s is RLE-encoded; only uncompressed TGAs are supported.\\n\", tga_filename);\n*result = TGA_ERROR_RLE;\n- return NULL;\n+ return nullptr;\n}\n// Check for x flip (rare, unsupported) and y flip (supported)\n@@ -220,7 +220,7 @@ astc_codec_image* load_tga_image(\n{\nfclose(f);\n*result = TGA_ERROR_LAYOUT;\n- return NULL;\n+ return nullptr;\n}\nif (hdr.descriptor & TGA_DESCRIPTOR_YFLIP)\n@@ -244,7 +244,7 @@ astc_codec_image* load_tga_image(\n{\nfclose(f);\n*result = TGA_ERROR_FORMAT;\n- return NULL;\n+ return nullptr;\n}\nif (hdr.identsize != 0) // skip ID field if it present.\n@@ -258,8 +258,8 @@ astc_codec_image* load_tga_image(\n// Now, let's read it.\nsize_t bytestoread = 0;\n- uint8_t **row_pointers8 = NULL;\n- uint16_t **row_pointers16 = NULL;\n+ uint8_t **row_pointers8 = nullptr;\n+ uint16_t **row_pointers16 = nullptr;\nif (bitness == 8)\n{\nrow_pointers8 = new uint8_t *[hdr.ysize];\n@@ -293,7 +293,7 @@ astc_codec_image* load_tga_image(\ndelete[]row_pointers16;\n}\n*result = -2;\n- return NULL;\n+ return nullptr;\n}\n// OK, at this point, we can expand the image data to RGBA.\n@@ -459,8 +459,8 @@ int store_tga_image(\n// construct image data to write\n- uint8_t **row_pointers8 = NULL;\n- uint16_t **row_pointers16 = NULL;\n+ uint8_t **row_pointers8 = nullptr;\n+ uint16_t **row_pointers16 = nullptr;\nif (bitness == 8)\n{\nrow_pointers8 = new uint8_t *[hdr.ysize];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -365,7 +365,7 @@ static void store_astc_file(\nif (!suppress_progress_counter)\nprintf(\"%d blocks to process ..\\n\", xblocks * yblocks * zblocks);\n- encode_astc_image(input_image, NULL, xdim, ydim, zdim, ewp, decode_mode, swz_encode, swz_encode, buffer, 0, threadcount);\n+ encode_astc_image(input_image, nullptr, xdim, ydim, zdim, ewp, decode_mode, swz_encode, swz_encode, buffer, 0, threadcount);\nend_coding_time = get_time();\n@@ -420,7 +420,8 @@ static astc_codec_image *pack_and_unpack_astc_image(\nif (!suppress_progress_counter)\nprintf(\"%d blocks to process...\\n\", xblocks * yblocks * zblocks);\n- encode_astc_image(input_image, img, xdim, ydim, zdim, ewp, decode_mode, swz_encode, swz_decode, NULL, 1, threadcount);\n+ encode_astc_image(input_image, img, xdim, ydim, zdim, ewp, decode_mode,\n+ swz_encode, swz_decode, nullptr, 1, threadcount);\nif (!suppress_progress_counter)\nprintf(\"\\n\");\n@@ -1471,12 +1472,12 @@ int astc_main(\nint zdim = -1;\n// Temporary image array (for merging multiple 2D images into one 3D image).\n- int *load_results = NULL;\n- astc_codec_image **input_images = NULL;\n+ int *load_results = nullptr;\n+ astc_codec_image **input_images = nullptr;\nint load_result = 0;\n- astc_codec_image *input_image = NULL;\n- astc_codec_image *output_image = NULL;\n+ astc_codec_image *input_image = nullptr;\n+ astc_codec_image *output_image = nullptr;\nint input_components = 0;\nint input_image_is_hdr = 0;\n@@ -1502,7 +1503,7 @@ int astc_main(\nchar new_input_filename[256];\n// Check for extension: <name>.<extension>\n- if (NULL == strrchr(input_filename, '.'))\n+ if (nullptr == strrchr(input_filename, '.'))\n{\nprintf(\"Unable to determine file type from extension: %s\\n\", input_filename);\nreturn 1;\n@@ -1581,10 +1582,10 @@ int astc_main(\n}\ndelete[] input_images;\n- input_images = NULL;\n+ input_images = nullptr;\ndelete[] load_results;\n- load_results = NULL;\n+ load_results = nullptr;\ninput_components = load_result & 7;\ninput_image_is_hdr = (load_result & 0x80) ? 1 : 0;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Standardize on "nullptr" rather than "NULL"
|
61,745 |
05.03.2020 23:30:22
| 0 |
9bfb3f4bd4f129371d38b0856ce02ed55fcd71a8
|
Linting style cleanup
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_image_load_store.cpp",
"new_path": "Source/astc_image_load_store.cpp",
"diff": "#include <cstdio>\n#include <cstring>\n-void destroy_image(astc_codec_image * img)\n-{\n- if (img == nullptr)\n- return;\n-\n- if (img->data8)\n- {\n- delete[] img->data8[0][0];\n- delete[] img->data8[0];\n- delete[] img->data8;\n- }\n-\n- if (img->data16)\n- {\n- delete[] img->data16[0][0];\n- delete[] img->data16[0];\n- delete[] img->data16;\n- }\n-\n- if (img->input_averages)\n- delete[] img->input_averages;\n- if (img->input_variances)\n- delete[] img->input_variances;\n- if (img->input_alpha_averages)\n- delete[] img->input_alpha_averages;\n-\n- delete img;\n-}\n-\nastc_codec_image *allocate_image(\nint bitness,\nint xsize,\n@@ -81,14 +52,20 @@ astc_codec_image *allocate_image(\nimg->data8 = new uint8_t **[ezsize];\nimg->data8[0] = new uint8_t *[ezsize * eysize];\nimg->data8[0][0] = new uint8_t[4 * ezsize * eysize * exsize];\n+\nfor (i = 1; i < ezsize; i++)\n{\nimg->data8[i] = img->data8[0] + i * eysize;\nimg->data8[i][0] = img->data8[0][0] + 4 * i * exsize * eysize;\n}\n+\nfor (i = 0; i < ezsize; i++)\n+ {\nfor (j = 1; j < eysize; j++)\n+ {\nimg->data8[i][j] = img->data8[i][0] + 4 * j * exsize;\n+ }\n+ }\nimg->data16 = nullptr;\n}\n@@ -97,14 +74,20 @@ astc_codec_image *allocate_image(\nimg->data16 = new uint16_t **[ezsize];\nimg->data16[0] = new uint16_t *[ezsize * eysize];\nimg->data16[0][0] = new uint16_t[4 * ezsize * eysize * exsize];\n+\nfor (i = 1; i < ezsize; i++)\n{\nimg->data16[i] = img->data16[0] + i * eysize;\nimg->data16[i][0] = img->data16[0][0] + 4 * i * exsize * eysize;\n}\n+\nfor (i = 0; i < ezsize; i++)\n+ {\nfor (j = 1; j < eysize; j++)\n+ {\nimg->data16[i][j] = img->data16[i][0] + 4 * j * exsize;\n+ }\n+ }\nimg->data8 = nullptr;\n}\n@@ -116,6 +99,45 @@ astc_codec_image *allocate_image(\nreturn img;\n}\n+void destroy_image(astc_codec_image * img)\n+{\n+ if (img == nullptr)\n+ {\n+ return;\n+ }\n+\n+ if (img->data8)\n+ {\n+ delete[] img->data8[0][0];\n+ delete[] img->data8[0];\n+ delete[] img->data8;\n+ }\n+\n+ if (img->data16)\n+ {\n+ delete[] img->data16[0][0];\n+ delete[] img->data16[0];\n+ delete[] img->data16;\n+ }\n+\n+ if (img->input_averages)\n+ {\n+ delete[] img->input_averages;\n+ }\n+\n+ if (img->input_variances)\n+ {\n+ delete[] img->input_variances;\n+ }\n+\n+ if (img->input_alpha_averages)\n+ {\n+ delete[] img->input_alpha_averages;\n+ }\n+\n+ delete img;\n+}\n+\nvoid initialize_image(astc_codec_image * img)\n{\nint x, y, z;\n@@ -127,7 +149,9 @@ void initialize_image(astc_codec_image * img)\nif (img->data8)\n{\nfor (z = 0; z < ezsize; z++)\n+ {\nfor (y = 0; y < eysize; y++)\n+ {\nfor (x = 0; x < exsize; x++)\n{\nimg->data8[z][y][4 * x] = 0;\n@@ -136,10 +160,14 @@ void initialize_image(astc_codec_image * img)\nimg->data8[z][y][4 * x + 3] = 0xFF;\n}\n}\n+ }\n+ }\nelse if (img->data16)\n{\nfor (z = 0; z < ezsize; z++)\n+ {\nfor (y = 0; y < eysize; y++)\n+ {\nfor (x = 0; x < exsize; x++)\n{\nimg->data16[z][y][4 * x] = 0;\n@@ -148,6 +176,8 @@ void initialize_image(astc_codec_image * img)\nimg->data16[z][y][4 * x + 3] = 0x3C00;\n}\n}\n+ }\n+ }\nelse\n{\nASTC_CODEC_INTERNAL_ERROR();\n@@ -161,7 +191,9 @@ void initialize_image(astc_codec_image * img)\nvoid fill_image_padding_area(astc_codec_image * img)\n{\nif (img->padding == 0)\n+ {\nreturn;\n+ }\nint x, y, z, i;\nint exsize = img->xsize + 2 * img->padding;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Linting style cleanup
|
61,745 |
08.03.2020 14:37:35
| 0 |
26283da80261f7506d30f94f8ee04bdb7e92573a
|
Fix rounding in sRGB constant color block decode
Fix
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_decompress_symbolic.cpp",
"new_path": "Source/astc_decompress_symbolic.cpp",
"diff": "@@ -75,11 +75,14 @@ static uint4 lerp_color_int(\necolor0 = int4(ecolor0.x >> 8, ecolor0.y >> 8, ecolor0.z >> 8, ecolor0.w >> 8);\necolor1 = int4(ecolor1.x >> 8, ecolor1.y >> 8, ecolor1.z >> 8, ecolor1.w >> 8);\n}\n+\nint4 color = (ecolor0 * eweight0) + (ecolor1 * eweight1) + int4(32, 32, 32, 32);\ncolor = int4(color.x >> 6, color.y >> 6, color.z >> 6, color.w >> 6);\nif (decode_mode == DECODE_LDR_SRGB)\n+ {\ncolor = color * 257;\n+ }\nreturn uint4(color.x, color.y, color.z, color.w);\n}\n@@ -142,13 +145,26 @@ void decompress_symbolic_block(\nif (scb->block_mode == -2)\n{\n- // For sRGB decoding, we should return only the top 8 bits.\n- int mask = (decode_mode == DECODE_LDR_SRGB) ? 0xFF00 : 0xFFFF;\n+ int ired = scb->constant_color[0];\n+ int igreen = scb->constant_color[1];\n+ int iblue = scb->constant_color[2];\n+ int ialpha = scb->constant_color[3];\n+\n+ // For sRGB decoding a real decoder would just use the top 8 bits\n+ // for color conversion. We don't color convert, so linearly scale\n+ // the top 8 bits into the full 16 bit dynamic range\n+ if (decode_mode == DECODE_LDR_SRGB)\n+ {\n+ ired = (ired >> 8) * 257;\n+ igreen = (igreen >> 8) * 257;\n+ iblue = (iblue >> 8) * 257;\n+ ialpha = (ialpha >> 8) * 257;\n+ }\n- red = sf16_to_float(unorm16_to_sf16(scb->constant_color[0] & mask));\n- green = sf16_to_float(unorm16_to_sf16(scb->constant_color[1] & mask));\n- blue = sf16_to_float(unorm16_to_sf16(scb->constant_color[2] & mask));\n- alpha = sf16_to_float(unorm16_to_sf16(scb->constant_color[3] & mask));\n+ red = sf16_to_float(unorm16_to_sf16(ired));\n+ green = sf16_to_float(unorm16_to_sf16(igreen));\n+ blue = sf16_to_float(unorm16_to_sf16(iblue));\n+ alpha = sf16_to_float(unorm16_to_sf16(ialpha));\nuse_lns = 0;\nuse_nan = 0;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix rounding in sRGB constant color block decode
Fix #94
|
61,750 |
09.03.2020 15:48:36
| 0 |
cda171b2e68d75ee954103e01a391b9c7e0851ea
|
Add artefact promotion link
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "-def dsgArtifactoryUpload(String sourcePattern, String target) {\n- rtBuildInfo (\n- // Maximum builds to keep in Artifactory.\n- maxBuilds: 10,\n- // Also delete the build artifacts when deleting a build.\n- deleteBuildArtifacts: true\n- )\n- rtUpload (\n- serverId: 'dsg-artifactory',\n- spec: \"\"\"\n- {\n- \"files\": [\n- {\n- \"pattern\": \"${sourcePattern}\",\n- \"target\": \"${target}\"\n- }\n- ]\n- }\n- \"\"\"\n- )\n- rtPublishBuildInfo (\n- serverId: 'dsg-artifactory'\n- )\n-}\n+@Library('hive-infra-library@master') _\npipeline {\nagent none\n@@ -191,7 +168,8 @@ pipeline {\nstage('Upload') {\nsteps {\nzip zipFile: 'astcenc.zip', dir: 'upload', archive: false\n- dsgArtifactoryUpload('*.zip', \"astc-encoder/build/${currentBuild.number}/\")\n+ dsgArtifactoryUpload('*.zip')\n+ dsgArtifactoryPromote()\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
QE-1687: Add artefact promotion link (#95)
|
61,745 |
09.03.2020 17:19:32
| 0 |
2b6ce7cdab8f4075d631cbec318457604f5e7df0
|
Enable new test script in Jenkins build
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -44,9 +44,9 @@ pipeline {\n}\nstage('Test') {\nsteps {\n- sh 'python3 ./Test/astc_test_run.py'\n- perfReport(sourceDataFiles:'TestOutput/results.xml')\n- junit(testResults: 'TestOutput/results.xml')\n+ sh 'python3 ./Test/astc_run_image_tests.py --test-set Small'\n+ //perfReport(sourceDataFiles:'TestOutput/results.xml')\n+ //junit(testResults: 'TestOutput/results.xml')\n}\n}\n}\n@@ -89,10 +89,10 @@ pipeline {\nsteps {\nbat '''\nset Path=c:\\\\Python38;c:\\\\Python38\\\\Scripts;%Path%\n- call python ./Test/astc_test_run.py\n+ call python ./Test/astc_run_image_tests.py --test-set Small\n'''\n- perfReport(sourceDataFiles:'TestOutput\\\\results.xml')\n- junit(testResults: 'TestOutput\\\\results.xml')\n+ //perfReport(sourceDataFiles:'TestOutput\\\\results.xml')\n+ //junit(testResults: 'TestOutput\\\\results.xml')\n}\n}\n}\n@@ -127,10 +127,10 @@ pipeline {\nsteps {\nsh '''\nexport PATH=$PATH:/usr/local/bin\n- python3 ./Test/astc_test_run.py\n+ python3 ./Test/astc_run_image_tests.py --test-set Small\n'''\n- perfReport(sourceDataFiles:'TestOutput/results.xml')\n- junit(testResults: 'TestOutput/results.xml')\n+ //perfReport(sourceDataFiles:'TestOutput/results.xml')\n+ //junit(testResults: 'TestOutput/results.xml')\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Enable new test script in Jenkins build
|
61,745 |
09.03.2020 17:26:45
| 0 |
73c57cdc0ce59575fc069765c00d3e5af7f199cd
|
Change macOS pipeline to SSE2; mini doesn't have avx2
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -112,7 +112,7 @@ pipeline {\nsteps {\nsh '''\ncd ./Source/\n- make VEC=avx2\n+ make VEC=sse2\n'''\n}\n}\n@@ -127,7 +127,7 @@ pipeline {\nsteps {\nsh '''\nexport PATH=$PATH:/usr/local/bin\n- python3 ./Test/astc_run_image_tests.py --test-set Small\n+ python3 ./Test/astc_run_image_tests.py --test-set Small --encoder=sse2\n'''\n//perfReport(sourceDataFiles:'TestOutput/results.xml')\n//junit(testResults: 'TestOutput/results.xml')\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Change macOS pipeline to SSE2; mini doesn't have avx2
|
61,745 |
09.03.2020 23:23:55
| 0 |
94961b61d940b7aac02dc4d3d5d1d2859a59e4ce
|
Fix error in dual-plane mode in the overview
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/FormatOverview.md",
"new_path": "Docs/FormatOverview.md",
"diff": "@@ -308,11 +308,13 @@ correlated with the color value - or normal data - the X and Y normal values\noften change independently.\nASTC allows a dual-plane mode, which uses two separate weight grids for each\n-texel. The RGB channels use one weight grid, and the A channel uses another.\n+texel. A single channel can be assigned to a second plane of weights, while\n+the other three use the first plane of weights.\nThe use of dual-plane mode can be chosen on a per-block basis, but its use\nprevents the use of four color partitions as we do not have enough bits to\n-store the payload for both concurrently.\n+concurrently store both an extra plane of weights and an extra set of color\n+endpoints.\nEnd results\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix error in dual-plane mode in the overview
|
61,745 |
09.03.2020 23:26:21
| 0 |
899c5b6a8112700c928144d6b0e76fc073b3c52b
|
Tweak wording Please enter the commit message for your changes. Lines starting
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/FormatOverview.md",
"new_path": "Docs/FormatOverview.md",
"diff": "@@ -346,10 +346,11 @@ The compression scheme used by ASTC effectively compresses arbitrary sequences\nof floating point numbers, with a flexible number of channels, across any of\nthe supported block sizes. There is no real notion of \"color format\" in the\nformat itself at all, beyond the color endpoint mode selection, although a\n-sensible compressor will want to use some format-specific metrics.\n+sensible compressor will want to use some format-specific heuristics to drive\n+an efficient state-space search.\nThe orthogonal encoding design allows ASTC to provide complete coverage of our\n-format matrix from earlier, across a wide range of bit rates:\n+desirable format matrix from earlier, across a wide range of bit rates:\n\n@@ -363,10 +364,10 @@ Image quality\nThe normal expectation would be that this level of format flexibility would\ncome at a cost of image quality; it has to cost something, right? Luckily this\n-isn't true. The high packing efficiency allowed by the BISE encoding, and the\n-ability to dynamically choose quantization levels on a per-block basis, means\n-that an ASTC compressor is not forced to spend bits on things that don't help\n-image quality.\n+isn't true. The high packing efficiency allowed by BISE encoding, and the\n+ability to dynamically choose where to spend encoding space on a per-block\n+basis, means that an ASTC compressor is not forced to spend bits on things that\n+don't help image quality.\nThis gives some significant improvements in image quality compared to the older\ntexture formats, even though ASTC also handles a much wider range of options.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Tweak wording Please enter the commit message for your changes. Lines starting
|
61,745 |
09.03.2020 23:41:44
| 0 |
75446e0df13879fa7ddb4c0b4f510973a875402f
|
Simplify wording for degenerates
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/FormatOverview.md",
"new_path": "Docs/FormatOverview.md",
"diff": "@@ -276,8 +276,8 @@ in a third, and no bias in the rest. As they are procedurally generated not all\nof the partitions are useful, in particular with the smaller block sizes.\n* Many partitions are duplicates.\n-* Many partitions are degenerate (an N partition hash results in a partition\n- assignment with some of the N containing no texels).\n+* Many partitions are degenerate (an N partition hash results in at least one\n+ partition assignment that contains no texels).\nTexel weights\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Simplify wording for degenerates
|
61,745 |
09.03.2020 23:58:38
| 0 |
36d70b46e8e231ea9b6279029b893cde3acd95ae
|
Correct extension feature listing for OpenGL ES
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/FormatOverview.md",
"new_path": "Docs/FormatOverview.md",
"diff": "@@ -417,8 +417,8 @@ Khronos extensions\nOfficial Khronos extensions exist for the feature profiles of ASTC:\n* [KHR_texture_compression_astc_ldr][astc_ldr]: 2D LDR support\n-* [KHR_texture_compression_astc_hdr][astc_ldr]: 2D LDR + HDR support\n-* [KHR_texture_compression_astc_sliced_3d][astc_3d]: 3D LDR + HDR support\n+* [KHR_texture_compression_astc_sliced_3d][astc_3d]: 2D + 3D LDR support\n+* [KHR_texture_compression_astc_hdr][astc_ldr]: 2D + 3D, LDR + HDR support\nA convenience extension which provides the full feature set implied by\nsupporting all three KHR extensions also exists.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Correct extension feature listing for OpenGL ES
|
61,745 |
10.03.2020 09:50:05
| 0 |
a89d7a4a72f643adddef7bdc71a288805ab9a792
|
Fix trit max value (3^5, not 5^3)
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/FormatOverview.md",
"new_path": "Docs/FormatOverview.md",
"diff": "@@ -161,9 +161,9 @@ Quints\n------\nInstead of rounding up a 5 symbol alphabet - called a \"quint\" in BISE - to\n-three bits, we could choose to instead pack three quints together. Three\n-characters in a 5-symbol alphabet have 5<sup>3</sup> (125) combinations, and\n-contain 6.97 bits of information. We can store this in 7 bits and have a\n+three bits, we could choose to instead pack three quint characters together.\n+Three characters in a 5-symbol alphabet have 5<sup>3</sup> (125) combinations,\n+and contain 6.97 bits of information. We can store this in 7 bits and have a\nstorage waste of only 0.5%.\n@@ -171,9 +171,9 @@ Trits\n-----\nWe can similarly construct a 3-symbol alphabet - called a \"trit\" in BISE - and\n-pack trits in groups of five. Each character group has 5<sup>3</sup> (243)\n-combinations, and contains 7.92 bits of information. We can store this in 8\n-bits and have a storage waste of only 1%.\n+pack trit characters in groups of five. Each character group has 3<sup>5</sup>\n+(243) combinations, and contains 7.92 bits of information. We can store this in\n+8 bits and have a storage waste of only 1%.\nBISE\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix trit max value (3^5, not 5^3)
|
61,745 |
10.03.2020 21:15:51
| 0 |
7ea2601857fa92891353198ec9ae885f7bf4de30
|
Strip out some low value logging
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "extern int block_mode_histogram[2048];\n#endif\n-\n-\n-int progress_counter_divider = 1;\n-\nint rgb_force_use_of_hdr = 0;\nint alpha_force_use_of_hdr = 0;\n@@ -74,7 +70,6 @@ struct astc_header\nuint8_t zsize[3]; // block count is inferred\n};\n-int suppress_progress_counter = 0;\nint perform_srgb_transform = 0;\nastc_codec_image *load_astc_file(\n@@ -362,9 +357,6 @@ static void store_astc_file(\nexit(1);\n}\n- if (!suppress_progress_counter)\n- printf(\"%d blocks to process ..\\n\", xblocks * yblocks * zblocks);\n-\nencode_astc_image(input_image, nullptr, xdim, ydim, zdim, ewp, decode_mode, swz_encode, swz_encode, buffer, 0, threadcount);\nend_coding_time = get_time();\n@@ -412,20 +404,9 @@ static astc_codec_image *pack_and_unpack_astc_image(\nastc_codec_image *img = allocate_image(bitness, xsize, ysize, zsize, 0);\n- /* allocate_output_image_space (bitness, xsize, ysize, zsize); */\n- int xblocks = (xsize + xdim - 1) / xdim;\n- int yblocks = (ysize + ydim - 1) / ydim;\n- int zblocks = (zsize + zdim - 1) / zdim;\n-\n- if (!suppress_progress_counter)\n- printf(\"%d blocks to process...\\n\", xblocks * yblocks * zblocks);\n-\nencode_astc_image(input_image, img, xdim, ydim, zdim, ewp, decode_mode,\nswz_encode, swz_decode, nullptr, 1, threadcount);\n- if (!suppress_progress_counter)\n- printf(\"\\n\");\n-\nreturn img;\n}\n@@ -659,8 +640,6 @@ int astc_main(\nint maxiters_autoset = 0;\nint maxiters_set_by_user = 0;\n- int pcdiv = 1;\n-\nint xdim_2d = 0;\nint ydim_2d = 0;\nint xdim_3d = 0;\n@@ -759,7 +738,6 @@ int astc_main(\n{\nargidx++;\nsilentmode = 1;\n- suppress_progress_counter = 1;\n}\nelse if (!strcmp(argv[argidx], \"-v\"))\n{\n@@ -1111,31 +1089,6 @@ int astc_main(\ndblimit_autoset_3d = MAX(85 - 35 * log10_texels_3d, 63 - 19 * log10_texels_3d);\nbmc_autoset = 50;\nmaxiters_autoset = 1;\n-\n- switch (ydim_2d)\n- {\n- case 4:\n- pcdiv = 60;\n- break;\n- case 5:\n- pcdiv = 27;\n- break;\n- case 6:\n- pcdiv = 30;\n- break;\n- case 8:\n- pcdiv = 24;\n- break;\n- case 10:\n- pcdiv = 16;\n- break;\n- case 12:\n- pcdiv = 20;\n- break;\n- default:\n- pcdiv = 20;\n- break;\n- };\npreset_has_been_set++;\n}\nelse if (!strcmp(argv[argidx], \"-medium\"))\n@@ -1148,31 +1101,6 @@ int astc_main(\ndblimit_autoset_3d = MAX(95 - 35 * log10_texels_3d, 70 - 19 * log10_texels_3d);\nbmc_autoset = 75;\nmaxiters_autoset = 2;\n-\n- switch (ydim_2d)\n- {\n- case 4:\n- pcdiv = 25;\n- break;\n- case 5:\n- pcdiv = 15;\n- break;\n- case 6:\n- pcdiv = 15;\n- break;\n- case 8:\n- pcdiv = 10;\n- break;\n- case 10:\n- pcdiv = 8;\n- break;\n- case 12:\n- pcdiv = 6;\n- break;\n- default:\n- pcdiv = 6;\n- break;\n- };\npreset_has_been_set++;\n}\nelse if (!strcmp(argv[argidx], \"-thorough\"))\n@@ -1185,31 +1113,6 @@ int astc_main(\ndblimit_autoset_3d = MAX(105 - 35 * log10_texels_3d, 77 - 19 * log10_texels_3d);\nbmc_autoset = 95;\nmaxiters_autoset = 4;\n-\n- switch (ydim_2d)\n- {\n- case 4:\n- pcdiv = 12;\n- break;\n- case 5:\n- pcdiv = 7;\n- break;\n- case 6:\n- pcdiv = 7;\n- break;\n- case 8:\n- pcdiv = 5;\n- break;\n- case 10:\n- pcdiv = 4;\n- break;\n- case 12:\n- pcdiv = 3;\n- break;\n- default:\n- pcdiv = 3;\n- break;\n- };\npreset_has_been_set++;\n}\nelse if (!strcmp(argv[argidx], \"-exhaustive\"))\n@@ -1222,32 +1125,7 @@ int astc_main(\ndblimit_autoset_3d = 999.0f;\nbmc_autoset = 100;\nmaxiters_autoset = 4;\n-\npreset_has_been_set++;\n- switch (ydim_2d)\n- {\n- case 4:\n- pcdiv = 3;\n- break;\n- case 5:\n- pcdiv = 1;\n- break;\n- case 6:\n- pcdiv = 1;\n- break;\n- case 8:\n- pcdiv = 1;\n- break;\n- case 10:\n- pcdiv = 1;\n- break;\n- case 12:\n- pcdiv = 1;\n- break;\n- default:\n- pcdiv = 1;\n- break;\n- }\n}\nelse if (!strcmp(argv[argidx], \"-j\"))\n{\n@@ -1363,8 +1241,6 @@ int astc_main(\nreturn 1;\n}\n- progress_counter_divider = pcdiv;\n-\nint partitions_to_test = plimit_set_by_user ? plimit_user_specified : plimit_autoset;\nfloat dblimit_2d = dblimit_set_by_user ? dblimit_user_specified : dblimit_autoset_2d;\nfloat dblimit_3d = dblimit_set_by_user ? dblimit_user_specified : dblimit_autoset_3d;\n@@ -1668,13 +1544,6 @@ int astc_main(\nprintf(\"Failed to store image %s\\n\", output_filename);\nreturn 1;\n}\n- else\n- {\n- if (!silentmode)\n- {\n- printf(\"Stored %s image %s with %d color channels\\n\", format_string, output_filename, store_result);\n- }\n- }\n}\nif (op_mode == ASTC_ENCODE)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Strip out some low value logging
|
61,745 |
11.03.2020 22:38:17
| 0 |
faa22ccbdae1d21e90056bf83b95b20ff086c8a4
|
Rationalize HDR RGB+A and RGBA handling in CLI
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -78,7 +78,8 @@ enum astc_decode_mode\n{\nDECODE_LDR_SRGB,\nDECODE_LDR,\n- DECODE_HDR\n+ DECODE_HDR,\n+ DECODE_HDRA\n};\n/*\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_color_unquantize.cpp",
"new_path": "Source/astc_color_unquantize.cpp",
"diff": "@@ -983,7 +983,7 @@ void unpack_color_endpoints(\nbreak;\ncase DECODE_HDR:\n-\n+ case DECODE_HDRA:\nif (*rgb_hdr == 0)\n{\noutput0->x *= 257;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_decompress_symbolic.cpp",
"new_path": "Source/astc_decompress_symbolic.cpp",
"diff": "@@ -189,6 +189,7 @@ void decompress_symbolic_block(\nuse_nan = 1;\nbreak;\ncase DECODE_HDR:\n+ case DECODE_HDRA:\n// constant-color block; unpack from FP16 to FP32.\nred = sf16_to_float(scb->constant_color[0]);\ngreen = sf16_to_float(scb->constant_color[1]);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -527,7 +527,7 @@ int astc_main(\nASTC_UNRECOGNIZED\n};\n- astc_decode_mode decode_mode = DECODE_HDR;\n+ astc_decode_mode decode_mode = DECODE_LDR;\nastc_op_mode op_mode = ASTC_UNRECOGNIZED;\nstruct {\n@@ -542,13 +542,16 @@ int astc_main(\n{\"-ds\", ASTC_DECODE, DECODE_LDR_SRGB},\n{\"-ts\", ASTC_ENCODE_AND_DECODE, DECODE_LDR_SRGB},\n{\"-ch\", ASTC_ENCODE, DECODE_HDR},\n+ {\"-cH\", ASTC_ENCODE, DECODE_HDRA},\n{\"-dh\", ASTC_DECODE, DECODE_HDR},\n+ {\"-dH\", ASTC_DECODE, DECODE_HDRA},\n{\"-th\", ASTC_ENCODE_AND_DECODE, DECODE_HDR},\n+ {\"-tH\", ASTC_ENCODE_AND_DECODE, DECODE_HDRA},\n{\"-compare\", ASTC_IMAGE_COMPARE, DECODE_HDR},\n{\"-h\", ASTC_PRINT_LONGHELP, DECODE_HDR},\n{\"-help\", ASTC_PRINT_LONGHELP, DECODE_HDR},\n{\"-v\", ASTC_PRINT_VERSION, DECODE_HDR},\n- {\"-version\", ASTC_PRINT_VERSION, DECODE_HDR },\n+ {\"-version\", ASTC_PRINT_VERSION, DECODE_HDR}\n};\nint modes_count = sizeof(modes) / sizeof(modes[0]);\n@@ -646,9 +649,6 @@ int astc_main(\nint ydim_3d = 0;\nint zdim_3d = 0;\n- int target_bitrate_set = 0;\n- float target_bitrate = 0;\n-\n#ifdef DEBUG_PRINT_DIAGNOSTICS\nint print_block_mode_histogram = 0;\n#endif\n@@ -659,6 +659,37 @@ int astc_main(\nint low_fstop = -10;\nint high_fstop = 10;\n+ if (decode_mode == DECODE_HDRA)\n+ {\n+ ewp.rgb_power = 0.75f;\n+ ewp.rgb_base_weight = 0.0f;\n+ ewp.rgb_mean_weight = 1.0f;\n+\n+ ewp.alpha_power = 0.75f;\n+ ewp.alpha_base_weight = 0.0f;\n+ ewp.alpha_mean_weight = 1.0f;\n+\n+ rgb_force_use_of_hdr = 1;\n+ alpha_force_use_of_hdr = 1;\n+\n+ dblimit_user_specified = 999.0f;\n+ dblimit_set_by_user = 1;\n+ }\n+ else if (decode_mode == DECODE_HDR)\n+ {\n+ ewp.rgb_power = 0.75f;\n+ ewp.rgb_base_weight = 0.0f;\n+ ewp.rgb_mean_weight = 1.0f;\n+\n+ ewp.alpha_base_weight = 0.05f;\n+\n+ rgb_force_use_of_hdr = 1;\n+ alpha_force_use_of_hdr = 0;\n+\n+ dblimit_user_specified = 999.0f;\n+ dblimit_set_by_user = 1;\n+ }\n+\n// parse the command line's encoding options.\nint argidx;\nif (op_mode == ASTC_ENCODE || op_mode == ASTC_ENCODE_AND_DECODE)\n@@ -964,52 +995,7 @@ int astc_main(\newp.alpha_mean_weight = 0.0f;\newp.alpha_stdev_weight = 25.0f;\n}\n- else if (!strcmp(argv[argidx], \"-alphablend\"))\n- {\n- argidx++;\n- ewp.enable_rgb_scale_with_alpha = 1;\n- ewp.alpha_radius = 1;\n- }\n- else if (!strcmp(argv[argidx], \"-hdra\"))\n- {\n- if (decode_mode != DECODE_HDR)\n- {\n- printf(\"The option -hdra is only available in HDR mode\\n\");\n- return 1;\n- }\n- argidx++;\n- ewp.mean_stdev_radius = 0;\n- ewp.rgb_power = 0.75;\n- ewp.rgb_base_weight = 0;\n- ewp.rgb_mean_weight = 1;\n- ewp.alpha_power = 0.75;\n- ewp.alpha_base_weight = 0;\n- ewp.alpha_mean_weight = 1;\n- rgb_force_use_of_hdr = 1;\n- alpha_force_use_of_hdr = 1;\n- dblimit_user_specified = 999;\n- dblimit_set_by_user = 1;\n- }\n- else if (!strcmp(argv[argidx], \"-hdr\"))\n- {\n- if (decode_mode != DECODE_HDR)\n- {\n- printf(\"The option -hdr is only available in HDR mode\\n\");\n- return 1;\n- }\n-\n- argidx++;\n- ewp.mean_stdev_radius = 0;\n- ewp.rgb_power = 0.75;\n- ewp.rgb_base_weight = 0;\n- ewp.rgb_mean_weight = 1;\n- ewp.alpha_base_weight = 0.05f;\n- rgb_force_use_of_hdr = 1;\n- alpha_force_use_of_hdr = 0;\n- dblimit_user_specified = 999;\n- dblimit_set_by_user = 1;\n- }\nelse if (!strcmp(argv[argidx], \"-blockmodelimit\"))\n{\nargidx += 2;\n@@ -1300,8 +1286,6 @@ int astc_main(\nif (!silentmode)\n{\nprintf(\"Encoding settings:\\n\\n\");\n- if (target_bitrate_set)\n- printf(\"Target bitrate provided: %.2f bpp\\n\", (double)target_bitrate);\nprintf(\"2D Block size: %dx%d (%.2f bpp)\\n\", xdim_2d, ydim_2d, 128.0 / (xdim_2d * ydim_2d));\nprintf(\"3D Block size: %dx%dx%d (%.2f bpp)\\n\", xdim_3d, ydim_3d, zdim_3d, 128.0 / (xdim_3d * ydim_3d * zdim_3d));\nprintf(\"Radius for mean-and-stdev calculations: %d texels\\n\", ewp.mean_stdev_radius);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel_help.cpp",
"new_path": "Source/astc_toplevel_help.cpp",
"diff": "@@ -32,36 +32,37 @@ R\"(\nBasic usage:\nTo compress an image use the following command line:\n- astcenc {-cl|-cs|-ch} <input> <output> <blockdim> <preset> [options]\n+ astcenc {-cl|-cs|-ch|-cH} <in> <out> <blockdim> <preset> [options]\nFor example, to compress to 8x6 blocks with the thorough preset use:\n- astcenc -ch kodim01.png kodim01.astc 8x6 -thorough\n+ astcenc -cl kodim01.png kodim01.astc 8x6 -thorough\nTo decompress an image use the following command line:\n- astcenc {-dl|-ds|-dh} <input> <output>\n+ astcenc {-dl|-ds|-dh|-dH} <in> <out>\nFor example, use:\n- astcenc -dh kodim01.astc kodim01.png\n+ astcenc -dl kodim01.astc kodim01.png\n-To perform a compression test, writing back the decompressed output, use the\n-following command line:\n- astcenc {-tl|-ts|-th} <input> <output> <blockdim> <preset> [options]\n+To perform a compression test, writing back the decompressed output, use\n+the following command line:\n+ astcenc {-tl|-ts|-th|-tH} <in> <out> <blockdim> <preset> [options]\nFor example, use:\n- astcenc -th kodim01.png kodim01-test.png 8x6 -thorough\n+ astcenc -tl kodim01.png kodim01-test.png 8x6 -thorough\n-The -ch/-dh/-th options are used to configure the codec to support the full\n-range of LDR and HDR ASTC color encoding options. Textures compressed with\n-this setting may fail to decompress correctly on GPU hardware without the\n-HDR profile support.\n+The -*l options are used to configure the codec to support only the linear\n+LDR profile, preventing use of the HDR encoding features.\n-The -cl/-dl/-tl options are used to configure the codec to support only\n-the linear LDR profile, preventing use of the HDR encoding features.\n-\n-The -cl/-ds/-ts options are used to configure the codec to support only\n+The -*s options are used to configure the codec to support only\nthe sRGB LDR profile, preventing use of the HDR encoding features. Input\ntexture data must be encoded in the sRGB colorspace for this option to\n-provide correct compressed data.\n+provide correct output results.\n+\n+The -*h/-*H options are used to configure the codec to support the HDR ASTC\n+color profile. Textures compressed with this profile may fail to decompress\n+correctly on GPU hardware without HDR profile support. The -*h options\n+configure the compressor for HDR RGB channels with an LDR alpha channel.\n+The -*H options configure the compressor for full HDR across all channels.\nFor full help documentation run 'astcenc -help'.\n)\";\n@@ -74,10 +75,10 @@ NAME\nSYNOPSIS\nastcenc {-h|-help}\nastcenc {-v|-version}\n- astcenc {-cl|-cs|-ch} <in> <out> <blocksize> <preset> [options ...]\n- astcenc {-dl|-ds|-dh} <in> <out> <blocksize> <preset> [options ...]\n- astcenc {-tl|-ts|-th} <in> <out> <blocksize> <preset> [options ...]\n- astcenc {-compare} <in1> <in2> [options ...]\n+ astcenc {-cl|-cs|-ch|-cH} <in> <out> <blocksize> <preset> [options]\n+ astcenc {-dl|-ds|-dh|-dH} <in> <out> <blocksize> <preset> [options]\n+ astcenc {-tl|-ts|-th|-tH} <in> <out> <blocksize> <preset> [options]\n+ astcenc {-compare} <in1> <in2> [options]\nDESCRIPTION\nastcenc compresses image files into the Adaptive Scalable Texture\n@@ -104,8 +105,9 @@ COMPRESSION\ntarget block size, and the quality preset.\nThe color profile is specified using the -cl (LDR linear),\n- -cs (LDR sRGB), and -ch (HDR) encoder option. Note that not all\n- hardware implementations of ASTC support the HDR profile.\n+ -cs (LDR sRGB), -ch (HDR RGB, LDR A), or -cH (HDR RGBA) encoder\n+ options. Note that not all hardware implementations of ASTC support\n+ the HDR profile.\nThe input file path must match a valid file format for compression,\nand the output file format must be a valid output for compression.\n@@ -158,12 +160,6 @@ COMPRESSION\nuseful to consider for common usage, based on the type of image\ndata being compressed.\n- -alphablend\n- The input texture alpha component is used to represent opacity\n- of the RGB components, where 0 is fully transparent and 1 is\n- fully opaque. This improves image quality by scaling RGB error\n- significance in transparent parts of the image.\n-\n-mask\nThe input texture is a mask texture with unrelated data stored\nin the various color channels. This improves image quality by\n@@ -186,16 +182,6 @@ COMPRESSION\nThis aims to improves perceptual quality of the normals, but\ntypically lowers the measured PSNR score.\n- -hdr\n- The input texture is an HDR RGB texture, with an LDR alpha\n- channel. This improves image quality by using error metrics that\n- are appropriate for the data in each channel.\n-\n- -hdra\n- The input texture is an HDR RGB texture, with an HDR alpha\n- channel. This improves image quality by using error metrics that\n- are appropriate for the data in each channel.\n-\n-array <size>\nLoads an array of <size> 2D image slices to use as a 3D image.\nThe input filename given is used is decorated with\n@@ -292,7 +278,7 @@ ADVANCED COMPRESSION\ndrive the performance-quality trade off.\n-partitionlimit <number>\n- Test only <number> block partitionings. Higher numbers give\n+ Test only <number> block partitions. Higher numbers give\nbetter quality, however large values give diminishing returns\nespecially for smaller block sizes. Preset defaults are:\n@@ -407,7 +393,7 @@ DECOMPRESSION\nthe color profile, the input file name, and the output file name.\nThe color profile is specified using the -dl (LDR linear), -ds\n- (LDR sRGB), and -dh (HDR) encoder option.\n+ (LDR sRGB), -dh (HDR RGB, LDR A), or -dH (HDR RGBA) decoder options.\nThe input file path must match a valid file format for\ndecompression, and the output file format must be a valid output for\n@@ -415,18 +401,18 @@ DECOMPRESSION\ncoompression path can produce are supported for decompression. See\nthe FILE FORMATS section for the list of supported formats.\n- The -dsw, -linearizesrgb options documented in ADVANCED COMPRESSION\n+ The -dsw, -linsrgb options documented in ADVANCED COMPRESSION\noption documentation are relevent to decompression.\nTEST\n- To perform a compression test which round-trips a single image through\n- compression and decompression and stores the decompressed result back\n- to file, you must specify same settings as COMPRESSION other than\n- swapping the color profile to select test mode. Note that the compressed\n- intermediate data is discarded in this mode.\n+ To perform a compression test which round-trips a single image\n+ through compression and decompression and stores the decompressed\n+ result back to file, you must specify same settings as COMPRESSION\n+ other than swapping the color profile to select test mode. Note that\n+ the compressed intermediate data is discarded in this mode.\nThe color profile is specified using the -tl (LDR linear), -ts (LDR\n- sRGB), and -th (HDR) encoder option.\n+ sRGB), -th (HDR RGB, LDR A), or -tH (HDR RGBA) encoder options.\nThis operation mode will print error metrics suitable for either\nLDR and HDR images, allowing some assessment of the compression\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/encoder.py",
"new_path": "Test/testlib/encoder.py",
"diff": "@@ -213,13 +213,15 @@ class Encoder2x(EncoderBase):\nSWITCHES = {\n\"ldr\": \"-tl\",\n\"ldrs\": \"-ts\",\n- \"hdr\": \"-th\"\n+ \"hdr\": \"-th\",\n+ \"hdra\": \"-tH\"\n}\nOUTPUTS = {\n\"ldr\": \".tga\",\n\"ldrs\": \".tga\",\n- \"hdr\": \".htga\"\n+ \"hdr\": \".htga\",\n+ \"hdra\": \".htga\"\n}\ndef __init__(self, variant):\n@@ -251,14 +253,12 @@ class Encoder2x(EncoderBase):\nif image.colorFormat == \"xy\":\ncommand.append(\"-normal_psnr\")\n- if image.colorProfile == \"hdr\":\n- command.append(\"-hdr\")\n-\nif image.isMask:\ncommand.append(\"-mask\")\nif image.isAlphaScaled:\n- command.append(\"-alphablend\")\n+ command.append(\"-a\")\n+ command.append(\"1\")\nreturn command\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Rationalize HDR RGB+A and RGBA handling in CLI
|
61,745 |
11.03.2020 22:54:11
| 0 |
81b8ebaa46679c3dda60c844ee1f26cf9edf3c8f
|
Update README with latest options
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -86,32 +86,45 @@ summary of the main encoder options are shown below.\n## Compressing an image\n-Compress an image using the `-cl` \\ `-cs` \\ `-ch` options. For example:\n+Compress an image using the `-cl` \\ `-cs` \\ `-ch` \\ `-cH` modes. For example:\nastcenc -cl example.png example.astc 6x6 -medium\nThis compresses `example.png` using the LDR color profile and a 6x6 block\nfootprint (3.55 bits/pixel). The `-medium` quality preset gives a reasonable\nimage quality for a relatively fast compression speed. The output is stored to\n-a linear color space compressed image, `example.astc`. The other modes are\n-`-cs`, which compresses using the LDR sRGB color profile, and `-ch`, which\n-compresses using the HDR color profile.\n+a linear color space compressed image, `example.astc`.\n+\n+The modes available are:\n+\n+* `-cl` : use the linear LDR color profile.\n+* `-cs` : use the sRGB LDR color profile.\n+* `-ch` : use the HDR color profile, tuned for HDR RGB and LDR A.\n+* `-cH` : use the HDR color profile, tuned for HDR RGBA.\n## Decompressing an image\n-Decompress an image using the `-dl` \\ `-ds` \\ `-dh` options. For example:\n+Decompress an image using the `-dl` \\ `-ds` \\ `-dh` \\ `-dH` modes. For\n+example:\nastcenc -dh example.astc example.tga\nThis decompresses `example.astc` using the full HDR feature profile, storing\n-the decompressed output to `example.tga`. The other modes are `-dl`, which\n-decompresses using the LDR profile, and `-ds`, which decompresses using the LDR\n-sRGB color profile.\n+the decompressed output to `example.tga`.\n+\n+The modes available are:\n+\n+* `-dl` : use the linear LDR color profile.\n+* `-ds` : use the sRGB LDR color profile.\n+* `-dh` and `-dH` : use the HDR color profile.\n+\n+Note that for decompression there is no difference between the two HDR modes,\n+they are both provided simply to maintain symmetry across operations.\n## Measuring image quality\n-Review the compression quality using the `-tl` \\ `-ts` \\ -`th` options. For\n-example:\n+Review the compression quality using the `-tl` \\ `-ts` \\ -`th`\\ -`tH` modes.\n+For example:\nastcenc -tl example.png example.tga 5x5 -thorough\n@@ -121,6 +134,13 @@ immediately decompressing the image and saving the result. This can be used\nto enable a visual inspection of the compressed image quality. In addition\nthis mode also prints out some image quality metrics to the console.\n+The modes available are:\n+\n+* `-tl` : use the linear LDR color profile.\n+* `-ts` : use the sRGB LDR color profile.\n+* `-th` : use the HDR color profile, tuned for HDR RGB and LDR A.\n+* `-tH` : use the HDR color profile, tuned for HDR RGBA.\n+\n## Experimenting\nEfficient real-time graphics benefits from minimizing compressed texture size,\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update README with latest options
|
61,745 |
12.03.2020 00:08:02
| 0 |
4d85037971e3c8df37846f6b0f615a63f1a67235
|
Re-restrict stb_image to support formats
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "@@ -123,7 +123,8 @@ $(BINARY): $(EXTERNAL_OBJECTS) $(OBJECTS)\n@echo \"[Link] $@ (using $(VEC), debug=$(DBG))\"\nstb_image-$(VEC).o: stb_image.h\n- @$(CXX) -c -x c++ -o $@ $< $(CXXFLAGS_EXTERNAL) -DSTB_IMAGE_IMPLEMENTATION\n+ @$(CXX) -c -x c++ -o $@ $< $(CXXFLAGS_EXTERNAL) -DSTB_IMAGE_IMPLEMENTATION \\\n+ -DSTBI_NO_PSD -DSTBI_NO_GIF -DSTBI_NO_PIC -DSTBI_NO_PNM\n@echo \"[C++] $<\"\nstb_image_write-$(VEC).o: stb_image_write.h\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_stb_tga.cpp",
"new_path": "Source/astc_stb_tga.cpp",
"diff": "#ifdef _MSC_VER\n#define STB_IMAGE_IMPLEMENTATION\n#define STBI_MSC_SECURE_CRT\n+ #define STBI_NO_GIF\n+ #define STBI_NO_PIC\n+ #define STBI_NO_PNM\n+ #define STBI_NO_PSD\n#endif\n#include \"stb_image.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel_help.cpp",
"new_path": "Source/astc_toplevel_help.cpp",
"diff": "@@ -424,15 +424,18 @@ R\"(\nFILE FORMATS\nThe following formats are supported as compression inputs:\n+ LDR Formats:\n+ BMP (*.bmp)\nPNG (*.png)\nTarga (*.tga)\nJPEG (*.jpg)\n- GIF (*.gif) (non-animated only)\n- BMP (*.bmp)\n+\n+ HDR Formats:\nRadiance HDR (*.hdr)\n+\n+ Container Formats:\nKhronos Texture KTX (*.ktx)\nDirectDraw Surface DDS (*.dds)\n- OpenEXR (*.exr)\nFor the KTX and DDS formats only a subset of the features of the\nformats are supported:\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Re-restrict stb_image to support formats
|
61,745 |
23.03.2020 00:18:29
| 0 |
c9268d912782de834fef3e452a5596209774295a
|
Allow X*Y*1 images to use 3D block sizes
Fix a bug where 3D images collapse to a 2D block size
if the Z dimension is 1, which may occur with mipmap
generation.
Fix
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -1290,8 +1290,14 @@ int astc_main(\nif (!silentmode)\n{\nprintf(\"Encoding settings:\\n\\n\");\n+ if (zdim_3d == 1)\n+ {\nprintf(\"2D Block size: %dx%d (%.2f bpp)\\n\", xdim_2d, ydim_2d, 128.0 / (xdim_2d * ydim_2d));\n+ }\n+ else\n+ {\nprintf(\"3D Block size: %dx%dx%d (%.2f bpp)\\n\", xdim_3d, ydim_3d, zdim_3d, 128.0 / (xdim_3d * ydim_3d * zdim_3d));\n+ }\nprintf(\"Radius for mean-and-stdev calculations: %d texels\\n\", ewp.mean_stdev_radius);\nprintf(\"RGB power: %g\\n\", (double)ewp.rgb_power);\nprintf(\"RGB base-weight: %g\\n\", (double)ewp.rgb_base_weight);\n@@ -1453,7 +1459,13 @@ int astc_main(\ninput_components = load_result & 7;\ninput_image_is_hdr = (load_result & 0x80) ? 1 : 0;\n- if (input_image->zsize > 1)\n+ if ((input_image->zsize > 1) && (zdim_3d == 1))\n+ {\n+ printf(\"ERROR: 3D input data for a 2D ASTC block format.\\n\");\n+ exit(1);\n+ }\n+\n+ if (zdim_3d != 1)\n{\nxdim = xdim_3d;\nydim = ydim_3d;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_weight_align.cpp",
"new_path": "Source/astc_weight_align.cpp",
"diff": "@@ -412,7 +412,7 @@ void compute_angular_endpoints_for_quantization_levels(\n// Did we find anything?\nif (bsi < 0)\n{\n- printf(\"ERROR: Unable to find an encoding within the specified error limits.\\n\");\n+ printf(\"ERROR: Unable to find an encoding within the specified error limits\\n\");\nASTC_CODEC_INTERNAL_ERROR();\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Allow X*Y*1 images to use 3D block sizes
Fix a bug where 3D images collapse to a 2D block size
if the Z dimension is 1, which may occur with mipmap
generation.
Fix #80
|
61,745 |
23.03.2020 10:52:15
| 0 |
b339cb83eac8427dc20a4117fb3c2174e9debee1
|
Move perform_srgb_transform out of a global
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -70,7 +70,6 @@ NORETURN void astc_codec_internal_error(const char *filename, int linenumber);\n#endif\n-extern int perform_srgb_transform;\nextern int rgb_force_use_of_hdr;\nextern int alpha_force_use_of_hdr;\n@@ -629,6 +628,8 @@ struct astc_codec_image\nfloat4 *input_averages;\nfloat4 *input_variances;\nfloat *input_alpha_averages;\n+\n+ int linearize_srgb;\n};\nastc_codec_image* alloc_image(\n@@ -724,6 +725,7 @@ astc_codec_image* astc_codec_load_image(\nconst char* filename,\nint padding,\nint y_flip,\n+ int linearize_srgb,\nint* result);\nint astc_codec_store_image(\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -916,7 +916,7 @@ static float prepare_error_weight_block(\n// if we perform a conversion from linear to sRGB, then we multiply\n// the weight with the derivative of the linear->sRGB transform function.\n- if (perform_srgb_transform)\n+ if (input_image->linearize_srgb)\n{\nfloat r = blk->orig_data[4 * idx];\nfloat g = blk->orig_data[4 * idx + 1];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_image.cpp",
"new_path": "Source/astc_image.cpp",
"diff": "@@ -39,6 +39,7 @@ astc_codec_image *alloc_image(\nimg->input_averages = nullptr;\nimg->input_variances = nullptr;\nimg->input_alpha_averages = nullptr;\n+ img->linearize_srgb = 0;\nint exsize = xsize + 2 * padding;\nint eysize = ysize + 2 * padding;\n@@ -622,7 +623,7 @@ void fetch_imageblock(\n// perform sRGB-to-linear transform on input data, if requested.\nint pixelcount = bsd->texel_count;\n- if (perform_srgb_transform)\n+ if (img->linearize_srgb)\n{\nfptr = pb->orig_data;\nfor (i = 0; i < pixelcount; i++)\n@@ -753,7 +754,7 @@ void write_imageblock(\nelse\n{\n// apply swizzle\n- if (perform_srgb_transform)\n+ if (img->linearize_srgb)\n{\nfloat r = fptr[0];\nfloat g = fptr[1];\n@@ -850,7 +851,7 @@ void write_imageblock(\nelse\n{\n// apply swizzle\n- if (perform_srgb_transform)\n+ if (img->linearize_srgb)\n{\nfloat r = fptr[0];\nfloat g = fptr[1];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_image_load_store.cpp",
"new_path": "Source/astc_image_load_store.cpp",
"diff": "@@ -1809,6 +1809,7 @@ astc_codec_image* astc_codec_load_image(\nconst char* input_filename,\nint padding,\nint y_flip,\n+ int linearize_srgb,\nint* load_result\n) {\n// get hold of the filename ending\n@@ -1825,7 +1826,9 @@ astc_codec_image* astc_codec_load_image(\n|| strcmp(eptr, loader_descs[i].ending1) == 0\n|| strcmp(eptr, loader_descs[i].ending2) == 0)\n{\n- return loader_descs[i].loader_func(input_filename, padding, y_flip, load_result);\n+ astc_codec_image* img = loader_descs[i].loader_func(input_filename, padding, y_flip, load_result);\n+ img->linearize_srgb = linearize_srgb;\n+ return img;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -70,13 +70,12 @@ struct astc_header\nuint8_t zsize[3]; // block count is inferred\n};\n-int perform_srgb_transform = 0;\n-\nastc_codec_image *load_astc_file(\nconst char *filename,\nint bitness,\nastc_decode_mode decode_mode,\n- swizzlepattern swz_decode\n+ swizzlepattern swz_decode,\n+ int linearize_srgb\n) {\nint x, y, z;\nFILE *f = fopen(filename, \"rb\");\n@@ -151,13 +150,16 @@ astc_codec_image *load_astc_file(\n}\nastc_codec_image *img = alloc_image(bitness, xsize, ysize, zsize, 0);\n+ img->linearize_srgb = linearize_srgb;\nblock_size_descriptor bsd;\ninit_block_size_descriptor(xdim, ydim, zdim, &bsd);\nimageblock pb;\nfor (z = 0; z < zblocks; z++)\n+ {\nfor (y = 0; y < yblocks; y++)\n+ {\nfor (x = 0; x < xblocks; x++)\n{\nint offset = (((z * yblocks + y) * xblocks) + x) * 16;\n@@ -168,6 +170,8 @@ astc_codec_image *load_astc_file(\ndecompress_symbolic_block(decode_mode, &bsd, x * xdim, y * ydim, z * zdim, &scb, &pb);\nwrite_imageblock(img, &pb, &bsd, x * xdim, y * ydim, z * zdim, swz_decode);\n}\n+ }\n+ }\nterm_block_size_descriptor(&bsd);\nfree(buffer);\n@@ -413,17 +417,18 @@ static void compare_two_files(\nconst char* filename1,\nconst char* filename2,\nint low_fstop,\n- int high_fstop\n+ int high_fstop,\n+ int linearize_srgb\n) {\nint load_result1;\n- astc_codec_image *img1 = astc_codec_load_image(filename1, 0, 0, &load_result1);\n+ astc_codec_image *img1 = astc_codec_load_image(filename1, 0, 0, linearize_srgb, &load_result1);\nif (load_result1 < 0)\n{\nexit(1);\n}\nint load_result2;\n- astc_codec_image *img2 = astc_codec_load_image(filename2, 0, 0, &load_result2);\n+ astc_codec_image *img2 = astc_codec_load_image(filename2, 0, 0, linearize_srgb, &load_result2);\nif (load_result2 < 0)\n{\nexit(1);\n@@ -585,6 +590,7 @@ int astc_main(\nint silentmode = 0;\nint y_flip = 0;\n+ int linearize_srgb = 0;\nerror_weighting_params ewp;\n@@ -1125,7 +1131,7 @@ int astc_main(\nelse if (!strcmp(argv[argidx], \"-linsrgb\"))\n{\nargidx++;\n- perform_srgb_transform = 1;\n+ linearize_srgb = 1;\ndblimit_user_specified = 60;\ndblimit_set_by_user = 1;\n}\n@@ -1213,7 +1219,7 @@ int astc_main(\nif (op_mode == ASTC_IMAGE_COMPARE)\n{\n- compare_two_files(input_filename, output_filename, low_fstop, high_fstop);\n+ compare_two_files(input_filename, output_filename, low_fstop, high_fstop, linearize_srgb);\nreturn 0;\n}\n@@ -1227,7 +1233,8 @@ int astc_main(\nif (preset_has_been_set != 1)\n{\nprintf(\"For encoding, need to specify exactly one performance-quality\\n\"\n- \"trade-off preset option. The available presets are:\\n\" \" -fast\\n\" \" -medium\\n\" \" -thorough\\n\" \" -exhaustive\\n\");\n+ \"trade-off preset option. The available presets are:\\n\"\n+ \" -fast\\n\" \" -medium\\n\" \" -thorough\\n\" \" -exhaustive\\n\");\nreturn 1;\n}\n@@ -1365,7 +1372,7 @@ int astc_main(\n// 2D input data.\nif (array_size == 1)\n{\n- input_images[image_index] = astc_codec_load_image(input_filename, padding, y_flip, &load_results[image_index]);\n+ input_images[image_index] = astc_codec_load_image(input_filename, padding, y_flip, linearize_srgb, &load_results[image_index]);\n}\n// 3D input data - multiple 2D images.\nelse\n@@ -1382,7 +1389,7 @@ int astc_main(\n// Construct new file name and load: <name>_N.<extension>\nstrcpy(new_input_filename, input_filename);\nsprintf(strrchr(new_input_filename, '.'), \"_%d%s\", image_index, strrchr(input_filename, '.'));\n- input_images[image_index] = astc_codec_load_image(new_input_filename, padding, y_flip, &load_results[image_index]);\n+ input_images[image_index] = astc_codec_load_image(new_input_filename, padding, y_flip, linearize_srgb, &load_results[image_index]);\n// Check image is not 3D.\nif (input_images[image_index]->zsize != 1)\n@@ -1461,7 +1468,7 @@ int astc_main(\nif ((input_image->zsize > 1) && (zdim_3d == 1))\n{\n- printf(\"ERROR: 3D input data for a 2D ASTC block format.\\n\");\n+ printf(\"ERROR: 3D input data for a 2D ASTC block format\\n\");\nexit(1);\n}\n@@ -1485,10 +1492,13 @@ int astc_main(\nif (!silentmode)\n{\nprintf(\"%s: %dD %s image, %d x %d x %d, %d components\\n\\n\",\n- input_filename, input_image->zsize > 1 ? 3 : 2, input_image_is_hdr ? \"HDR\" : \"LDR\", input_image->xsize, input_image->ysize, input_image->zsize, load_result & 7);\n+ input_filename, input_image->zsize > 1 ? 3 : 2, input_image_is_hdr ? \"HDR\" : \"LDR\",\n+ input_image->xsize, input_image->ysize, input_image->zsize, load_result & 7);\n}\n- if (padding > 0 || ewp.rgb_mean_weight != 0.0f || ewp.rgb_stdev_weight != 0.0f || ewp.alpha_mean_weight != 0.0f || ewp.alpha_stdev_weight != 0.0f)\n+ if (padding > 0 ||\n+ ewp.rgb_mean_weight != 0.0f || ewp.rgb_stdev_weight != 0.0f ||\n+ ewp.alpha_mean_weight != 0.0f || ewp.alpha_stdev_weight != 0.0f)\n{\nif (!silentmode)\n{\n@@ -1502,7 +1512,7 @@ int astc_main(\newp.alpha_power,\newp.mean_stdev_radius,\newp.alpha_radius,\n- perform_srgb_transform,\n+ linearize_srgb,\nswz_encode,\nthread_count);\n@@ -1517,11 +1527,15 @@ int astc_main(\nstart_coding_time = get_time();\nif (op_mode == ASTC_DECODE)\n- output_image = load_astc_file(input_filename, out_bitness, decode_mode, swz_decode);\n+ {\n+ output_image = load_astc_file(input_filename, out_bitness, decode_mode, swz_decode, linearize_srgb);\n+ }\n// process image, if relevant\nif (op_mode == ASTC_ENCODE_AND_DECODE)\n+ {\noutput_image = pack_and_unpack_astc_image(input_image, xdim, ydim, zdim, &ewp, decode_mode, swz_encode, swz_decode, out_bitness, thread_count);\n+ }\nend_coding_time = get_time();\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Move perform_srgb_transform out of a global
|
61,745 |
23.03.2020 11:45:02
| 0 |
24b54300db40ac21652c852411bfd72e00355450
|
Move rgb/alpha_force_use_of_hdr out of globals
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -69,10 +69,6 @@ NORETURN void astc_codec_internal_error(const char *filename, int linenumber);\nextern int print_statistics;\n#endif\n-\n-extern int rgb_force_use_of_hdr;\n-extern int alpha_force_use_of_hdr;\n-\nenum astc_decode_mode\n{\nDECODE_LDR_SRGB,\n@@ -630,6 +626,8 @@ struct astc_codec_image\nfloat *input_alpha_averages;\nint linearize_srgb;\n+ int rgb_force_use_of_hdr;\n+ int alpha_force_use_of_hdr;\n};\nastc_codec_image* alloc_image(\n@@ -726,6 +724,8 @@ astc_codec_image* astc_codec_load_image(\nint padding,\nint y_flip,\nint linearize_srgb,\n+ int rgb_force_use_of_hdr,\n+ int alpha_force_use_of_hdr,\nint* result);\nint astc_codec_store_image(\n@@ -864,6 +864,7 @@ int pack_color_endpoints(\n// unpack a pair of color endpoints from a series of integers.\nvoid unpack_color_endpoints(\n+ const astc_codec_image* image,\nastc_decode_mode decode_mode,\nint format,\nint quantization_level,\n@@ -989,6 +990,7 @@ float compress_symbolic_block(\ncompress_symbolic_block_buffers* tmpbuf);\nvoid decompress_symbolic_block(\n+ const astc_codec_image* image,\nastc_decode_mode decode_mode,\nconst block_size_descriptor* bsd,\nint xpos,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_color_unquantize.cpp",
"new_path": "Source/astc_color_unquantize.cpp",
"diff": "@@ -795,6 +795,7 @@ static void hdr_rgb_hdr_alpha_unpack3(\n}\nvoid unpack_color_endpoints(\n+ const astc_codec_image* image,\nastc_decode_mode decode_mode,\nint format,\nint quantization_level,\n@@ -911,7 +912,7 @@ void unpack_color_endpoints(\nif (*alpha_hdr == -1)\n{\n- if (alpha_force_use_of_hdr)\n+ if (image->alpha_force_use_of_hdr)\n{\noutput0->w = 0x7800;\noutput1->w = 0x7800;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "* quality by moving each weight up by one or down by one quantization step.\n*/\nstatic int realign_weights(\n+ const astc_codec_image* image,\nastc_decode_mode decode_mode,\nconst block_size_descriptor* bsd,\nconst imageblock* blk,\n@@ -77,7 +78,8 @@ static int realign_weights(\nfor (int pa_idx = 0; pa_idx < partition_count; pa_idx++)\n{\n- unpack_color_endpoints(decode_mode,\n+ unpack_color_endpoints(image,\n+ decode_mode,\nscb->color_formats[pa_idx],\nscb->color_quantization_level,\nscb->color_values[pa_idx],\n@@ -205,6 +207,7 @@ static int realign_weights(\nfunction for compressing a block symbolically, given that we have already decided on a partition\n*/\nstatic void compress_symbolic_block_fixed_partition_1_plane(\n+ const astc_codec_image* image,\nastc_decode_mode decode_mode,\nfloat mode_cutoff,\nint max_refinement_iters,\n@@ -437,11 +440,8 @@ static void compress_symbolic_block_fixed_partition_1_plane(\n}\n// perform a final pass over the weights to try to improve them.\n- int adjustments = realign_weights(decode_mode,\n- bsd,\n- blk, ewb, scb,\n- u8_weight_src,\n- nullptr);\n+ int adjustments = realign_weights(\n+ image, decode_mode, bsd, blk, ewb, scb, u8_weight_src, nullptr);\nif (adjustments == 0)\nbreak;\n@@ -455,6 +455,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\n}\nstatic void compress_symbolic_block_fixed_partition_2_planes(\n+ const astc_codec_image* image,\nastc_decode_mode decode_mode,\nfloat mode_cutoff,\nint max_refinement_iters,\n@@ -728,11 +729,8 @@ static void compress_symbolic_block_fixed_partition_2_planes(\nscb->error_block = 1; // should never happen, but cannot prove it impossible\n}\n- int adjustments = realign_weights(decode_mode,\n- bsd,\n- blk, ewb, scb,\n- u8_weight1_src,\n- u8_weight2_src);\n+ int adjustments = realign_weights(\n+ image, decode_mode, bsd, blk, ewb, scb, u8_weight1_src, u8_weight2_src);\nif (adjustments == 0)\nbreak;\n@@ -1158,7 +1156,7 @@ float compress_symbolic_block(\n// detected a constant-color block. Encode as FP16 if using HDR\nscb->error_block = 0;\n- if (rgb_force_use_of_hdr)\n+ if (input_image->rgb_force_use_of_hdr)\n{\nscb->block_mode = -1;\nscb->partition_count = 0;\n@@ -1265,7 +1263,7 @@ float compress_symbolic_block(\nfloat best_errorval_in_mode;\nfor (i = 0; i < 2; i++)\n{\n- compress_symbolic_block_fixed_partition_1_plane(decode_mode, modecutoffs[i], ewp->max_refinement_iters, bsd, 1, // partition count\n+ compress_symbolic_block_fixed_partition_1_plane(input_image, decode_mode, modecutoffs[i], ewp->max_refinement_iters, bsd, 1, // partition count\n0, // partition index\nblk, ewb, tempblocks, tmpbuf->plane1);\n@@ -1274,7 +1272,7 @@ float compress_symbolic_block(\n{\nif (tempblocks[j].error_block)\ncontinue;\n- decompress_symbolic_block(decode_mode, bsd, xpos, ypos, zpos, tempblocks + j, temp);\n+ decompress_symbolic_block(input_image, decode_mode, bsd, xpos, ypos, zpos, tempblocks + j, temp);\nfloat errorval = compute_imageblock_difference(bsd, blk, temp, ewb) * errorval_mult[i];\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -1333,7 +1331,7 @@ float compress_symbolic_block(\nif (!uses_alpha && i == 3)\ncontinue;\n- compress_symbolic_block_fixed_partition_2_planes(decode_mode, mode_cutoff, ewp->max_refinement_iters,\n+ compress_symbolic_block_fixed_partition_2_planes(input_image, decode_mode, mode_cutoff, ewp->max_refinement_iters,\nbsd, 1, // partition count\n0, // partition index\ni, // the color component to test a separate plane of weights for.\n@@ -1344,7 +1342,7 @@ float compress_symbolic_block(\n{\nif (tempblocks[j].error_block)\ncontinue;\n- decompress_symbolic_block(decode_mode, bsd, xpos, ypos, zpos, tempblocks + j, temp);\n+ decompress_symbolic_block(input_image, decode_mode, bsd, xpos, ypos, zpos, tempblocks + j, temp);\nfloat errorval = compute_imageblock_difference(bsd, blk, temp, ewb);\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -1397,7 +1395,7 @@ float compress_symbolic_block(\nfor (i = 0; i < 2; i++)\n{\n- compress_symbolic_block_fixed_partition_1_plane(decode_mode, mode_cutoff, ewp->max_refinement_iters,\n+ compress_symbolic_block_fixed_partition_1_plane(input_image, decode_mode, mode_cutoff, ewp->max_refinement_iters,\nbsd, partition_count, partition_indices_1plane[i], blk, ewb, tempblocks, tmpbuf->plane1);\nbest_errorval_in_mode = 1e30f;\n@@ -1405,7 +1403,7 @@ float compress_symbolic_block(\n{\nif (tempblocks[j].error_block)\ncontinue;\n- decompress_symbolic_block(decode_mode, bsd, xpos, ypos, zpos, tempblocks + j, temp);\n+ decompress_symbolic_block(input_image, decode_mode, bsd, xpos, ypos, zpos, tempblocks + j, temp);\nfloat errorval = compute_imageblock_difference(bsd, blk, temp, ewb);\n#ifdef DEBUG_PRINT_DIAGNOSTICS\n@@ -1457,7 +1455,7 @@ float compress_symbolic_block(\n{\nif (lowest_correl > ewp->lowest_correlation_cutoff)\ncontinue;\n- compress_symbolic_block_fixed_partition_2_planes(decode_mode,\n+ compress_symbolic_block_fixed_partition_2_planes(input_image, decode_mode,\nmode_cutoff,\newp->max_refinement_iters,\nbsd,\n@@ -1470,7 +1468,7 @@ float compress_symbolic_block(\n{\nif (tempblocks[j].error_block)\ncontinue;\n- decompress_symbolic_block(decode_mode, bsd, xpos, ypos, zpos, tempblocks + j, temp);\n+ decompress_symbolic_block(input_image, decode_mode, bsd, xpos, ypos, zpos, tempblocks + j, temp);\nfloat errorval = compute_imageblock_difference(bsd, blk, temp, ewb);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_decompress_symbolic.cpp",
"new_path": "Source/astc_decompress_symbolic.cpp",
"diff": "@@ -88,6 +88,7 @@ static uint4 lerp_color_int(\n}\nvoid decompress_symbolic_block(\n+ const astc_codec_image* image,\nastc_decode_mode decode_mode,\nconst block_size_descriptor* bsd,\nint xpos,\n@@ -239,7 +240,9 @@ void decompress_symbolic_block(\nint nan_endpoint[4];\nfor (i = 0; i < partition_count; i++)\n- unpack_color_endpoints(decode_mode,\n+ {\n+ unpack_color_endpoints(image,\n+ decode_mode,\nscb->color_formats[i],\nscb->color_quantization_level,\nscb->color_values[i],\n@@ -248,6 +251,7 @@ void decompress_symbolic_block(\n&(nan_endpoint[i]),\n&(color_endpoint0[i]),\n&(color_endpoint1[i]));\n+ }\n// first unquantize the weights\nint uq_plane1_weights[MAX_WEIGHTS_PER_BLOCK];\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_image.cpp",
"new_path": "Source/astc_image.cpp",
"diff": "@@ -39,7 +39,10 @@ astc_codec_image *alloc_image(\nimg->input_averages = nullptr;\nimg->input_variances = nullptr;\nimg->input_alpha_averages = nullptr;\n+\nimg->linearize_srgb = 0;\n+ img->rgb_force_use_of_hdr = 0;\n+ img->alpha_force_use_of_hdr = 0;\nint exsize = xsize + 2 * padding;\nint eysize = ysize + 2 * padding;\n@@ -693,8 +696,8 @@ void fetch_imageblock(\nint alpha_lns = rgb_lns ? (max_alpha > 1.0f || max_alpha < 0.15f) : 0;\n// not yet though; for the time being, just obey the command line.\n- rgb_lns = rgb_force_use_of_hdr;\n- alpha_lns = alpha_force_use_of_hdr;\n+ rgb_lns = img->rgb_force_use_of_hdr;\n+ alpha_lns = img->alpha_force_use_of_hdr;\n// impose the choice on every pixel when encoding.\nfor (i = 0; i < pixelcount; i++)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_image_load_store.cpp",
"new_path": "Source/astc_image_load_store.cpp",
"diff": "@@ -1810,6 +1810,8 @@ astc_codec_image* astc_codec_load_image(\nint padding,\nint y_flip,\nint linearize_srgb,\n+ int rgb_force_use_of_hdr,\n+ int alpha_force_use_of_hdr,\nint* load_result\n) {\n// get hold of the filename ending\n@@ -1828,6 +1830,8 @@ astc_codec_image* astc_codec_load_image(\n{\nastc_codec_image* img = loader_descs[i].loader_func(input_filename, padding, y_flip, load_result);\nimg->linearize_srgb = linearize_srgb;\n+ img->rgb_force_use_of_hdr = rgb_force_use_of_hdr;\n+ img->alpha_force_use_of_hdr = alpha_force_use_of_hdr;\nreturn img;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "extern int block_mode_histogram[2048];\n#endif\n-int rgb_force_use_of_hdr = 0;\n-int alpha_force_use_of_hdr = 0;\n-\nstatic double start_time;\nstatic double end_time;\nstatic double start_coding_time;\n@@ -75,7 +72,9 @@ astc_codec_image *load_astc_file(\nint bitness,\nastc_decode_mode decode_mode,\nswizzlepattern swz_decode,\n- int linearize_srgb\n+ int linearize_srgb,\n+ int rgb_force_use_of_hdr,\n+ int alpha_force_use_of_hdr\n) {\nint x, y, z;\nFILE *f = fopen(filename, \"rb\");\n@@ -151,6 +150,8 @@ astc_codec_image *load_astc_file(\nastc_codec_image *img = alloc_image(bitness, xsize, ysize, zsize, 0);\nimg->linearize_srgb = linearize_srgb;\n+ img->rgb_force_use_of_hdr = rgb_force_use_of_hdr;\n+ img->alpha_force_use_of_hdr = alpha_force_use_of_hdr;\nblock_size_descriptor bsd;\ninit_block_size_descriptor(xdim, ydim, zdim, &bsd);\n@@ -167,7 +168,7 @@ astc_codec_image *load_astc_file(\nphysical_compressed_block pcb = *(physical_compressed_block *) bp;\nsymbolic_compressed_block scb;\nphysical_to_symbolic(&bsd, pcb, &scb);\n- decompress_symbolic_block(decode_mode, &bsd, x * xdim, y * ydim, z * zdim, &scb, &pb);\n+ decompress_symbolic_block(img, decode_mode, &bsd, x * xdim, y * ydim, z * zdim, &scb, &pb);\nwrite_imageblock(img, &pb, &bsd, x * xdim, y * ydim, z * zdim, swz_decode);\n}\n}\n@@ -260,7 +261,7 @@ static void encode_astc_image_threadfunc(\ncompress_symbolic_block(input_image, decode_mode, bsd, ewp, &pb, &scb, &temp_buffers);\nif (pack_and_unpack)\n{\n- decompress_symbolic_block(decode_mode, bsd, x * xdim, y * ydim, z * zdim, &scb, &pb);\n+ decompress_symbolic_block(input_image, decode_mode, bsd, x * xdim, y * ydim, z * zdim, &scb, &pb);\nwrite_imageblock(output_image, &pb, bsd, x * xdim, y * ydim, z * zdim, swz_decode);\n}\nelse\n@@ -421,14 +422,14 @@ static void compare_two_files(\nint linearize_srgb\n) {\nint load_result1;\n- astc_codec_image *img1 = astc_codec_load_image(filename1, 0, 0, linearize_srgb, &load_result1);\n+ astc_codec_image *img1 = astc_codec_load_image(filename1, 0, 0, linearize_srgb, 0, 0, &load_result1);\nif (load_result1 < 0)\n{\nexit(1);\n}\nint load_result2;\n- astc_codec_image *img2 = astc_codec_load_image(filename2, 0, 0, linearize_srgb, &load_result2);\n+ astc_codec_image *img2 = astc_codec_load_image(filename2, 0, 0, linearize_srgb, 0, 0, &load_result2);\nif (load_result2 < 0)\n{\nexit(1);\n@@ -439,9 +440,7 @@ static void compare_two_files(\nint comparison_components = MAX(file1_components, file2_components);\nint compare_hdr = 0;\n- if (load_result1 & 0x80)\n- compare_hdr = 1;\n- if (load_result2 & 0x80)\n+ if ((load_result1 & 0x80) || (load_result2 & 0x80))\ncompare_hdr = 1;\ncompute_error_metrics(compare_hdr, comparison_components, img1, img2, low_fstop, high_fstop);\n@@ -591,6 +590,8 @@ int astc_main(\nint silentmode = 0;\nint y_flip = 0;\nint linearize_srgb = 0;\n+ int rgb_force_use_of_hdr = 0;\n+ int alpha_force_use_of_hdr = 0;\nerror_weighting_params ewp;\n@@ -1372,7 +1373,10 @@ int astc_main(\n// 2D input data.\nif (array_size == 1)\n{\n- input_images[image_index] = astc_codec_load_image(input_filename, padding, y_flip, linearize_srgb, &load_results[image_index]);\n+ input_images[image_index] = astc_codec_load_image(\n+ input_filename, padding, y_flip, linearize_srgb,\n+ rgb_force_use_of_hdr, alpha_force_use_of_hdr,\n+ &load_results[image_index]);\n}\n// 3D input data - multiple 2D images.\nelse\n@@ -1389,7 +1393,10 @@ int astc_main(\n// Construct new file name and load: <name>_N.<extension>\nstrcpy(new_input_filename, input_filename);\nsprintf(strrchr(new_input_filename, '.'), \"_%d%s\", image_index, strrchr(input_filename, '.'));\n- input_images[image_index] = astc_codec_load_image(new_input_filename, padding, y_flip, linearize_srgb, &load_results[image_index]);\n+ input_images[image_index] = astc_codec_load_image\n+ (new_input_filename, padding, y_flip, linearize_srgb,\n+ rgb_force_use_of_hdr, alpha_force_use_of_hdr,\n+ &load_results[image_index]);\n// Check image is not 3D.\nif (input_images[image_index]->zsize != 1)\n@@ -1528,7 +1535,8 @@ int astc_main(\nif (op_mode == ASTC_DECODE)\n{\n- output_image = load_astc_file(input_filename, out_bitness, decode_mode, swz_decode, linearize_srgb);\n+ output_image = load_astc_file(input_filename, out_bitness, decode_mode, swz_decode,\n+ linearize_srgb, rgb_force_use_of_hdr, alpha_force_use_of_hdr);\n}\n// process image, if relevant\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Move rgb/alpha_force_use_of_hdr out of globals
|
61,745 |
24.03.2020 22:11:55
| 0 |
099e25cda8cf46cf5e0ec9b29ba20359f367e4b5
|
Add utility script to query image info
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "Test/astc_image_info.py",
"diff": "+#!/usr/bin/env python3\n+# SPDX-License-Identifier: Apache-2.0\n+# -----------------------------------------------------------------------------\n+# Copyright 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+Utility to show info about an image.\n+\"\"\"\n+\n+import argparse\n+from PIL import Image\n+import sys\n+\n+\n+def main_pipette(args):\n+ \"\"\"\n+ Main function for the \"pipette\" mode.\n+\n+ This mode prints the color at a pixel coordinate in the image, in a variety\n+ of color format (decimal, HTML string, float).\n+\n+ Returns:\n+ The process return code.\n+ \"\"\"\n+ retCode = 0\n+\n+ for i, image in enumerate(args.images):\n+ if i != 0:\n+ print(\"\")\n+\n+ img = Image.open(image.name)\n+ x = args.location[0]\n+ y = args.location[1]\n+\n+ print(image.name)\n+ print(\"=\" * len(image.name))\n+\n+ if (x >= img.size[0]) or (y >= img.size[1]):\n+ print(\"- ERROR: location out-of-bounds [%ux%u]\" % img.size)\n+ retCode = 1\n+ else:\n+ color = img.getpixel((x, y))\n+ # Print byte values\n+ print(\"+ Byte: %s\" % str(color))\n+\n+ # Print hex values\n+ fmtString = \"+ Hex: #\" + (\"%02X\" * len(color))\n+ print(fmtString % color)\n+\n+ # Print float values\n+ parts = [\"%g\"] * len(color)\n+ parts = \", \".join(parts)\n+ fmtString = \"+ Float: (\" + parts + \")\"\n+ print(fmtString % tuple(float(x)/255.0 for x in color))\n+\n+ return retCode\n+\n+\n+def main_info(args):\n+ \"\"\"\n+ Main function for the \"info\" mode.\n+\n+ This mode prints the basic metadata of an image:\n+\n+ - the overall image size.\n+ - the number of color channels.\n+ - the min/max value in each color channel.\n+\n+ Returns:\n+ The process return code.\n+ \"\"\"\n+ for i, image in enumerate(args.images):\n+ if i != 0:\n+ print(\"\")\n+\n+ img = Image.open(image.name)\n+ minmax = img.getextrema()\n+\n+ print(image.name)\n+ print(\"=\" * len(image.name))\n+ print(\"+ Size: %ux%u\" % (img.size[0], img.size[1]))\n+ print(\"+ Channels: %s\" % (\"\".join(img.getbands())))\n+ for j, channel in enumerate(img.getbands()):\n+ print(\" + %s: %u - %u\" % (channel, *minmax[j]))\n+\n+ return 0\n+\n+\n+def parse_loc(value):\n+ \"\"\"\n+ Command line argument parser for position arguments.\n+\n+ Args:\n+ value: The command line argument string to parse. Must be of the form\n+ \"<int>x<int>\", where both integers must be zero or positive.\n+\n+ Returns:\n+ The parsed value [int, int].\n+\n+ Raises:\n+ ArgumentTypeError: The value is not a valid location.\n+ \"\"\"\n+ error = argparse.ArgumentTypeError(\"%s is an invalid location\" % value)\n+ svalue = value.split(\"x\")\n+\n+ if len(svalue) != 2:\n+ raise error\n+\n+ try:\n+ ivalue = [int(x) for x in svalue if int(x) >= 0]\n+ except ValueError:\n+ raise error\n+\n+ if len(ivalue) != len(svalue):\n+ raise error\n+\n+ return ivalue\n+\n+\n+def parse_command_line():\n+ \"\"\"\n+ Parse the command line.\n+\n+ Returns:\n+ The parsed command line container.\n+ \"\"\"\n+ parser = argparse.ArgumentParser()\n+ subparsers = parser.add_subparsers(\n+ title=\"Operations\")\n+\n+ # Create the parser for the \"pipette\" command\n+ parser_a = subparsers.add_parser(\n+ \"pipette\",\n+ help=\"Print color at given coordinate\")\n+\n+ parser_a.set_defaults(func=main_pipette)\n+\n+ parser_a.add_argument(\n+ \"location\", metavar=\"loc\", type=parse_loc,\n+ help=\"The location spec XxY\")\n+\n+ parser_a.add_argument(\n+ \"images\", metavar=\"image\", nargs=\"+\", type=argparse.FileType(\"r\"),\n+ help=\"The images to query\")\n+\n+ # Create the parser for the \"size\" command\n+ parser_b = subparsers.add_parser(\n+ \"info\",\n+ help=\"Print image metadata info\")\n+\n+ parser_b.set_defaults(func=main_info)\n+\n+ parser_b.add_argument(\n+ \"images\", metavar=\"image\", nargs=\"+\", type=argparse.FileType(\"r\"),\n+ help=\"The images to query\")\n+\n+ # Cope with the user failing to specify any sub-command. Note on Python 3.8\n+ # we could use required=True on the add_subparsers call, but we cannot do\n+ # this on 3.6 which is our current min-spec.\n+ args = parser.parse_args()\n+ if not hasattr(args, \"func\"):\n+ parser.print_help()\n+ return None\n+\n+ return args\n+\n+\n+def main():\n+ \"\"\"\n+ The main function.\n+ \"\"\"\n+ args = parse_command_line()\n+ if args:\n+ return args.func(args)\n+\n+\n+if __name__ == \"__main__\":\n+ sys.exit(main())\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add utility script to query image info
|
61,745 |
25.03.2020 00:59:17
| 0 |
a73b63da4c1f0f8238928f6195489a1d4a5927c8
|
Standardize Return: -> Returns: in test script autodoc
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_run_image_tests.py",
"new_path": "Test/astc_run_image_tests.py",
"diff": "@@ -49,7 +49,7 @@ def is_3d(blockSize):\n\"\"\"\nIs a block size string for a 3D block?\n- Return:\n+ Returns:\nTrue if the block string is a 3D block size.\n\"\"\"\nreturn blockSize.count(\"x\") == 2\n@@ -84,7 +84,7 @@ def determine_result(image, reference, result):\nreference: The reference result to compare against.\nresult: The test result.\n- Return:\n+ Returns:\nA Result enum.\n\"\"\"\ndPSNR = result.psnr - reference.psnr\n@@ -109,7 +109,7 @@ def format_solo_result(image, result):\nimage: The image being tested.\nresult: The test result.\n- Return:\n+ Returns:\nThe metrics string.\n\"\"\"\n# pylint: disable=unused-argument\n@@ -131,7 +131,7 @@ def format_result(image, reference, result):\nreference: The reference result to compare against.\nresult: The test result.\n- Return:\n+ Returns:\nThe metrics string.\n\"\"\"\n# pylint: disable=unused-argument\n@@ -161,7 +161,7 @@ def run_test_set(encoder, testRef, testSet, blockSizes, testRuns):\nblockSizes: The block sizes to execute each test against.\ntestRuns: The number of test runs.\n- Return:\n+ Returns:\nThe result set.\n\"\"\"\nresultSet = trs.ResultSet(testSet.name)\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_size_binary.py",
"new_path": "Test/astc_size_binary.py",
"diff": "@@ -34,7 +34,7 @@ def run_size(binary):\nArgs:\nbinary: The path.\n- Return:\n+ Returns:\nA tuple of (code size, read-only data size, and zero-init data size).\n\"\"\"\nargs = [\"size\", \"--format=sysv\", binary]\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/encoder.py",
"new_path": "Test/testlib/encoder.py",
"diff": "@@ -69,7 +69,7 @@ class EncoderBase():\nblockSize: The block size to use.\npreset: The quality-performance preset to use.\n- Return:\n+ Returns:\nA list of command line arguments.\n\"\"\"\n# pylint: disable=unused-argument,no-self-use\n@@ -82,7 +82,7 @@ class EncoderBase():\nArgs:\ncommand: The list of command line arguments.\n- Return:\n+ Returns:\nThe output log (stdout) split into lines.\n\"\"\"\n# pylint: disable=no-self-use\n@@ -104,7 +104,7 @@ class EncoderBase():\nimage: The test image to compress.\noutput: The output log from the compression process.\n- Return:\n+ Returns:\nTuple: (PSNR, TotalTime, CodingTime)\n\"\"\"\n# Regex pattern for image quality\n@@ -146,7 +146,7 @@ class EncoderBase():\nArgs:\nimage: The test image we are compressing.\n- Return:\n+ Returns:\nThe string for a regex pattern.\n\"\"\"\n# pylint: disable=unused-argument,no-self-use\n@@ -156,7 +156,7 @@ class EncoderBase():\n\"\"\"\nGet the regex pattern to match the total compression time.\n- Return:\n+ Returns:\nThe string for a regex pattern.\n\"\"\"\n# pylint: disable=unused-argument,no-self-use\n@@ -166,7 +166,7 @@ class EncoderBase():\n\"\"\"\nGet the regex pattern to match the coding compression time.\n- Return:\n+ Returns:\nThe string for a regex pattern.\n\"\"\"\n# pylint: disable=unused-argument,no-self-use\n@@ -182,7 +182,7 @@ class EncoderBase():\npreset: The quality-performance preset to use.\ntestRuns: The number of test runs.\n- Return:\n+ Returns:\nReturns the best results from the N test runs.\nTuple: (bestPSNR, bestTotalTime, bestCodingTime)\n\"\"\"\n@@ -417,7 +417,7 @@ class EncoderISPC(EncoderBase):\nArgs:\ncommand: The list of command line arguments.\n- Return:\n+ Returns:\nThe output log (stdout) split into lines.\n\"\"\"\ncommand = \" \".join(command)\n@@ -446,7 +446,7 @@ class EncoderISPC(EncoderBase):\nusable image quality)\ntestRuns: The number of test runs.\n- Return:\n+ Returns:\nReturns the best results from the N test runs.\nTuple: (bestPSNR, bestTotalTime, bestCodingTime)\n\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/misc.py",
"new_path": "Test/testlib/misc.py",
"diff": "@@ -28,7 +28,7 @@ def path_splitall(path):\nArgs:\npath: The relative path to split.\n- Return:\n+ Returns:\nAn array of path parts.\n\"\"\"\n# Sanity check we have a relative path on Windows\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/resultset.py",
"new_path": "Test/testlib/resultset.py",
"diff": "@@ -86,7 +86,7 @@ class ResultSummary():\n\"\"\"\nGet the worst result in this set.\n- Return:\n+ Returns:\nThe worst Result value.\n\"\"\"\nif self.fails:\n@@ -187,7 +187,7 @@ class ResultSet():\nblkSz: The block size.\nname: The test name.\n- Return:\n+ Returns:\nThe result Record, if present.\nRaises:\n@@ -209,7 +209,7 @@ class ResultSet():\nArgs:\nother: The pattern result Record.\n- Return:\n+ Returns:\nThe result Record, if present.\nRaises:\n@@ -225,7 +225,7 @@ class ResultSet():\n\"\"\"\nGet a results summary of all the records in this result set.\n- Return:\n+ Returns:\nThe result summary.\n\"\"\"\nsummary = ResultSummary()\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Standardize Return: -> Returns: in test script autodoc
|
61,745 |
06.04.2020 22:25:42
| -3,600 |
77bd52e4f14161765981c9f30aabedf6c836b64f
|
Add missing block sizes to toplevel help
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel_help.cpp",
"new_path": "Source/astc_toplevel_help.cpp",
"diff": "@@ -119,15 +119,13 @@ COMPRESSION\nSupported 2D block sizes are:\n- 4x4: 8.00 bpp\n- 5x5: 5.12 bpp\n- 6x6: 3.56 bpp\n- 8x6: 2.67 bpp\n- 8x8: 2.00 bpp\n- 10x8: 1.60 bpp\n- 10x10: 1.28 bpp\n- 12x10: 1.07 bpp\n- 12x12: 0.89 bpp\n+ 4x4: 8.00 bpp 10x5: 2.56 bpp\n+ 5x4: 6.40 bpp 10x6: 2.13 bpp\n+ 5x5: 5.12 bpp 8x8: 2.00 bpp\n+ 6x5: 4.27 bpp 10x8: 1.60 bpp\n+ 6x6: 3.56 bpp 10x10: 1.28 bpp\n+ 8x5: 3.20 bpp 12x10: 1.07 bpp\n+ 8x6: 2.67 bpp 12x12: 0.89 bpp\nSupported 3D block sizes are:\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add missing block sizes to toplevel help
|
61,745 |
12.04.2020 22:50:42
| -3,600 |
e9b705884210f139761547e9db714f36671225de
|
Fix -partitionlimit CLI typo
Fix
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -1016,7 +1016,7 @@ int astc_main(\nbmc_user_specified = cutoff;\nbmc_set_by_user = 1;\n}\n- else if (!strcmp(argv[argidx], \"-partitionlimitt\"))\n+ else if (!strcmp(argv[argidx], \"-partitionlimit\"))\n{\nargidx += 2;\nif (argidx > argc)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix -partitionlimit CLI typo
Fix #101
|
61,745 |
13.04.2020 00:56:13
| -3,600 |
dae7517af1bc7949b723047313dfc396a9b40bf5
|
Handle unknown image types gracefully, un-skip test
Fix (partial) for
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_image_load_store.cpp",
"new_path": "Source/astc_image_load_store.cpp",
"diff": "@@ -1829,9 +1829,12 @@ astc_codec_image* astc_codec_load_image(\n|| strcmp(eptr, loader_descs[i].ending2) == 0)\n{\nastc_codec_image* img = loader_descs[i].loader_func(input_filename, padding, y_flip, load_result);\n+ if (img)\n+ {\nimg->linearize_srgb = linearize_srgb;\nimg->rgb_force_use_of_hdr = rgb_force_use_of_hdr;\nimg->alpha_force_use_of_hdr = alpha_force_use_of_hdr;\n+ }\nreturn img;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1490,7 +1490,6 @@ class CLINTest(CLITestBase):\nself.exec(command)\n- @unittest.skip(\"Bug #93\")\ndef test_tl_unknown_input(self):\n\"\"\"\nTest -tl with an unknown input file extension.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Handle unknown image types gracefully, un-skip test
Fix (partial) for #93
|
61,745 |
13.04.2020 01:08:11
| -3,600 |
598feffadb22926757f08a93bf4183e6d982db90
|
Handle missing input files (2D and sliced 3D)
Fix (partial) for # 93
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -1398,8 +1398,9 @@ int astc_main(\nrgb_force_use_of_hdr, alpha_force_use_of_hdr,\n&load_results[image_index]);\n- // Check image is not 3D.\n- if (input_images[image_index]->zsize != 1)\n+ // If image loaded correctly, check image is not 3D.\n+ if ((load_results[image_index] >= 0) &&\n+ (input_images[image_index]->zsize != 1))\n{\nprintf(\"3D source images not supported with -array option: %s\\n\", new_input_filename);\nreturn 1;\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1269,16 +1269,17 @@ class CLINTest(CLITestBase):\nresult = ex\nerror = True\n- # Emit debug logging if needed\n- badResult = error == expectPass\n+ rcode = result.returncode\n+\n+ # Emit debug logging if needed (negative rcode is a signal)\n+ badResult = (error == expectPass) or (rcode < 0)\n+\nif ASTCENC_CLI_ALWAYS or (badResult and ASTCENC_CLI_ON_ERROR_NEG):\nprint(\" \".join(command))\nif ASTCENC_LOG_ALWAYS or (badResult and ASTCENC_LOG_ON_ERROR_NEG):\nprint(result.stdout)\n- rcode = result.returncode\n-\n# If we expected a pass, then rcode == 0\nif expectPass:\nself.assertEqual(rcode, 0, \"Exec did not pass as expected\")\n@@ -1322,7 +1323,6 @@ class CLINTest(CLITestBase):\nexpectPass = omit == 0\nself.exec(testCommand, expectPass)\n- @unittest.skip(\"Bug #93\")\ndef test_cl_missing_input(self):\n\"\"\"\nTest -cl with a missing input file.\n@@ -1336,7 +1336,6 @@ class CLINTest(CLITestBase):\nself.exec(command)\n- @unittest.skip(\"Bug #93\")\ndef test_cl_missing_input_array_slice(self):\n\"\"\"\nTest -cl with a missing input file in an array slice.\n@@ -1350,7 +1349,6 @@ class CLINTest(CLITestBase):\nself.exec(command)\n- @unittest.skip(\"Bug #93\")\ndef test_cl_unknown_input(self):\n\"\"\"\nTest -cl with an unknown input file extension.\n@@ -1476,7 +1474,6 @@ class CLINTest(CLITestBase):\nexpectPass = omit == 0\nself.exec(testCommand, expectPass)\n- @unittest.skip(\"Bug #93\")\ndef test_tl_missing_input(self):\n\"\"\"\nTest -tl with a missing input file.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Handle missing input files (2D and sliced 3D)
Fix (partial) for # 93
|
61,745 |
13.04.2020 01:30:09
| -3,600 |
795971197ad112843cc77d8304c9dc3cbda73fe7
|
Cleanly handle missing input/output files
Fix (partial) for
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -584,8 +584,8 @@ int astc_main(\nint array_size = 1;\n- const char *input_filename = argv[2];\n- const char *output_filename = argv[3];\n+ const char *input_filename = argc >= 3 ? argv[2] : nullptr;\n+ const char *output_filename = argc >= 4 ? argv[3] : nullptr;\nint silentmode = 0;\nint y_flip = 0;\n@@ -1218,6 +1218,32 @@ int astc_main(\n}\n}\n+ if (!input_filename)\n+ {\n+ if (op_mode == ASTC_IMAGE_COMPARE)\n+ {\n+ printf(\"ERROR: Input file A not specified\\n\");\n+ }\n+ else\n+ {\n+ printf(\"ERROR: Input file not specified\\n\");\n+ }\n+ return 1;\n+ }\n+\n+ if (!output_filename)\n+ {\n+ if (op_mode == ASTC_IMAGE_COMPARE)\n+ {\n+ printf(\"ERROR: Input file B not specified\\n\");\n+ }\n+ else\n+ {\n+ printf(\"ERROR: Output file not specified\\n\");\n+ }\n+ return 1;\n+ }\n+\nif (op_mode == ASTC_IMAGE_COMPARE)\n{\ncompare_two_files(input_filename, output_filename, low_fstop, high_fstop, linearize_srgb);\n@@ -1230,7 +1256,6 @@ int astc_main(\nif (op_mode == ASTC_ENCODE || op_mode == ASTC_ENCODE_AND_DECODE)\n{\n// if encode, process the parsed command line values\n-\nif (preset_has_been_set != 1)\n{\nprintf(\"For encoding, need to specify exactly one performance-quality\\n\"\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1571,7 +1571,6 @@ class CLINTest(CLITestBase):\nself.exec(command)\n- @unittest.skip(\"Bug #93\")\ndef test_dl_missing_args(self):\n\"\"\"\nTest -dl with missing arguments.\n@@ -1595,13 +1594,27 @@ class CLINTest(CLITestBase):\nexpectPass = omit == 0\nself.exec(testCommand, expectPass)\n- @unittest.skip(\"Bug #93\")\n- def test_compare_no_args(self):\n+ def test_compare_missing(self):\n\"\"\"\n- Test -compare with no arguments.\n+ Test -compare with missing arguments.\n\"\"\"\n- command = [self.binary, \"-compare\"]\n- self.exec(command)\n+ command = [\n+ self.binary, \"-compare\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),]\n+\n+ # Run the command, incrementally omitting arguments\n+ commandLen = len(command)\n+ for subLen in range(2, commandLen + 1):\n+ omit = len(command) - subLen\n+ with self.subTest(omit=omit):\n+ testCommand = command[:subLen]\n+\n+ # For the last run we omit no arguments; make sure this works\n+ # to ensure that the underlying test is actually valid and\n+ # we're not failing for a different reason\n+ expectPass = omit == 0\n+ self.exec(testCommand, expectPass)\ndef main():\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Cleanly handle missing input/output files
Fix (partial) for #93
|
61,745 |
13.04.2020 01:41:27
| -3,600 |
229905629c350681eef517b5c3aa059e59afafc8
|
Cleanly handle missing output directories
Fix
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -357,7 +357,7 @@ static void store_astc_file(\nuint8_t *buffer = (uint8_t *) malloc(xblocks * yblocks * zblocks * 16);\nif (!buffer)\n{\n- printf(\"Ran out of memory\\n\");\n+ printf(\"ERROR: Ran out of memory\\n\");\nexit(1);\n}\n@@ -384,6 +384,11 @@ static void store_astc_file(\nhdr.zsize[2] = (zsize >> 16) & 0xFF;\nFILE *wf = fopen(filename, \"wb\");\n+ if (!wf)\n+ {\n+ printf(\"ERROR: Failed to write output image %s\\n\", filename);\n+ exit(1);\n+ }\nfwrite(&hdr, 1, sizeof(astc_header), wf);\nfwrite(buffer, 1, xblocks * yblocks * zblocks * 16, wf);\nfclose(wf);\n@@ -1588,7 +1593,7 @@ int astc_main(\nstore_result = astc_codec_store_image(output_image, output_filename, &format_string, y_flip);\nif (store_result < 0)\n{\n- printf(\"Failed to store image %s\\n\", output_filename);\n+ printf(\"ERROR: Failed to write output image %s\\n\", output_filename);\nreturn 1;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1362,7 +1362,6 @@ class CLINTest(CLITestBase):\nself.exec(command)\n- @unittest.skip(\"Bug #93\")\ndef test_cl_missing_output(self):\n\"\"\"\nTest -cl with a missing output directory.\n@@ -1500,7 +1499,6 @@ class CLINTest(CLITestBase):\nself.exec(command)\n- @unittest.skip(\"Bug #93\")\ndef test_tl_missing_output(self):\n\"\"\"\nTest -tl with a missing output directory.\n@@ -1594,6 +1592,18 @@ class CLINTest(CLITestBase):\nexpectPass = omit == 0\nself.exec(testCommand, expectPass)\n+ def test_dl_missing_output(self):\n+ \"\"\"\n+ Test -dl with a missing output directory.\n+ \"\"\"\n+ # Build an otherwise valid command with the test flaw\n+ command = [\n+ self.binary, \"-dl\",\n+ self.get_ref_image_path(\"LDR\", \"comp\", \"A\"),\n+ \"./DoesNotExist/test.png\"]\n+\n+ self.exec(command)\n+\ndef test_compare_missing(self):\n\"\"\"\nTest -compare with missing arguments.\n@@ -1601,7 +1611,7 @@ class CLINTest(CLITestBase):\ncommand = [\nself.binary, \"-compare\",\nself.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n- self.get_ref_image_path(\"LDR\", \"input\", \"A\"),]\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\")]\n# Run the command, incrementally omitting arguments\ncommandLen = len(command)\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Cleanly handle missing output directories
Fix #93
|
61,745 |
13.04.2020 02:16:35
| -3,600 |
b5366644f7254d9abd5d803d3f57a3acd6da9a1b
|
Clean up handling of block size argument decoding
Fix
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_codec_internals.h",
"new_path": "Source/astc_codec_internals.h",
"diff": "@@ -463,6 +463,25 @@ const float *get_2d_percentile_table(\nint xdim,\nint ydim);\n+/**\n+ * @brief Query if a 2D block size is legal.\n+ *\n+ * @return A non-zero value if legal, zero otherwise.\n+ */\n+int is_legal_2d_block_size(\n+ int xdim,\n+ int ydim);\n+\n+/**\n+ * @brief Query if a 3D block size is legal.\n+ *\n+ * @return A non-zero value if legal, zero otherwise.\n+ */\n+int is_legal_3d_block_size(\n+ int xdim,\n+ int ydim,\n+ int zdim);\n+\n// ***********************************************************\n// functions and data pertaining to quantization and encoding\n// **********************************************************\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_percentile_tables.cpp",
"new_path": "Source/astc_percentile_tables.cpp",
"diff": "@@ -1147,3 +1147,36 @@ const float *get_2d_percentile_table(\nreturn unpacked_table;\n}\n+\n+/* Public function, see header file for detailed documentation */\n+int is_legal_2d_block_size(\n+ int xdim,\n+ int ydim\n+) {\n+ return get_packed_table(xdim, ydim) != nullptr;\n+}\n+\n+/* Public function, see header file for detailed documentation */\n+int is_legal_3d_block_size(\n+ int xdim,\n+ int ydim,\n+ int zdim\n+) {\n+ int idx = (xdim << 16) | (ydim << 8) | zdim;\n+ switch (idx)\n+ {\n+ case 0x030303:\n+ case 0x040303:\n+ case 0x040403:\n+ case 0x040404:\n+ case 0x050404:\n+ case 0x050504:\n+ case 0x050505:\n+ case 0x060505:\n+ case 0x060605:\n+ case 0x060606:\n+ return 1;\n+ default:\n+ return 0;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel.cpp",
"new_path": "Source/astc_toplevel.cpp",
"diff": "@@ -707,54 +707,36 @@ int astc_main(\n{\nif (argc < 5)\n{\n- printf(\"Cannot encode without specifying blocksize\\n\");\n+ printf(\"ERROR: Block size not specified\\n\");\nreturn 1;\n}\n- int dimensions = sscanf(argv[4], \"%dx%dx%d\", &xdim_3d, &ydim_3d, &zdim_3d);\n+ int cnt2D, cnt3D;\n+ int dimensions = sscanf(argv[4], \"%dx%d%nx%d%n\", &xdim_3d, &ydim_3d, &cnt2D, &zdim_3d, &cnt3D);\nswitch (dimensions)\n{\ncase 0:\ncase 1:\n- // failed to parse the blocksize argument at all.\n- printf(\"Blocksize not specified\\n\");\n+ printf(\"ERROR: Invalid block size %s specified\\n\", argv[4]);\nreturn 1;\ncase 2:\n{\n- zdim_3d = 1;\n-\n- // Check 2D constraints\n- if (!(xdim_3d ==4 || xdim_3d == 5 || xdim_3d == 6 || xdim_3d == 8 || xdim_3d == 10 || xdim_3d == 12) ||\n- !(ydim_3d ==4 || ydim_3d == 5 || ydim_3d == 6 || ydim_3d == 8 || ydim_3d == 10 || ydim_3d == 12))\n+ // Character after the last match should be a NUL\n+ if (argv[4][cnt2D] || !is_legal_2d_block_size(xdim_3d, ydim_3d))\n{\n- printf(\"Block dimensions %d x %d unsupported\\n\", xdim_3d, ydim_3d);\n+ printf(\"ERROR: Invalid block size %s specified\\n\", argv[4]);\nreturn 1;\n}\n- int is_legal_2d = (xdim_3d==ydim_3d) || (xdim_3d==ydim_3d+1) || ((xdim_3d==ydim_3d+2) && !(xdim_3d==6 && ydim_3d==4)) ||\n- (xdim_3d==8 && ydim_3d==5) || (xdim_3d==10 && ydim_3d==5) || (xdim_3d==10 && ydim_3d==6);\n-\n- if (!is_legal_2d)\n- {\n- printf(\"Block dimensions %d x %d disallowed\\n\", xdim_3d, ydim_3d);\n- return 1;\n- }\n+ zdim_3d = 1;\n}\nbreak;\ndefault:\n{\n- // Check 3D constraints\n- if (xdim_3d < 3 || xdim_3d > 6 || ydim_3d < 3 || ydim_3d > 6 || zdim_3d < 3 || zdim_3d > 6)\n- {\n- printf(\"Block dimensions %d x %d x %d unsupported\\n\", xdim_3d, ydim_3d, zdim_3d);\n- return 1;\n- }\n-\n- int is_legal_3d = ((xdim_3d==ydim_3d)&&(ydim_3d==zdim_3d)) || ((xdim_3d==ydim_3d+1)&&(ydim_3d==zdim_3d)) || ((xdim_3d==ydim_3d)&&(ydim_3d==zdim_3d+1));\n-\n- if (!is_legal_3d)\n+ // Character after the last match should be a NUL\n+ if (argv[4][cnt3D]|| !is_legal_3d_block_size(xdim_3d, ydim_3d, zdim_3d))\n{\n- printf(\"Block dimensions %d x %d x %d disallowed\\n\", xdim_3d, ydim_3d, zdim_3d);\n+ printf(\"ERROR: Invalid block size %s specified\\n\", argv[4]);\nreturn 1;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1375,7 +1375,6 @@ class CLINTest(CLITestBase):\nself.exec(command)\n- @unittest.skip(\"Bug #99\")\ndef test_cl_bad_block_size(self):\n\"\"\"\nTest -cl with an invalid block size.\n@@ -1386,6 +1385,7 @@ class CLINTest(CLITestBase):\n\"4x4x4x4\", # Too many dimensions\n\"4x\", # Incomplete 2D block size\n\"4x4x\", # Incomplete 3D block size\n+ \"4x4x4x\", # Over-long 3D block size\n\"4xe\", # Illegal non-numeric character\n\"4x4e\" # Additional non-numeric character\n]\n@@ -1512,7 +1512,6 @@ class CLINTest(CLITestBase):\nself.exec(command)\n- @unittest.skip(\"Bug #99\")\ndef test_tl_bad_block_size(self):\n\"\"\"\nTest -tl with an invalid block size.\n@@ -1523,6 +1522,7 @@ class CLINTest(CLITestBase):\n\"4x4x4x4\", # Too many dimensions\n\"4x\", # Incomplete 2D block size\n\"4x4x\", # Incomplete 3D block size\n+ \"4x4x4x\", # Over-long 3D block size\n\"4xe\", # Illegal non-numeric character\n\"4x4e\" # Additional non-numeric character\n]\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Clean up handling of block size argument decoding
Fix #99
|
61,745 |
13.04.2020 02:24:40
| -3,600 |
aa8759093ad3e52c3e9e6e9beec5e060ee6aee8c
|
Update README for latest input/output formats
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -38,9 +38,13 @@ functionality or performance improvements should be expected.\n# Encoder feature support\n-The encoder supports compression of PNG, TGA and KTX input images into ASTC\n-format output images. The encoder supports decompression of ASTC input images\n-into TGA or KTX format output images.\n+The encoder supports compression of low dynamic range (BMP, JPEG, PNG, TGA) and\n+high dynamic range (EXR, HDR) images, as well as a subset of image data wrapped\n+in the DDS and KTX container formats, into ASTC format output images.\n+\n+The decoder supports decompression of ASTC format input images into low dynamic\n+range (BMP, PNG, TGA), high dynamic range (EXR), or DDS and KTX wrapped output\n+images.\nThe encoder allows control over the compression time/quality tradeoff with\n`exhaustive`, `thorough`, `medium`, and `fast` encoding quality presets.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update README for latest input/output formats
|
61,745 |
13.04.2020 02:28:42
| -3,600 |
b4c821204a4c0f27804caea3f410bda769e5fab9
|
Update README for latest help info
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -84,9 +84,9 @@ the astcenc encoder program, like this on Linux or macOS:\nastcenc\n-Invoking the tool with no arguments gives an extensive help message, including\n-usage instructions, and details of all the available command line options. A\n-summary of the main encoder options are shown below.\n+Invoking `astcenc -help` gives an extensive help message, including usage\n+instructions and details of all available command line options. A summary of\n+the main encoder options are shown below.\n## Compressing an image\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Update README for latest help info
|
61,745 |
19.04.2020 16:38:31
| -3,600 |
09ad573cb099857921bed73d2398a58d26b2e005
|
Add real support for building 2.0 reference
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_image.py",
"new_path": "Test/astc_test_image.py",
"diff": "@@ -246,17 +246,24 @@ def get_encoder_params(encoderName, imageSet):\nclass, the output data name, the output result directory, and the\nreference to use.\n\"\"\"\n- if encoderName == \"1.7\":\n+ if encoderName == \"ref-1.7\":\nencoder = te.Encoder1x()\nname = \"reference-1.7\"\noutDir = \"Test/Images/%s\" % imageSet\nrefName = None\n- elif encoderName == \"prototype\":\n+ if encoderName == \"ref-2.0\":\n+ # Note this option rebuilds a new reference test set using the\n+ # user's locally build encoder.\n+ encoder = te.Encoder2x(\"avx2\")\n+ name = \"reference-2.0-avx2\"\n+ outDir = \"Test/Images/%s\" % imageSet\n+ refName = None\n+ elif encoderName == \"ref-prototype\":\nencoder = te.EncoderProto()\nname = \"reference-prototype\"\noutDir = \"Test/Images/%s\" % imageSet\nrefName = None\n- elif encoderName == \"intelispc\":\n+ elif encoderName == \"ref-intelispc\":\nencoder = te.EncoderISPC()\nname = \"reference-intelispc\"\noutDir = \"Test/Images/%s\" % imageSet\n@@ -279,7 +286,7 @@ def parse_command_line():\n\"\"\"\nparser = argparse.ArgumentParser()\n- refcoders = [\"1.7\", \"prototype\", \"intelispc\"]\n+ refcoders = [\"ref-1.7\", \"ref-2.0\", \"ref-prototype\", \"ref-intelispc\"]\ntestcoders = [\"nointrin\", \"sse2\", \"sse4.2\", \"avx2\"]\ncoders = refcoders + testcoders + [\"all\"]\nparser.add_argument(\"--encoder\", dest=\"encoders\", default=\"avx2\",\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add real support for building 2.0 reference
|
61,745 |
19.04.2020 16:39:29
| -3,600 |
ecb97615918b38179b0f434295003d56c3aa74a0
|
Add new Small test for mask textures with new reference
|
[
{
"change_type": "MODIFY",
"old_path": "Test/Images/HDRIHaven/astc_reference-2.0-avx2_results.csv",
"new_path": "Test/Images/HDRIHaven/astc_reference-2.0-avx2_results.csv",
"diff": "Image Set,Block Size,Name,PSNR,Total Time,Coding Time\n-HDRIHaven,4x4,hdr-rgb-arboretum.hdr,45.49503,6.420,5.390\n-HDRIHaven,4x4,hdr-rgb-bellparkpier.hdr,56.18211,6.210,5.210\n-HDRIHaven,4x4,hdr-rgb-canarywharf.hdr,49.89927,6.120,5.120\n-HDRIHaven,4x4,hdr-rgb-eveningroad.hdr,52.33261,5.610,4.580\n-HDRIHaven,4x4,hdr-rgb-riverwalk.hdr,33.63952,6.550,5.520\n-HDRIHaven,5x5,hdr-rgb-arboretum.hdr,41.34702,6.440,5.400\n-HDRIHaven,5x5,hdr-rgb-bellparkpier.hdr,52.34750,6.130,5.150\n-HDRIHaven,5x5,hdr-rgb-canarywharf.hdr,46.24506,6.160,5.160\n-HDRIHaven,5x5,hdr-rgb-eveningroad.hdr,49.22413,5.640,4.580\n-HDRIHaven,5x5,hdr-rgb-riverwalk.hdr,29.73205,6.200,5.130\n-HDRIHaven,6x6,hdr-rgb-arboretum.hdr,37.73441,6.590,5.540\n-HDRIHaven,6x6,hdr-rgb-bellparkpier.hdr,49.41621,6.160,5.180\n-HDRIHaven,6x6,hdr-rgb-canarywharf.hdr,43.41487,6.230,5.220\n-HDRIHaven,6x6,hdr-rgb-eveningroad.hdr,46.77974,5.680,4.650\n-HDRIHaven,6x6,hdr-rgb-riverwalk.hdr,27.41270,6.110,5.050\n-HDRIHaven,8x8,hdr-rgb-arboretum.hdr,33.43174,6.500,5.460\n-HDRIHaven,8x8,hdr-rgb-bellparkpier.hdr,45.53648,6.090,5.100\n-HDRIHaven,8x8,hdr-rgb-canarywharf.hdr,39.81839,6.240,5.240\n-HDRIHaven,8x8,hdr-rgb-eveningroad.hdr,43.65009,5.790,4.780\n-HDRIHaven,8x8,hdr-rgb-riverwalk.hdr,24.58154,6.040,4.990\n-HDRIHaven,12x12,hdr-rgb-arboretum.hdr,29.89919,5.990,4.920\n-HDRIHaven,12x12,hdr-rgb-bellparkpier.hdr,41.22622,5.570,4.580\n-HDRIHaven,12x12,hdr-rgb-canarywharf.hdr,36.32984,5.700,4.710\n-HDRIHaven,12x12,hdr-rgb-eveningroad.hdr,40.77070,5.400,4.380\n-HDRIHaven,12x12,hdr-rgb-riverwalk.hdr,21.81902,5.930,4.880\n+HDRIHaven,4x4,hdr-rgb-arboretum.hdr,45.49503,5.810,4.810\n+HDRIHaven,4x4,hdr-rgb-bellparkpier.hdr,56.18211,5.590,4.600\n+HDRIHaven,4x4,hdr-rgb-canarywharf.hdr,49.89927,5.520,4.510\n+HDRIHaven,4x4,hdr-rgb-eveningroad.hdr,52.33261,5.080,4.060\n+HDRIHaven,4x4,hdr-rgb-riverwalk.hdr,33.63952,5.940,4.940\n+HDRIHaven,5x5,hdr-rgb-arboretum.hdr,41.34702,5.880,4.880\n+HDRIHaven,5x5,hdr-rgb-bellparkpier.hdr,52.34750,5.590,4.610\n+HDRIHaven,5x5,hdr-rgb-canarywharf.hdr,46.24506,5.630,4.620\n+HDRIHaven,5x5,hdr-rgb-eveningroad.hdr,49.22413,5.110,4.080\n+HDRIHaven,5x5,hdr-rgb-riverwalk.hdr,29.73205,5.590,4.570\n+HDRIHaven,6x6,hdr-rgb-arboretum.hdr,37.73441,6.030,5.000\n+HDRIHaven,6x6,hdr-rgb-bellparkpier.hdr,49.41621,5.640,4.650\n+HDRIHaven,6x6,hdr-rgb-canarywharf.hdr,43.41487,5.740,4.720\n+HDRIHaven,6x6,hdr-rgb-eveningroad.hdr,46.77974,5.260,4.220\n+HDRIHaven,6x6,hdr-rgb-riverwalk.hdr,27.41270,5.580,4.560\n+HDRIHaven,8x8,hdr-rgb-arboretum.hdr,33.43174,6.070,5.070\n+HDRIHaven,8x8,hdr-rgb-bellparkpier.hdr,45.53648,5.640,4.650\n+HDRIHaven,8x8,hdr-rgb-canarywharf.hdr,39.81839,5.790,4.790\n+HDRIHaven,8x8,hdr-rgb-eveningroad.hdr,43.65009,5.350,4.340\n+HDRIHaven,8x8,hdr-rgb-riverwalk.hdr,24.58154,5.710,4.690\n+HDRIHaven,12x12,hdr-rgb-arboretum.hdr,29.89919,5.550,4.520\n+HDRIHaven,12x12,hdr-rgb-bellparkpier.hdr,41.22622,5.240,4.240\n+HDRIHaven,12x12,hdr-rgb-canarywharf.hdr,36.32984,5.330,4.330\n+HDRIHaven,12x12,hdr-rgb-eveningroad.hdr,40.77070,5.060,4.050\n+HDRIHaven,12x12,hdr-rgb-riverwalk.hdr,21.81902,5.500,4.480\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Images/Khronos/astc_reference-2.0-avx2_results.csv",
"new_path": "Test/Images/Khronos/astc_reference-2.0-avx2_results.csv",
"diff": "Image Set,Block Size,Name,PSNR,Total Time,Coding Time\n-Khronos,4x4,ldr-l-occlusion.png,70.86035,0.460,0.380\n-Khronos,4x4,ldr-rgb-diffuse.png,54.77733,17.320,16.700\n-Khronos,4x4,ldr-rgb-emissive.png,60.85045,0.500,0.410\n-Khronos,4x4,ldr-rgb-metalrough.png,44.97128,5.430,5.230\n-Khronos,4x4,ldr-rgb-metalrough2.png,44.07510,31.540,30.790\n-Khronos,4x4,ldr-rgba-base.png,44.06403,6.840,6.630\n-Khronos,4x4,ldr-rgba-diffuse.png,44.44850,4.540,4.360\n-Khronos,4x4,ldr-rgba-specgloss.png,42.47283,9.490,9.240\n-Khronos,4x4,ldr-xy-normal1.png,48.48679,7.890,7.640\n-Khronos,4x4,ldr-xy-normal2.png,54.35627,17.800,17.090\n-Khronos,5x5,ldr-l-occlusion.png,58.71131,0.670,0.580\n-Khronos,5x5,ldr-rgb-diffuse.png,49.81100,10.310,9.700\n-Khronos,5x5,ldr-rgb-emissive.png,56.20314,0.520,0.430\n-Khronos,5x5,ldr-rgb-metalrough.png,40.50106,5.750,5.560\n-Khronos,5x5,ldr-rgb-metalrough2.png,39.54918,31.470,30.760\n-Khronos,5x5,ldr-rgba-base.png,39.80310,6.720,6.500\n-Khronos,5x5,ldr-rgba-diffuse.png,39.93856,4.480,4.300\n-Khronos,5x5,ldr-rgba-specgloss.png,39.05463,9.380,9.150\n-Khronos,5x5,ldr-xy-normal1.png,44.18346,8.780,8.540\n-Khronos,5x5,ldr-xy-normal2.png,49.31975,23.740,23.060\n-Khronos,6x6,ldr-l-occlusion.png,52.11003,1.070,0.990\n-Khronos,6x6,ldr-rgb-diffuse.png,45.75278,9.520,8.900\n-Khronos,6x6,ldr-rgb-emissive.png,52.73920,0.580,0.480\n-Khronos,6x6,ldr-rgb-metalrough.png,37.06972,6.380,6.200\n-Khronos,6x6,ldr-rgb-metalrough2.png,36.80112,33.500,32.810\n-Khronos,6x6,ldr-rgba-base.png,36.90713,8.250,8.040\n-Khronos,6x6,ldr-rgba-diffuse.png,36.72718,5.640,5.450\n-Khronos,6x6,ldr-rgba-specgloss.png,36.71283,9.470,9.240\n-Khronos,6x6,ldr-xy-normal1.png,41.33108,6.140,5.910\n-Khronos,6x6,ldr-xy-normal2.png,46.61175,17.020,16.340\n-Khronos,8x8,ldr-l-occlusion.png,45.97299,0.900,0.810\n-Khronos,8x8,ldr-rgb-diffuse.png,40.86687,8.730,8.150\n-Khronos,8x8,ldr-rgb-emissive.png,47.71896,0.520,0.420\n-Khronos,8x8,ldr-rgb-metalrough.png,32.87011,6.090,5.920\n-Khronos,8x8,ldr-rgb-metalrough2.png,33.62420,33.480,32.780\n-Khronos,8x8,ldr-rgba-base.png,33.32482,8.360,8.180\n-Khronos,8x8,ldr-rgba-diffuse.png,32.77119,6.390,6.220\n-Khronos,8x8,ldr-rgba-specgloss.png,33.69351,9.370,9.160\n-Khronos,8x8,ldr-xy-normal1.png,37.60663,3.330,3.110\n-Khronos,8x8,ldr-xy-normal2.png,42.76908,4.260,3.600\n-Khronos,12x12,ldr-l-occlusion.png,42.22431,0.450,0.360\n-Khronos,12x12,ldr-rgb-diffuse.png,36.55695,7.960,7.410\n-Khronos,12x12,ldr-rgb-emissive.png,42.49384,0.600,0.500\n-Khronos,12x12,ldr-rgb-metalrough.png,29.30859,5.740,5.570\n-Khronos,12x12,ldr-rgb-metalrough2.png,30.74511,29.790,29.120\n-Khronos,12x12,ldr-rgba-base.png,29.91806,6.570,6.380\n-Khronos,12x12,ldr-rgba-diffuse.png,29.24359,6.060,5.890\n-Khronos,12x12,ldr-rgba-specgloss.png,30.71173,8.400,8.190\n-Khronos,12x12,ldr-xy-normal1.png,33.73169,2.850,2.660\n-Khronos,12x12,ldr-xy-normal2.png,38.38530,3.610,3.030\n+Khronos,4x4,ldr-l-occlusion.png,70.86035,0.400,0.320\n+Khronos,4x4,ldr-rgb-diffuse.png,54.77733,15.250,14.700\n+Khronos,4x4,ldr-rgb-emissive.png,60.85045,0.440,0.360\n+Khronos,4x4,ldr-rgb-metalrough.png,44.97128,4.850,4.680\n+Khronos,4x4,ldr-rgb-metalrough2.png,44.07510,28.090,27.420\n+Khronos,4x4,ldr-rgba-base.png,44.06403,6.040,5.850\n+Khronos,4x4,ldr-rgba-diffuse.png,44.44850,3.990,3.820\n+Khronos,4x4,ldr-rgba-specgloss.png,42.47283,7.820,7.610\n+Khronos,4x4,ldr-xy-normal1.png,48.48679,6.570,6.350\n+Khronos,4x4,ldr-xy-normal2.png,54.35627,14.960,14.340\n+Khronos,5x5,ldr-l-occlusion.png,58.71131,0.600,0.520\n+Khronos,5x5,ldr-rgb-diffuse.png,49.81100,9.220,8.680\n+Khronos,5x5,ldr-rgb-emissive.png,56.20314,0.470,0.390\n+Khronos,5x5,ldr-rgb-metalrough.png,40.50106,5.210,5.040\n+Khronos,5x5,ldr-rgb-metalrough2.png,39.54918,28.460,27.810\n+Khronos,5x5,ldr-rgba-base.png,39.80310,6.020,5.830\n+Khronos,5x5,ldr-rgba-diffuse.png,39.93856,3.980,3.820\n+Khronos,5x5,ldr-rgba-specgloss.png,39.05463,7.990,7.780\n+Khronos,5x5,ldr-xy-normal1.png,44.18346,7.410,7.190\n+Khronos,5x5,ldr-xy-normal2.png,49.31975,20.220,19.610\n+Khronos,6x6,ldr-l-occlusion.png,52.11003,0.970,0.900\n+Khronos,6x6,ldr-rgb-diffuse.png,45.75278,8.660,8.120\n+Khronos,6x6,ldr-rgb-emissive.png,52.73920,0.530,0.450\n+Khronos,6x6,ldr-rgb-metalrough.png,37.06972,5.840,5.680\n+Khronos,6x6,ldr-rgb-metalrough2.png,36.80112,30.560,29.940\n+Khronos,6x6,ldr-rgba-base.png,36.90713,7.270,7.090\n+Khronos,6x6,ldr-rgba-diffuse.png,36.72718,5.080,4.920\n+Khronos,6x6,ldr-rgba-specgloss.png,36.71283,8.150,7.940\n+Khronos,6x6,ldr-xy-normal1.png,41.33108,5.200,4.980\n+Khronos,6x6,ldr-xy-normal2.png,46.61175,14.590,13.990\n+Khronos,8x8,ldr-l-occlusion.png,45.97299,0.830,0.760\n+Khronos,8x8,ldr-rgb-diffuse.png,40.86687,7.970,7.460\n+Khronos,8x8,ldr-rgb-emissive.png,47.71896,0.480,0.400\n+Khronos,8x8,ldr-rgb-metalrough.png,32.87011,5.600,5.430\n+Khronos,8x8,ldr-rgb-metalrough2.png,33.62420,30.940,30.330\n+Khronos,8x8,ldr-rgba-base.png,33.32482,7.630,7.470\n+Khronos,8x8,ldr-rgba-diffuse.png,32.77119,5.890,5.730\n+Khronos,8x8,ldr-rgba-specgloss.png,33.69351,8.200,8.010\n+Khronos,8x8,ldr-xy-normal1.png,37.60663,2.890,2.690\n+Khronos,8x8,ldr-xy-normal2.png,42.76908,3.750,3.180\n+Khronos,12x12,ldr-l-occlusion.png,42.22431,0.410,0.350\n+Khronos,12x12,ldr-rgb-diffuse.png,36.55695,7.310,6.820\n+Khronos,12x12,ldr-rgb-emissive.png,42.49384,0.550,0.470\n+Khronos,12x12,ldr-rgb-metalrough.png,29.30859,5.330,5.170\n+Khronos,12x12,ldr-rgb-metalrough2.png,30.74511,27.720,27.130\n+Khronos,12x12,ldr-rgba-base.png,29.91806,6.010,5.850\n+Khronos,12x12,ldr-rgba-diffuse.png,29.24359,5.540,5.390\n+Khronos,12x12,ldr-rgba-specgloss.png,30.71173,7.400,7.210\n+Khronos,12x12,ldr-xy-normal1.png,33.73169,2.500,2.330\n+Khronos,12x12,ldr-xy-normal2.png,38.38530,3.220,2.710\n"
},
{
"change_type": "ADD",
"old_path": "Test/Images/Small/LDR-RGB/ldr-rgb-10.png",
"new_path": "Test/Images/Small/LDR-RGB/ldr-rgb-10.png",
"diff": "Binary files /dev/null and b/Test/Images/Small/LDR-RGB/ldr-rgb-10.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/Images/Small/astc_reference-2.0-avx2_results.csv",
"new_path": "Test/Images/Small/astc_reference-2.0-avx2_results.csv",
"diff": "Image Set,Block Size,Name,PSNR,Total Time,Coding Time\n-Small,4x4,hdr-rgb-00.hdr,32.51980,0.650,0.530\n-Small,4x4,ldr-rgb-00.png,39.16128,0.560,0.540\n-Small,4x4,ldr-rgb-01.png,40.34345,0.510,0.490\n-Small,4x4,ldr-rgb-02.png,35.37958,0.470,0.450\n-Small,4x4,ldr-rgb-03.png,47.44658,0.580,0.560\n-Small,4x4,ldr-rgb-04.png,42.28133,0.470,0.450\n-Small,4x4,ldr-rgb-05.png,37.97282,0.500,0.480\n-Small,4x4,ldr-rgb-06.png,35.48148,0.440,0.420\n-Small,4x4,ldr-rgb-07.png,39.70443,0.610,0.590\n-Small,4x4,ldr-rgb-08.png,45.71284,0.560,0.550\n-Small,4x4,ldr-rgb-09.png,42.22100,0.490,0.470\n-Small,4x4,ldr-rgba-00.png,36.99093,0.600,0.580\n-Small,4x4,ldr-rgba-01.png,39.04210,0.570,0.550\n-Small,4x4,ldr-rgba-02.png,34.98959,0.680,0.660\n-Small,4x4,ldr-xy-00.png,34.06655,0.500,0.480\n-Small,4x4,ldr-xy-01.png,34.72375,0.580,0.560\n-Small,4x4,ldr-xy-02.png,54.19894,0.690,0.670\n-Small,4x4,ldrs-rgba-00.png,37.00035,0.610,0.590\n-Small,4x4,ldrs-rgba-01.png,39.06068,0.570,0.550\n-Small,4x4,ldrs-rgba-02.png,34.99314,0.680,0.660\n-Small,5x5,hdr-rgb-00.hdr,27.91247,0.620,0.500\n-Small,5x5,ldr-rgb-00.png,35.38063,0.560,0.540\n-Small,5x5,ldr-rgb-01.png,36.52744,0.520,0.500\n-Small,5x5,ldr-rgb-02.png,31.13320,0.480,0.450\n-Small,5x5,ldr-rgb-03.png,44.37351,0.550,0.530\n-Small,5x5,ldr-rgb-04.png,37.85562,0.460,0.440\n-Small,5x5,ldr-rgb-05.png,33.69565,0.520,0.500\n-Small,5x5,ldr-rgb-06.png,31.15185,0.460,0.440\n-Small,5x5,ldr-rgb-07.png,36.61978,0.620,0.600\n-Small,5x5,ldr-rgb-08.png,42.26076,0.540,0.520\n-Small,5x5,ldr-rgb-09.png,37.69809,0.490,0.470\n-Small,5x5,ldr-rgba-00.png,33.43193,0.620,0.600\n-Small,5x5,ldr-rgba-01.png,35.36130,0.580,0.560\n-Small,5x5,ldr-rgba-02.png,31.17562,0.760,0.740\n-Small,5x5,ldr-xy-00.png,33.86589,0.380,0.370\n-Small,5x5,ldr-xy-01.png,34.30785,0.640,0.620\n-Small,5x5,ldr-xy-02.png,51.14270,0.680,0.670\n-Small,5x5,ldrs-rgba-00.png,33.43441,0.620,0.610\n-Small,5x5,ldrs-rgba-01.png,35.36887,0.590,0.570\n-Small,5x5,ldrs-rgba-02.png,31.17582,0.770,0.750\n-Small,6x6,hdr-rgb-00.hdr,25.02750,0.600,0.490\n-Small,6x6,ldr-rgb-00.png,32.70132,0.660,0.650\n-Small,6x6,ldr-rgb-01.png,33.20237,0.670,0.650\n-Small,6x6,ldr-rgb-02.png,27.52939,0.690,0.670\n-Small,6x6,ldr-rgb-03.png,42.42157,0.380,0.370\n-Small,6x6,ldr-rgb-04.png,34.37072,0.670,0.650\n-Small,6x6,ldr-rgb-05.png,30.31159,0.680,0.660\n-Small,6x6,ldr-rgb-06.png,27.60149,0.700,0.680\n-Small,6x6,ldr-rgb-07.png,34.44531,0.680,0.660\n-Small,6x6,ldr-rgb-08.png,39.93280,0.390,0.380\n-Small,6x6,ldr-rgb-09.png,33.88719,0.640,0.630\n-Small,6x6,ldr-rgba-00.png,30.74792,0.690,0.670\n-Small,6x6,ldr-rgba-01.png,32.26000,0.600,0.580\n-Small,6x6,ldr-rgba-02.png,27.89976,0.810,0.790\n-Small,6x6,ldr-xy-00.png,33.50796,0.320,0.300\n-Small,6x6,ldr-xy-01.png,33.65717,0.530,0.520\n-Small,6x6,ldr-xy-02.png,48.55830,0.640,0.630\n-Small,6x6,ldrs-rgba-00.png,30.74985,0.690,0.670\n-Small,6x6,ldrs-rgba-01.png,32.26543,0.600,0.580\n-Small,6x6,ldrs-rgba-02.png,27.89876,0.810,0.790\n-Small,8x8,hdr-rgb-00.hdr,21.83303,0.580,0.460\n-Small,8x8,ldr-rgb-00.png,29.05559,0.660,0.650\n-Small,8x8,ldr-rgb-01.png,29.01750,0.650,0.630\n-Small,8x8,ldr-rgb-02.png,23.19101,0.720,0.700\n-Small,8x8,ldr-rgb-03.png,39.26658,0.150,0.140\n-Small,8x8,ldr-rgb-04.png,29.80378,0.640,0.630\n-Small,8x8,ldr-rgb-05.png,26.05900,0.710,0.690\n-Small,8x8,ldr-rgb-06.png,23.28154,0.710,0.700\n-Small,8x8,ldr-rgb-07.png,31.21111,0.660,0.640\n-Small,8x8,ldr-rgb-08.png,36.55424,0.280,0.260\n-Small,8x8,ldr-rgb-09.png,29.21611,0.540,0.520\n-Small,8x8,ldr-rgba-00.png,26.73176,0.690,0.680\n-Small,8x8,ldr-rgba-01.png,28.38860,0.580,0.560\n-Small,8x8,ldr-rgba-02.png,23.97378,0.770,0.750\n-Small,8x8,ldr-xy-00.png,32.41617,0.290,0.280\n-Small,8x8,ldr-xy-01.png,32.59702,0.300,0.280\n-Small,8x8,ldr-xy-02.png,44.84781,0.310,0.300\n-Small,8x8,ldrs-rgba-00.png,26.73313,0.700,0.680\n-Small,8x8,ldrs-rgba-01.png,28.39179,0.580,0.560\n-Small,8x8,ldrs-rgba-02.png,23.97317,0.780,0.760\n-Small,12x12,hdr-rgb-00.hdr,18.89035,0.570,0.460\n-Small,12x12,ldr-rgb-00.png,25.12907,0.690,0.670\n-Small,12x12,ldr-rgb-01.png,25.16467,0.640,0.620\n-Small,12x12,ldr-rgb-02.png,19.32186,0.740,0.720\n-Small,12x12,ldr-rgb-03.png,35.91156,0.150,0.130\n-Small,12x12,ldr-rgb-04.png,25.06225,0.640,0.620\n-Small,12x12,ldr-rgb-05.png,21.77635,0.720,0.700\n-Small,12x12,ldr-rgb-06.png,19.33846,0.730,0.720\n-Small,12x12,ldr-rgb-07.png,27.14738,0.670,0.650\n-Small,12x12,ldr-rgb-08.png,32.39691,0.250,0.230\n-Small,12x12,ldr-rgb-09.png,24.47497,0.570,0.550\n-Small,12x12,ldr-rgba-00.png,22.43041,0.700,0.680\n-Small,12x12,ldr-rgba-01.png,24.70312,0.530,0.510\n-Small,12x12,ldr-rgba-02.png,20.22269,0.600,0.580\n-Small,12x12,ldr-xy-00.png,29.90454,0.350,0.330\n-Small,12x12,ldr-xy-01.png,30.83627,0.250,0.240\n-Small,12x12,ldr-xy-02.png,39.64317,0.100,0.080\n-Small,12x12,ldrs-rgba-00.png,22.43383,0.700,0.680\n-Small,12x12,ldrs-rgba-01.png,24.70471,0.530,0.510\n-Small,12x12,ldrs-rgba-02.png,20.22275,0.600,0.590\n-Small,3x3x3,ldr-l-00-3.dds,52.50881,0.210,0.210\n-Small,3x3x3,ldr-l-01-3.dds,55.38258,0.090,0.090\n-Small,6x6x6,ldr-l-00-3.dds,33.28935,0.330,0.330\n-Small,6x6x6,ldr-l-01-3.dds,41.81136,0.080,0.070\n+Small,4x4,hdr-rgb-00.hdr,32.51980,0.590,0.480\n+Small,4x4,ldr-rgb-00.png,39.16128,0.500,0.480\n+Small,4x4,ldr-rgb-01.png,40.34345,0.460,0.440\n+Small,4x4,ldr-rgb-02.png,35.37958,0.420,0.400\n+Small,4x4,ldr-rgb-03.png,47.44658,0.520,0.510\n+Small,4x4,ldr-rgb-04.png,42.28133,0.410,0.390\n+Small,4x4,ldr-rgb-05.png,37.97282,0.450,0.430\n+Small,4x4,ldr-rgb-06.png,35.48148,0.400,0.380\n+Small,4x4,ldr-rgb-07.png,39.70443,0.550,0.530\n+Small,4x4,ldr-rgb-08.png,45.71284,0.520,0.500\n+Small,4x4,ldr-rgb-09.png,42.22100,0.440,0.420\n+Small,4x4,ldr-rgb-10.png,44.95143,0.080,0.080\n+Small,4x4,ldr-rgba-00.png,36.99093,0.530,0.510\n+Small,4x4,ldr-rgba-01.png,39.04210,0.470,0.450\n+Small,4x4,ldr-rgba-02.png,34.98959,0.580,0.560\n+Small,4x4,ldr-xy-00.png,34.06655,0.420,0.400\n+Small,4x4,ldr-xy-01.png,34.72375,0.480,0.470\n+Small,4x4,ldr-xy-02.png,54.19894,0.580,0.570\n+Small,4x4,ldrs-rgba-00.png,37.00035,0.520,0.510\n+Small,4x4,ldrs-rgba-01.png,39.06068,0.470,0.450\n+Small,4x4,ldrs-rgba-02.png,34.99314,0.580,0.560\n+Small,5x5,hdr-rgb-00.hdr,27.91247,0.570,0.460\n+Small,5x5,ldr-rgb-00.png,35.38063,0.520,0.500\n+Small,5x5,ldr-rgb-01.png,36.52744,0.470,0.460\n+Small,5x5,ldr-rgb-02.png,31.13320,0.440,0.420\n+Small,5x5,ldr-rgb-03.png,44.37351,0.500,0.480\n+Small,5x5,ldr-rgb-04.png,37.85562,0.420,0.410\n+Small,5x5,ldr-rgb-05.png,33.69565,0.480,0.460\n+Small,5x5,ldr-rgb-06.png,31.15185,0.420,0.400\n+Small,5x5,ldr-rgb-07.png,36.61978,0.560,0.540\n+Small,5x5,ldr-rgb-08.png,42.26076,0.500,0.480\n+Small,5x5,ldr-rgb-09.png,37.69809,0.450,0.430\n+Small,5x5,ldr-rgb-10.png,40.76587,0.090,0.090\n+Small,5x5,ldr-rgba-00.png,33.43193,0.550,0.530\n+Small,5x5,ldr-rgba-01.png,35.36130,0.490,0.470\n+Small,5x5,ldr-rgba-02.png,31.17562,0.660,0.640\n+Small,5x5,ldr-xy-00.png,33.86589,0.330,0.320\n+Small,5x5,ldr-xy-01.png,34.30785,0.550,0.530\n+Small,5x5,ldr-xy-02.png,51.14270,0.590,0.580\n+Small,5x5,ldrs-rgba-00.png,33.43441,0.550,0.530\n+Small,5x5,ldrs-rgba-01.png,35.36887,0.500,0.480\n+Small,5x5,ldrs-rgba-02.png,31.17582,0.660,0.640\n+Small,6x6,hdr-rgb-00.hdr,25.02750,0.560,0.450\n+Small,6x6,ldr-rgb-00.png,32.70132,0.600,0.590\n+Small,6x6,ldr-rgb-01.png,33.20237,0.610,0.590\n+Small,6x6,ldr-rgb-02.png,27.52939,0.640,0.620\n+Small,6x6,ldr-rgb-03.png,42.42157,0.360,0.340\n+Small,6x6,ldr-rgb-04.png,34.37072,0.610,0.590\n+Small,6x6,ldr-rgb-05.png,30.31159,0.630,0.610\n+Small,6x6,ldr-rgb-06.png,27.60149,0.640,0.620\n+Small,6x6,ldr-rgb-07.png,34.44531,0.620,0.600\n+Small,6x6,ldr-rgb-08.png,39.93280,0.360,0.340\n+Small,6x6,ldr-rgb-09.png,33.88719,0.600,0.580\n+Small,6x6,ldr-rgb-10.png,37.20181,0.100,0.100\n+Small,6x6,ldr-rgba-00.png,30.74792,0.600,0.580\n+Small,6x6,ldr-rgba-01.png,32.26000,0.510,0.490\n+Small,6x6,ldr-rgba-02.png,27.89976,0.700,0.680\n+Small,6x6,ldr-xy-00.png,33.50796,0.270,0.260\n+Small,6x6,ldr-xy-01.png,33.65717,0.460,0.450\n+Small,6x6,ldr-xy-02.png,48.55830,0.550,0.540\n+Small,6x6,ldrs-rgba-00.png,30.74985,0.610,0.590\n+Small,6x6,ldrs-rgba-01.png,32.26543,0.510,0.490\n+Small,6x6,ldrs-rgba-02.png,27.89876,0.710,0.690\n+Small,8x8,hdr-rgb-00.hdr,21.83303,0.550,0.440\n+Small,8x8,ldr-rgb-00.png,29.05559,0.610,0.600\n+Small,8x8,ldr-rgb-01.png,29.01750,0.590,0.570\n+Small,8x8,ldr-rgb-02.png,23.19101,0.660,0.640\n+Small,8x8,ldr-rgb-03.png,39.26658,0.150,0.130\n+Small,8x8,ldr-rgb-04.png,29.80378,0.590,0.570\n+Small,8x8,ldr-rgb-05.png,26.05900,0.660,0.640\n+Small,8x8,ldr-rgb-06.png,23.28154,0.660,0.640\n+Small,8x8,ldr-rgb-07.png,31.21111,0.610,0.600\n+Small,8x8,ldr-rgb-08.png,36.55424,0.260,0.240\n+Small,8x8,ldr-rgb-09.png,29.21611,0.500,0.480\n+Small,8x8,ldr-rgb-10.png,32.40118,0.110,0.110\n+Small,8x8,ldr-rgba-00.png,26.73176,0.620,0.610\n+Small,8x8,ldr-rgba-01.png,28.38860,0.500,0.480\n+Small,8x8,ldr-rgba-02.png,23.97378,0.680,0.660\n+Small,8x8,ldr-xy-00.png,32.41617,0.260,0.250\n+Small,8x8,ldr-xy-01.png,32.59702,0.260,0.250\n+Small,8x8,ldr-xy-02.png,44.84781,0.280,0.270\n+Small,8x8,ldrs-rgba-00.png,26.73313,0.630,0.610\n+Small,8x8,ldrs-rgba-01.png,28.39179,0.500,0.480\n+Small,8x8,ldrs-rgba-02.png,23.97317,0.680,0.660\n+Small,12x12,hdr-rgb-00.hdr,18.89035,0.540,0.430\n+Small,12x12,ldr-rgb-00.png,25.12907,0.640,0.630\n+Small,12x12,ldr-rgb-01.png,25.16467,0.590,0.580\n+Small,12x12,ldr-rgb-02.png,19.32186,0.680,0.670\n+Small,12x12,ldr-rgb-03.png,35.91156,0.140,0.130\n+Small,12x12,ldr-rgb-04.png,25.06225,0.590,0.580\n+Small,12x12,ldr-rgb-05.png,21.77635,0.670,0.660\n+Small,12x12,ldr-rgb-06.png,19.33846,0.680,0.670\n+Small,12x12,ldr-rgb-07.png,27.14738,0.630,0.610\n+Small,12x12,ldr-rgb-08.png,32.39691,0.230,0.220\n+Small,12x12,ldr-rgb-09.png,24.47497,0.530,0.520\n+Small,12x12,ldr-rgb-10.png,28.20585,0.120,0.120\n+Small,12x12,ldr-rgba-00.png,22.43041,0.620,0.610\n+Small,12x12,ldr-rgba-01.png,24.70312,0.460,0.440\n+Small,12x12,ldr-rgba-02.png,20.22269,0.540,0.520\n+Small,12x12,ldr-xy-00.png,29.90454,0.310,0.300\n+Small,12x12,ldr-xy-01.png,30.83627,0.230,0.220\n+Small,12x12,ldr-xy-02.png,39.64317,0.090,0.080\n+Small,12x12,ldrs-rgba-00.png,22.43383,0.630,0.620\n+Small,12x12,ldrs-rgba-01.png,24.70471,0.460,0.450\n+Small,12x12,ldrs-rgba-02.png,20.22275,0.540,0.520\n+Small,3x3x3,ldr-l-00-3.dds,52.50881,0.190,0.190\n+Small,3x3x3,ldr-l-01-3.dds,55.38258,0.080,0.080\n+Small,6x6x6,ldr-l-00-3.dds,33.28935,0.320,0.310\n+Small,6x6x6,ldr-l-01-3.dds,41.81136,0.070,0.070\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add new Small test for mask textures with new reference
|
61,745 |
19.04.2020 23:14:01
| -3,600 |
89889b50c316edcfc3d9ac705e0f432859e9a339
|
Add more CLI functional tests
* All CLI options now have at least some positive coverage
that the option is accepted and used.
* All CLI options that accept additonal arguments now have
full truncated command line negative test coverage.
* Tests for esw/dsw swizzle validity have been added.
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_toplevel_help.cpp",
"new_path": "Source/astc_toplevel_help.cpp",
"diff": "@@ -177,8 +177,8 @@ COMPRESSION\n-array <size>\nLoads an array of <size> 2D image slices to use as a 3D image.\n- The input filename given is used is decorated with\n- _<slice_index> to find the file to load. For example, an input\n+ The input filename given is used is decorated with the postfix\n+ \"_<slice>\" to find the file to load. For example, an input\nnamed \"input.png\" would load as input_0.png, input_1.png, etc.\nCOMPRESSION TIPS & TRICKS\n@@ -223,12 +223,12 @@ ADVANCED COMPRESSION\ncomputed.\nThe <mix> parameter is used to control the degree of mixing\n- between the color channels. Setting this parameter to 0 causes\n- the computation to be done completely separately for each color\n- channel; setting it to 1 causes the results from the RGB\n- channels to be combined and applied to all three together.\n- Intermediate values between these two extremes do a linear mix\n- of the two error values.\n+ of the average and stddev error components across the color\n+ channels. Setting this parameter to 0 causes the computation\n+ to be done completely separately for each color channel; setting\n+ it to 1 causes the results from the RGB channels to be combined\n+ and applied to all three together. Intermediate values between\n+ these two extremes do a linear mix of the two error values.\nThe <power> argument is a power used to raise the values of the\ninput pixels before computing average and standard deviation;\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -62,7 +62,9 @@ HDR images are an 8x8 image containing 4 4x4 constant color blocks. Assuming\nimport filecmp\nimport os\n+import re\nimport signal\n+import string\nimport subprocess as sp\nimport sys\nimport tempfile\n@@ -103,6 +105,8 @@ ASTCENC_TEST_PATTERN_HDR = {\n\"BR\": (0.25, 0.75, 0.00, 0.87)\n}\n+LDR_RGB_PSNR_PATTERN = re.compile(r\"PSNR \\(LDR-RGB\\): (.*) dB\")\n+\nclass CLITestBase(unittest.TestCase):\n\"\"\"\n@@ -457,7 +461,7 @@ class CLIPTest(CLITestBase):\ndeltaMax = chRef * threshold\nself.assertAlmostEqual(chRef, chNew, delta=deltaMax)\n- def exec(self, command):\n+ def exec(self, command, pattern=None):\n\"\"\"\nExecute a positive test.\n@@ -466,9 +470,13 @@ class CLIPTest(CLITestBase):\nArgs:\ncommand (list(str)): The command to execute.\n+ pattern (re.Pattern): The regex pattern to search for, must\n+ contain a single group (this is returned to the caller). The\n+ test will fail if no pattern match is found.\nReturns:\n- str: The stdout output of the child process.\n+ str: The stdout output of the child process, or the first group\n+ from the passed regex pattern.\n\"\"\"\ntry:\nresult = sp.run(command, stdout=sp.PIPE, stderr=sp.PIPE,\n@@ -495,6 +503,12 @@ class CLIPTest(CLITestBase):\nmsg = \"Exec died with application error %u\" % rcode\nself.assertEqual(rcode, 0, msg)\n+ # If there is a regex pattern provided, then search for it\n+ if pattern:\n+ match = pattern.search(result.stdout)\n+ self.assertIsNotNone(match)\n+ return match.group(1)\n+\nreturn result.stdout\ndef test_ldr_compress(self):\n@@ -786,6 +800,69 @@ class CLIPTest(CLITestBase):\ncolOut = tli.Image(imOut).get_colors((7, 7))\nself.assertColorSame(colIn, colOut)\n+ def test_compress_mask(self):\n+ \"\"\"\n+ Test compression of mask textures.\n+ \"\"\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ command = [\n+ self.binary, \"-tl\",\n+ \"./Test/Images/Small/LDR-RGB/ldr-rgb-10.png\",\n+ decompFile, \"4x4\", \"-exhaustive\"]\n+\n+ noMaskdB = float(self.exec(command, LDR_RGB_PSNR_PATTERN))\n+\n+ command.append(\"-mask\")\n+ maskdB = float(self.exec(command, LDR_RGB_PSNR_PATTERN))\n+\n+ # Note that this test simply asserts that the \"-mask\" is connected and\n+ # affects the output. We don't test it does something useful; that it\n+ # outside the scope of this test case.\n+ self.assertNotEqual(noMaskdB, maskdB)\n+\n+ def test_compress_normal_psnr(self):\n+ \"\"\"\n+ Test compression of normal textures using PSNR error metrics.\n+ \"\"\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ command = [\n+ self.binary, \"-tl\",\n+ \"./Test/Images/Small/LDR-XY/ldr-xy-00.png\",\n+ decompFile, \"5x5\", \"-exhaustive\"]\n+\n+ refdB = float(self.exec(command, LDR_RGB_PSNR_PATTERN))\n+\n+ command.append(\"-normal_psnr\")\n+ testdB = float(self.exec(command, LDR_RGB_PSNR_PATTERN))\n+\n+ # Note that this test simply asserts that the \"-normal_psnr\" is\n+ # connected and affects the output. We don't test it does something\n+ # useful; that it outside the scope of this test case.\n+ self.assertNotEqual(refdB, testdB)\n+\n+ def test_compress_normal_percep(self):\n+ \"\"\"\n+ Test compression of normal textures using perceptual error metrics.\n+ \"\"\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ command = [\n+ self.binary, \"-tl\",\n+ \"./Test/Images/Small/LDR-XY/ldr-xy-00.png\",\n+ decompFile, \"4x4\", \"-exhaustive\"]\n+\n+ refdB = float(self.exec(command, LDR_RGB_PSNR_PATTERN))\n+\n+ command.append(\"-normal_percep\")\n+ testdB = float(self.exec(command, LDR_RGB_PSNR_PATTERN))\n+\n+ # Note that this test simply asserts that the \"-normal_percep\" is\n+ # connected and affects the output. We don't test it does something\n+ # useful; that it outside the scope of this test case.\n+ self.assertNotEqual(refdB, testdB)\n+\ndef test_compress_esw(self):\n\"\"\"\nTest compression swizzles.\n@@ -1106,6 +1183,141 @@ class CLIPTest(CLITestBase):\n# RMSE should get worse (higher) if we reduce search space\nself.assertGreater(testRMSE, refRMSE)\n+ def test_deblock(self):\n+ \"\"\"\n+ Test deblock bias.\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\"]\n+\n+ self.exec(command)\n+ refRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ command += [\"-b\", \"1.8\"]\n+ self.exec(command)\n+ testRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ # RMSE should get worse (higher) if we force deblock\n+ self.assertGreater(testRMSE, refRMSE)\n+\n+ def test_low_level_control_v(self):\n+ \"\"\"\n+ Test low level control options.\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\"]\n+\n+ self.exec(command)\n+ refRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ # Test that explicit defaults match same as implicit defaults\n+ command2 = command + [\"-v\", \"0\", \"1\", \"1\", \"0\", \"0\", \"0\"]\n+ self.exec(command2)\n+ testRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+ self.assertEqual(testRMSE, refRMSE)\n+\n+ # Mutate the values to check they are worse than ref\n+ subtests = [\n+ (\"ref\", [\"-v\", \"2.5\", \"0.85\", \"0.25\", \"0.75\", \"25.0\", \"0.03\"]),\n+ (\"radius\", [\"-v\", \"3.5\", \"0.85\", \"0.25\", \"0.75\", \"25.0\", \"0.03\"]),\n+ (\"power\", [\"-v\", \"2.5\", \"1.85\", \"0.25\", \"0.75\", \"25.0\", \"0.03\"]),\n+ (\"base\", [\"-v\", \"2.5\", \"0.85\", \"0.05\", \"0.75\", \"25.0\", \"0.03\"]),\n+ (\"avg\", [\"-v\", \"2.5\", \"0.85\", \"0.25\", \"2.75\", \"25.0\", \"0.03\"]),\n+ (\"stdev\", [\"-v\", \"2.5\", \"0.85\", \"0.25\", \"0.75\", \"99.0\", \"0.03\"]),\n+ (\"mix\", [\"-v\", \"2.5\", \"0.85\", \"0.25\", \"0.75\", \"25.0\", \"1.03\"])\n+ ]\n+\n+ # Test that our mutations made it worse; note we manually chose values\n+ # that did for this test image - this is not guranteed for all images\n+ resultSet = set()\n+ for (name, params) in subtests:\n+ with self.subTest(param=name):\n+ testCommand = command + params\n+ self.exec(testCommand)\n+ testRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+ self.assertGreater(testRMSE, refRMSE)\n+ resultSet.add(testRMSE)\n+\n+ # Test that each mutation was \"differently\" worse; i.e. some new\n+ # error metric was used\n+ self.assertEqual(len(resultSet), len(subtests))\n+\n+ @unittest.skip(\"Issue #105\")\n+ def test_low_level_control_v_issue_105(self):\n+ \"\"\"\n+ Test low level control options.\n+\n+ Regression test for:\n+ * https://github.com/ARM-software/astc-encoder/issues/105\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\",\n+ \"-v\", \"0\", \"1\", \"2\", \"0\", \"0\", \"0\"]\n+\n+ # This should not segfault\n+ self.exec(command)\n+\n+ def test_low_level_control_va(self):\n+ \"\"\"\n+ Test low level control options.\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\",\n+ \"-v\", \"2.5\", \"0.85\", \"0.25\", \"0.75\", \"25.0\", \"0.03\"]\n+\n+ self.exec(command)\n+ refRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ # Test that explicit defaults match same as implicit defaults\n+ command2 = command + [\"-va\", \"1\", \"1\", \"0\", \"0\"]\n+ self.exec(command2)\n+ testRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+ self.assertEqual(testRMSE, refRMSE)\n+\n+ # Mutate the values to check they are worse than ref\n+ subtests = [\n+ (\"ref\", [\"-va\", \"2.8\", \"0.25\", \"0.75\", \"25.0\"]),\n+ (\"power\", [\"-va\", \"4.8\", \"0.25\", \"0.75\", \"25.0\"]),\n+ (\"base\", [\"-va\", \"2.8\", \"0.05\", \"0.75\", \"25.0\"]),\n+ (\"avg\", [\"-va\", \"2.8\", \"0.25\", \"2.75\", \"25.0\"]),\n+ (\"stdev\", [\"-va\", \"2.8\", \"0.25\", \"0.75\", \"99.0\"])\n+ ]\n+\n+ # Test that our mutations made it worse; note we manually chose values\n+ # that did for this test image - this is not guranteed for all images\n+ resultSet = set()\n+ for (name, params) in subtests:\n+ with self.subTest(param=name):\n+ testCommand = command + params\n+ self.exec(testCommand)\n+ testRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+ self.assertGreater(testRMSE, refRMSE)\n+ resultSet.add(testRMSE)\n+\n+ # Test that each mutation was \"differently\" worse; i.e. some new\n+ # error metric was used\n+ self.assertEqual(len(resultSet), len(subtests))\n+\n@unittest.skipIf(os.cpu_count() == 1, \"Cannot test on single core host\")\ndef test_thread_count(self):\n\"\"\"\n@@ -1228,6 +1440,27 @@ class CLIPTest(CLITestBase):\nself.assertColorSame(refColors[:3], srgbColors[:3], threshold=0.05)\nself.assertColorSame(refColors[3:], srgbColors[3:], threshold=0.0)\n+ def test_silent(self):\n+ \"\"\"\n+ Test silent\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\"]\n+ stdout = self.exec(command)\n+\n+ command += [\"-silent\"]\n+ stdoutSilent = self.exec(command)\n+\n+ # Check that stdout is shorter in silent mode. Note that this doesn't\n+ # check that it is as silent as it should be, just that silent is wired\n+ # somewhere ...\n+ self.assertLess(len(stdoutSilent), len(stdout))\n+\nclass CLINTest(CLITestBase):\n\"\"\"\n@@ -1299,6 +1532,29 @@ class CLINTest(CLITestBase):\nself.assertGreater(rcode, 0, \"Exec did not fail as expected\")\n+ def exec_with_omit(self, command, startOmit):\n+ \"\"\"\n+ Execute a negative test with command line argument omission.\n+\n+ These tests aim to prove that the command fails if arguments are\n+ missing. However the passed command MUST be a valid command which\n+ passes if no argument are omitted (this is checked, to ensure that\n+ the test case is a valid test).\n+\n+ Test will automatically fail if:\n+\n+ * A partial command doesn't fail.\n+ * The full command doesn't pass.\n+ \"\"\"\n+ # Run the command, incrementally omitting arguments\n+ commandLen = len(command)\n+ for subLen in range(startOmit, commandLen + 1):\n+ omit = len(command) - subLen\n+ with self.subTest(omit=omit):\n+ testCommand = command[:subLen]\n+ expectPass = omit == 0\n+ self.exec(testCommand, expectPass)\n+\ndef test_cl_missing_args(self):\n\"\"\"\nTest -cl with missing arguments.\n@@ -1310,18 +1566,7 @@ class CLINTest(CLITestBase):\nself.get_tmp_image_path(\"LDR\", \"comp\"),\n\"4x4\", \"-fast\"]\n- # Run the command, incrementally omitting arguments\n- commandLen = len(command)\n- for subLen in range(2, commandLen + 1):\n- omit = len(command) - subLen\n- with self.subTest(omit=omit):\n- testCommand = command[:subLen]\n-\n- # For the last run we omit no arguments; make sure this works\n- # to ensure that the underlying test is actually valid and\n- # we're not failing for a different reason\n- expectPass = omit == 0\n- self.exec(testCommand, expectPass)\n+ self.exec_with_omit(command, 2)\ndef test_cl_missing_input(self):\n\"\"\"\n@@ -1449,6 +1694,20 @@ class CLINTest(CLITestBase):\nself.exec(command)\n+ def test_cl_array_missing_args(self):\n+ \"\"\"\n+ Test -cl with a 2D block size and 3D input data.\n+ \"\"\"\n+ # Build an otherwise valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ \"./Test/Data/Tiles/ldr.png\",\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4x4\", \"-fast\", \"-array\", \"2\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\ndef test_tl_missing_args(self):\n\"\"\"\nTest -tl with missing arguments.\n@@ -1461,17 +1720,7 @@ class CLINTest(CLITestBase):\n\"4x4\", \"-fast\"]\n# Run the command, incrementally omitting arguments\n- commandLen = len(command)\n- for subLen in range(2, commandLen + 1):\n- omit = len(command) - subLen\n- with self.subTest(omit=omit):\n- testCommand = command[:subLen]\n-\n- # For the last run we omit no arguments; make sure this works\n- # to ensure that the underlying test is actually valid and\n- # we're not failing for a different reason\n- expectPass = omit == 0\n- self.exec(testCommand, expectPass)\n+ self.exec_with_omit(command, 2)\ndef test_tl_missing_input(self):\n\"\"\"\n@@ -1580,17 +1829,7 @@ class CLINTest(CLITestBase):\nself.get_tmp_image_path(\"LDR\", \"decomp\")]\n# Run the command, incrementally omitting arguments\n- commandLen = len(command)\n- for subLen in range(2, commandLen + 1):\n- omit = len(command) - subLen\n- with self.subTest(omit=omit):\n- testCommand = command[:subLen]\n-\n- # For the last run we omit no arguments; make sure this works\n- # to ensure that the underlying test is actually valid and\n- # we're not failing for a different reason\n- expectPass = omit == 0\n- self.exec(testCommand, expectPass)\n+ self.exec_with_omit(command, 2)\ndef test_dl_missing_output(self):\n\"\"\"\n@@ -1614,17 +1853,279 @@ class CLINTest(CLITestBase):\nself.get_ref_image_path(\"LDR\", \"input\", \"A\")]\n# Run the command, incrementally omitting arguments\n- commandLen = len(command)\n- for subLen in range(2, commandLen + 1):\n- omit = len(command) - subLen\n- with self.subTest(omit=omit):\n- testCommand = command[:subLen]\n+ self.exec_with_omit(command, 2)\n- # For the last run we omit no arguments; make sure this works\n- # to ensure that the underlying test is actually valid and\n- # we're not failing for a different reason\n- expectPass = omit == 0\n- self.exec(testCommand, expectPass)\n+ def test_cl_v_missing_args(self):\n+ \"\"\"\n+ Test -cl with -v and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-v\", \"3\", \"1.1\", \"0.8\", \"0.25\", \"0.5\", \"0.04\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_va_missing_args(self):\n+ \"\"\"\n+ Test -cl with -va and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-va\", \"1.1\", \"0.8\", \"0.25\", \"0.5\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_a_missing_args(self):\n+ \"\"\"\n+ Test -cl with -a and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-a\", \"2\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_cw_missing_args(self):\n+ \"\"\"\n+ Test -cl with -cw and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-cw\", \"0\", \"1\", \"2\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_b_missing_args(self):\n+ \"\"\"\n+ Test -cl with -b and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-b\", \"1.6\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_partitionlimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -partitionlimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-partitionlimit\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_blockmodelimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -blockmodelimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-blockmodelimit\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_refinementlimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -refinementlimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-refinementlimit\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_dblimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -dblimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-dblimit\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_partitionearlylimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -partitionearlylimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-partitionearlylimit\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_planecorlimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -planecorlimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-planecorlimit\", \"0.66\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_esw_missing_args(self):\n+ \"\"\"\n+ Test -cl with -esw and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-esw\", \"rgb1\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_esw_invalid_swizzle(self):\n+ \"\"\"\n+ Test -cl with -esw and invalid swizzles.\n+ \"\"\"\n+ badSwizzles = [\n+ \"\", # Short swizzles\n+ \"r\",\n+ \"rr\",\n+ \"rrr\",\n+ \"rrrrr\", # Long swizzles\n+ ]\n+\n+ # Create swizzles with all invalid printable ascii codes\n+ good = [\"r\", \"g\", \"b\", \"a\", \"0\", \"1\"]\n+ for channel in string.printable:\n+ if channel not in good:\n+ badSwizzles.append(channel * 4)\n+\n+ # Build a valid base command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-esw\", \"rgba\"]\n+\n+ blockIndex = command.index(\"rgba\")\n+ for badSwizzle in badSwizzles:\n+ with self.subTest(swizzle=badSwizzle):\n+ command[blockIndex] = badSwizzle\n+ self.exec(command)\n+\n+ def test_dl_dsw_missing_args(self):\n+ \"\"\"\n+ Test -dl with -dsw and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-dl\",\n+ self.get_ref_image_path(\"LDR\", \"comp\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"decomp\"),\n+ \"-dsw\", \"rgb1\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 5)\n+\n+ def test_dl_dsw_invalid_swizzle(self):\n+ \"\"\"\n+ Test -dl with -dsw and invalid swizzles.\n+ \"\"\"\n+ badSwizzles = [\n+ \"\", # Short swizzles\n+ \"r\",\n+ \"rr\",\n+ \"rrr\",\n+ \"rrrrr\", # Long swizzles\n+ ]\n+\n+ # Create swizzles with all invalid printable ascii codes\n+ good = [\"r\", \"g\", \"b\", \"a\", \"z\", \"0\", \"1\"]\n+ for channel in string.printable:\n+ if channel not in good:\n+ badSwizzles.append(channel * 4)\n+\n+ # Build a valid base command\n+ command = [\n+ self.binary, \"-dl\",\n+ self.get_ref_image_path(\"LDR\", \"comp\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"decomp\"),\n+ \"-dsw\", \"rgba\"]\n+\n+ blockIndex = command.index(\"rgba\")\n+ for badSwizzle in badSwizzles:\n+ with self.subTest(swizzle=badSwizzle):\n+ command[blockIndex] = badSwizzle\n+ self.exec(command)\n+\n+ def test_ch_mpsnr_missing_args(self):\n+ \"\"\"\n+ Test -ch with -mpsnr and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-ch\",\n+ self.get_ref_image_path(\"HDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"HDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-mpsnr\", \"-5\", \"5\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\ndef main():\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/image.py",
"new_path": "Test/testlib/image.py",
"diff": "@@ -212,14 +212,15 @@ class Image():\n\"\"\"\nassert profile in [None, \"ldr\", \"hdr\"]\n- if profile is None:\n- return fileFormat in cls.SUPPORTED_LDR or \\\n- fileFormat in cls.SUPPORTED_HDR\n- elif profile == \"ldr\":\n+ if profile == \"ldr\":\nreturn fileFormat in cls.SUPPORTED_LDR\n- else:\n+\n+ if profile == \"hdr\":\nreturn fileFormat in cls.SUPPORTED_HDR\n+ return fileFormat in cls.SUPPORTED_LDR or \\\n+ fileFormat in cls.SUPPORTED_HDR\n+\ndef __init__(self, filePath):\n\"\"\"\nConstruct a new Image.\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add more CLI functional tests
* All CLI options now have at least some positive coverage
that the option is accepted and used.
* All CLI options that accept additonal arguments now have
full truncated command line negative test coverage.
* Tests for esw/dsw swizzle validity have been added.
|
61,750 |
23.04.2020 17:51:44
| -3,600 |
1d45c8d298d86551b30382ceaf45104c39814c4c
|
Updates for CEPE Artifactory
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -168,8 +168,8 @@ pipeline {\nstage('Upload') {\nsteps {\nzip zipFile: 'astcenc.zip', dir: 'upload', archive: false\n- dsgArtifactoryUpload('*.zip')\n- dsgArtifactoryPromote()\n+ cepeArtifactoryUpload('*.zip')\n+ cepeArtifactoryPromote()\n}\n}\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
QE-1831: Updates for CEPE Artifactory (#107)
|
61,750 |
24.04.2020 10:17:58
| -3,600 |
d269d9851eee4ef1354056fb93af328c5780503c
|
Update Mac path
|
[
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -126,7 +126,7 @@ pipeline {\nstage('Test') {\nsteps {\nsh '''\n- export PATH=$PATH:/usr/local/bin\n+ export PATH=/usr/local/bin:$PATH\npython3 ./Test/astc_test_image.py --test-set Small --encoder=sse2\n'''\n//perfReport(sourceDataFiles:'TestOutput/results.xml')\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
QE-1543: Update Mac path (#108)
|
61,745 |
24.04.2020 10:59:55
| -3,600 |
f7d12b45ca9348b4580f471af9490f7e836e1daa
|
Test all VEC variants
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_image.py",
"new_path": "Test/astc_test_image.py",
"diff": "@@ -53,10 +53,11 @@ if COMPARE_WITH_1_7:\nRESULT_REF_NAME = \"reference-1.7\"\nelse:\nRESULT_THRESHOLD_WARN = -0.01\n- RESULT_THRESHOLD_FAIL = -0.02\n+ RESULT_THRESHOLD_FAIL = -0.05\nRESULT_THRESHOLD_3D_FAIL = -0.02\nRESULT_REF_NAME = \"reference-2.0-avx2\"\n+\nTEST_BLOCK_SIZES = [\"4x4\", \"5x5\", \"6x6\", \"8x8\", \"12x12\",\n\"3x3x3\", \"6x6x6\"]\n"
},
{
"change_type": "MODIFY",
"old_path": "jenkins/build.Jenkinsfile",
"new_path": "jenkins/build.Jenkinsfile",
"diff": "@@ -32,6 +32,9 @@ pipeline {\nsh '''\ncd ./Source/\nmake CXX=clang++ VEC=avx2\n+ make CXX=clang++ VEC=sse4.2\n+ make CXX=clang++ VEC=sse2\n+ make CXX=clang++ VEC=nointrin\n'''\n}\n}\n@@ -44,7 +47,7 @@ pipeline {\n}\nstage('Test') {\nsteps {\n- sh 'python3 ./Test/astc_test_image.py --test-set Small'\n+ sh 'python3 ./Test/astc_test_image.py --encoder=all --test-set Small'\n//perfReport(sourceDataFiles:'TestOutput/results.xml')\n//junit(testResults: 'TestOutput/results.xml')\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Test all VEC variants
|
61,745 |
24.04.2020 23:17:53
| -3,600 |
9bbae09d6274bbbafbc23e008ee0e867a7778d98
|
Allow the test runner to select a single image from a test set
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_image.py",
"new_path": "Test/astc_test_image.py",
"diff": "@@ -318,6 +318,9 @@ def parse_command_line():\nparser.add_argument(\"--test-set\", dest=\"testSets\", default=\"Small\",\nchoices=testSets, help=\"test image test set\")\n+ parser.add_argument(\"--test-image\", dest=\"testImage\", default=None,\n+ help=\"select a specific test image from the test set\")\n+\nparser.add_argument(\"--repeats\", dest=\"testRepeats\", default=1,\ntype=int, help=\"test iteration count\")\n@@ -371,7 +374,7 @@ def main():\ntestSetCount += 1\ntestSet = tts.TestSet(imageSet, testDir,\n- args.profiles, args.formats)\n+ args.profiles, args.formats, args.testImage)\nresultSet = run_test_set(encoder, testRef, testSet,\nargs.blockSizes, args.testRepeats)\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/testset.py",
"new_path": "Test/testlib/testset.py",
"diff": "@@ -47,7 +47,7 @@ class TestSet():\ntests: The list of TestImages forming the set.\n\"\"\"\n- def __init__(self, name, rootDir, profiles, formats):\n+ def __init__(self, name, rootDir, profiles, formats, imageFilter=None):\n\"\"\"\nCreate a new TestSet through reflection.\n@@ -56,6 +56,7 @@ class TestSet():\nrootDir (str): The root directory of the test set.\nprofiles (list(str)): The ASTC profiles to allow.\nformats (list(str)): The image formats to allow.\n+ imageFilter (str): The name of the image to include (for bug repo).\nRaises:\nTSetException: The specified TestSet could not be loaded.\n@@ -85,6 +86,9 @@ class TestSet():\nif image.colorFormat not in formats:\ncontinue\n+ if imageFilter and image.testFile != imageFilter:\n+ continue\n+\nself.tests.append((filePath, image))\n# Sort the TestImages so they are in a stable order\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Allow the test runner to select a single image from a test set
|
61,745 |
25.04.2020 00:03:54
| -3,600 |
0b0dd0b4c4ae175e7eff5ddaa1a4051102ab65cb
|
Remove type conversion in lerp_color_int
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_decompress_symbolic.cpp",
"new_path": "Source/astc_decompress_symbolic.cpp",
"diff": "@@ -46,45 +46,29 @@ static uint4 lerp_color_int(\nint plane2_weight,\nint plane2_color_component // -1 in 1-plane mode\n) {\n- int4 ecolor0 = int4(color0.x, color0.y, color0.z, color0.w);\n- int4 ecolor1 = int4(color1.x, color1.y, color1.z, color1.w);\n+ uint4 weight1 = uint4(\n+ plane2_color_component == 0 ? plane2_weight : weight,\n+ plane2_color_component == 1 ? plane2_weight : weight,\n+ plane2_color_component == 2 ? plane2_weight : weight,\n+ plane2_color_component == 3 ? plane2_weight : weight);\n- int4 eweight1 = int4(weight, weight, weight, weight);\n- switch (plane2_color_component)\n- {\n- case 0:\n- eweight1.x = plane2_weight;\n- break;\n- case 1:\n- eweight1.y = plane2_weight;\n- break;\n- case 2:\n- eweight1.z = plane2_weight;\n- break;\n- case 3:\n- eweight1.w = plane2_weight;\n- break;\n- default:\n- break;\n- }\n-\n- int4 eweight0 = int4(64, 64, 64, 64) - eweight1;\n+ uint4 weight0 = uint4(64, 64, 64, 64) - weight1;\nif (decode_mode == DECODE_LDR_SRGB)\n{\n- ecolor0 = int4(ecolor0.x >> 8, ecolor0.y >> 8, ecolor0.z >> 8, ecolor0.w >> 8);\n- ecolor1 = int4(ecolor1.x >> 8, ecolor1.y >> 8, ecolor1.z >> 8, ecolor1.w >> 8);\n+ color0 = uint4(color0.x >> 8, color0.y >> 8, color0.z >> 8, color0.w >> 8);\n+ color1 = uint4(color1.x >> 8, color1.y >> 8, color1.z >> 8, color1.w >> 8);\n}\n- int4 color = (ecolor0 * eweight0) + (ecolor1 * eweight1) + int4(32, 32, 32, 32);\n- color = int4(color.x >> 6, color.y >> 6, color.z >> 6, color.w >> 6);\n+ uint4 color = (color0 * weight0) + (color1 * weight1) + uint4(32, 32, 32, 32);\n+ color = uint4(color.x >> 6, color.y >> 6, color.z >> 6, color.w >> 6);\nif (decode_mode == DECODE_LDR_SRGB)\n{\ncolor = color * 257;\n}\n- return uint4(color.x, color.y, color.z, color.w);\n+ return color;\n}\nvoid decompress_symbolic_block(\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove type conversion in lerp_color_int
|
61,745 |
25.04.2020 00:28:02
| -3,600 |
681ab52a26a5421103fa082052d7469ae3151ac2
|
Fix ref-1.7 encoder test support
|
[
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_image.py",
"new_path": "Test/astc_test_image.py",
"diff": "@@ -252,7 +252,7 @@ def get_encoder_params(encoderName, imageSet):\nname = \"reference-1.7\"\noutDir = \"Test/Images/%s\" % imageSet\nrefName = None\n- if encoderName == \"ref-2.0\":\n+ elif encoderName == \"ref-2.0\":\n# Note this option rebuilds a new reference test set using the\n# user's locally build encoder.\nencoder = te.Encoder2x(\"avx2\")\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix ref-1.7 encoder test support
|
61,745 |
25.04.2020 00:37:25
| -3,600 |
4838a8a26088f33354b65d0b32451014ad1401eb
|
Fix support for ref-prototype test runs
|
[
{
"change_type": "MODIFY",
"old_path": "Test/testlib/encoder.py",
"new_path": "Test/testlib/encoder.py",
"diff": "@@ -303,8 +303,9 @@ class Encoder1x(EncoderBase):\n\"hdr\": \".htga\"\n}\n- def __init__(self):\n+ def __init__(self, binary=None):\nname = \"astcenc-%s\" % self.VERSION\n+ if not binary:\nif os.name == 'nt':\nbinary = \"./Binaries/1.7/astcenc.exe\"\nelse:\n@@ -377,7 +378,7 @@ class EncoderProto(Encoder1x):\nname = \"astcenc-%s\" % self.VERSION\nassert os.name != 'nt', \"Windows builds not available\"\nbinary = \"./Binaries/Prototype/astcenc\"\n- super().__init__(name, None, binary)\n+ super().__init__(binary)\nclass EncoderISPC(EncoderBase):\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix support for ref-prototype test runs
|
61,745 |
09.05.2020 14:48:08
| -3,600 |
eb45d3454824a49149aa837923e548b5786ff855
|
Clarify 3D feature profile support in overview
|
[
{
"change_type": "MODIFY",
"old_path": "Docs/FormatOverview.md",
"new_path": "Docs/FormatOverview.md",
"diff": "@@ -400,38 +400,57 @@ bit rates:\nAvailability\n============\n-The ASTC functionality is specified as a set of three feature profiles:\n-\n-* 2D LDR profile\n-* 2D LDR + HDR profile\n-* 2D LDR + HDR and 3D LDR + HDR profile\n-\n-The 2D LDR profile is mandatory in OpenGL ES 3.2, and a standardized optional\n+The ASTC functionality is specified as a set of feature profiles, allowing\n+GPU hardware manufacturers to select which parts of the standard they\n+implement. There are four commonly seen profiles:\n+\n+* \"LDR\":\n+ * 2D blocks.\n+ * LDR and sRGB color space.\n+ * [KHR_texture_compression_astc_ldr][astc_ldr]: KHR OpenGL ES extension.\n+* \"LDR + Sliced 3D\":\n+ * 2D blocks and sliced 3D blocks.\n+ * LDR and sRGB color space.\n+ * [KHR_texture_compression_astc_sliced_3d][astc_3d]: KHR OpenGL ES extension.\n+* \"HDR\":\n+ * 2D and sliced 3D blocks.\n+ * LDR, sRGB, and HDR color spaces.\n+ * [KHR_texture_compression_astc_hdr][astc_ldr]: KHR OpenGL ES extension.\n+* \"Full\":\n+ * 2D, sliced 3D, and volumetric 3D blocks.\n+ * LDR, sRGB, and HDR color spaces.\n+ * [OES_texture_compression_astc][astc_full]: OES OpenGL ES extension.\n+\n+The LDR profile is mandatory in OpenGL ES 3.2 and a standardized optional\nfeature for Vulkan, and therefore widely supported on contemporary mobile\ndevices. The 2D HDR profile is not mandatory, but is widely supported.\n+3D texturing\n+------------\n-Khronos extensions\n-------------------\n-\n-Official Khronos extensions exist for the feature profiles of ASTC:\n+The APIs expose 3D textures in two flavors.\n-* [KHR_texture_compression_astc_ldr][astc_ldr]: 2D LDR support\n-* [KHR_texture_compression_astc_sliced_3d][astc_3d]: 2D + 3D LDR support\n-* [KHR_texture_compression_astc_hdr][astc_ldr]: 2D + 3D, LDR + HDR support\n+The sliced 3D texture support builds a 3D texture from an array of 2D image\n+slices that have each been individually compressed using 2D ASTC compression.\n+This is required for the HDR profile, so is also widely supported.\n-A convenience extension which provides the full feature set implied by\n-supporting all three KHR extensions also exists.\n+The volumetric 3D texture support uses the native 3D block sizes provided by\n+ASTC to implement true volumetric compression. This enables a wider choice of\n+low bitrate options than the 2D blocks, which is particularly important for 3D\n+textures of any non-trivial size. Volumetric formats are not widely supported,\n+but are supported on all of the Arm Mali GPUs that support ASTC.\n-* [OES_texture_compression_astc][astc_full]: 2D + 3D, LDR + HDR support\n+ASTC decode mode\n+----------------\nASTC is specified to decompress texels into fp16 intermediate values, except\nfor sRGB which always decompresses into 8-bit UNORM intermediates. For many use\n-cases this gives more dynamic range and precision than required, and can cause\n-a reduction in texturing efficiency due to the larger data size.\n+cases this gives more dynamic range and precision than required. This can cause\n+a reduction in both texture cache efficiency and texture filtering performance\n+due to the larger decompressed data size.\n-A pair of extensions exist, and are supported on recent mobile GPUs, which\n-allow applications to reduce the intermediate precision to either UNORM8\n+A pair of extensions exist, and are widely supported on recent mobile GPUs,\n+which allow applications to reduce the intermediate precision to either UNORM8\n(recommended for LDR textures) or RGB9e5 (recommended for HDR textures).\n* [OES_texture_compression_astc_decode_mode][astc_decode]: Allow UNORM8\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Clarify 3D feature profile support in overview
|
61,745 |
25.05.2020 22:52:35
| -3,600 |
cb04cd6f818968ca73b1c9e63ed2307f6470ba88
|
Fix null dereference with -v option
Bug only occurs if base weight is not one and
mean/stdev are both zero.
Fix
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astc_compress_symbolic.cpp",
"new_path": "Source/astc_compress_symbolic.cpp",
"diff": "@@ -790,7 +790,6 @@ static float prepare_error_weight_block(\nint idx = 0;\nint any_mean_stdev_weight =\n- ewp->rgb_base_weight != 1.0f || ewp->alpha_base_weight != 1.0f || \\\newp->rgb_mean_weight != 0.0f || ewp->rgb_stdev_weight != 0.0f || \\\newp->alpha_mean_weight != 0.0f || ewp->alpha_stdev_weight != 0.0f;\n@@ -909,6 +908,7 @@ static float prepare_error_weight_block(\nerror_weight.y *= alpha_scale;\nerror_weight.z *= alpha_scale;\n}\n+\nerror_weight = error_weight * color_weights;\nerror_weight = error_weight * ewp->block_artifact_suppression_expanded[idx];\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -1252,7 +1252,6 @@ class CLIPTest(CLITestBase):\n# error metric was used\nself.assertEqual(len(resultSet), len(subtests))\n- @unittest.skip(\"Issue #105\")\ndef test_low_level_control_v_issue_105(self):\n\"\"\"\nTest low level control options.\n@@ -1269,7 +1268,7 @@ class CLIPTest(CLITestBase):\ninputFile, decompFile, \"4x4\", \"-medium\",\n\"-v\", \"0\", \"1\", \"2\", \"0\", \"0\", \"0\"]\n- # This should not segfault\n+ # This should not segfault ...\nself.exec(command)\ndef test_low_level_control_va(self):\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix null dereference with -v option
Bug only occurs if base weight is not one and
mean/stdev are both zero.
Fix #105
|
61,745 |
02.07.2020 21:52:20
| -3,600 |
38077e78c0a072fe8e1884164e32ccf27aa5db96
|
Remove -linsrgb option
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc.h",
"new_path": "Source/astcenc.h",
"diff": "@@ -175,15 +175,13 @@ static const unsigned int ASTCENC_FLG_MAP_MASK = 1 << 1;\nstatic const unsigned int ASTCENC_FLG_USE_ALPHA_WEIGHT = 1 << 2;\nstatic const unsigned int ASTCENC_FLG_USE_PERCEPTUAL = 1 << 3;\nstatic const unsigned int ASTCENC_FLG_USE_USER_THREADS = 1 << 4;\n-static const unsigned int ASTCENC_FLG_USE_LINEARIZED_SRGB = 1 << 5;\nstatic const unsigned int ASTCENC_ALL_FLAGS =\nASTCENC_FLG_MAP_NORMAL |\nASTCENC_FLG_MAP_MASK |\nASTCENC_FLG_USE_ALPHA_WEIGHT |\nASTCENC_FLG_USE_PERCEPTUAL |\n- ASTCENC_FLG_USE_USER_THREADS |\n- ASTCENC_FLG_USE_LINEARIZED_SRGB;\n+ ASTCENC_FLG_USE_USER_THREADS;\n// Config structure\nstruct astcenc_config {\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -891,30 +891,6 @@ static float prepare_error_weight_block(\nerror_weight = error_weight * color_weights;\nerror_weight = error_weight * ewp->block_artifact_suppression_expanded[idx];\n- // if we perform a conversion from linear to sRGB, then we multiply\n- // the weight with the derivative of the linear->sRGB transform function.\n- if (input_image->linearize_srgb)\n- {\n- float r = blk->orig_data[4 * idx];\n- float g = blk->orig_data[4 * idx + 1];\n- float b = blk->orig_data[4 * idx + 2];\n- if (r < 0.0031308f)\n- r = 12.92f;\n- else\n- r = 0.4396f * powf(r, -0.58333f);\n- if (g < 0.0031308f)\n- g = 12.92f;\n- else\n- g = 0.4396f * powf(g, -0.58333f);\n- if (b < 0.0031308f)\n- b = 12.92f;\n- else\n- b = 0.4396f * powf(b, -0.58333f);\n- error_weight.x *= r;\n- error_weight.y *= g;\n- error_weight.z *= b;\n- }\n-\n// when we loaded the block to begin with, we applied a transfer function\n// and computed the derivative of the transfer function. However, the\n// error-weight computation so far is based on the original color values,\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compute_variance.cpp",
"new_path": "Source/astcenc_compute_variance.cpp",
"diff": "@@ -45,8 +45,6 @@ struct pixel_region_variance_args\nfloat rgb_power;\n/** The alpha channel power adjustment. */\nfloat alpha_power;\n- /** The RGB data should be treated as sRGB. */\n- int need_srgb_transform;\n/** The channel swizzle pattern. */\nastcenc_swizzle swz;\n/** Should the algorithm bother with Z axis processing? */\n@@ -161,7 +159,6 @@ static void compute_pixel_region_variance(\nconst astc_codec_image *img = arg->img;\nfloat rgb_power = arg->rgb_power;\nfloat alpha_power = arg->alpha_power;\n- int need_srgb_transform = arg->need_srgb_transform;\nastcenc_swizzle swz = arg->swz;\nint have_z = arg->have_z;\n@@ -246,13 +243,6 @@ static void compute_pixel_region_variance(\nb * (1.0f / 255.0f),\na * (1.0f / 255.0f));\n- if (need_srgb_transform)\n- {\n- d.x = astc::srgb_transform(d.x);\n- d.y = astc::srgb_transform(d.y);\n- d.z = astc::srgb_transform(d.z);\n- }\n-\nif (!are_powers_1)\n{\nd.x = powf(MAX(d.x, 1e-6f), rgb_power);\n@@ -299,13 +289,6 @@ static void compute_pixel_region_variance(\nsf16_to_float(b),\nsf16_to_float(a));\n- if (need_srgb_transform)\n- {\n- d.x = astc::srgb_transform(d.x);\n- d.y = astc::srgb_transform(d.y);\n- d.z = astc::srgb_transform(d.z);\n- }\n-\nif (!are_powers_1)\n{\nd.x = powf(MAX(d.x, 1e-6f), rgb_power);\n@@ -602,7 +585,6 @@ void compute_averages_and_variances(\nfloat alpha_power,\nint avg_var_kernel_radius,\nint alpha_kernel_radius,\n- int need_srgb_transform,\nastcenc_swizzle swz,\nint thread_count\n) {\n@@ -643,7 +625,6 @@ void compute_averages_and_variances(\narg.img = img;\narg.rgb_power = rgb_power;\narg.alpha_power = alpha_power;\n- arg.need_srgb_transform = need_srgb_transform;\narg.swz = swz;\narg.have_z = have_z;\narg.avg_var_kernel_radius = avg_var_kernel_radius;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -672,9 +672,6 @@ astcenc_error astcenc_compress_image(\ninput_image.zsize = image.dim_z;\ninput_image.padding = image.dim_pad;\n- // Need to agree what we do with linearize sRGB\n- input_image.linearize_srgb = context->config.flags & ASTCENC_FLG_USE_LINEARIZED_SRGB ? 1 : 0;\n-\ninput_image.input_averages = nullptr;\ninput_image.input_variances = nullptr;\ninput_image.input_alpha_averages = nullptr;\n@@ -685,7 +682,7 @@ astcenc_error astcenc_compress_image(\n{\ncompute_averages_and_variances(&input_image, ewp.rgb_power, ewp.alpha_power,\newp.mean_stdev_radius, ewp.alpha_radius,\n- input_image.linearize_srgb, swizzle, context->thread_count);\n+ swizzle, context->thread_count);\n}\n// TODO: This could be done once when the context is created\n@@ -761,9 +758,6 @@ astcenc_error astcenc_decompress_image(\nimage.zsize = image_out.dim_z;\nimage.padding = image_out.dim_pad;\n- // Need to agree what we do with linearize sRGB\n- image.linearize_srgb = (context->config.flags & ASTCENC_FLG_USE_LINEARIZED_SRGB) == 0 ? 0 : 1;\n-\nimage.input_averages = nullptr;\nimage.input_variances = nullptr;\nimage.input_alpha_averages = nullptr;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_image.cpp",
"new_path": "Source/astcenc_image.cpp",
"diff": "@@ -378,82 +378,18 @@ void fetch_imageblock(\n}\n}\n- // perform sRGB-to-linear transform on input data, if requested.\n- int pixelcount = bsd->texel_count;\n-\n- // sRGB to Linear\n- if (img->linearize_srgb)\n- {\n- fptr = pb->orig_data;\n- for (i = 0; i < pixelcount; i++)\n- {\n- float r = fptr[0];\n- float g = fptr[1];\n- float b = fptr[2];\n-\n- if (r <= 0.04045f)\n- r = r * (1.0f / 12.92f);\n- else if (r <= 1)\n- r = powf((r + 0.055f) * (1.0f / 1.055f), 2.4f);\n-\n- if (g <= 0.04045f)\n- g = g * (1.0f / 12.92f);\n- else if (g <= 1)\n- g = powf((g + 0.055f) * (1.0f / 1.055f), 2.4f);\n-\n- if (b <= 0.04045f)\n- b = b * (1.0f / 12.92f);\n- else if (b <= 1)\n- b = powf((b + 0.055f) * (1.0f / 1.055f), 2.4f);\n-\n- fptr[0] = r;\n- fptr[1] = g;\n- fptr[2] = b;\n-\n- fptr += 4;\n- }\n- }\n-\n- // collect color max-value, in order to determine whether to use LDR or HDR\n- // interpolation.\n- float max_red, max_green, max_blue, max_alpha;\n- max_red = 0.0f;\n- max_green = 0.0f;\n- max_blue = 0.0f;\n- max_alpha = 0.0f;\n-\n- fptr = pb->orig_data;\n- for (i = 0; i < pixelcount; i++)\n- {\n- float r = fptr[0];\n- float g = fptr[1];\n- float b = fptr[2];\n- float a = fptr[3];\n-\n- if (r > max_red)\n- max_red = r;\n- if (g > max_green)\n- max_green = g;\n- if (b > max_blue)\n- max_blue = b;\n- if (a > max_alpha)\n- max_alpha = a;\n-\n- fptr += 4;\n- }\n-\nint rgb_lns = (decode_mode == ASTCENC_PRF_HDR) || (decode_mode == ASTCENC_PRF_HDR_RGB_LDR_A);\nint alpha_lns = decode_mode == ASTCENC_PRF_HDR;\n// impose the choice on every pixel when encoding.\n- for (i = 0; i < pixelcount; i++)\n+ for (i = 0; i < bsd->texel_count; i++)\n{\npb->rgb_lns[i] = rgb_lns;\npb->alpha_lns[i] = alpha_lns;\npb->nan_texel[i] = 0;\n}\n- imageblock_initialize_work_from_orig(pb, pixelcount);\n+ imageblock_initialize_work_from_orig(pb,bsd->texel_count);\nupdate_imageblock_flags(pb, bsd->xdim, bsd->ydim, bsd->zdim);\n}\n@@ -502,42 +438,9 @@ void write_imageblock(\n}\nelse\n{\n- // Linear to sRGB\n- if (img->linearize_srgb)\n- {\n- float r = fptr[0];\n- float g = fptr[1];\n- float b = fptr[2];\n-\n- if (r <= 0.0031308f)\n- r = r * 12.92f;\n- else if (r <= 1)\n- r = 1.055f * powf(r, (1.0f / 2.4f)) - 0.055f;\n-\n- if (g <= 0.0031308f)\n- g = g * 12.92f;\n- else if (g <= 1)\n- g = 1.055f * powf(g, (1.0f / 2.4f)) - 0.055f;\n-\n- if (b <= 0.0031308f)\n- b = b * 12.92f;\n- else if (b <= 1)\n- b = 1.055f * powf(b, (1.0f / 2.4f)) - 0.055f;\n-\n- data[0] = r;\n- data[1] = g;\n- data[2] = b;\n- }\n- else\n- {\n- float r = fptr[0];\n- float g = fptr[1];\n- float b = fptr[2];\n-\n- data[0] = r;\n- data[1] = g;\n- data[2] = b;\n- }\n+ data[0] = fptr[0];\n+ data[1] = fptr[1];\n+ data[2] = fptr[2];\ndata[3] = fptr[3];\nfloat xcoord = (data[0] * 2.0f) - 1.0f;\n@@ -597,38 +500,11 @@ void write_imageblock(\nimg->data16[zi][yi][4 * xi + 3] = 0xFFFF;\n}\n- else\n- {\n- // Linear to sRGB\n- if (img->linearize_srgb)\n- {\n- float r = fptr[0];\n- float g = fptr[1];\n- float b = fptr[2];\n-\n- if (r <= 0.0031308f)\n- r = r * 12.92f;\n- else if (r <= 1)\n- r = 1.055f * powf(r, (1.0f / 2.4f)) - 0.055f;\n- if (g <= 0.0031308f)\n- g = g * 12.92f;\n- else if (g <= 1)\n- g = 1.055f * powf(g, (1.0f / 2.4f)) - 0.055f;\n- if (b <= 0.0031308f)\n- b = b * 12.92f;\n- else if (b <= 1)\n- b = 1.055f * powf(b, (1.0f / 2.4f)) - 0.055f;\n-\n- data[0] = r;\n- data[1] = g;\n- data[2] = b;\n- }\nelse\n{\ndata[0] = fptr[0];\ndata[1] = fptr[1];\ndata[2] = fptr[2];\n- }\ndata[3] = fptr[3];\nfloat xN = (data[0] * 2.0f) - 1.0f;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -616,7 +616,6 @@ struct astc_codec_image\nfloat4 *input_averages;\nfloat4 *input_variances;\nfloat *input_alpha_averages;\n- int linearize_srgb;\n};\n@@ -638,7 +637,6 @@ struct astcenc_context\n* @param alpha_power The A channel power.\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 need_srgb_transform Do we need srgb transform or not?\n* @param swz Input data channel swizzle.\n* @param thread_count The number of threads to use.\n*/\n@@ -648,7 +646,6 @@ void compute_averages_and_variances(\nfloat alpha_power,\nint avg_var_kernel_radius,\nint alpha_kernel_radius,\n- int need_srgb_transform,\nastcenc_swizzle swz,\nint thread_count);\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_mathlib.h",
"new_path": "Source/astcenc_mathlib.h",
"diff": "@@ -233,22 +233,6 @@ static inline int clampi(int val, int low, int high)\nreturn val;\n}\n-/**\n- * @brief Return the sRGB transform of a color value.\n- *\n- * Values outside of the 0-1 range are passed through unmodified.\n- *\n- * @param val The value to convert.\n- *\n- * @return The transformed value.\n- */\n-static inline float srgb_transform(float val)\n-{\n- if (val <= 0.04045f) return val * (1.0f / 12.92f);\n- if (val <= 1) return powf((val + 0.055f) * (1.0f / 1.055f), 2.4f);\n- return val;\n-}\n-\n/**\n* @brief SP float round-to-nearest.\n*\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_internal.h",
"new_path": "Source/astcenccli_internal.h",
"diff": "@@ -48,7 +48,6 @@ struct cli_config_options\nunsigned int array_size;\nbool silentmode;\nbool y_flip;\n- bool linearize_srgb;\nint low_fstop;\nint high_fstop;\nastcenc_swizzle swz_encode;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -131,7 +131,6 @@ static std::string get_slice_filename(\n* @param dim_z The number of slices to load.\n* @param padding The number of texels of padding.\n* @param y_flip Should this image be Y flipped?\n- * @param linearize_srgb Should this image be converted to linear from sRGB?\n* @param[out] is_hdr Is the loaded image HDR?\n* @param[out] num_components The number of components in the loaded image.\n*\n@@ -397,10 +396,6 @@ astcenc_error init_astcenc_config(\nflags |= ASTCENC_FLG_MAP_MASK;\n}\n- else if (!strcmp(argv[argidx], \"-linsrgb\"))\n- {\n- flags |= ASTCENC_FLG_USE_LINEARIZED_SRGB;\n- }\nargidx ++;\n}\n@@ -717,11 +712,6 @@ int edit_astcenc_config(\ncli_config.thread_count = atoi(argv[argidx - 1]);\n}\n- else if (!strcmp(argv[argidx], \"-linsrgb\"))\n- {\n- argidx++;\n- cli_config.linearize_srgb = 1;\n- }\nelse if (!strcmp(argv[argidx], \"-yflip\"))\n{\nargidx++;\n@@ -928,7 +918,7 @@ int main(\n}\n// Initialize cli_config_options with default values\n- cli_config_options cli_config { 0, 1, false, false, false, -10, 10,\n+ cli_config_options cli_config { 0, 1, false, false, -10, 10,\n{ ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCENC_SWZ_B, ASTCENC_SWZ_A },\n{ ASTCENC_SWZ_R, ASTCENC_SWZ_G, ASTCENC_SWZ_B, ASTCENC_SWZ_A } };\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel_help.cpp",
"new_path": "Source/astcenccli_toplevel_help.cpp",
"diff": "@@ -357,20 +357,6 @@ ADVANCED COMPRESSION\nwhich uses an 'rrrg' compression swizzle, you should specify an\n'raz1' swizzle for decompression.\n- -linsrgb\n- Convert input images from sRGB to linear RGB before compression,\n- and output images from linear RGB to sRGB after decompression.\n- For compression, the transform is applied after any swizzle; for\n- decode, the transform is applied before any swizzle. Note that\n- using this option in a test mode (-t*) will have no obvious\n- effect as the image will be converted twice, although some image\n- precision loss may occur.\n-\n- Note that this switch is only intended for diagnostic purposes;\n- real use cases should directly compress/decompress sRGB data\n- using the LDR sRGB profile, using the -cs, -ds, and -ts\n- operation modes. This preserves more perceptual image quality.\n-\n-yflip\nFlip the image in the vertical axis prior to compression and\nafter decompression. Note that using this option in a test mode\n@@ -401,8 +387,8 @@ DECOMPRESSION\ncoompression path can produce are supported for decompression. See\nthe FILE FORMATS section for the list of supported formats.\n- The -dsw, -linsrgb options documented in ADVANCED COMPRESSION\n- option documentation are relevent to decompression.\n+ The -dsw options documented in ADVANCED COMPRESSION option documentation\n+ are relevent to decompression.\nTEST\nTo perform a compression test which round-trips a single image\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_functional.py",
"new_path": "Test/astc_test_functional.py",
"diff": "@@ -358,69 +358,6 @@ class CLIPTest(CLITestBase):\nreturn [modes[mode][corner] for corner in corners]\n- @staticmethod\n- def to_srgb_color(color):\n- \"\"\"\n- Convert a linear color to an sRGB color.\n-\n- If the input color has 4 channels the 4th is presumed to be alpha and\n- therefore not sRGB converted; the alpha is just passed through.\n-\n- Args:\n- color (tuple): The linear color value.\n-\n- Returns:\n- tuple: The sRGB converted color value.\n- \"\"\"\n- newColor = []\n-\n- # Color convert only RGB\n- for i, channel in enumerate(color):\n- # Pass though alpha\n- if i == 3:\n- pass\n- # Linear region near zero\n- elif channel < 0.0031308:\n- channel = channel * 12.92\n- # Power curve\n- else:\n- channel = ((1.055 * channel) ** (1 / 2.4)) - 0.055\n-\n- newColor.append(channel)\n-\n- return newColor\n-\n- @staticmethod\n- def from_srgb_color(color):\n- \"\"\"\n- Convert an sRGB color to a linear color.\n-\n- If the input color has 4 channels the 4th is presumed to be alpha and\n- therefore not converted; the alpha is just passed through.\n-\n- Args:\n- color (tuple): The sRGB color value.\n-\n- Returns:\n- tuple: The linear converted color value.\n- \"\"\"\n- newColor = []\n-\n- # Color convert only RGB\n- for i, channel in enumerate(color):\n- # Pass though alpha\n- if i == 3:\n- pass\n- # Linear region near zero\n- elif channel < 0.04045:\n- channel = channel / 12.92\n- # Power curve\n- else:\n- channel = ((channel + 0.055) / 1.055) ** 2.4\n- newColor.append(channel)\n-\n- return newColor\n-\ndef assertColorSame(self, colorRef, colorNew, threshold=0.02, swiz=None):\n\"\"\"\nTest if a color is the similar to a reference.\n@@ -1345,102 +1282,6 @@ class CLIPTest(CLITestBase):\n# Test time should get slower with fewer threads\nself.assertGreater(testTime, refTime)\n- def test_linearize_srgb_compress(self):\n- \"\"\"\n- Test linearize srgb on compression.\n-\n- This option converts srgb to linear before compression, so we expect\n- the compressed output to be linear colorspace.\n- \"\"\"\n- inputFile = \"./Test/Data/Tiles/ldr.png\"\n- compFile = self.get_tmp_image_path(\"LDR\", \"comp\")\n- decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n-\n- # Compute the basic image without any channel weights\n- compCommand = [\n- self.binary, \"-cl\",\n- inputFile, compFile, \"4x4\", \"-exhaustive\", \"-linsrgb\"]\n-\n- decompCommand = [\n- self.binary, \"-dl\",\n- compFile, decompFile]\n-\n- self.exec(compCommand)\n- self.exec(decompCommand)\n-\n- img = tli.Image(inputFile)\n- refColors = img.get_colors((7, 7))\n-\n- img = tli.Image(decompFile)\n- testColors = img.get_colors((7, 7))\n- srgbColors = self.to_srgb_color(testColors)\n-\n- # Test we get a match within 5% on the RGB channels, exact on alpha\n- self.assertColorSame(refColors[:3], srgbColors[:3], threshold=0.05)\n- self.assertColorSame(refColors[3:], srgbColors[3:], threshold=0.0)\n-\n- def test_linearize_srgb_decompress(self):\n- \"\"\"\n- Test linearize srgb on decompression.\n-\n- This option converts linear to srgb after decompression, so we expect\n- the decompressed output to be srgb colorspace.\n- \"\"\"\n- inputFile = \"./Test/Data/Tiles/ldr.png\"\n- compFile = self.get_tmp_image_path(\"LDR\", \"comp\")\n- decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n-\n- # Compute the basic image without any channel weights\n- compCommand = [\n- self.binary, \"-cl\",\n- inputFile, compFile, \"4x4\", \"-exhaustive\"]\n-\n- decompCommand = [\n- self.binary, \"-dl\",\n- compFile, decompFile, \"-linsrgb\"]\n-\n- self.exec(compCommand)\n- self.exec(decompCommand)\n-\n- img = tli.Image(inputFile)\n- refColors = img.get_colors((7, 7))\n-\n- img = tli.Image(decompFile)\n- testColors = img.get_colors((7, 7))\n- linColors = self.from_srgb_color(testColors)\n-\n- # Test we get a match within 5% on the RGB channels, exact on alpha\n- self.assertColorSame(refColors[:3], linColors[:3], threshold=0.05)\n- self.assertColorSame(refColors[3:], linColors[3:], threshold=0.0)\n-\n- def test_linearize_srgb_roundtrip(self):\n- \"\"\"\n- Test linearize srgb on round-trip.\n-\n- This linearizes on input, and converts back to sRGB on output, so\n- overall no conversion should occur. There may be some precision\n- losses however.\n- \"\"\"\n- inputFile = \"./Test/Data/Tiles/ldr.png\"\n- decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n-\n- # Compute the basic image without any channel weights\n- command = [\n- self.binary, \"-tl\",\n- inputFile, decompFile, \"4x4\", \"-exhaustive\", \"-linsrgb\"]\n-\n- self.exec(command)\n-\n- img = tli.Image(inputFile)\n- refColors = img.get_colors((7, 7))\n-\n- img = tli.Image(decompFile)\n- testColors = img.get_colors((7, 7))\n-\n- # Test we get a match within 5% on the RGB channels, exact on alpha\n- self.assertColorSame(refColors[:3], testColors[:3], threshold=0.0)\n- self.assertColorSame(refColors[3:], testColors[3:], threshold=0.0)\n-\ndef test_silent(self):\n\"\"\"\nTest silent\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove -linsrgb option
|
61,745 |
02.07.2020 22:36:12
| -3,600 |
7d041c95457c3da76ccbd0b5ec8066733fd35d0f
|
Enable -flto on non-debug builds
Add some deafult initializers to keep g++-9 happy with
flto enbled, but they shouldn't really be needed.
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "@@ -90,7 +90,7 @@ CXXFLAGS = -std=c++14 -fvisibility=hidden -mfpmath=sse \\\n# Validate that the DBG parameter is a supported value, and patch CXXFLAGS\nifeq ($(DBG),0)\n-CXXFLAGS += -O3 -DNDEBUG\n+CXXFLAGS += -O3 -DNDEBUG -flto\nelse\nCXXFLAGS += -O0 -g\nendif\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -899,7 +899,7 @@ int main(\n// Load the compressed input file if needed\n// This has to come first, as the block size is in the file header\n- astc_compressed_image image_comp;\n+ astc_compressed_image image_comp {};\nif (operation & ASTCENC_STAGE_LD_COMP)\n{\nerror = load_cimage(input_filename.c_str(), image_comp);\n@@ -909,7 +909,7 @@ int main(\n}\n}\n- astcenc_config config;\n+ astcenc_config config {};\nerror = init_astcenc_config(argc, argv, profile, operation, image_comp, config);\nif (error)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/astc_test_image.py",
"new_path": "Test/astc_test_image.py",
"diff": "@@ -138,7 +138,7 @@ def format_solo_result(image, result):\nimSize = image.get_size()\nif imSize:\nmpix = float(imSize[0] * imSize[1]) / 1000000.0\n- tCMPS = \"%3.2f MP/s\" % (mpix / result.cTime)\n+ tCMPS = \"%3.3f MP/s\" % (mpix / result.cTime)\nelse:\ntCMPS = \"?\"\n@@ -166,7 +166,7 @@ def format_result(image, reference, result):\nimSize = image.get_size()\nif imSize:\nmpix = float(imSize[0] * imSize[1]) / 1000000.0\n- tCMPS = \"%3.2f MP/s\" % (mpix / result.cTime)\n+ tCMPS = \"%3.3f MP/s\" % (mpix / result.cTime)\nelse:\ntCMPS = \"?\"\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Enable -flto on non-debug builds
Add some deafult initializers to keep g++-9 happy with
-flto enbled, but they shouldn't really be needed.
|
61,745 |
05.07.2020 22:17:01
| -3,600 |
e6e2f817acf0e1f1d52241102b693399c613e0d8
|
Move block_supression infill to context init
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -472,6 +472,9 @@ astcenc_error astcenc_context_alloc(\nctx->bsd = bsd;\nctx->barrier = new Barrier(thread_count);\n+\n+ expand_block_artifact_suppression(\n+ ctx->config.block_x, ctx->config.block_y, ctx->config.block_z, &ctx->ewp);\n}\ncatch(const std::bad_alloc&)\n{\n@@ -682,13 +685,6 @@ astcenc_error astcenc_compress_image(\ncompute_averages_and_variances(context->thread_count, thread_index, context->ag);\n}\n- // TODO: This could be done once when the context is created\n- if (thread_index <= 0)\n- {\n- expand_block_artifact_suppression(\n- context->config.block_x, context->config.block_y, context->config.block_z, &ewp);\n- }\n-\ncompress_astc_image_info ai;\nai.bsd = context->bsd;\nai.buffer = data_out;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Move block_supression infill to context init
|
61,745 |
05.07.2020 22:46:11
| -3,600 |
00907ad03230d452200909ede95015ddfb68265f
|
Use statically sized temp buffers
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_compress_symbolic.cpp",
"new_path": "Source/astcenc_compress_symbolic.cpp",
"diff": "@@ -225,7 +225,7 @@ static void compress_symbolic_block_fixed_partition_1_plane(\n// first, compute ideal weights and endpoint colors, under the assumption that\n// there is no quantization or decimation going on.\n- endpoints_and_weights *ei = tmpbuf->ei1;\n+ endpoints_and_weights *ei = &tmpbuf->ei1;\nendpoints_and_weights *eix = tmpbuf->eix1;\ncompute_endpoints_and_ideal_weights_1_plane(bsd, pi, blk, ewb, ei);\n@@ -457,8 +457,8 @@ static void compress_symbolic_block_fixed_partition_2_planes(\npi += partition_index;\n// first, compute ideal weights and endpoint colors\n- endpoints_and_weights *ei1 = tmpbuf->ei1;\n- endpoints_and_weights *ei2 = tmpbuf->ei2;\n+ endpoints_and_weights *ei1 = &tmpbuf->ei1;\n+ endpoints_and_weights *ei2 = &tmpbuf->ei2;\nendpoints_and_weights *eix1 = tmpbuf->eix1;\nendpoints_and_weights *eix2 = tmpbuf->eix2;\ncompute_endpoints_and_ideal_weights_2_planes(bsd, pi, blk, ewb, separate_component, ei1, ei2);\n@@ -1131,8 +1131,8 @@ float compress_symbolic_block(\nreturn 0.0f;\n}\n- error_weight_block *ewb = tmpbuf->ewb;\n- error_weight_block_orig *ewbo = tmpbuf->ewbo;\n+ error_weight_block *ewb = &tmpbuf->ewb;\n+ error_weight_block_orig *ewbo = &tmpbuf->ewbo;\nfloat error_weight_sum = prepare_error_weight_block(input_image, bsd, ewp, blk, ewb, ewbo);\n@@ -1140,7 +1140,7 @@ float compress_symbolic_block(\nfloat error_of_best_block = 1e20f;\n- imageblock *temp = tmpbuf->temp;\n+ imageblock *temp = &tmpbuf->temp;\nfloat best_errorvals_in_modes[17];\nfor (i = 0; i < 17; i++)\n@@ -1164,7 +1164,7 @@ float compress_symbolic_block(\n{\ncompress_symbolic_block_fixed_partition_1_plane(decode_mode, modecutoffs[i], ewp->max_refinement_iters, bsd, 1, // partition count\n0, // partition index\n- blk, ewb, tempblocks, tmpbuf->plane1);\n+ blk, ewb, tempblocks, &tmpbuf->planes);\nbest_errorval_in_mode = 1e30f;\nfor (j = 0; j < 4; j++)\n@@ -1213,7 +1213,7 @@ float compress_symbolic_block(\nbsd, 1, // partition count\n0, // partition index\ni, // the color component to test a separate plane of weights for.\n- blk, ewb, tempblocks, tmpbuf->planes2);\n+ blk, ewb, tempblocks, &tmpbuf->planes);\nbest_errorval_in_mode = 1e30f;\nfor (j = 0; j < 4; j++)\n@@ -1253,7 +1253,7 @@ float compress_symbolic_block(\nfor (i = 0; i < 2; i++)\n{\ncompress_symbolic_block_fixed_partition_1_plane(decode_mode, mode_cutoff, ewp->max_refinement_iters,\n- bsd, partition_count, partition_indices_1plane[i], blk, ewb, tempblocks, tmpbuf->plane1);\n+ bsd, partition_count, partition_indices_1plane[i], blk, ewb, tempblocks, &tmpbuf->planes);\nbest_errorval_in_mode = 1e30f;\nfor (j = 0; j < 4; j++)\n@@ -1296,7 +1296,7 @@ float compress_symbolic_block(\nbsd,\npartition_count,\npartition_indices_2planes[i] & (PARTITION_COUNT - 1), partition_indices_2planes[i] >> PARTITION_BITS,\n- blk, ewb, tempblocks, tmpbuf->planes2);\n+ blk, ewb, tempblocks, &tmpbuf->planes);\nbest_errorval_in_mode = 1e30f;\nfor (j = 0; j < 4; j++)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -543,22 +543,8 @@ static void encode_astc_image_threadfunc(\nint yblocks = (ysize + ydim - 1) / ydim;\nint zblocks = (zsize + zdim - 1) / zdim;\n- //allocate memory for temporary buffers\n- compress_symbolic_block_buffers temp_buffers;\n- temp_buffers.ewb = new error_weight_block;\n- temp_buffers.ewbo = new error_weight_block_orig;\n- temp_buffers.tempblocks = new symbolic_compressed_block[4];\n- temp_buffers.temp = new imageblock;\n- temp_buffers.planes2 = new compress_fixed_partition_buffers;\n- temp_buffers.planes2->ei1 = new endpoints_and_weights;\n- temp_buffers.planes2->ei2 = new endpoints_and_weights;\n- temp_buffers.planes2->eix1 = new endpoints_and_weights[MAX_DECIMATION_MODES];\n- temp_buffers.planes2->eix2 = new endpoints_and_weights[MAX_DECIMATION_MODES];\n- temp_buffers.planes2->decimated_quantized_weights = new float[2 * MAX_DECIMATION_MODES * MAX_WEIGHTS_PER_BLOCK];\n- temp_buffers.planes2->decimated_weights = new float[2 * MAX_DECIMATION_MODES * MAX_WEIGHTS_PER_BLOCK];\n- temp_buffers.planes2->flt_quantized_decimated_quantized_weights = new float[2 * MAX_WEIGHT_MODES * MAX_WEIGHTS_PER_BLOCK];\n- temp_buffers.planes2->u8_quantized_decimated_quantized_weights = new uint8_t[2 * MAX_WEIGHT_MODES * MAX_WEIGHTS_PER_BLOCK];\n- temp_buffers.plane1 = temp_buffers.planes2;\n+ // Allocate temporary buffers. Large, so allocate on the heap\n+ auto temp_buffers = std::make_unique<compress_symbolic_block_buffers>();\nfor (z = 0; z < zblocks; z++)\n{\n@@ -572,7 +558,7 @@ static void encode_astc_image_threadfunc(\nuint8_t *bp = buffer + offset;\nfetch_imageblock(decode_mode, input_image, &pb, bsd, x * xdim, y * ydim, z * zdim, swz_encode);\nsymbolic_compressed_block scb;\n- compress_symbolic_block(input_image, decode_mode, bsd, ewp, &pb, &scb, &temp_buffers);\n+ compress_symbolic_block(input_image, decode_mode, bsd, ewp, &pb, &scb, temp_buffers.get());\n*(physical_compressed_block*) bp = symbolic_to_physical(bsd, &scb);\nctr = thread_count - 1;\n}\n@@ -581,20 +567,6 @@ static void encode_astc_image_threadfunc(\n}\n}\n}\n-\n- delete[] temp_buffers.planes2->decimated_quantized_weights;\n- delete[] temp_buffers.planes2->decimated_weights;\n- delete[] temp_buffers.planes2->flt_quantized_decimated_quantized_weights;\n- delete[] temp_buffers.planes2->u8_quantized_decimated_quantized_weights;\n- delete[] temp_buffers.planes2->eix1;\n- delete[] temp_buffers.planes2->eix2;\n- delete temp_buffers.planes2->ei1;\n- delete temp_buffers.planes2->ei2;\n- delete temp_buffers.planes2;\n- delete[] temp_buffers.tempblocks;\n- delete temp_buffers.temp;\n- delete temp_buffers.ewbo;\n- delete temp_buffers.ewb;\n}\nastcenc_error astcenc_compress_image(\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -939,24 +939,23 @@ struct encoding_choice_errors\n// buffers used to store intermediate data in compress_symbolic_block_fixed_partition_*()\nstruct compress_fixed_partition_buffers\n{\n- endpoints_and_weights* ei1;\n- endpoints_and_weights* ei2;\n- endpoints_and_weights* eix1;\n- endpoints_and_weights* eix2;\n- float* decimated_quantized_weights;\n- float* decimated_weights;\n- float* flt_quantized_decimated_quantized_weights;\n- uint8_t* u8_quantized_decimated_quantized_weights;\n+ endpoints_and_weights ei1;\n+ endpoints_and_weights ei2;\n+ endpoints_and_weights eix1[MAX_DECIMATION_MODES];\n+ endpoints_and_weights eix2[MAX_DECIMATION_MODES];\n+ float decimated_quantized_weights[2 * MAX_DECIMATION_MODES * MAX_WEIGHTS_PER_BLOCK];\n+ float decimated_weights[2 * MAX_DECIMATION_MODES * MAX_WEIGHTS_PER_BLOCK];\n+ float flt_quantized_decimated_quantized_weights[2 * MAX_WEIGHT_MODES * MAX_WEIGHTS_PER_BLOCK];\n+ uint8_t u8_quantized_decimated_quantized_weights[2 * MAX_WEIGHT_MODES * MAX_WEIGHTS_PER_BLOCK];\n};\nstruct compress_symbolic_block_buffers\n{\n- error_weight_block* ewb;\n- error_weight_block_orig* ewbo;\n- symbolic_compressed_block* tempblocks;\n- imageblock* temp;\n- compress_fixed_partition_buffers* plane1;\n- compress_fixed_partition_buffers* planes2;\n+ error_weight_block ewb;\n+ error_weight_block_orig ewbo;\n+ symbolic_compressed_block tempblocks[4];\n+ imageblock temp;\n+ compress_fixed_partition_buffers planes;\n};\nvoid compute_encoding_choice_errors(\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use statically sized temp buffers
|
61,745 |
05.07.2020 22:46:50
| -3,600 |
b6eeba09ae6698693ce2ded98f9eba934b536005
|
Add compressed data size checks to codec API
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -590,6 +590,21 @@ astcenc_error astcenc_compress_image(\nreturn ASTCENC_ERR_BAD_PARAM;\n}\n+ unsigned int block_x = context->config.block_x;\n+ unsigned int block_y = context->config.block_y;\n+ unsigned int block_z = context->config.block_z;\n+\n+ unsigned int xblocks = (image.dim_x + block_x - 1) / block_x;\n+ unsigned int yblocks = (image.dim_y + block_y - 1) / block_y;\n+ unsigned int zblocks = (image.dim_z + block_z - 1) / block_z;\n+\n+ // Check we have enough output space (16 bytes per block)\n+ size_t size_needed = xblocks * yblocks * zblocks * 16;\n+ if (data_len < size_needed)\n+ {\n+ return ASTCENC_ERR_OUT_OF_MEM;\n+ }\n+\n// TODO: Replace error_weighting_params in the core codec with the config / context structs\nerror_weighting_params& ewp = context->ewp;\newp.rgb_power = context->config.v_rgb_power;\n@@ -710,8 +725,12 @@ astcenc_error astcenc_decompress_image(\nunsigned int yblocks = (image_out.dim_y + block_y - 1) / block_y;\nunsigned int zblocks = (image_out.dim_z + block_z - 1) / block_z;\n- // TODO: Check output bounds\n- (void)data_len;\n+ // Check we have enough output space (16 bytes per block)\n+ size_t size_needed = xblocks * yblocks * zblocks * 16;\n+ if (data_len < size_needed)\n+ {\n+ return ASTCENC_ERR_OUT_OF_MEM;\n+ }\n// TODO: Replace astc_codec_image in the core codec with the astcenc_image struct\nastc_codec_image image;\n@@ -727,6 +746,7 @@ astcenc_error astcenc_decompress_image(\nimage.input_alpha_averages = nullptr;\nimageblock pb;\n+\nfor (unsigned int z = 0; z < zblocks; z++)\n{\nfor (unsigned int y = 0; y < yblocks; y++)\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_image_load_store.cpp",
"new_path": "Source/astcenccli_image_load_store.cpp",
"diff": "@@ -1945,6 +1945,7 @@ int load_cimage(\n}\nout_image.data = buffer;\n+ out_image.data_len = data_size;\nout_image.block_x = block_x;\nout_image.block_y = block_y;\nout_image.block_z = block_z;\n@@ -1959,11 +1960,6 @@ int store_cimage(\nconst astc_compressed_image& comp_img,\nconst char* filename\n) {\n- int xblocks = (comp_img.dim_x + comp_img.block_x - 1) / comp_img.block_x;\n- int yblocks = (comp_img.dim_y + comp_img.block_y - 1) / comp_img.block_y;\n- int zblocks = (comp_img.dim_z + comp_img.block_z - 1) / comp_img.block_z;\n- size_t data_bytes = xblocks * yblocks * zblocks * 16;\n-\nastc_header hdr;\nhdr.magic[0] = ASTC_MAGIC_ID & 0xFF;\nhdr.magic[1] = (ASTC_MAGIC_ID >> 8) & 0xFF;\n@@ -1994,6 +1990,6 @@ int store_cimage(\n}\nfile.write((char*)&hdr, sizeof(astc_header));\n- file.write((char*)comp_img.data, data_bytes);\n+ file.write((char*)comp_img.data, comp_img.data_len);\nreturn 0;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_internal.h",
"new_path": "Source/astcenccli_internal.h",
"diff": "@@ -39,6 +39,7 @@ struct astc_compressed_image\nunsigned int dim_y;\nunsigned int dim_z;\nuint8_t* data;\n+ size_t data_len;\n};\n// Config options to be read from command line\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -1043,6 +1043,7 @@ int main(\nimage_comp.dim_y = image_uncomp_in->dim_y;\nimage_comp.dim_z = image_uncomp_in->dim_z;\nimage_comp.data = buffer;\n+ image_comp.data_len = buffer_size;\n}\n// Decompress an image\n@@ -1059,7 +1060,7 @@ int main(\nout_bitness, image_comp.dim_x, image_comp.dim_y, image_comp.dim_z, 0);\n// TODO: Pass through data len to avoid out-of-bounds reads\n- codec_status = astcenc_decompress_image(codec_context, image_comp.data, 0,\n+ codec_status = astcenc_decompress_image(codec_context, image_comp.data, image_comp.data_len,\n*image_decomp_out, cli_config.swz_decode);\nif (codec_status != ASTCENC_SUCCESS)\n{\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Add compressed data size checks to codec API
|
61,745 |
05.07.2020 23:03:30
| -3,600 |
574cc3656c38073edc62a9a8c703bb554529f474
|
Remove opaque struct for function call
No longer needed; not a thread entry point
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -501,44 +501,32 @@ void astcenc_context_free(\n{\nterm_block_size_descriptor(context->bsd);\ndelete context->bsd;\n+ delete context->barrier;\ndelete context;\n}\n}\n-struct compress_astc_image_info\n-{\n- const block_size_descriptor* bsd;\n- const error_weighting_params* ewp;\n- uint8_t* buffer;\n- int threadcount;\n- astcenc_profile decode_mode;\n- astcenc_swizzle swz_encode;\n- const astc_codec_image* input_image;\n-};\n-\n-static void encode_astc_image_threadfunc(\n- int thread_count,\n- int thread_id,\n- void* vblk\n+static void compress_astc_image(\n+ astcenc_context& ctx,\n+ const astc_codec_image& image,\n+ astcenc_swizzle swizzle,\n+ uint8_t* buffer,\n+ int thread_id\n) {\n- const compress_astc_image_info *blk = (const compress_astc_image_info *)vblk;\n- const block_size_descriptor *bsd = blk->bsd;\n+ const block_size_descriptor *bsd = ctx.bsd;\nint xdim = bsd->xdim;\nint ydim = bsd->ydim;\nint zdim = bsd->zdim;\n- uint8_t *buffer = blk->buffer;\n- const error_weighting_params *ewp = blk->ewp;\n- astcenc_profile decode_mode = blk->decode_mode;\n- astcenc_swizzle swz_encode = blk->swz_encode;\n- const astc_codec_image *input_image = blk->input_image;\n+ const error_weighting_params *ewp = &ctx.ewp;\n+ astcenc_profile decode_mode = ctx.config.profile;\nimageblock pb;\nint ctr = thread_id;\nint x, y, z;\n- int xsize = input_image->xsize;\n- int ysize = input_image->ysize;\n- int zsize = input_image->zsize;\n+ int xsize = image.xsize;\n+ int ysize = image.ysize;\n+ int zsize = image.zsize;\nint xblocks = (xsize + xdim - 1) / xdim;\nint yblocks = (ysize + ydim - 1) / ydim;\nint zblocks = (zsize + zdim - 1) / zdim;\n@@ -555,19 +543,21 @@ static void encode_astc_image_threadfunc(\nif (ctr == 0)\n{\nint offset = ((z * yblocks + y) * xblocks + x) * 16;\n- uint8_t *bp = buffer + offset;\n- fetch_imageblock(decode_mode, input_image, &pb, bsd, x * xdim, y * ydim, z * zdim, swz_encode);\n+ const uint8_t *bp = buffer + offset;\n+ fetch_imageblock(decode_mode, &image, &pb, bsd, x * xdim, y * ydim, z * zdim, swizzle);\nsymbolic_compressed_block scb;\n- compress_symbolic_block(input_image, decode_mode, bsd, ewp, &pb, &scb, temp_buffers.get());\n+ compress_symbolic_block(&image, decode_mode, bsd, ewp, &pb, &scb, temp_buffers.get());\n*(physical_compressed_block*) bp = symbolic_to_physical(bsd, &scb);\n- ctr = thread_count - 1;\n+ ctr = ctx.thread_count - 1;\n}\nelse\n+ {\nctr--;\n}\n}\n}\n}\n+}\nastcenc_error astcenc_compress_image(\nastcenc_context* context,\n@@ -653,6 +643,7 @@ astcenc_error astcenc_compress_image(\ninput_image.input_variances = nullptr;\ninput_image.input_alpha_averages = nullptr;\n+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\ncontext->barrier->wait();\nif (image.dim_pad > 0 ||\n@@ -667,32 +658,22 @@ astcenc_error astcenc_compress_image(\ncontext->arg, context->ag);\n}\n+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\ncontext->barrier->wait();\ncompute_averages_and_variances(context->thread_count, thread_index, context->ag);\n}\n- compress_astc_image_info ai;\n- ai.bsd = context->bsd;\n- ai.buffer = data_out;\n- ai.ewp = &ewp;\n- ai.decode_mode = context->config.profile;\n- ai.swz_encode = swizzle;\n- ai.input_image = &input_image;\n-\n- // TODO: Add bounds checking\n- (void)data_len;\n-\n- // TODO: Implement user-thread pools\n-\n+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\ncontext->barrier->wait();\n- encode_astc_image_threadfunc(context->thread_count, thread_index, (void*)&ai);\n+ compress_astc_image(*context, input_image, swizzle, data_out, thread_index);\n+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\ncontext->barrier->wait();\n// Clean up any memory allocated by compute_averages_and_variances\n- if (thread_index < 0)\n+ if (thread_index == 0)\n{\ndelete[] input_image.input_averages;\ndelete[] input_image.input_variances;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Remove opaque struct for function call
No longer needed; not a thread entry point
|
61,745 |
05.07.2020 23:33:55
| -3,600 |
43753e58e894fdc00e464a198fb5245eac256007
|
Improve error messages for codec returns
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenccli_toplevel.cpp",
"new_path": "Source/astcenccli_toplevel.cpp",
"diff": "@@ -327,7 +327,7 @@ int parse_commandline_options(\n*\n* @return 0 if everything is Okay, 1 if there is some error\n*/\n-astcenc_error init_astcenc_config(\n+int init_astcenc_config(\nint argc,\nchar **argv,\nastcenc_profile profile,\n@@ -356,7 +356,8 @@ astcenc_error init_astcenc_config(\n// Read and decode block size\nif (argc < 5)\n{\n- return ASTCENC_ERR_BAD_BLOCK_SIZE;\n+ printf(\"ERROR: Block size must be specified\\n\");\n+ return 1;\n}\nint cnt2D, cnt3D;\n@@ -365,13 +366,15 @@ astcenc_error init_astcenc_config(\n// Character after the last match should be a NUL\nif (!(((dimensions == 2) && !argv[4][cnt2D]) || ((dimensions == 3) && !argv[4][cnt3D])))\n{\n- return ASTCENC_ERR_BAD_BLOCK_SIZE;\n+ printf(\"ERROR: Block size '%s' is invalid\\n\", argv[4]);\n+ return 1;\n}\n// Read and decode search preset\nif (argc < 6)\n{\n- return ASTCENC_ERR_BAD_PRESET;\n+ printf(\"ERROR: Search preset must be specified\\n\");\n+ return 1;\n}\nif (!strcmp(argv[5], \"-fast\"))\n@@ -392,7 +395,8 @@ astcenc_error init_astcenc_config(\n}\nelse\n{\n- return ASTCENC_ERR_BAD_PRESET;\n+ printf(\"ERROR: Search preset '%s' is invalid\\n\", argv[5]);\n+ return 1;\n}\nargidx = 6;\n@@ -427,7 +431,28 @@ astcenc_error init_astcenc_config(\n}\nastcenc_error status = astcenc_init_config(profile, block_x, block_y, block_z, preset, flags, config);\n- return status;\n+ if (status == ASTCENC_ERR_BAD_BLOCK_SIZE)\n+ {\n+ printf(\"ERROR: Block size '%s' is invalid\\n\", argv[4]);\n+ return 1;\n+ }\n+ else if (status == ASTCENC_ERR_BAD_CPU_ISA)\n+ {\n+ printf(\"ERROR: Required SIMD ISA support missing on this CPU\\n\");\n+ return 1;\n+ }\n+ else if (status == ASTCENC_ERR_BAD_CPU_FLOAT)\n+ {\n+ printf(\"ERROR: astcenc must not be compiled with -ffast-math\\n\");\n+ return 1;\n+ }\n+ else if (status != ASTCENC_SUCCESS)\n+ {\n+ printf(\"ERROR: Init config failed with %s\\n\", astcenc_get_error_string(status));\n+ return 1;\n+ }\n+\n+ return 0;\n}\n/**\n@@ -945,7 +970,6 @@ int main(\nerror = init_astcenc_config(argc, argv, profile, operation, image_comp, config);\nif (error)\n{\n- printf(\"ERROR: Astcenc configuration initialization failed.\\n\");\nreturn 1;\n}\n@@ -957,7 +981,6 @@ int main(\nerror = edit_astcenc_config(argc, argv, operation, cli_config, config);\nif (error)\n{\n- printf(\"ERROR: Astcenc configuration initialization failed.\\n\");\nreturn 1;\n}\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Improve error messages for codec returns
|
61,745 |
05.07.2020 23:47:14
| -3,600 |
2fbda5605141166eded1936afab6513e7a493c61
|
Force align compress_fixed_partition_buffers
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -937,7 +937,7 @@ struct encoding_choice_errors\n};\n// buffers used to store intermediate data in compress_symbolic_block_fixed_partition_*()\n-struct compress_fixed_partition_buffers\n+struct alignas(32) compress_fixed_partition_buffers\n{\nendpoints_and_weights ei1;\nendpoints_and_weights ei2;\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Force align compress_fixed_partition_buffers
|
61,745 |
05.07.2020 23:50:35
| -3,600 |
4f067b21eb58f6e1b645ec504db770c8aa35258d
|
Fix deblock init
|
[
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_entry.cpp",
"new_path": "Source/astcenc_entry.cpp",
"diff": "@@ -473,6 +473,7 @@ astcenc_error astcenc_context_alloc(\nctx->barrier = new Barrier(thread_count);\n+ ctx->ewp.block_artifact_suppression = ctx->config.b_deblock_weight;\nexpand_block_artifact_suppression(\nctx->config.block_x, ctx->config.block_y, ctx->config.block_z, &ctx->ewp);\n}\n@@ -610,7 +611,6 @@ astcenc_error astcenc_compress_image(\newp.enable_rgb_scale_with_alpha = context->config.flags & ASTCENC_FLG_USE_ALPHA_WEIGHT ? 1 : 0;\newp.alpha_radius = context->config.a_scale_radius;\newp.ra_normal_angular_scale = context->config.flags & ASTCENC_FLG_MAP_NORMAL ? 1 : 0;\n- ewp.block_artifact_suppression = context->config.b_deblock_weight;\newp.rgba_weights[0] = context->config.cw_r_weight;\newp.rgba_weights[1] = context->config.cw_g_weight;\newp.rgba_weights[2] = context->config.cw_b_weight;\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/astcenc_internal.h",
"new_path": "Source/astcenc_internal.h",
"diff": "@@ -87,7 +87,7 @@ private:\nsize_t current_count;\n/** @brief The number of threads in the workgroup. */\n- const size_t thread_count;\n+ const size_t workgroup_size;\n/** @brief The current direction of the counter changes. */\nDir dir;\n@@ -100,7 +100,7 @@ public:\n*/\nBarrier(size_t thread_count) :\ncurrent_count(0),\n- thread_count(thread_count),\n+ workgroup_size(thread_count),\ndir(Dir::Up) { }\n/**\n@@ -135,7 +135,7 @@ public:\nelse\n{\ncurrent_count++;\n- if (current_count == thread_count)\n+ if (current_count == workgroup_size)\n{\ndir = Dir::Down;\ncv.notify_all();\n"
},
{
"change_type": "MODIFY",
"old_path": "Test/testlib/encoder.py",
"new_path": "Test/testlib/encoder.py",
"diff": "@@ -92,6 +92,8 @@ class EncoderBase():\nexcept (OSError, sp.CalledProcessError):\nprint(\"ERROR: Test run failed\")\nprint(\" + %s\" % \" \".join(command))\n+ qcommand = [\"\\\"%s\\\"\" % x for x in command]\n+ print(\" + %s\" % \", \".join(qcommand))\nsys.exit(1)\nreturn result.stdout.splitlines()\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Fix deblock init
|
61,745 |
06.07.2020 08:23:16
| -3,600 |
d116086bdc6e2b11ddcdd7a5c9ee51485672b26d
|
Bump to C++17 to get aligned new variants
|
[
{
"change_type": "MODIFY",
"old_path": "Source/Makefile",
"new_path": "Source/Makefile",
"diff": "@@ -84,7 +84,7 @@ EXTERNAL_OBJECTS = $(EXTERNAL_SOURCES:.h=-$(VEC).o)\nBINARY = astcenc-$(VEC)\n-CXXFLAGS = -std=c++14 -fvisibility=hidden -mfpmath=sse \\\n+CXXFLAGS = -std=c++17 -fvisibility=hidden -mfpmath=sse \\\n-Wall -Wextra -Wpedantic -Werror -Werror=shadow -Wdouble-promotion\n# Validate that the DBG parameter is a supported value, and patch CXXFLAGS\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/VS2019/astcenc-avx2.vcxproj",
"new_path": "Source/VS2019/astcenc-avx2.vcxproj",
"diff": "<ClCompile Include=\"..\\astcenc_partition_tables.cpp\" />\n<ClCompile Include=\"..\\astcenc_percentile_tables.cpp\" />\n<ClCompile Include=\"..\\astcenc_pick_best_endpoint_format.cpp\" />\n- <ClCompile Include=\"..\\astcenc_platform_dependents.cpp\" />\n<ClCompile Include=\"..\\astcenc_platform_isa_detection.cpp\" />\n<ClCompile Include=\"..\\astcenc_quantization.cpp\" />\n<ClCompile Include=\"..\\astcenc_symbolic_physical.cpp\" />\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n<StringPooling>true</StringPooling>\n+ <LanguageStandard>stdcpp17</LanguageStandard>\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/VS2019/astcenc-sse2.vcxproj",
"new_path": "Source/VS2019/astcenc-sse2.vcxproj",
"diff": "<ClCompile Include=\"..\\astcenc_partition_tables.cpp\" />\n<ClCompile Include=\"..\\astcenc_percentile_tables.cpp\" />\n<ClCompile Include=\"..\\astcenc_pick_best_endpoint_format.cpp\" />\n- <ClCompile Include=\"..\\astcenc_platform_dependents.cpp\" />\n<ClCompile Include=\"..\\astcenc_platform_isa_detection.cpp\" />\n<ClCompile Include=\"..\\astcenc_quantization.cpp\" />\n<ClCompile Include=\"..\\astcenc_symbolic_physical.cpp\" />\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n<StringPooling>true</StringPooling>\n+ <LanguageStandard>stdcpp17</LanguageStandard>\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/VS2019/astcenc-sse4.2.vcxproj",
"new_path": "Source/VS2019/astcenc-sse4.2.vcxproj",
"diff": "<ClCompile Include=\"..\\astcenc_partition_tables.cpp\" />\n<ClCompile Include=\"..\\astcenc_percentile_tables.cpp\" />\n<ClCompile Include=\"..\\astcenc_pick_best_endpoint_format.cpp\" />\n- <ClCompile Include=\"..\\astcenc_platform_dependents.cpp\" />\n<ClCompile Include=\"..\\astcenc_platform_isa_detection.cpp\" />\n<ClCompile Include=\"..\\astcenc_quantization.cpp\" />\n<ClCompile Include=\"..\\astcenc_symbolic_physical.cpp\" />\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n<StringPooling>true</StringPooling>\n+ <LanguageStandard>stdcpp17</LanguageStandard>\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Bump to C++17 to get aligned new variants
|
61,745 |
06.07.2020 14:22:32
| -3,600 |
cf098db3a21ed10649abaff351de351550cd6a55
|
Use C++17 in Debug and Release for MSVC
|
[
{
"change_type": "MODIFY",
"old_path": ".gitattributes",
"new_path": ".gitattributes",
"diff": "@@ -10,6 +10,7 @@ Jenkinsfile text\n# VS solution always use Windows line endings\n*.sln text eol=crlf\n+*.vcxproj text eol=crlf\n# Denote all files that are truly binary and should not be modified.\n*.png binary\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/VS2019/astcenc-avx2.vcxproj",
"new_path": "Source/VS2019/astcenc-avx2.vcxproj",
"diff": "</PrecompiledHeader>\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n+ <LanguageStandard>stdcpp17</LanguageStandard>\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/VS2019/astcenc-sse2.vcxproj",
"new_path": "Source/VS2019/astcenc-sse2.vcxproj",
"diff": "</PrecompiledHeader>\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n+ <LanguageStandard>stdcpp17</LanguageStandard>\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n"
},
{
"change_type": "MODIFY",
"old_path": "Source/VS2019/astcenc-sse4.2.vcxproj",
"new_path": "Source/VS2019/astcenc-sse4.2.vcxproj",
"diff": "</PrecompiledHeader>\n<WarningLevel>Level3</WarningLevel>\n<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n+ <LanguageStandard>stdcpp17</LanguageStandard>\n</ClCompile>\n<Link>\n<GenerateDebugInformation>true</GenerateDebugInformation>\n"
}
] |
C
|
Apache License 2.0
|
arm-software/astc-encoder
|
Use C++17 in Debug and Release for MSVC
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.