Commit Graph

83 Commits

Author SHA1 Message Date
Rich Geldreich
ee610c914e Fixing tabs 2021-04-13 00:29:01 -04:00
Rich Geldreich
7f0a00afe1 Adding KTX2 transcoding/encoding/decompression to PNG/KTX1 support to the transcoder, encoder, JavaScript wrappers. This is also adding Zstandard to the repo, which is optional. Set BASISD_SUPPORT_KTX2_ZSTD=0 when compiling the encoder/transcoder to disable it, or from cmake set KTX2_ZSTANDARD=FALSE. 2021-04-12 13:30:45 -04:00
Rich Geldreich
041ad47c27 - Global codebook related fixes
- Minor fix to basisu_frontend::optimize_selector_codebook() so the new_selector_cluster_indices array is initialized correctly. (The backend doesn't use this array so no harm was being done.)
2021-03-31 00:01:52 -04:00
Rich Geldreich
bf13257528 Merge branch 'branch' 2021-03-30 14:53:22 -04:00
Rich Geldreich
053ed374b4 In progress global codebook changes 2021-03-30 14:51:26 -04:00
Rich Geldreich
8fccf9e799 Merge pull request #219 from lexaknyazev/patch-1
Fix UASTC to EAC RG11 green channel selection
2021-03-30 14:14:45 -04:00
Rich Geldreich
bd2756a617 Merge pull request #218 from JCash/android-compile-fix
Android compile fix
2021-03-30 14:09:15 -04:00
Rich Geldreich
2fd9aec037 Merge pull request #220 from JCash/basisu-min-max
Replaced std::min/std::max with basisu::minimum/basisu::maximum
2021-03-30 14:06:56 -04:00
JCash
2c0c038ffe Renamed to minimum/maximum 2021-03-30 19:17:50 +02:00
JCash
03cca3778e Replaced std::min/std::max with basisu::min/basisu::max
Removed use of NOMINMAX
2021-03-30 18:44:07 +02:00
JCash
5e285fe950 Added two newlines to pass the formatting rules 2021-03-30 17:04:41 +02:00
Alexey Knyazev
915b91b56c Fix UASTC to EAC RG11 green channel selection 2021-03-28 15:10:38 +04:00
JCash
4d00ef7bc0 Android compile fix 2021-03-28 11:31:29 +02:00
Rich Geldreich
57b9051d94 Forward declaring hash_map::iterator and const_iterator. This doesn't fix issues in basisu, but hopefully in the KTX2 repo. 2021-03-17 12:29:08 -04:00
Rich Geldreich
a7994821e5 Disabling unaligned reads unless it's x86/x64 by default 2021-03-16 21:16:57 -04:00
Rich Geldreich
2f2965992b Was always including malloc.h - this is now only done on Linux. It was for malloc_usable_size(). 2021-03-10 03:22:15 -05:00
Rich Geldreich
2d4fe933b2 Basis Universal v1.13:
- Optimized ETC1S encoder (3-4.5x faster)
- Added optional SSE 4.1 support to encoder
- Switched from std::vector to a custom vector in the encoder and transcoder
- Added CppSPMD (SSE only for now)
- UASTC RDO is now more effective, but the command line parameter controlling qualiy has changed (to "lambda")
2021-03-09 11:00:25 -05:00
Rich Geldreich
bb2a355560 New files 2021-03-09 10:58:49 -05:00
Ondrej Stava
c959383657 Build and warning fixes for basisu_transcoder.cpp
Some of our static analysis tools were complaining about unreachable code due to "#if ... return  false;  #endif code " blocks. This was changed to "#if ... return false #else ... #endif" which doesn't change the functionality but makes the static analyzers happy.

Also removed BASISU_NOTE_UNUSED on two variables that are no longer declared (resulting in a build error when BASISD_SUPPORT_UASTC was not defined)
2021-01-29 13:37:01 -08:00
Rich Geldreich
7b9004899b Merge pull request #192 from fintelia/patch-1
Fix comment typo in basisu_transcoder.h
2020-12-18 14:05:05 -05:00
Rich Geldreich
85fa18ec94 Adding encoder WebAssembly support, encode_test sample
Encoder is now a library in the "encoder" directory
JavaScript wrappers now expose the entire codec: encoder, transcoder, container independent transcoding, and .basis file information
2020-12-17 14:26:28 -05:00
Jonathan Behrens
ad5daec2fc Fix comment typo in basisu_transcoder.h 2020-12-12 14:44:14 -05:00
Rich Geldreich
638c348294 Adding container independent transcoding support. See methods basisu_lowlevel_etc1s_transcoder::transcode_image() and basisu_lowlevel_uastc_transcoder::transcode_image(). 2020-11-23 17:58:38 -05:00
Rich Geldreich
46af0305fc Merge pull request #150 from davidhubbard/master
Fix #44: document _ofs header fields
2020-09-18 23:35:37 -04:00
Ondrej Stava
52147e5a99 Fixed signed integer overflow
(1 << num_bits)  was converted to a signed integer that caused an overflow (as num_bits was usually set to 31). It worked fine since the value was later converted back to uint32_t but signed integer overflow is technically an undefined behavior and it was triggering errors in our automated tests.
2020-06-11 12:18:59 -07:00
David Hubbard
c65ab695ca Fix #44: document _ofs header fields
Image slices have m_file_ofs. It is not relative to the start of the header, it is relative to the
start of the file. Double-check basisu_basis_file.cpp:

`m_images_descs[i].m_file_ofs = (uint32_t)cur_slice_file_ofs;`

basis_file_header has m_endpoint_cb_file_ofs. It might be easier to read if the comment on it
just said "file offset," but to clear up any confusion if someone is re-reading the spec later
this commit leaves the "relative to the" language but clarifies it. Ditto for
m_selector_cb_file_ofs.
2020-06-04 23:26:26 -05:00
Rich Geldreich
374a04d54d Merge pull request #134 from cwoffenden/transcoder-xcode
Xcode 11 transcoder warnings removed
2020-05-06 19:59:59 -04:00
Rich Geldreich
525458ae82 Merge pull request #137 from ondys/patch-2
Fixed undefined behavior in BASISU_OFFSETOF
2020-05-06 19:56:56 -04:00
richgel999
a1689504ea Huffman encoder fixes for very large streams
Allowing Huffman decoder to use different fast bits table sizes
Adding NV and AMD BC1 decoders
2020-05-05 23:10:21 -04:00
richgel999
bb64ec604c Renaming USE_UNALIGNED_WORD_READS to BASISD_USE_UNALIGNED_WORD_READS.
Setting BASISD_USE_UNALIGNED_WORD_READS to 0 for WebAssembly builds.
Renaming IS_BIG_ENDIAN to BASISD_IS_BIG_ENDIAN.
2020-05-05 22:40:40 -04:00
Ondrej Stava
57ca9acadd Fixed undefined behavior in BASISU_OFFSETOF
The original implementation was dereferencing a nullptr which is an undefined behavior according to the C++ spec. It was triggering some automatic errors during our sanitizer tests (asan with nullptr check).

The fix replaces the offset with standard implementation of offsetof that uses compiler built in instructions when available (avoiding the undefined behavior).
2020-04-28 11:11:10 -07:00
Carl Woffenden
5c11484595 Xcode 11 transcoder warnings removed
With the default Xcode 11 settings, these non-functional changes remove warnings when building for iOS and Mac, notably:

Possible misuse of comma operator here

Implicit conversion loses integer precision: 'long' to 'int'
2020-04-21 19:11:10 +02:00
Carl Woffenden
ec00f06e81 Removed unused macro around now commented 'max_bits' vars 2020-03-21 12:05:38 +01:00
Carl Woffenden
a8bbc031f1 Revert "Removed unused macro around now commented 'max_bits' vars"
This reverts commit 0a7098a231.
2020-03-21 12:04:33 +01:00
Carl Woffenden
0a7098a231 Removed unused macro around now commented 'max_bits' vars 2020-03-21 12:03:47 +01:00
Carl Woffenden
5b2d795617 Merge branch 'master' into single-file-transcoder 2020-03-21 11:48:33 +01:00
Aaron Franke
2a58642381 Make file formatting comply with POSIX and Unix standards
UTF-8, LF, no BOM, and newlines at end of files
2020-03-21 02:44:10 -04:00
Carl Woffenden
3953f6099a Merge branch 'master' into single-file-transcoder 2020-03-20 19:40:30 +01:00
Rich Geldreich
5b6eb565e4 - Adding UASTC support to encoder, transcoder, .basis file format
- Removing BC7 mode 6 support from transcoder (will alway use the much smaller mode 5 tables now)
- Adding BMP support
- Adding -bench mode, for development
- CMakeLists.txt file now compatible with Visual Studio 2019 (MSVC)
2020-03-20 02:00:34 -04:00
Rich Geldreich
93fc3a8fc6 new files 2020-03-20 01:57:23 -04:00
Carl Woffenden
0cc6736a3e Merge remote-tracking branch 'upstream/master' into single-file-transcoder 2020-01-05 13:16:03 +01:00
richgel999
82eee2eda7 Fixing BASISD_SUPPORT_ATC so if it's set to 0 we check to make sure PVRTC2 is also set to 0 2020-01-03 20:50:43 -08:00
Vladimír Vondruš
176df98c3e Don't require the huge BC7m6 tables if this format is disabled.
The 1.3 MB file might be considered excessive when bundling the
transcoder sources in another project, don't require it to be present
when not needed.
2019-11-01 17:26:41 +01:00
Carl Woffenden
a5c36a5291 -x included error if used
The -x include files error if used (saying they were excluded). Changed the trancoder to surround the BC7 mode 6 include with guards.
2019-09-30 15:15:13 +02:00
Carl Woffenden
b48087bab8 Merge remote-tracking branch 'upstream/master' into single-file-transcoder 2019-09-30 11:46:21 +02:00
richgel999
01d391cc2a PVRTC1 apparently always use wrap addressing when fetching the adjacent block colors (even when clamp texture addressing is being used), so we don't need the wrap vs. clamp option anymore. It's always wrap and that's that. 2019-09-29 19:34:00 -07:00
Carl Woffenden
ac73849b0e Fixes more -Wunused-parameter warnings
These unused params occur when disabling various transcode options.
2019-09-28 07:04:29 +02:00
Carl Woffenden
a6bd48a16c Minor Clang fixes
Minor fixes so that Clang doesn't trip with `-Werror` and `-Wextra`.
2019-09-28 07:04:29 +02:00
richgel999
11f46d74af New files 2019-09-26 23:36:54 -07:00
richgel999
54304fa014 - Adding PVRTC2 RGB/RGBA and ETC2 EAC R11 and RG11
- Renaming -no_auto_global_sel_pal to -auto_global_sel_pal, disabling global selector palette usage by default to speed up compression on small images
- Renaming texture format enums
- Fixing uninitialized memory issue in front end - it wouldn't have affected the correctness of the output, or output quality
- Bumping command line tool up to v1.10
2019-09-26 22:35:14 -07:00