Skip to content

Commit

Permalink
Update 3rd libs (axmolengine#2411)
Browse files Browse the repository at this point in the history
- astcenc to 5.2.0
- openssl to 3.0.16
- curl to 8.12.1
- png to 1.6.47
  • Loading branch information
halx99 authored Feb 22, 2025
1 parent c6cd800 commit 0cd7af9
Show file tree
Hide file tree
Showing 31 changed files with 1,984 additions and 3,068 deletions.
8 changes: 4 additions & 4 deletions 3rdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## astcenc
- [![Upstream](https://img.shields.io/github/v/release/ARM-software/astc-encoder?label=Upstream)](https://github.com/ARM-software/astc-encoder)
- Version: 5.1.0
- Version: 5.2.0
- License: Apache-2.0

## Box2D
Expand Down Expand Up @@ -47,7 +47,7 @@

## curl
- [![Upstream](https://img.shields.io/github/v/release/curl/curl?label=Upstream)](https://github.com/curl/curl)
- Version: 8.11.1
- Version: 8.12.1
- License: Curl (MIT/X)

## doctest
Expand Down Expand Up @@ -180,12 +180,12 @@

## OpenSSL
- [![Upstream](https://img.shields.io/github/v/tag/openssl/openssl?label=Upstream)](https://github.com/openssl/openssl)
- Version: 3.0.15
- Version: 3.0.16
- License: Apache-2.0

## png
- [![Upstream](https://img.shields.io/github/v/tag/glennrp/libpng?label=Upstream)](https://github.com/glennrp/libpng)
- Version: 1.6.46
- Version: 1.6.47
- License: PNG Reference Library License version 2

## poly2tri
Expand Down
16 changes: 15 additions & 1 deletion 3rdparty/astcenc/astcenc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// ----------------------------------------------------------------------------
// Copyright 2020-2024 Arm Limited
// Copyright 2020-2025 Arm Limited
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -784,6 +784,20 @@ ASTCENC_PUBLIC astcenc_error astcenc_compress_image(
ASTCENC_PUBLIC astcenc_error astcenc_compress_reset(
astcenc_context* context);

/**
* @brief Cancel any pending compression operation.
*
* The caller must behave as if the compression completed normally, even though the data will be
* undefined. They are still responsible for synchronizing threads in the worker thread pool, and
* must call reset before starting another compression.
*
* @param context Codec context.
*
* @return @c ASTCENC_SUCCESS on success, or an error if cancellation failed.
*/
ASTCENC_PUBLIC astcenc_error astcenc_compress_cancel(
astcenc_context* context);

/**
* @brief Decompress an image.
*
Expand Down
11 changes: 2 additions & 9 deletions 3rdparty/astcenc/astcenc_color_unquantize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,15 +925,8 @@ void unpack_color_endpoints(
alpha_hdr = false;
}

vmask4 mask(true, true, true, false);

vint4 output0rgb = lsl<8>(output0) | vint4(0x80);
vint4 output0a = output0 * 257;
output0 = select(output0a, output0rgb, mask);

vint4 output1rgb = lsl<8>(output1) | vint4(0x80);
vint4 output1a = output1 * 257;
output1 = select(output1a, output1rgb, mask);
output0 = lsl<8>(output0) | vint4(0x80);
output1 = lsl<8>(output1) | vint4(0x80);
}
// An HDR profile decode, but may be using linear LDR endpoints
// Linear LDR 8-bit endpoints are expanded to 16-bit by replication
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/astcenc/astcenc_compress_symbolic.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// ----------------------------------------------------------------------------
// Copyright 2011-2024 Arm Limited
// Copyright 2011-2025 Arm Limited
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -1280,7 +1280,7 @@ void compress_block(
1.0f
};

static const float errorval_overshoot = 1.0f / ctx.config.tune_mse_overshoot;
const float errorval_overshoot = 1.0f / ctx.config.tune_mse_overshoot;

// Only enable MODE0 fast path if enabled
// Never enable for 3D blocks as no "always" block modes are available
Expand Down
25 changes: 24 additions & 1 deletion 3rdparty/astcenc/astcenc_entry.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// ----------------------------------------------------------------------------
// Copyright 2011-2024 Arm Limited
// Copyright 2011-2025 Arm Limited
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -1123,6 +1123,29 @@ astcenc_error astcenc_compress_reset(
#endif
}

/* See header for documentation. */
astcenc_error astcenc_compress_cancel(
astcenc_context* ctxo
) {
#if defined(ASTCENC_DECOMPRESS_ONLY)
(void)ctxo;
return ASTCENC_ERR_BAD_CONTEXT;
#else
astcenc_contexti* ctx = &ctxo->context;
if (ctx->config.flags & ASTCENC_FLG_DECOMPRESS_ONLY)
{
return ASTCENC_ERR_BAD_CONTEXT;
}

// Cancel compression before cancelling avg. This avoids the race condition
// where cancelling them in the other order could see a compression worker
// starting to process even though some of the avg data is undefined.
ctxo->manage_compress.cancel();
ctxo->manage_avg.cancel();
return ASTCENC_SUCCESS;
#endif
}

/* See header for documentation. */
astcenc_error astcenc_decompress_image(
astcenc_context* ctxo,
Expand Down
14 changes: 4 additions & 10 deletions 3rdparty/astcenc/astcenc_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1583,19 +1583,13 @@ static inline vmask4 get_u8_component_mask(
astcenc_profile decode_mode,
const image_block& blk
) {
vmask4 u8_mask(false);
// Decode mode writing to a unorm8 output value
if (blk.decode_unorm8)
// Decode mode or sRGB forces writing to unorm8 output value
if (blk.decode_unorm8 || decode_mode == ASTCENC_PRF_LDR_SRGB)
{
u8_mask = vmask4(true);
}
// SRGB writing to a unorm8 RGB value
else if (decode_mode == ASTCENC_PRF_LDR_SRGB)
{
u8_mask = vmask4(true, true, true, false);
return vmask4(true);
}

return u8_mask;
return vmask4(false);
}

/**
Expand Down
37 changes: 26 additions & 11 deletions 3rdparty/astcenc/astcenc_internal_entry.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// ----------------------------------------------------------------------------
// Copyright 2011-2024 Arm Limited
// Copyright 2011-2025 Arm Limited
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -100,6 +100,9 @@ class ParallelManager
/** @brief Lock used for critical section and condition synchronization. */
std::mutex m_lock;

/** @brief True if the current operation is cancelled. */
std::atomic<bool> m_is_cancelled;

/** @brief True if the stage init() step has been executed. */
bool m_init_done;

Expand Down Expand Up @@ -147,6 +150,7 @@ class ParallelManager
{
m_init_done = false;
m_term_done = false;
m_is_cancelled = false;
m_start_count = 0;
m_done_count = 0;
m_task_count = 0;
Expand All @@ -155,6 +159,16 @@ class ParallelManager
m_callback_min_diff = 1.0f;
}

/**
* @brief Clear the tracker and stop new tasks being assigned.
*
* Note, all in-flight tasks in a worker will still complete normally.
*/
void cancel()
{
m_is_cancelled = true;
}

/**
* @brief Trigger the pipeline stage init step.
*
Expand Down Expand Up @@ -211,7 +225,7 @@ class ParallelManager
unsigned int get_task_assignment(unsigned int granule, unsigned int& count)
{
unsigned int base = m_start_count.fetch_add(granule, std::memory_order_relaxed);
if (base >= m_task_count)
if (m_is_cancelled || base >= m_task_count)
{
count = 0;
return 0;
Expand Down Expand Up @@ -241,16 +255,17 @@ class ParallelManager
local_count = m_done_count;
local_last_value = m_callback_last_value;

if (m_done_count == m_task_count)
// Ensure the progress bar hits 100%
if (m_callback && m_done_count == m_task_count)
{
// Ensure the progress bar hits 100%
if (m_callback)
{
std::unique_lock<std::mutex> cblck(m_callback_lock);
m_callback(100.0f);
m_callback_last_value = 100.0f;
}
std::unique_lock<std::mutex> cblck(m_callback_lock);
m_callback(100.0f);
m_callback_last_value = 100.0f;
}

// Notify if nothing left to do
if (m_is_cancelled || m_done_count == m_task_count)
{
lck.unlock();
m_complete.notify_all();
}
Expand Down Expand Up @@ -285,7 +300,7 @@ class ParallelManager
void wait()
{
std::unique_lock<std::mutex> lck(m_lock);
m_complete.wait(lck, [this]{ return m_done_count == m_task_count; });
m_complete.wait(lck, [this]{ return m_is_cancelled || m_done_count == m_task_count; });
}

/**
Expand Down
9 changes: 0 additions & 9 deletions 3rdparty/astcenc/astcenc_vecmathlib_neon_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,15 +582,6 @@ ASTCENC_SIMD_INLINE vint4 hmax(vint4 a)
return vint4(vmaxvq_s32(a.m));
}

/**
* @brief Return the horizontal sum of a vector.
*/
ASTCENC_SIMD_INLINE int hadd_s(vint4 a)
{
int32x2_t t = vadd_s32(vget_high_s32(a.m), vget_low_s32(a.m));
return vget_lane_s32(vpadd_s32(t, t), 0);
}

/**
* @brief Store a vector to a 16B aligned memory address.
*/
Expand Down
8 changes: 0 additions & 8 deletions 3rdparty/astcenc/astcenc_vecmathlib_none_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,6 @@ ASTCENC_SIMD_INLINE vint4 hmax(vint4 a)
return vint4(std::max(b, c));
}

/**
* @brief Return the horizontal sum of vector lanes as a scalar.
*/
ASTCENC_SIMD_INLINE int hadd_s(vint4 a)
{
return a.m[0] + a.m[1] + a.m[2] + a.m[3];
}

/**
* @brief Store a vector to an aligned memory address.
*/
Expand Down
16 changes: 0 additions & 16 deletions 3rdparty/astcenc/astcenc_vecmathlib_sse_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,22 +621,6 @@ ASTCENC_SIMD_INLINE vint4 hmax(vint4 a)
return a;
}

/**
* @brief Return the horizontal sum of a vector as a scalar.
*/
ASTCENC_SIMD_INLINE int hadd_s(vint4 a)
{
// Add top and bottom halves, lane 1/0
__m128i fold = _mm_castps_si128(_mm_movehl_ps(_mm_castsi128_ps(a.m),
_mm_castsi128_ps(a.m)));
__m128i t = _mm_add_epi32(a.m, fold);

// Add top and bottom halves, lane 0 (_mm_hadd_ps exists but slow)
t = _mm_add_epi32(t, _mm_shuffle_epi32(t, 0x55));

return _mm_cvtsi128_si32(t);
}

/**
* @brief Store a vector to a 16B aligned memory address.
*/
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/png/README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
README for libpng version 1.6.46
README for libpng version 1.6.47
================================

See the note about version numbers near the top of `png.h`.
Expand Down
Loading

0 comments on commit 0cd7af9

Please sign in to comment.