Commit Graph

49 Commits

Author SHA1 Message Date
Alexey Knyazev
915b91b56c Fix UASTC to EAC RG11 green channel selection 2021-03-28 15:10:38 +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
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
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
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
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
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
Rich Geldreich
374a04d54d Merge pull request #134 from cwoffenden/transcoder-xcode
Xcode 11 transcoder warnings removed
2020-05-06 19:59:59 -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
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
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
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
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
richgel999
c2869ffecc Adding uncompressed pixel support to transcoder wrappers in webgl/transcoder/basis_wrappers.cpp. Note uncompressed hasn't been tested yet, but I've verified that compressed still works. 2019-09-19 21:39:57 -07:00
richgel999
33bf902b01 Development message fixes 2019-09-19 20:00:54 -07:00
richgel999
36676e29eb When BASISD_SUPPORT_BC7 is defined and set to 0, we disable all the BC7 modes so the WebAssembly/Javascript transcoder doesn't get bloated. I'm going to disable BC7 mode 6 by default in the next minor update. 2019-09-19 13:42:51 -07:00
richgel999
3629438d43 Transcoder update: ASTC 4x4 RGB/RGBA, ATC RGB/RGBA, BC7 mode 5 RGBA, PVRTC1 4bpp RGBA, and uncompressed raster formats. 2019-09-19 12:29:44 -07:00
Rich Geldreich
7d784c7288 Correcting the copyright date, as all of the Basis Universal code was written during/after April '19. 2019-06-09 18:29:41 -07:00
richgel999
ab722fa2e1 - Adding support for skip blocks, i-frames and p-frames to the backend and transcoder, for texture video use.
- For PVRTC1, we now memset() any extra blocks after the blocks we know will be transcoded into. This is done because in GL there is padding that occurs on textures smaller than 8x8.
- Removing all OpenMP usage and replacing it with a basis C++11 job system.
- Fixing TSVQ class so it can split very long "thin" clusters that before weren't being split. This improves endpoint quantization on videos and complex 2D textures.
- More frontend perf. optimizations.

Tested on OSX, Linux with gcc/clang, and Win using MSVC 2019.
2019-06-07 20:35:38 -07:00
Rich Geldreich
c180a087b9 Minor transcoder update: Adding support for arbitrary output texture row pitches, for usage with the Vulkan rendering API. 2019-05-28 15:41:16 -07:00
Arseny Kapoulkine
f5d502912d Make codec options externally configurable and remove BC7 support
This change makes it possible to exclude formats using compile time
options. BC7 is *never* exposed on the web and it has an absolutely huge
coding table which means we're just wasting space.

basis_transcoder.js 58707
basis_transcoder.wasm 224404
2019-05-22 20:57:17 -07:00
Rich Geldreich
81464a6d6b Changing the ETC1S->BC4 and ETC1S->ETC2 EAC transcoders so they convert from the source red channel, not source green. Source red makes more sense when transcoding to BC4/BC5, especially when the source texture only has color slices. BC4 is red, and BC5 is red/green. This change makes no difference if the source texture slices are grayscale. 2019-05-10 22:04:48 -07:00
Rich Geldreich
6da5bf05a6 Another bugfix found during fuzz testing 2019-05-09 20:40:41 -07:00
Rich Geldreich
f83ee300a3 Adding more header checks 2019-05-09 18:09:47 -07:00
Rich Geldreich
85f4651def Fixing mipmap bug introduced from a fuzz test fix 2019-05-09 17:57:14 -07:00
Rich Geldreich
3347b17393 Another fuzz testing fix 2019-05-09 15:05:12 -07:00
Rich Geldreich
78e22234bd More transcoder fixes found during fuzz testing (I disabled all header/data CRC checking by setting BASISU_NO_HEADER_OR_DATA_CRC16_CHECKS to 1). 2019-05-09 14:43:13 -07:00
Rich Geldreich
d7b22fc404 Adding -fuzz_testing command line option, which disables the file data CRC16 check used by the -validate command. To fuzz testing using zzuf on Linux:
zzuf -d -c -s 1000000:2000000 ./basisu -validate -fuzz_testing kodim23.basis
2019-05-09 12:43:59 -07:00
Rich Geldreich
c7e14a97fa - Fixing minor block artifacts on pure 2 color B&W blocks when transcoding to BC1/BC7. This was caused by the ETC1S blocks using extreme ETC1S settings: codetable 7 (the one with the largest intensity deltas), using blocks with selectors that took up the full range (0-3), but the blocks only actually used the two outlier colors (0 and 3 only). The ETC1S->BC1/BC7 table based format conversion system doesn't realize that only the outlie colors were going to be used (i.e. not all 4 colors, just the outer 2), and so the quality of the transcoded block suffered because pure black could not be mapped. In BC7 mode, we now switch to pure BCT (block truncation coding) for any blocks with <= 2 unique colors, independent of their selectors.
- Adding -csv_file option, to generate .csv files for mass benchmarking/testing
- Adding -no_ktx option, to avoid writing large .KTX files while unpacking
- Fixing printf() format issue when one of the -multifile options wasn't correct
Rebuilt compiled javascript transcoder
2019-05-09 10:44:38 -07:00
Rich Geldreich
d699c819f7 Moving g_hamming_dist[] array from transcoder to encoder (it's never used by the transcoder).
Adding remarks to basisu_file_header.h
2019-05-08 20:01:35 -07:00
Rich Geldreich
d2f1594efb Removing old test code 2019-05-07 17:02:06 -07:00
Rich Geldreich
130eb9f115 Major compression performance/quality improvements, for a 15-35% or so decrease in file size for the same Y PSNR/SSIM. The basis file format has changed due to these optimizations.
Increasing the max codebook size to 16K vs. 8K, for a major increase in the max achievable quality.
Adding exception catching to command line tool.
Enabling debug iterators on MSVC.
Refining command line options, adding "-individual" flag to create multiple .basis files (vs. a texture array).
Changing default colorspace to sRGB, because that's probably the best default. -linear disables this and uses linear colorspace metrics.
PNG reader in 32-bit builds checks the size of the file before loading to avoid out of memory exceptions.
2019-05-07 15:52:54 -07:00
Rich Geldreich
33996b1a5f Important: Changing the Basis file version, so any existing files will need to be recompressed!
Adding new fields to the basis header: texture type and framerate. Texture type may be 2D, 2D array, video, volume, or cubemap array. The compressor makes sure that anything other than pure 2D follows certain constraints (cubemap arrays must have a multiple of 6 input images, videos/texture array images all must have the same resolution/# of mipmaps, etc.)
When unpacking cubemaps, the -unpack command now writes cubemap .KTX files which various tools like PVRTexTool support.
2019-05-02 16:09:11 -07:00
Rich Geldreich
7cdf6fc0be Removing some unused/old code from transcoder 2019-05-01 20:54:22 -07:00
Rich Geldreich
7a727fb31c ETC1S->DXT5A transcoding bugfix on solid color blocks
Adding development messages support
Adding a few new transcoder get methods to help with creating C-style wrappers
2019-04-30 20:01:39 -07:00
Rich Geldreich
16c9e35c45 Removing detex dependency
Adding new GPU texture format decoders for BC1/4/5, ETC2 EAC alpha, and BC7 mode 6
Adding GPU texture unpack failure checks and warnings
Adding support for 3 color blocks to transcoder, and making sure that BC3 blocks will never use 3 color (punchthrough alpha) blocks.
2019-04-30 13:50:01 -07:00
Rich Geldreich
bd7d786a8a Initial checkin 2019-04-29 18:53:00 -07:00