Releases: bluescan/tacent
Natural Sorting, XDG, and High Precision Colours
This release improves command-line processing by allowing UTF-16 strings as arguments, adds support for the B4A4R4G4 pixel format, and includes support for 16-bit per component images and types. In particular 16 BPC PNG loading and saving is now available using the SPNG library. Functions to retrieve XDG base directories have been added and a natural sorting implementation is included.
Features and Fixes
- tCmdLine can parse UTF-16 argv strings.
- Detection of 16-bit per component png images (R16G16B16 and R16G16B16A16).
- Support R4G4B4A4 (BARG) ktx1 files.
- 16-bit colour/pixel types. tColour3s and tColour4s.
- Support 16 BPC PNG loads.
- PNG loading supports auto gamma/sRGB compression. Source and current colour profiles set correctly.
- Fixed row reversal loading for PNG files.
- Write support for 16-bit per component PNG files. 24, 32, 48, and 64 bpp PNGs may now be saved. Uses the SPNG library.
- Upgraded libpng to version 1.6.42.
- Picture copy-region with channels and optional use of anchors. Unit tests added.
- Respect horizontal and vertical flip bits when loading TGA files.
- Updated libktx to v 4.3.2.
- Update bcdec to v0.97.
- Added a descriptions array for all pixel formats.
- String compare functions now guaranteed to return -1, 0, or 1 rather than the more vague <0, 0, or >0.
- Externally exposed tPathStd functions. Added platform (path) string compare functions tPstrcmp and tPstrncmp to tStandard. Added tPathsEqual and tComparePaths to tFile.
- Added numerous mipmap dimension computation functions. Includes tGetNumMipmapLevels, tGetNextMipmapLevelDim(s), and tGetMipmapDim(s).
- tImageQOI now using colour profile instead of colour space.
- Improved usefulness of tBaseImage by placing ColourProfile and PixelFormat members in the base. Simplifies all derived image-loading classes.
- Better colour profile reporting for APNG, ASTC, BMP, DDS, GIF, PKM, PVR, and QOI.
- Added implementation of a 'natural' string compare function originally contributed by github user ClangPan.
- Similar behaviour between the tString Left and ExtractLeft functions. In both cases an empty string is returned if the marker is not present. Same update for Right and ExtractRight.
- Added the natural string compare function tNstrcmp. It sorts similarly to Windows natural sorting and uses a single loop.
- Added teList and tzList. They are basically tLists with different default constructor modes (External and Static) so that you can put lists of different modes in a C++ array (which calls the default constructors on initialization).
- Added virtual functions IsMipmapped, IsCubemap, GetLayers, and GetCubemapLayers to tBaseImage. This will allow simplification of client code that can now be unaware of the exact tImage type.
- Accessors for reading and parsing environment variables from the XDG Base Directory specification. Appropriate defaults, also defined by the spec, will be used if the environment variable is not set or is empty.
- Added tCreateDirs for creating multiple directories in one go.
- Fixed issue loading palettized (indexed colour) PNG files that have transparency. Specifically the tRNS chunk is being parsed.
Full Changelog: v0.8.17...v0.8.18
Packed Floats and Pixel Formats
This release introduces experimental support for loading and decoding PowerVR images, extends pixel-format support for image container formats (DDS, KTX, and PVR), adds new packed floatng-point classes, improves the drive-information API (especially for removeable media), updates the PNG loading library, and allows saving/loading of meta-data to disk. PBC = Possible Breaking Change.
Features
- Saving and loading of image tMetaData to/from tChunk binary format.
- Meta-data focal length is in mm.
- Updated libpng from 1.6.37 to 1.6.40.
- Detection of JPG/JFIF content inside a PNG file. Some phone software generates these 'invalid' images and now they will load.
- Better handling of corrupt tga files that used to cause a buffer overrun. We now check that we're in bounds.
- PVR supprt for V1, V2, and V3 files.
- Cleaned-up and consistently named interpolation and extrapolation functions. PBC.
- tGetDriveInfo now reports drive state: Ready, NotReady, or Unknown.
- Added public-facing UTF functions that are capable of returning the number of codeunits that could or would be read. The codeunit count can be determined for UTF-8, UTF-16, and UTF-32.
- Consistent naming of all pixel-formats. PBC.
- Introduced satellite information for channel-type (UNORM, SNORM, UINT, UFLOAT, etc). PBC.
- Changed the behaviour of tString ExtractLeft and ExtractRight for the case where the divider was not found. If not found the string now remains unmodified and an empty string is returned. This more closely matches the bahaviour of the non-char overloads. PBC.
- Packed small-float classes. F11F11F10 is a 32-bit packed format supporting 2xE5M6 and 1xE5M5 floats (no sign bit). M9M9M9E5 is a 32-bit packed format supporting 3xE5M9 (3xF14) but with a shared 5-bit exponent and no sign bit. Because of the shared exponent this format does not used normalized mantissa (always denorm).
- Support for exotic pixel-formats including PVRBPP2, PVRBPP4, R11G11B10uf, E5R9G9B9uf, R8G8B8M8, R8G8B8D8 plus integral types R16, R16G16, R16G16B16, R16G16B16A16 and their 32-bit-per-component counterparts. Where supported these formats may be contained by DDS, KTX, KTX2, and PVR (V1, V2, V3) files.
Improvements and Fixes
- Unit test for saving and loading meta-data to a tChunk file. Added operator== and != for both tMetaDatum and tMetaData.
- Deborder picture function now returns false if there is no change.
- Consistent use of load params across all image loaders that need them. JPG and PNG now have params instead if just a set of flags. PBC.
- The naming for the PVRTC pixel formats is finalized so they are unambiguous. For version 1: "PVRBPP4", "PVRBPP2", "PVRHDRBPP8", and "PVRHDRBPP6". For version 2: "PVR2BPP4", "PVR2BPP2", "PVR2HDRBPP8", and "PVR2HDRBPP6". Updated the remaining pixel-format query functions and added a tIsLDRFormat in addition to tIsHRDFormat. Note that for the ".pvr" container format (as opposed to the pixel format) it comes in 3 versions (V1 V2 V3) but all use the same "pvr" extension.
- Fixed issue where tGetDriveInfo was not filling out the drive letter correctly.
- tString convenience functions for dealing with known null-terminated strings.
- The state of tImageDDS and specifically the IsValid call could give bad results if a file load wasn't attempted. The Results bitfield is now a more general current State and the IsValid works for all cases. The fix has been propagated to tImageKTX and tImagePVR.
- If possible, the DDS loader will now set the channel-type - modern dds pixel formats allow it to be determined in some cases.
- Channel-type determined for VK packed formats in KTX2 files.
- ICO files always considered to be in sRGB colour profile.
- Now handle both unsigned and signed versions for BC4 and BC5. These new ATI1 and ATI2 variants are supported in dds, ktx, ktx2, and pvr files. All BC formats exportable by PVRTexTool are now loadable.
Full Changelog: v0.8.16...v0.8.17
Levels, Lossless Transformations, and Intervals
This release features additional image adjustments (levels, brightness, contrast), support for PKM and ETC-compressed textures, lossless image transformations for JPG files, support for intervals and interval-sets, improvements to command-line option parsing, plus many smaller features and some bug fixes. PBC = Possible Breaking Change.
Features
- Brightness and Contrast adjustments for tPictures.
- Levels adjustments for tPicture. Black, mid, and white points may be set independently or the mid-point can be computed for you.
- Colour-frequency histograms (for various channels) computed for tPictures.
- All image saving interfaces accept a save-parameters struct. The interfaces for the various image types is more unified.
- Command line options parser now able to collect all parameters of a particular type in a single tParam object (PBC).
- Changed the default compression setting for TGA files to None as RLE is not universally supported by other software (PBC).
- tPrintf functions named consistently. Added convenient tPrintf functions for appending to tStrings (PBC).
- Colour quantization functions available to tPicture class.
- Math library supports computing greatest-common-divisor (tGCD) and least-common-multiple (tLCM).
- Aspect-ratio API added. Supports all common print and screen aspect ratios.
- Support for decode of more pixel formats. Specifically, ETC1, EACR11, EACR11S, EACRG11, EACRG11S, ETC2RGB, ETC2RGBA1, and ETC2RGBA.
- Support pkm images. These may contain pixel data in any ETC, ETC2, or EAC encoding.
- Support ETC encoded KTX and KTK2 files.
- Support ETC encoded DDS files.
- Channel swizzling support in tPicture.
- Lossless JPG transformations (90 degree rotations and flips).
- Intervals and interval-sets are now supported by the math module. Integral interval-sets are are able to accumulate intervals and maintain the simplest representation possible.
- Conversions to/from string representations for tInterval and tIntervalSet.
Improvements and Fixes
- Introduced an alternate mid-point gamma algorithm based on a base 10 power function. This one is not C1 discontinuous at gamma 1.
- Fix palettized image class (tPaletteImage) when Wu quantization requested.
- Ability to set an external pixel buffer for tPicture.
- Changed the way picture adjustments work. Instead of using an 'original' pixel buffer, all functions starting with 'Adjust' must be called between AdjustmentBegin and AdjustmentEnd (PBC).
- Allow fractional counts for the histograms generated in some tPictures. Alpha is not considered. For example, a red at index 200 with alpha 128 would only add 0.5 to that index.
- Intensity can now be computed for specific colour channels. tPicture adjustments can be performed on chosen colour channels instead of forcing RGB.
- Added predefined 'one' vectors for all vector classes.
- Added filesystem friendly time string format. No colons/dots/spaces.
- Cleaned up the Save interfaces for the tImage types that allow specification of an 'auto' pixel-format.
- Command-line parsing. tParam now able to collect all parameters no matter how many of them there are. To do this set the parameter number to 0. Escape sequences now use hat (^) instead of backslashes. Makes using backslashes for file paths easier (PBC).
- Fix issue with GetProgramPath on Linux. Return value from readlink is now checked.
- tFileInfo needed, and now has, a copy constructor. One of the members is a tString so a memcpy is no good.
- Made the image saving interface more consistent. Every tImaageNNN class that supports saving now uses a SaveParams structure. The parameters inside are dependent on the particular image file format and what it supports (PBC).
- Improved colour-space handling for QOI images. Fixed QOI colour-space names (PBC).
- Added resample and edge-mode names.
- More consistent tPrintf naming for functions taking in va_list. Print functions returning tString no longer overloaded to avoid ambiguity. Added 'append' versions of the print functions. These are prefixed with 'tsa' (BPC).
- Added tFindFirstSetBit calls for unsigned integral types.
- Improved AlphaBlendColour by allowing you to specify the RGB channels and explicit final-alpha value.
- Spread and intensity functions added to tPicture.
- Fixed possible memory overrun while demuxing some webp files.
- Allow ill-formed dds files to be loaded. A new strict-loading flag has been added. If the flag is not set we allow none of the dds-header format-flags to be set and proceed by assuming the FourCC is correct and sufficient.
- Reduced windows synonym define pollution by using a Win prefix (BPC).
- Background colour preserved by webp loading code. Any invalid demux regions that extend ouside of canvas area are skipped. The background colour may now be inspected after a webp load.
- Implemented greatest-common-divisor (tGCD) and least-common-multiple (tLCM). tGCD is used by the aspect-ratio functions. A fairly extensive list of common screen and print aspect-ratios are supported.
- Fixed row order while loading qoi images. Fixed saving of qoi images so rows not reversed. Because both load and save had reveresed rows, this 'upside-down image' bug wasn't noticed right away.
- Changed the tScript string write-atom calls to not do tuple-detection. In all cases if a space is present, quotes are added. It was a problem before if, for example. a path was stored in an atom-string and the path had ()s in them. Now the writing code calls WriteRaw instead for tuples and paths with spaces always get surrounded by quotes.
- Support (less common) atc file extension for ASTC files.
- Fix DDS, KTX, and KTX2 loading when dimensions not multiple of 4.
- Optional gamma or sRGB compression while loading PKM images. No auto-gamma by default for PKM files. There are too many ETC2 files in the wild not set to sRGB pixel format that in fact are in sRGB space.
- Safer detection for when an ill-formed dds file does not have enough data. We no longer try to read into uninitialized memory.
- Tacent component type (tcomp) now renamed to comp_t. This frees up tComp to be used for the Tacent component enum, and tCompBit to be used for the component bits enum (PBC). Functions for determining if a component is a colour, vector, or matrix component.
- tPicture colour channel swizzling and colour-spead functions.
- Renamed GetCompName to GetComputerName so it's not confused with component (BPC).
- Load option to swap Red and Blue when decoding KTX files.
- Improved how LDR and HDR buffers are handled by the DDS loader. Dealing with colour-space conversions now always happens after decode.
- Pulled out the pixel-format decode function from the DDS loader. This will be used for more than just tImageDDS. It's basically the same code for KTX, ASTC, PKM, etc.
- Separate decode functions based on pixel-format being either BC, ASTC, or Packed.
- Colour 'profiles' introduced and are being used by image loaders. A colour profile specifies what colour space the colour channels are in and whether they are LDR (0.0 to 1.0) or HDR.
- If a non sRGB pixel-format detected for dds and ktx/ktx2 files with ASTC data, the HDR (lin alpha) profile is selected.
- Prefer sRGB for UNORM pixel formats in dds files.
- tImageASTC supports auto-gamma.
- All packed, block decompression, and astc code now shared by all image formats that support those formats.
- sRGB assumed more often based on content of real ktx files. In the wild, many non-sRGB pixel-format images are actually sRGB.
- The VK (ktx2) formats are obeyed more closely in terms of the colour profile specified by the VK format.
- EAC encoded PKM files default to the sRGB colour profile.
- Default to no gamma-correction for PKM files. The linear test files have incorrect sRGB data in them and I want them displayed correctly but don't want to just default to the sRGB profile.
- Cleanup ProcessHDRFlags when loading ASTC, DDS, KTX, and KTX2 files. Add some asserts to make sure the decoded pixel buffers are the ones we expect.
- Added versioning to ETCDec library.
- Ability to detect imperfect lossless transform results before performing the transform on a tImageJPG.
- Added a tString member function (RemoveAnyNot) that allows you to specify a string of characters that will not be removed. Everything else will. This is useful if you want to take an input string and make it well-formed by limiting what characters it may contain.
- Added Count function to tInterval and tIntervalSet. Can only work over discrete (integral-type) domains.
- Support the less common dds formats R8G8B8 and R8G8B8A8. The more common ones are B8G8R8 and B8G8R8A8 that were previously supported.
- Fixed gif encoder. It was possible for it to set the transparency flag in the graphics control extension block when encoding fully opaque images. This was fixed in two ways: a) The extension block is no longer included by setting the frame duration to 0 for single-frame images, and b) even if the extension block were included, it now checks the bgindex to see if it should write a false for the transparency bit/flag.
- Auto mode for alpha threshold when saving GIFs.
Full Changelog: v0.8.15...v0.8.16
Quality Quantization
This release features colour quantization of images using 3 high quality algorithms: Neu Quant, Scolorq, and Wu Bipartition. These quantization methods are now used by the GIF encoder. A fair amount of work has gone into more extensive image loading especially for block-compressed formats. KTX and KTX2 are now supported and all block formats (KTX, KTX2, DDS, and ASTC files) support the full compliment of the newer ASTC compression modes (adaptive scalable texture compression).
ASTC file loading (ARM .astc files) supports both LDR and HDR colour profiles. Support for loading and saving the lossless QOI (Quite OK Image) format has been added. GIF file encoding now supports transparency.
Supporting changes include a new palettized image class, a new tightly packed bit-array class (tBitArray8), and an abstract base for all image classes to help standardize the interfaces for different image types.
Additional fixes and changes:
- HDR dds formats (which can be exported from nVidia texture tools) can now process exposure on load.
- Reinhard tonemapping implemented.
- Standardize base image loader interface.
- DDS loader defaults to sRGB compression for gamma-correction instead of the simpler power-function.
- Official LibKTX used for ktx/ktx2 file parsing.
- tPrintf supports width specifier for %c. Added support for %B to easily print booleans.
- KTX/KTX2 loading support for formats: BC1, BC2, BC3, BC4, BC5, BC6U, BC6S, BC7, L8, A8, R8, R16F, R32F, R8G8, R16G16F, R32G32F, R8G8B8, R8G8B8A8, R16G16B16A16F, R32B32G32A32F, B8G8R8, B5G6R5, B8G8R8A8, B4G4R4A4, B5G5R5A1, plus all 14 ASTC formats for block sizes from 4x4 to 12x12.
- Improved animated APNG detection inside PNG files.
- QOI loading and saving of 24 and 32 bit images.
- Added tBitArray8 type and ability to set and get multiple bits in one function call for both tBitArray and tBitArray8.
- tPaletteImage class for storing palettized image data at varying bit-depths and palette sizes.
- Reverse and Find bit operations for basic types added to the foundation module.
- Functions to convert between palettized colours and flat pixel arrays.
- Standard quantization interface created. Implements 4 quantization methods: Fixed, Wu, Neu, and Scolorq. Fixed is a non-adaptive predetermined palette and the redmean colour distance function is used to find the closest match.
- Saving GIF files now supports high-quality quantization (palette generation) at various bit-depths from 1bpp (2-colour) to 8bpp (256-colour).
- Saving GIF files now uses gifenc to encode. This change allowed transparency to be supported.
- Scolorq supports dithering. Unit-tests added for various levels of dither.
Block Compression and HDR
This release integrates the bcdec decoder into the DDS loading code of Tacent. The DDS-loading code has been upgraded substantially and can process both legacy and modern DDS files (ones with the DX10 header). The full list of pixel-formats that may be read:
- BC1 (DXT1 and DXT1A / Legacy and Modern)
- BC2 (DXT2 and DXT3 / Legacy and Modern)
- BC3 (DXT4 and DXT5 / Legacy and Modern)
- BC4 (ATI1 / Legacy and Modern)
- BC5 (ATI2 / Legacy and Modern)
- BC6s (HDR. Modern)
- BC6u (HDR. Modern)
- BC7 (Modern)
- A8 (Legacy and Modern)
- L8 (Legacy and Modern/R8)
- B8G8R8 (Legacy)
- B8G8R8A8 (Legacy and Modern)
- B5G6R5 (Legacy and Modern)
- B4G4R4A4 (Legacy and Modern)
- B5G5R5A1 (Legacy and Modern)
- R16f (HDR. Legacy and Modern)
- R16G16f (HDR. Legacy and Modern)
- R16G16B16A16f (HDR. Legacy and Modern)
- R32f (HDR. Legacy and Modern)
- R32G32f (HDR. Legacy and Modern)
- R32G32B32A32f (HDR. Legacy and Modern)
This is a superset of the possible export types provided by NVidia Texture Tools Exporter, but a subset of the possible types supported by Microsoft's DirectXTex texconv command-line tool.
Additional Notes:
- A 'tHalf' class was introduced that represents a half-precision (16-bit) floating point number. Conversion to and from float is possible.
- Many unit tests and and sample dds images were added. Unit tests consist of reading dds files in various formats and writing to tga files for inspection.
- Before this release, only power-of-2 width or height dds files were supported. This was an artificial and unnecessary restriction that has been removed.
- tGetRelativePath is now consistent between platforms, and the use of PathRelativePathTo has been removed from the Windows implementation.
- Added an exact sRGB transform function to the tColour interface. Allows conversion from linear RGB to the sRGB colour-space. This transform may optionally be applied to pixel colour values when loading from an HDR format DDS file.
UTF, Fast Strings, Fast Filesystem, and Image Meta-Data
Many improvemnts in this release. Major new functionality includes support for reading image meta-data (EXIF) from jpg files, full support for UFT encodings (UTF-8, UTF-16, and UTF-32), and significant implovements to the string class -- it is much more time and space efficient. There are a number of changes that may require modification of client code to remain compatible -- these have been marked PBC (Possible Breaking Change) below. In most cases it is trivial to update.
The improvements and fixes are itemized below.
- tCommand is now renames tCmdLine to clarify that it is used for command-line parsing. PBC.
- Fixed a GIF-loading error that could lead to incorrect (uninitialized) pixels in the first frame of animated GIFS that contain transparency.
- Fixed a subtle bug in tChrlwr and tChrupr where non-alphabetic characters would get modified.
- tScriptWriter consistently uses either tabs (default) or spaces. It mixed them before this release.
- Explicitely set the alpha for tColour aggregate initializers.
- Component-channel support in tPicture.
- Thread-safe intrusive list class (tsList).
- Ability to retrieve network share names in Windows. Results will match what Windows explorer displays.
- File-type handling and queries much faster by using table lookups.
- Added tGetHomeDir that gets the home directory in Linux and the User directory in Windows.
- Description of how to use function-objects with all tList sort functions so that arbitrary satellite data can be accessed.
- TinyXML2 and TinyEXIF libraries now in use by Tacent for parsing image meta-data.
- All meta-data attributes massaged for easy access as well as descriptions for each attribute type.
- Cleaned up tString case functions. PBC.
- Optional EXIF orientation compensation in JPG-loading class. Can correct for photos taken in portrait, mirrored etc.
- tString internal representation is now UTF-8 and uses proper char8_t C++ type for the code-units. PBC
- tStandard conversion functions to and from all combinations of UTF-8, UTF-16, and UTF-32. Convenient UTF helper classes for UTF-16 and UTF-32. tString works directly for UTF-8.
- Tacent can be compiled to use either UTF-8 OS API or UTF-16 API functions on Windows. See TACENT_USE_UTF16_API.
- In order to be clear about the distinction between a filetype and its extensions, the synonyms in the tFileTypes enum have been removed. A single filetype may map to multiple extensions. PBC
- Variants of tFindDirs and tFindDirsRec that populate a tFileInfo list instaead of just a list or strings. Allows retrieval of more directory info in the same pass. This can be considerably faster if you need to know more than just directory names -- for example whether the directory is read-only or not.
- Removed tFindFilesFast and its variants. The heavy-lifting file functions now support running either a native backend (Linux and Windows) or a cross-platform C++ std::filesystem implementation. In all cases the native is faster -- all functions that support different backends default to native. If you are using the 'fast' versions of the functions, now just use the normal versions as they default to the fast behaviour. PBC.
- tString supports multiple nulls inside the string. String length is now stored explicitely (faster).
- tString supports 'capacity' (more memory allocated than is necessary for the current string length). This results in faster appends/concatenations and less memory fragmentation. Ability to set heuristic for how the memory automatically grows. This may be breaking if client code copies directly into the tString code-units array. Code that needs to do this should now set the length properly first instead of calling Reserve. See description at start of tString.h. PBC
Consistency and Speed
This is an iterative release with some improvments to method consistency and a much faster file query function. PBC means possible breaking change.
- Fast version of tFindFiles that also retrieves tFileInfo as it goes. Much faster than retrieving the extra file-information afterwards. If you know you'll need it, get it right away.
- PBC Similar raw element accessors for tBitArray, tBitField, and tFixInt. tBitField now does not depend on the heavier tFixInt.
- tBitField supports implicit conversion to built-in types. Before this change, operator-bool would be called which was dangerous since it resulted in a simple 0 or 1. Added construction and setting of tFixInt from tBitField of same size.
- Ability to specify tCommand parameters in an array if you have lots of them. Added fn to query how many were present.
- PBC More consistent argument order for string to/from float/double functions. Using the C-style where dest aargument is always first. Added tSystem functions for conversion of floats/doubles to string rep, optionally with the hash(#) binary encoding enabled. tScript uses these new functions instead of rolling its own versions.
- GetArea function for tPicture added.
Little Bugs
Fix to tFindFilesFast under Linus for some mounted filesystems. Added const element accessor to tBitField.
Fast Dolphin
Small but important improvements.
- Added native tFindFilesFast functions which are much faster than the std::filesystem API.
- Support non-blocking opening of Dolphin file explorer (KDE/Kubuntu) by OpenSystemFileExplorer.
- Query the build configuration (Debug, Develop, Release, Ship, etc) at runtime.
- Fast platform-specific implementations of tFindFiles. Use tFindFilesFast if you have 1000s of files in a directory.
- PBC Hidden files (tIsHidden) now behave more consistently in Windows. A file starting with a dot is hidden in Linux, and on Windows only the hidden file attribute is considered. Have both if you want a file that is hidden universally (attrib set on windows, and starts with a dot).