Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Source/Fuzzers/fuzz_astc_decompress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ extern "C" int LLVMFuzzerTestOneInput(
// Randomize quality
float quality = fdp.ConsumeFloatingPointInRange<float>(ASTCENC_PRE_FASTEST, ASTCENC_PRE_EXHAUSTIVE);

// Randomize flags
// Randomize flags, but constrain to be safe with arbitrary input data
unsigned int flags = fdp.ConsumeIntegralInRange<unsigned int>(0, ASTCENC_ALL_FLAGS);
flags &= ~ASTCENC_FLG_SELF_DECOMPRESS_ONLY;

// Ensure we don't use flags incompatible with decompress-only if we were to use that,
// but here we are using a general context.
astcenc_config config;
astcenc_error status = astcenc_config_init(profile, block_x, block_y, block_z, quality, flags, &config);
if (status != ASTCENC_SUCCESS) {
if (status != ASTCENC_SUCCESS)
{
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/astcenc.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
* When using the normal map compression mode ASTC will store normals as a two component X+Y map.
* Input images must contain unit-length normalized and should be passed in using a two component
* swizzle. The astcenc command line tool defaults to an RRRG swizzle, but some developers prefer
* to use GGGR for compatability with BC5n which will work just as well. The Z component can be
* to use GGGR for compatibility with BC5n which will work just as well. The Z component can be
* recovered programmatically in shader code, using knowledge that the vector is unit length and
* that Z must be positive for a tangent-space normal map.
*
Expand Down
10 changes: 6 additions & 4 deletions Source/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-2025 Arm Limited
// Copyright 2011-2026 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 @@ -431,7 +431,6 @@ static float compress_symbolic_block_for_partition_1plane(
// * Generate an optimized set of quantized weights
// * Compute quantization errors for the mode


static const int8_t free_bits_for_partition_count[4] {
115 - 4, 111 - 4 - PARTITION_INDEX_BITS, 108 - 4 - PARTITION_INDEX_BITS, 105 - 4 - PARTITION_INDEX_BITS
};
Expand Down Expand Up @@ -1304,8 +1303,11 @@ void compress_block(
1, 0, scb, tmpbuf, QUANT_32);

// Record the quant level so we can use the filter later searches
const auto& bm = bsd.get_block_mode(scb.block_mode);
quant_limit = bm.get_weight_quant_mode();
if (scb.block_type != SYM_BTYPE_ERROR)
{
const auto& bm = bsd.get_block_mode(scb.block_mode);
quant_limit = bm.get_weight_quant_mode();
}

best_errorvals_for_pcount[0] = astc::min(best_errorvals_for_pcount[0], errorval);
if (errorval < (error_threshold * errorval_mult[i]))
Expand Down
Loading