diff options
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/skcms/skcms.cc (renamed from third_party/skcms/skcms.c) | 180 | ||||
-rw-r--r-- | third_party/skcms/skcms.gni | 2 | ||||
-rw-r--r-- | third_party/skcms/src/Transform_inl.h | 36 | ||||
-rwxr-xr-x | third_party/skcms/version.sha1 | 2 |
4 files changed, 112 insertions, 108 deletions
diff --git a/third_party/skcms/skcms.c b/third_party/skcms/skcms.cc index 99b05cbca0..41a67ff0a2 100644 --- a/third_party/skcms/skcms.c +++ b/third_party/skcms/skcms.cc @@ -20,6 +20,9 @@ // (We have no way of enforcing these requests...) #define SAFE_SIZEOF(x) ((uint64_t)sizeof(x)) +// Same sort of thing for _Layout structs with a variable sized array at the end (named "variable"). +#define SAFE_FIXED_SIZE(type) ((uint64_t)offsetof(type, variable)) + static const union { uint32_t bits; float f; @@ -252,12 +255,12 @@ typedef struct { uint8_t reserved_a [4]; uint8_t function_type [2]; uint8_t reserved_b [2]; - uint8_t parameters [ ]; // 1, 3, 4, 5, or 7 s15.16 parameters, depending on function_type + uint8_t variable [1/*variable*/]; // 1, 3, 4, 5, or 7 s15.16, depending on function_type } para_Layout; static bool read_curve_para(const uint8_t* buf, uint32_t size, skcms_Curve* curve, uint32_t* curve_size) { - if (size < SAFE_SIZEOF(para_Layout)) { + if (size < SAFE_FIXED_SIZE(para_Layout)) { return false; } @@ -270,12 +273,12 @@ static bool read_curve_para(const uint8_t* buf, uint32_t size, } static const uint32_t curve_bytes[] = { 4, 12, 16, 20, 28 }; - if (size < SAFE_SIZEOF(para_Layout) + curve_bytes[function_type]) { + if (size < SAFE_FIXED_SIZE(para_Layout) + curve_bytes[function_type]) { return false; } if (curve_size) { - *curve_size = SAFE_SIZEOF(para_Layout) + curve_bytes[function_type]; + *curve_size = SAFE_FIXED_SIZE(para_Layout) + curve_bytes[function_type]; } curve->table_entries = 0; @@ -285,21 +288,21 @@ static bool read_curve_para(const uint8_t* buf, uint32_t size, curve->parametric.d = 0.0f; curve->parametric.e = 0.0f; curve->parametric.f = 0.0f; - curve->parametric.g = read_big_fixed(paraTag->parameters); + curve->parametric.g = read_big_fixed(paraTag->variable); switch (function_type) { case kGAB: - curve->parametric.a = read_big_fixed(paraTag->parameters + 4); - curve->parametric.b = read_big_fixed(paraTag->parameters + 8); + curve->parametric.a = read_big_fixed(paraTag->variable + 4); + curve->parametric.b = read_big_fixed(paraTag->variable + 8); if (curve->parametric.a == 0) { return false; } curve->parametric.d = -curve->parametric.b / curve->parametric.a; break; case kGABC: - curve->parametric.a = read_big_fixed(paraTag->parameters + 4); - curve->parametric.b = read_big_fixed(paraTag->parameters + 8); - curve->parametric.e = read_big_fixed(paraTag->parameters + 12); + curve->parametric.a = read_big_fixed(paraTag->variable + 4); + curve->parametric.b = read_big_fixed(paraTag->variable + 8); + curve->parametric.e = read_big_fixed(paraTag->variable + 12); if (curve->parametric.a == 0) { return false; } @@ -307,18 +310,18 @@ static bool read_curve_para(const uint8_t* buf, uint32_t size, curve->parametric.f = curve->parametric.e; break; case kGABCD: - curve->parametric.a = read_big_fixed(paraTag->parameters + 4); - curve->parametric.b = read_big_fixed(paraTag->parameters + 8); - curve->parametric.c = read_big_fixed(paraTag->parameters + 12); - curve->parametric.d = read_big_fixed(paraTag->parameters + 16); + curve->parametric.a = read_big_fixed(paraTag->variable + 4); + curve->parametric.b = read_big_fixed(paraTag->variable + 8); + curve->parametric.c = read_big_fixed(paraTag->variable + 12); + curve->parametric.d = read_big_fixed(paraTag->variable + 16); break; case kGABCDEF: - curve->parametric.a = read_big_fixed(paraTag->parameters + 4); - curve->parametric.b = read_big_fixed(paraTag->parameters + 8); - curve->parametric.c = read_big_fixed(paraTag->parameters + 12); - curve->parametric.d = read_big_fixed(paraTag->parameters + 16); - curve->parametric.e = read_big_fixed(paraTag->parameters + 20); - curve->parametric.f = read_big_fixed(paraTag->parameters + 24); + curve->parametric.a = read_big_fixed(paraTag->variable + 4); + curve->parametric.b = read_big_fixed(paraTag->variable + 8); + curve->parametric.c = read_big_fixed(paraTag->variable + 12); + curve->parametric.d = read_big_fixed(paraTag->variable + 16); + curve->parametric.e = read_big_fixed(paraTag->variable + 20); + curve->parametric.f = read_big_fixed(paraTag->variable + 24); break; } return tf_is_valid(&curve->parametric); @@ -328,24 +331,24 @@ typedef struct { uint8_t type [4]; uint8_t reserved [4]; uint8_t value_count [4]; - uint8_t parameters [ ]; // value_count parameters (8.8 if 1, uint16 (n*65535) if > 1) + uint8_t variable [1/*variable*/]; // value_count, 8.8 if 1, uint16 (n*65535) if > 1 } curv_Layout; static bool read_curve_curv(const uint8_t* buf, uint32_t size, skcms_Curve* curve, uint32_t* curve_size) { - if (size < SAFE_SIZEOF(curv_Layout)) { + if (size < SAFE_FIXED_SIZE(curv_Layout)) { return false; } const curv_Layout* curvTag = (const curv_Layout*)buf; uint32_t value_count = read_big_u32(curvTag->value_count); - if (size < SAFE_SIZEOF(curv_Layout) + value_count * SAFE_SIZEOF(uint16_t)) { + if (size < SAFE_FIXED_SIZE(curv_Layout) + value_count * SAFE_SIZEOF(uint16_t)) { return false; } if (curve_size) { - *curve_size = SAFE_SIZEOF(curv_Layout) + value_count * SAFE_SIZEOF(uint16_t); + *curve_size = SAFE_FIXED_SIZE(curv_Layout) + value_count * SAFE_SIZEOF(uint16_t); } if (value_count < 2) { @@ -361,11 +364,11 @@ static bool read_curve_curv(const uint8_t* buf, uint32_t size, curve->parametric.g = 1.0f; } else { // Single entry tables are a shorthand for simple gamma - curve->parametric.g = read_big_u16(curvTag->parameters) * (1.0f / 256.0f); + curve->parametric.g = read_big_u16(curvTag->variable) * (1.0f / 256.0f); } } else { - curve->table_8 = NULL; - curve->table_16 = curvTag->parameters; + curve->table_8 = nullptr; + curve->table_16 = curvTag->variable; curve->table_entries = value_count; } @@ -373,7 +376,7 @@ static bool read_curve_curv(const uint8_t* buf, uint32_t size, } // Parses both curveType and parametricCurveType data. Ensures that at most 'size' bytes are read. -// If curve_size is not NULL, writes the number of bytes used by the curve in (*curve_size). +// If curve_size is not nullptr, writes the number of bytes used by the curve in (*curve_size). static bool read_curve(const uint8_t* buf, uint32_t size, skcms_Curve* curve, uint32_t* curve_size) { if (!buf || size < 4 || !curve) { @@ -402,17 +405,17 @@ typedef struct { } mft_CommonLayout; typedef struct { - mft_CommonLayout common [ 1]; + mft_CommonLayout common [1]; - uint8_t tables [ ]; + uint8_t variable [1/*variable*/]; } mft1_Layout; typedef struct { - mft_CommonLayout common [ 1]; + mft_CommonLayout common [1]; - uint8_t input_table_entries [ 2]; - uint8_t output_table_entries [ 2]; - uint8_t tables [ ]; + uint8_t input_table_entries [2]; + uint8_t output_table_entries [2]; + uint8_t variable [1/*variable*/]; } mft2_Layout; static bool read_mft_common(const mft_CommonLayout* mftTag, skcms_A2B* a2b) { @@ -469,18 +472,18 @@ static bool init_a2b_tables(const uint8_t* table_base, uint64_t max_tables_len, a2b->input_curves[i].table_entries = input_table_entries; if (byte_width == 1) { a2b->input_curves[i].table_8 = table_base + i * byte_len_per_input_table; - a2b->input_curves[i].table_16 = NULL; + a2b->input_curves[i].table_16 = nullptr; } else { - a2b->input_curves[i].table_8 = NULL; + a2b->input_curves[i].table_8 = nullptr; a2b->input_curves[i].table_16 = table_base + i * byte_len_per_input_table; } } if (byte_width == 1) { a2b->grid_8 = table_base + byte_len_all_input_tables; - a2b->grid_16 = NULL; + a2b->grid_16 = nullptr; } else { - a2b->grid_8 = NULL; + a2b->grid_8 = nullptr; a2b->grid_16 = table_base + byte_len_all_input_tables; } @@ -489,9 +492,9 @@ static bool init_a2b_tables(const uint8_t* table_base, uint64_t max_tables_len, a2b->output_curves[i].table_entries = output_table_entries; if (byte_width == 1) { a2b->output_curves[i].table_8 = output_table_base + i * byte_len_per_output_table; - a2b->output_curves[i].table_16 = NULL; + a2b->output_curves[i].table_16 = nullptr; } else { - a2b->output_curves[i].table_8 = NULL; + a2b->output_curves[i].table_8 = nullptr; a2b->output_curves[i].table_16 = output_table_base + i * byte_len_per_output_table; } } @@ -500,7 +503,7 @@ static bool init_a2b_tables(const uint8_t* table_base, uint64_t max_tables_len, } static bool read_tag_mft1(const skcms_ICCTag* tag, skcms_A2B* a2b) { - if (tag->size < SAFE_SIZEOF(mft1_Layout)) { + if (tag->size < SAFE_FIXED_SIZE(mft1_Layout)) { return false; } @@ -512,12 +515,12 @@ static bool read_tag_mft1(const skcms_ICCTag* tag, skcms_A2B* a2b) { uint32_t input_table_entries = 256; uint32_t output_table_entries = 256; - return init_a2b_tables(mftTag->tables, tag->size - SAFE_SIZEOF(mft1_Layout), 1, + return init_a2b_tables(mftTag->variable, tag->size - SAFE_FIXED_SIZE(mft1_Layout), 1, input_table_entries, output_table_entries, a2b); } static bool read_tag_mft2(const skcms_ICCTag* tag, skcms_A2B* a2b) { - if (tag->size < SAFE_SIZEOF(mft2_Layout)) { + if (tag->size < SAFE_FIXED_SIZE(mft2_Layout)) { return false; } @@ -535,7 +538,7 @@ static bool read_tag_mft2(const skcms_ICCTag* tag, skcms_A2B* a2b) { return false; } - return init_a2b_tables(mftTag->tables, tag->size - SAFE_SIZEOF(mft2_Layout), 2, + return init_a2b_tables(mftTag->variable, tag->size - SAFE_FIXED_SIZE(mft2_Layout), 2, input_table_entries, output_table_entries, a2b); } @@ -583,7 +586,7 @@ typedef struct { uint8_t grid_points [16]; uint8_t grid_byte_width [ 1]; uint8_t reserved [ 3]; - uint8_t data [ ]; + uint8_t variable [1/*variable*/]; } mABCLUT_Layout; static bool read_tag_mab(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xyz) { @@ -667,17 +670,17 @@ static bool read_tag_mab(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xy return false; } - if (tag->size < clut_offset + SAFE_SIZEOF(mABCLUT_Layout)) { + if (tag->size < clut_offset + SAFE_FIXED_SIZE(mABCLUT_Layout)) { return false; } const mABCLUT_Layout* clut = (const mABCLUT_Layout*)(tag->buf + clut_offset); if (clut->grid_byte_width[0] == 1) { - a2b->grid_8 = clut->data; - a2b->grid_16 = NULL; + a2b->grid_8 = clut->variable; + a2b->grid_16 = nullptr; } else if (clut->grid_byte_width[0] == 2) { - a2b->grid_8 = NULL; - a2b->grid_16 = clut->data; + a2b->grid_8 = nullptr; + a2b->grid_16 = clut->variable; } else { return false; } @@ -691,7 +694,7 @@ static bool read_tag_mab(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xy } grid_size *= a2b->grid_points[i]; } - if (tag->size < clut_offset + SAFE_SIZEOF(mABCLUT_Layout) + grid_size) { + if (tag->size < clut_offset + SAFE_FIXED_SIZE(mABCLUT_Layout) + grid_size) { return false; } } else { @@ -770,16 +773,16 @@ static bool read_a2b(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xyz) { // Detect and canonicalize identity tables. skcms_Curve* curves[] = { - a2b->input_channels > 0 ? a2b->input_curves + 0 : NULL, - a2b->input_channels > 1 ? a2b->input_curves + 1 : NULL, - a2b->input_channels > 2 ? a2b->input_curves + 2 : NULL, - a2b->input_channels > 3 ? a2b->input_curves + 3 : NULL, - a2b->matrix_channels > 0 ? a2b->matrix_curves + 0 : NULL, - a2b->matrix_channels > 1 ? a2b->matrix_curves + 1 : NULL, - a2b->matrix_channels > 2 ? a2b->matrix_curves + 2 : NULL, - a2b->output_channels > 0 ? a2b->output_curves + 0 : NULL, - a2b->output_channels > 1 ? a2b->output_curves + 1 : NULL, - a2b->output_channels > 2 ? a2b->output_curves + 2 : NULL, + a2b->input_channels > 0 ? a2b->input_curves + 0 : nullptr, + a2b->input_channels > 1 ? a2b->input_curves + 1 : nullptr, + a2b->input_channels > 2 ? a2b->input_curves + 2 : nullptr, + a2b->input_channels > 3 ? a2b->input_curves + 3 : nullptr, + a2b->matrix_channels > 0 ? a2b->matrix_curves + 0 : nullptr, + a2b->matrix_channels > 1 ? a2b->matrix_curves + 1 : nullptr, + a2b->matrix_channels > 2 ? a2b->matrix_curves + 2 : nullptr, + a2b->output_channels > 0 ? a2b->output_curves + 0 : nullptr, + a2b->output_channels > 1 ? a2b->output_curves + 1 : nullptr, + a2b->output_channels > 2 ? a2b->output_curves + 2 : nullptr, }; for (int i = 0; i < ARRAY_COUNT(curves); i++) { @@ -793,9 +796,9 @@ static bool read_a2b(const skcms_ICCTag* tag, skcms_A2B* a2b, bool pcs_is_xyz) { && c == 1.0f && f == 0.0f) { curve->table_entries = 0; - curve->table_8 = NULL; - curve->table_16 = NULL; - curve->parametric = (skcms_TransferFunction){1,1,0,0,0,0,0}; + curve->table_8 = nullptr; + curve->table_16 = nullptr; + curve->parametric = skcms_TransferFunction{1,1,0,0,0,0,0}; } } } @@ -896,7 +899,7 @@ bool skcms_Parse(const void* buf, size_t len, skcms_ICCProfile* profile) { skcms_ICCTag kTRC; if (profile->data_color_space == skcms_Signature_Gray && skcms_GetTagBySignature(profile, skcms_Signature_kTRC, &kTRC)) { - if (!read_curve(kTRC.buf, kTRC.size, &profile->trc[0], NULL)) { + if (!read_curve(kTRC.buf, kTRC.size, &profile->trc[0], nullptr)) { // Malformed tag return false; } @@ -915,9 +918,9 @@ bool skcms_Parse(const void* buf, size_t len, skcms_ICCProfile* profile) { if (skcms_GetTagBySignature(profile, skcms_Signature_rTRC, &rTRC) && skcms_GetTagBySignature(profile, skcms_Signature_gTRC, &gTRC) && skcms_GetTagBySignature(profile, skcms_Signature_bTRC, &bTRC)) { - if (!read_curve(rTRC.buf, rTRC.size, &profile->trc[0], NULL) || - !read_curve(gTRC.buf, gTRC.size, &profile->trc[1], NULL) || - !read_curve(bTRC.buf, bTRC.size, &profile->trc[2], NULL)) { + if (!read_curve(rTRC.buf, rTRC.size, &profile->trc[0], nullptr) || + !read_curve(gTRC.buf, gTRC.size, &profile->trc[1], nullptr) || + !read_curve(bTRC.buf, bTRC.size, &profile->trc[2], nullptr)) { // Malformed TRC tags return false; } @@ -960,7 +963,7 @@ bool skcms_Parse(const void* buf, size_t len, skcms_ICCProfile* profile) { const skcms_ICCProfile* skcms_sRGB_profile() { static const skcms_ICCProfile sRGB_profile = { - NULL, // buffer, moot here + nullptr, // buffer, moot here 0, // size, moot here skcms_Signature_RGB, // data_color_space @@ -993,8 +996,8 @@ const skcms_ICCProfile* skcms_sRGB_profile() { {{0, {1,1, 0,0,0,0,0}}}, }, {0,0,0,0}, - NULL, - NULL, + nullptr, + nullptr, 0, { @@ -1022,7 +1025,7 @@ const skcms_ICCProfile* skcms_sRGB_profile() { const skcms_ICCProfile* skcms_XYZD50_profile() { // Just like sRGB above, but with identity transfer functions and toXYZD50 matrix. static const skcms_ICCProfile XYZD50_profile = { - NULL, // buffer, moot here + nullptr, // buffer, moot here 0, // size, moot here skcms_Signature_RGB, // data_color_space @@ -1053,8 +1056,8 @@ const skcms_ICCProfile* skcms_XYZD50_profile() { {{0, {1,1, 0,0,0,0,0}}}, }, {0,0,0,0}, - NULL, - NULL, + nullptr, + nullptr, 0, { @@ -1871,8 +1874,8 @@ typedef enum { #define U16 U16x16 #define U8 U8x16 - #define F0 (F){0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0} - #define F1 (F){1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1} + #define F0 F{0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0} + #define F1 F{1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1} #elif defined(__AVX__) #define N 8 @@ -1883,8 +1886,8 @@ typedef enum { #define U16 U16x8 #define U8 U8x8 - #define F0 (F){0,0,0,0, 0,0,0,0} - #define F1 (F){1,1,1,1, 1,1,1,1} + #define F0 F{0,0,0,0, 0,0,0,0} + #define F1 F{1,1,1,1, 1,1,1,1} #else #define N 4 @@ -1895,8 +1898,8 @@ typedef enum { #define U16 U16x4 #define U8 U8x4 - #define F0 (F){0,0,0,0} - #define F1 (F){1,1,1,1} + #define F0 F{0,0,0,0} + #define F1 F{1,1,1,1} #endif #define NS(id) id @@ -1924,8 +1927,8 @@ typedef enum { #define I32 I32x8 #define U16 U16x8 #define U8 U8x8 - #define F0 (F){0,0,0,0, 0,0,0,0} - #define F1 (F){1,1,1,1, 1,1,1,1} + #define F0 F{0,0,0,0, 0,0,0,0} + #define F1 F{1,1,1,1, 1,1,1,1} #define NS(id) id ## _hsw #define ATTR __attribute__((target("avx2,f16c"))) @@ -2024,7 +2027,8 @@ typedef enum { } static bool hsw_ok() { - InitOnceExecuteOnce(&check_hsw_ok_once, check_hsw_ok_InitOnce_wrapper, NULL, NULL); + InitOnceExecuteOnce(&check_hsw_ok_once, check_hsw_ok_InitOnce_wrapper, + nullptr, nullptr); return hsw_ok_; } #else @@ -2059,16 +2063,16 @@ static OpAndArg select_curve_op(const skcms_Curve* curve, int channel) { if (curve->table_entries == 0) { return is_identity_tf(&curve->parametric) - ? (OpAndArg){ Op_noop, NULL } - : (OpAndArg){ ops[channel].parametric, &curve->parametric }; + ? OpAndArg{ Op_noop, nullptr } + : OpAndArg{ ops[channel].parametric, &curve->parametric }; } else if (curve->table_8) { - return (OpAndArg){ ops[channel].table_8, curve }; + return OpAndArg{ ops[channel].table_8, curve }; } else if (curve->table_16) { - return (OpAndArg){ ops[channel].table_16, curve }; + return OpAndArg{ ops[channel].table_16, curve }; } assert(false); - return (OpAndArg){Op_noop,NULL}; + return OpAndArg{Op_noop,nullptr}; } static size_t bytes_per_pixel(skcms_PixelFormat fmt) { diff --git a/third_party/skcms/skcms.gni b/third_party/skcms/skcms.gni index 2cfe2fbe68..a3def6e9b5 100644 --- a/third_party/skcms/skcms.gni +++ b/third_party/skcms/skcms.gni @@ -4,7 +4,7 @@ # found in the LICENSE file. skcms_sources = [ - "skcms.c", + "skcms.cc", "skcms.h", "skcms_internal.h", "src/Transform_inl.h", diff --git a/third_party/skcms/src/Transform_inl.h b/third_party/skcms/src/Transform_inl.h index 6dc2a7950f..09183bfd42 100644 --- a/third_party/skcms/src/Transform_inl.h +++ b/third_party/skcms/src/Transform_inl.h @@ -72,12 +72,12 @@ #elif defined(__clang__) #define CAST(T, v) __builtin_convertvector((v), T) #elif N == 4 - #define CAST(T, v) (T){(v)[0],(v)[1],(v)[2],(v)[3]} + #define CAST(T, v) T{(v)[0],(v)[1],(v)[2],(v)[3]} #elif N == 8 - #define CAST(T, v) (T){(v)[0],(v)[1],(v)[2],(v)[3], (v)[4],(v)[5],(v)[6],(v)[7]} + #define CAST(T, v) T{(v)[0],(v)[1],(v)[2],(v)[3], (v)[4],(v)[5],(v)[6],(v)[7]} #elif N == 16 - #define CAST(T, v) (T){(v)[0],(v)[1],(v)[ 2],(v)[ 3], (v)[ 4],(v)[ 5],(v)[ 6],(v)[ 7], \ - (v)[8],(v)[9],(v)[10],(v)[11], (v)[12],(v)[13],(v)[14],(v)[15]} + #define CAST(T, v) T{(v)[0],(v)[1],(v)[ 2],(v)[ 3], (v)[ 4],(v)[ 5],(v)[ 6],(v)[ 7], \ + (v)[8],(v)[9],(v)[10],(v)[11], (v)[12],(v)[13],(v)[14],(v)[15]} #endif // When we convert from float to fixed point, it's very common to want to round, @@ -247,28 +247,28 @@ SI ATTR F NS(apply_tf_)(const skcms_TransferFunction* tf, F x) { #define STORE_3(p, v) (p)[0] = v #define STORE_4(p, v) (p)[0] = v #elif N == 4 && !defined(USING_NEON) - #define LOAD_3(T, p) (T){(p)[0], (p)[3], (p)[6], (p)[ 9]} - #define LOAD_4(T, p) (T){(p)[0], (p)[4], (p)[8], (p)[12]}; + #define LOAD_3(T, p) T{(p)[0], (p)[3], (p)[6], (p)[ 9]} + #define LOAD_4(T, p) T{(p)[0], (p)[4], (p)[8], (p)[12]}; #define STORE_3(p, v) (p)[0] = (v)[0]; (p)[3] = (v)[1]; (p)[6] = (v)[2]; (p)[ 9] = (v)[3] #define STORE_4(p, v) (p)[0] = (v)[0]; (p)[4] = (v)[1]; (p)[8] = (v)[2]; (p)[12] = (v)[3] #elif N == 8 - #define LOAD_3(T, p) (T){(p)[0], (p)[3], (p)[6], (p)[ 9], (p)[12], (p)[15], (p)[18], (p)[21]} - #define LOAD_4(T, p) (T){(p)[0], (p)[4], (p)[8], (p)[12], (p)[16], (p)[20], (p)[24], (p)[28]} + #define LOAD_3(T, p) T{(p)[0], (p)[3], (p)[6], (p)[ 9], (p)[12], (p)[15], (p)[18], (p)[21]} + #define LOAD_4(T, p) T{(p)[0], (p)[4], (p)[8], (p)[12], (p)[16], (p)[20], (p)[24], (p)[28]} #define STORE_3(p, v) (p)[ 0] = (v)[0]; (p)[ 3] = (v)[1]; (p)[ 6] = (v)[2]; (p)[ 9] = (v)[3]; \ (p)[12] = (v)[4]; (p)[15] = (v)[5]; (p)[18] = (v)[6]; (p)[21] = (v)[7] #define STORE_4(p, v) (p)[ 0] = (v)[0]; (p)[ 4] = (v)[1]; (p)[ 8] = (v)[2]; (p)[12] = (v)[3]; \ (p)[16] = (v)[4]; (p)[20] = (v)[5]; (p)[24] = (v)[6]; (p)[28] = (v)[7] #elif N == 16 // TODO: revisit with AVX-512 gathers and scatters? - #define LOAD_3(T, p) (T){(p)[ 0], (p)[ 3], (p)[ 6], (p)[ 9], \ - (p)[12], (p)[15], (p)[18], (p)[21], \ - (p)[24], (p)[27], (p)[30], (p)[33], \ - (p)[36], (p)[39], (p)[42], (p)[45]} + #define LOAD_3(T, p) T{(p)[ 0], (p)[ 3], (p)[ 6], (p)[ 9], \ + (p)[12], (p)[15], (p)[18], (p)[21], \ + (p)[24], (p)[27], (p)[30], (p)[33], \ + (p)[36], (p)[39], (p)[42], (p)[45]} - #define LOAD_4(T, p) (T){(p)[ 0], (p)[ 4], (p)[ 8], (p)[12], \ - (p)[16], (p)[20], (p)[24], (p)[28], \ - (p)[32], (p)[36], (p)[40], (p)[44], \ - (p)[48], (p)[52], (p)[56], (p)[60]} + #define LOAD_4(T, p) T{(p)[ 0], (p)[ 4], (p)[ 8], (p)[12], \ + (p)[16], (p)[20], (p)[24], (p)[28], \ + (p)[32], (p)[36], (p)[40], (p)[44], \ + (p)[48], (p)[52], (p)[56], (p)[60]} #define STORE_3(p, v) \ (p)[ 0] = (v)[ 0]; (p)[ 3] = (v)[ 1]; (p)[ 6] = (v)[ 2]; (p)[ 9] = (v)[ 3]; \ @@ -389,11 +389,11 @@ SI ATTR U32 NS(gather_24_)(const uint8_t* p, I32 ix) { #if N == 1 *v = load_48_64(p,ix); #elif N == 4 - *v = (U64){ + *v = U64{ load_48_64(p,ix[0]), load_48_64(p,ix[1]), load_48_64(p,ix[2]), load_48_64(p,ix[3]), }; #elif N == 8 && !defined(__AVX2__) - *v = (U64){ + *v = U64{ load_48_64(p,ix[0]), load_48_64(p,ix[1]), load_48_64(p,ix[2]), load_48_64(p,ix[3]), load_48_64(p,ix[4]), load_48_64(p,ix[5]), load_48_64(p,ix[6]), load_48_64(p,ix[7]), }; diff --git a/third_party/skcms/version.sha1 b/third_party/skcms/version.sha1 index c6dcd2b8fa..06fca98b00 100755 --- a/third_party/skcms/version.sha1 +++ b/third_party/skcms/version.sha1 @@ -1 +1 @@ -f447e42de7255d262856aa710e84553a906e872b
\ No newline at end of file +8342d776db5a2be1ce1e2c08a1f69c75d2b84425
\ No newline at end of file |