google / astc-codec Goto Github PK
View Code? Open in Web Editor NEWA software ASTC decoder implementation which supports the ASTC LDR profile
License: Apache License 2.0
A software ASTC decoder implementation which supports the ASTC LDR profile
License: Apache License 2.0
if (kBytesPerPixelUNORM8 * width > out_buffer_stride ||
out_buffer_stride * height < out_buffer_size) {
// Output buffer too small.
return false;
}
If I pass in a buffer with exactly the right size, this would fail. If I passed in a buffer much larger than required, it would also fail? Seems like the logic is inverted on the second condition - unless I'm missing something?
astc-codec/src/decoder/endpoint_codec.cc
Line 79 in b56a500
Hi,
The code to compute 8-bit non-sRGB output doesn't seem to follow the method outlined in the ASTC spec:
const int c = (c0 * (64 - weight) + c1 * weight + 32) / 64;
// TODO(google): Handle conversion to sRGB or FP16 per C.2.19.
const int quantized = ((c * 255) + 32767) / 65536;
assert(quantized < 256);
The spec says "If sRGB conversion is not enabled and the decoding mode is decode_unorm8, then the top 8 bits of the interpolation result for the R, G, B and A channels are used as the final result.":
The difference will be very slight, and I'm not sure if this actually causes any issues at all because the scale factors are so similar. I'm pointing it out here because there's a comment, and because I noticed that the implementation deviates from the spec in a way that could break bit-exact decoding.
Greetings astc-codec developers and contributors,
We’re reaching out because your project is an important part of the open source ecosystem, and we’d like to invite you to integrate with our fuzzing service, OSS-Fuzz. OSS-Fuzz is a free fuzzing infrastructure you can use to identify security vulnerabilities and stability bugs in your project. OSS-Fuzz will:
Many widely used open source projects like OpenSSL, FFmpeg, LibreOffice, and ImageMagick are fuzzing via OSS-Fuzz, which helps them find and remediate critical issues.
We see that you are fuzzing it already. We can help with the integration to OSS-Fuzz with the fuzzer you have.
If you're not interested in integrating with OSS-Fuzz, it would be helpful for us to understand why—lack of interest, lack of time, or something else—so we can better support projects like yours in the future.
If we’ve missed your question in our FAQ, feel free to reply or reach out to us at [email protected].
Thanks!
Tommy
OSS-Fuzz Team
Hi!
I see no restriction described about building this project as shared library, however, I see a linkage error and building:
$ cd build && cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_CXX_FLAGS="-m64" -DCMAKE_SHARED_LINKER_FLAGS="-m64" -DCMAKE_C_FLAGS="-m64" -DBUILD_SHARED_LIBS="ON" -DCMAKE_POSITION_INDEPENDENT_CODE="ON" -DOPTION_ASTC_TESTS="OFF"
-- The C compiler identification is GNU 10.1.0
-- The CXX compiler identification is GNU 10.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Adjusting fPIC flag (ON)
-- Conan: Compiler GCC>=5, checking major version 10
-- Conan: Checking correct version: 10
-- Conan: C++ stdlib: libstdc++11
-- Configuring done
-- Generating done
-- Build files have been written to: /home/uilian/data/astc-codec/build
$ cmake --build .
Scanning dependencies of target footprint
[ 6%] Building CXX object src/decoder/CMakeFiles/footprint.dir/footprint.cc.o
[ 12%] Linking CXX shared library libfootprint.so
[ 12%] Built target footprint
Scanning dependencies of target astc_utils
[ 18%] Building CXX object src/decoder/CMakeFiles/astc_utils.dir/astc_file.cc.o
[ 25%] Building CXX object src/decoder/CMakeFiles/astc_utils.dir/endpoint_codec.cc.o
[ 31%] Building CXX object src/decoder/CMakeFiles/astc_utils.dir/integer_sequence_codec.cc.o
[ 37%] Building CXX object src/decoder/CMakeFiles/astc_utils.dir/intermediate_astc_block.cc.o
[ 43%] Building CXX object src/decoder/CMakeFiles/astc_utils.dir/logical_astc_block.cc.o
[ 50%] Building CXX object src/decoder/CMakeFiles/astc_utils.dir/partition.cc.o
[ 56%] Building CXX object src/decoder/CMakeFiles/astc_utils.dir/physical_astc_block.cc.o
[ 62%] Building CXX object src/decoder/CMakeFiles/astc_utils.dir/quantization.cc.o
[ 68%] Building CXX object src/decoder/CMakeFiles/astc_utils.dir/weight_infill.cc.o
[ 75%] Linking CXX shared library libastc_utils.so
[ 75%] Built target astc_utils
Scanning dependencies of target astc_inspector_cli
[ 81%] Building CXX object src/decoder/CMakeFiles/astc_inspector_cli.dir/tools/astc_inspector_cli.cc.o
[ 87%] Linking CXX executable astc_inspector_cli
/usr/bin/ld: CMakeFiles/astc_inspector_cli.dir/tools/astc_inspector_cli.cc.o: undefined reference to symbol '_ZN10astc_codec9Footprint5ParseEPKc'
/usr/bin/ld: /home/uilian/data/astc-codec/build/build/src/decoder/libfootprint.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [src/decoder/CMakeFiles/astc_inspector_cli.dir/build.make:104: src/decoder/astc_inspector_cli] Error 1
make[1]: *** [CMakeFiles/Makefile2:140: src/decoder/CMakeFiles/astc_inspector_cli.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
The error seems be related to astc_inspector_cli and some missing symbol.
Environment:
arch=x86_64
build type=Release
compiler=gcc 10
libcxx=libstdc++11
os=Linux
I'm using the commit 9757bef: https://github.com/google/astc-codec/archive/9757befb64db6662aad45de09ca87cd6f599ac02.tar.gz
Hi,
I've been comparing the output of astc-codec vs. another ASTC decoder from Google. I found a decoding issue with void extent blocks, where the output differs from what is expected by the ASTC spec in LDR mode when sRGB enabled. Here's the relevant code:
static std::vector DecodeEndpoints(const VoidExtentData& block) {
EndpointPair eps;
// Original code:
//eps.first[0] = eps.second[0] = (block.r * 255) / 65535;
//eps.first[1] = eps.second[1] = (block.g * 255) / 65535;
//eps.first[2] = eps.second[2] = (block.b * 255) / 65535;
//eps.first[3] = eps.second[3] = (block.a * 255) / 65535;
// Corrected code that generates the expected result with void extent blocks:
eps.first[0] = eps.second[0] = (block.r >> 8);
eps.first[1] = eps.second[1] = (block.g >> 8);
eps.first[2] = eps.second[2] = (block.b >> 8);
eps.first[3] = eps.second[3] = (block.a >> 8);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.