Skip to content

Releases

OpenXISF 1.1.0

Choose a tag to compare

@github-actions github-actions released this 03 Nov 15:33
ceca3ad

OpenXISF 1.1.0 reads and writes regions of interest: a box of pixels and a range of channels of an image, read alone
from a unit, and written in place in a file, so that an application such as a stacking program works on its frames
tile by tile without holding them whole. It also bounds more of what an untrusted unit can cost, closes races of the
file system, and follows Revision 2 of the specification. The API of 1.0 compiles as it is. The ABI is that of a new
minor version, so programs built against 1.0 are rebuilt for 1.1: the shared library is libopenxisf.so.1.1, and the
Windows DLL is named after the minor version as well, openxisf-1.1.dll. Some changes alter what a call does; they are
listed under Behaviour changes.

Regions of interest. pixel_read_options::region reads a pixel_region of an image alone, into memory of the
library or of the application, and pitch places its rows in a larger buffer, such as a tile in its place in a frame.
What a region costs follows how the image is stored: uncompressed data are read run by run, the stretches of the block
that the region fills, runs close together in one read; a compressed block decodes only the subblocks that hold the
region, a few at a time, so that a region of a large image takes a few subblocks of memory, whatever its size; a block
compressed with byte shuffling is read in parts too, gathered byte by byte. A block with a checksum is read whole and
verified first, unless the application opts out with verify_checksum, for data that it verified once. A source whose
content lies in memory, as that of memory_source and a file that the application maps into memory do, gives it with
the new input_source::bytes(), and regions are then taken from it in place. On a desktop with a PCIe 5 NVMe disk, the
same 512 x 512 tile of 32 frames of 5120 x 5120 Float32 samples, from files not yet in memory, is read in 74 ms
uncompressed, where the whole frames take 435 ms, and in 256 ms compressed with Zstandard and byte shuffling in
subblocks of 4 MiB, where decoding the whole frames takes 870 ms on 16 threads.

Writing in place. openxisf::editor opens a monolithic file and writes regions of the pixel data of its images
where they are, with write_pixels() and pixel_write_options, from any number of threads at once for regions that
share no sample. commit() then writes in place the checksums of the blocks written; until then a reader finds such a
block corrupt, so an output left incomplete is not taken for a complete one. A block with a checksum is verified once,
before its first write. writer::add_reserved_image() writes an image as zeros, without its data in memory: the room
that an editor fills, with the checksum of its zeros when the options ask for checksums. The editor writes into
uncompressed attached blocks, and refuses any other block, and a distributed unit, with errc::not_editable. It reads
and writes through a random_access_device: file_device, memory_device, or a device of the application. The new
sample stack_regions.cpp shows the pattern: input frames written for region access, and a reserved output filled tile
by tile from several threads, each tile the mean of the same tile of every input.

Block facts. reader::block() tells how the pixel data of an image are stored, before anything is read
(block_info): where the block is (block_location), the byte order of its samples, its codec and byte shuffling, the
size of its largest subblock and their number, its checksum algorithm, and its sizes as stored and uncompressed, so that
an application knows what a read of a region costs.

Specification. OpenXISF follows Revision 2 of the XISF 1.0 specification, which defines the uncompressed subblocks
that OpenXISF already wrote and read (§10.6.1): a subblock whose compressed and uncompressed sizes are equal holds its
data as they are, and one longer than its data is decompressed. PixInsight 1.9.6 stores so each subblock that does not
compress, and its units, with SHA3-256 and SHA3-512 checksums too, are among the samples that the tests read. The
writer divides a compressed block into subblocks of 4 MiB by default, as PixInsight 1.9.6 does, which readers decode in
parallel and a region read decodes in part (see Behaviour changes).

Untrusted input and the file system. New limits, each with a default that every real unit stays within:
limits::max_diagnostics, the number of diagnostics that an open lists, 10,000 as in 1.0 and 0 for all;
max_index_elements, 16,777,216 elements over the block index of a data blocks file, whose walk a sparse file of
2^32 - 1 elements could make take minutes; max_model_objects, 1,000,000 images, thumbnails, properties, FITS keywords,
tables, fields and elements that describe images, counted before any object is made, an image taking about 2 KB; and
max_zstd_expansion, the bytes that a Zstandard block may declare for each of its stored bytes, 32768 by default, the
bound of the format, which a service lowers for data of a known kind as it lowers max_allocation. On POSIX systems
the default resolver of distributed units opens each directory of the path of a file from the one before, without
following links, so that a program that swaps a directory for a link meanwhile makes the open fail rather than lead it
outside the directory of the header file, as Windows has read through the handle that it checked since 1.0.0.
file_sink looks at its target again before it replaces it. On Windows a path of the device namespace, such as
\\.\COM1, \\.\pipe\name or \\?\GLOBALROOT\..., is refused by its text before anything opens it, and a directory
that is a reparse point of another kind than a link, such as the placeholder of a cloud file system, is a directory.
The resolver applies its rules for . and .. steps to absolute locations too. reader::load_ancillary_data() takes
the external files that the reader holds open, instead of opening a second set.

API. version_numbers() gives the version of the library as numbers (version_info), whose major and minor
numbers tell whether a library belongs to the headers in use. writer::add_image() and editor::write_pixels() take a
span of samples that are not const, such as std::span(samples) of a vector. property_value takes vectors and
matrices of integers of any C++ integer type, such as std::vector<long>, as the fixed-width type of their width and
signedness, as it takes scalars. New error codes, appended to errc: too_many_index_elements,
too_many_model_objects, not_editable and zstd_expansion_too_large.

Behaviour changes.

  • The Windows DLL is named after the minor version, openxisf-1.1.dll (libopenxisf-1.1.dll with MinGW,
    openxisf-1.1d.dll in Debug), as the soname is on other systems, so that a program built against 1.0 does not load
    the DLL of 1.1 that it finds first. The import library keeps its name, openxisf.lib (libopenxisf.dll.a), so link
    lines stay as they are; a program that ships the DLL ships the new one.
  • write_options::subblock_size is 4 MiB by default, where it was 0: a compressed block larger than that is written in
    subblocks, and a subblock that does not compress is stored as it is, which decoders of earlier revisions of the
    specification may not read. A unit meant for them is written with subblock_size 0, a single subblock, as before; a
    block that does not compress at all is still written uncompressed, which every decoder reads.
  • writer::save(path) writes to the path it is given, whatever its suffix, so that a unit can be written under a
    temporary name and renamed into place: the specification asks for .xisf, which the application gives.
    save_distributed() keeps .xish and .xisb.
  • A header-only open (read_options::header_only) of a distributed unit leaves its external files closed until the
    pixels of an image in one of them are read, or load_ancillary_data() runs, so that a resolver that is costly to
    call is called only for the files that are used: the diagnostics of the open no longer list the problems of those
    files, a strict header-only open no longer fails for them, and a read of an image in such a file throws the error of
    its block.
  • limits::max_external_files is 128 by default, where it was 256: half of the file descriptors that a macOS
    application has by default.
  • An application that raised limits::max_xml_elements to read a header of more than 1,000,000 images, properties,
    FITS keywords, fields or elements that describe images raises max_model_objects too. The rows and cells of tables do
    not count, so a large table still needs max_xml_elements alone.
  • file_sink::finish() refuses a target that has become a directory, a FIFO, a socket or a device since the sink was
    made (errc::not_a_regular_file).
  • The constructors of property_value from char, wchar_t, char8_t, char16_t and char32_t are deprecated,
    and 2.0 deletes them: a character is an integer there, so set("Instrument:Filter", 'R') sets the number 82. Give a
    String, "R", or the integer meant.
  • 2.0 will give a thumbnail the defaults of an image_info, UInt16 samples and the Gray colour space, where 1.x has
    UInt8 and RGB: a thumbnail that sets its sample format and colour space is written the same by both.

Build and packaging. The version is 1.1.0; the installed package accepts requests of 1.0 and 1.1
(SameMajorVersion), and the vcpkg overlay port of the repository is at 1.1.0.

Documentation. The README describes regions of interest and the editor, with excerpts of read_pixels.cpp, which
now reads a region into a tile with a margin, and of stack_regions.cpp. The headers say what a region read costs for
each form of block, how to write a frame for region access (subblocks of a few MiB, and no checksum or
verify_checksum off), and what an editor may share with readers of the same file.

**Tests and C...

Read more

OpenXISF 1.0.1

Choose a tag to compare

@github-actions github-actions released this 17 Oct 19:28
a0e83a3

OpenXISF 1.0.1 fixes costs of untrusted input beyond the size of a unit, a few defects of correctness, and places where
the reader and the writer were more lenient than the specification. It keeps the API and the ABI of 1.0.0: programs
built against 1.0.0 run with its shared library, libopenxisf.so.1.0, as they are. Some fixes change what a call does
with input that was wrong or unsafe; they are listed under Behaviour changes.

Untrusted input. A header no longer takes more than linear time, and memory bounded by its size, to open. The
search for character references no longer runs again after each comment, CDATA section or processing instruction
(100,000 comments took 2.5 s). Diagnostics name their elements by local names, /xisf/Image[1]/Property[2], so a long
prefix of the XISF namespace is not copied into every path, and a reader lists at most 10,000 of them, the last one
counting the rest. Location and compression attributes are split no further than their form, and a list of subblocks
is checked before a list of its size is made. A compressed block or subblock cannot declare more data than its codec
decodes from its stored bytes (1032 times them for zlib, 255 for LZ4, 32768 for Zstandard): beyond it the block is
unavailable, so a few bytes cannot make a read allocate up to limits::max_allocation. A Zstandard frame that declares
another size than its subblock is refused before the data are allocated, and so is a typed read of an unavailable
block. remove_astrometric_solution() takes linear time.

Files and devices. A path that is not a regular file is refused before it is opened, since opening a device can act
on it: on Windows a name that the system makes a device, such as NUL in any directory, and on POSIX systems what
stat() does not call a regular file, which is opened with O_NOCTTY. file_sink refuses a target that is a
directory, a FIFO, a socket or a device before it writes anything; a rename used to replace the last three. The file
resolver refuses a . or .. step after a file on every system, as POSIX does. On macOS the directory of a replaced
file is flushed with F_FULLFSYNC. On Windows, the temporary file of file_sink is no longer created through a
symbolic link that has its name, and a directory there counts as taken, as on POSIX systems; stdio_sink reports a
rewrite whose flush failed, which fseek() of the C runtime hides, and the root of a drive or a share is
not_a_regular_file.

Correctness. The writer wrote a creator application longer than 1 MiB as the data of another block of the unit, or
crashed when the unit had none; it now refuses one. With oneTBB, each parallel loop of the library runs in a context of
its own, isolated: a cancelled task group of the application, in which the calling thread runs, made a read return bytes
that were never written and a save list empty subblocks, and a thread that waits for the loop no longer runs the
application's tasks inside a call of the library. An I/O failure of an external file while ancillary data are loaded
makes its block unavailable with a diagnostic, in a lenient open, instead of failing it. A failed copy assignment of a
property_value or a property_list leaves it as it was, and the copy of a property_value no longer goes through the
copy constructor of std::variant, which in libstdc++ 12 to 16 is undefined behaviour when the copy of an alternative
throws. istream_source and ostream_sink seek through seekoff(), which stream buffers written by hand often
implement alone. Equation [31] of the native pole is computed in its arctangent form, exact near the poles, and an exact
tie takes the candidate of WCSLIB. On a big-endian host the pixel data are swapped only once the subblocks are counted.

Performance. A save in many subblocks keeps the state of its codec from one subblock to the next, so 32,768
subblocks of one byte take 0.008 s with LZ4 HC instead of 0.15 s; the bytes written are those of 1.0.0 for every codec
and level.

Behaviour changes.

  • The writer refuses an Image:FrameNumber below one, an Image:GroupId or Image:SubgroupId outside the grammar of
    the specification and an Image:SubgroupId without an Image:GroupId (invalid_property), a codec or a checksum
    algorithm outside its enumeration (usage_error), and a creator application longer than 1 MiB. It leaves out bounds
    equal to the default range of an unsigned integer image, which then reads back without bounds.
  • The reader keeps the values of the Image namespace that the writer refuses, with a warning, and warns about
    chromaticities whose luminance coefficients leave [0, 1]. A Property or Table element that an object contains and
    references, or references twice, is one property with a warning instead of an error; identifiers repeated among the
    standalone properties or tables are a warning, the first listed. FITS keyword names padded with spaces are read
    without them, with a warning. The character data of a String around a comment, a processing instruction or a CDATA
    section are those that XML defines, white space included. Non-finite Float128 and Complex128 values are kept as
    NaN, +Inf and -Inf, also through from_float128_text() and from_complex128_text().
  • Diagnostic paths use local names, and a reader lists at most 10,000 diagnostics.
  • file_sink, file_source and the file resolver refuse devices, and file_sink directories, FIFOs and sockets, with
    not_a_regular_file; the resolver refuses dot steps after a file; a block beyond the expansion of its codec is
    invalid_subblocks.
  • pixel_storage_name() and resolution_unit_name() give an empty name for a value outside their enumerations.

Build and packaging. The installed headers record whether the library is static (openxisf/linkage.h), so a build
system that is given only the include and library directories, as a Visual Studio project or a makefile is, links a
static library without defining OPENXISF_STATIC_DEFINE; neither the CMake target nor the pkg-config file defines it
any longer. The headers keep to ASCII, which every code page reads without /utf-8, and pass Clang's -Wdeprecated and
GCC's -Wdeprecated-copy-dtor for applications that include them without SYSTEM. LZ4, Zstandard and zlib are found by
their modules also when CMAKE_FIND_PACKAGE_PREFER_CONFIG is on, as Conan sets it, where the CMake package of zlib
1.3.2 names a static library ZLIB::ZLIBSTATIC. The programs and the DLL of a shared build go to
CMAKE_RUNTIME_OUTPUT_DIRECTORY when the project that includes OpenXISF sets it, and to bin otherwise. LICENSE and
NOTICE are installed to CMAKE_INSTALL_DOCDIR.

Documentation. The headers say what a model read with header_only lacks until load_ancillary_data(), the order
in which sinks receive a unit and what progress counts, what a cancelled operation leaves, which exceptions pass through
besides openxisf::error, what max_allocation bounds in reads into memory of the application, that confinement is by
paths, and how to compare version(): by its major and minor numbers. The README names the Windows DLL, which has one
name in every version, and the minimum versions of the dependencies.

Tests and CI. About 90 new tests and 42 fuzz seeds, among them tests of the costs of untrusted input up to the
default limits, and of the memory they take; the tests that count or fail allocations run in an executable of their
own. Every test has a timeout of 900 seconds. The nightly fuzzing keeps its corpus from one night to the next and runs
the targets at once; the s390x job has two hours; the lint job checks the version of the README and that the headers
are ASCII.

OpenXISF 1.0.0

Choose a tag to compare

@github-actions github-actions released this 09 Oct 02:54
5d98e9f

OpenXISF 1.0.0 is the first stable release: the API is stable, and from now on only a new major version may break it.
The ABI holds within a minor version: the shared library is libopenxisf.so.1.0, and each minor version gets a soname
of its own.

Signed units. A unit whose header carries an XML signature after its root element is read like any other. The
reader returns the signature and the root element that it covers, byte for byte, for the XML signature tooling of the
application; it does not verify signatures. A malformed signature, or one that does not name the root element, and a
block of a signed unit without a checksum, are warnings. The writer never signs: a signed unit written again is
unsigned.

Security. On Windows, the default resolver of a distributed unit reads each file through the handle whose final
path it checked: a directory whose name ends with a dot, reached through a junction, could lead it to a file outside
the directory of the header file, since Windows drops that dot when it opens a path again. The relative directory of a
file_resolver() and the target of a file_sink are made absolute when they are made, so a later change of the current
directory does not change what they open. Headers that hold tens of thousands of namespace declarations, tables or
element names no longer take quadratic time. The copies that Reference elements make count against
limits::max_ancillary_data with the size of each object, and a block that fails to load no longer holds room there.
With oneTBB, a Zstandard frame without a declared size is decoded alone, so limits::max_zstd_window bounds a read
rather than each thread. The limits on the number and nesting of XML elements are checked on the text before the
document is built, so a header beyond them costs no memory, and limits.h says how the size of a header bounds the
memory of its attributes. Every fuzz target had a long campaign with MSVC's libFuzzer and AddressSanitizer besides the
hour per target of the nightly runs with Clang, ASan and UBSan; the sanitizer matrix, clang-tidy, CodeQL and MSVC's
static analysis are clean. The build supports the fuzzing engines of OSS-Fuzz (OPENXISF_FUZZING_ENGINE,
fuzz/oss-fuzz/build.sh).

Reading. Departures from the specification that are harmless are read with a warning: codec and checksum algorithm
names in another case, characters that XML 1.0 does not allow, character data outside the root element, blank FITS
keywords and keyword values or comments outside printable ASCII, and ICC profiles without the header of a profile. A
reference to U+0000 is refused everywhere in the header, in attribute values and the XML declaration included.
XISF:CreationTime and the other reserved TimePoint properties that PixInsight writes as Strings are read as the
TimePoint they hold, with an info diagnostic instead of a warning, so the files of PixInsight open without warnings. A
header-only open keeps the identifiers of the values that it leaves in their blocks, and the io_error or
unsupported_error of a resolver keeps its class and its system error. A typed read into memory of the application no
longer applies limits::max_allocation, as a read of bytes did not.

Writing. save() refuses a sink that already holds bytes. A String longer than 1 MiB is written in a data block, so
that the header stays within the limits of readers. The writer refuses an RGB working space whose chromaticities give
luminance coefficients outside [0, 1], a table field whose type is no property type, and U+FFFE or U+FFFF in the path
of a data blocks file. A unit whose header would be too long is refused before any byte of it is written, the data
blocks file of a distributed unit included. Float128 and Complex128 values are kept without the white space around
them and their parts.

Algorithms. White converts to CIE L*a*b* with a lightness of exactly 1, and sRGB white delinearizes to exactly 1.
Primaries that lie on one line within rounding define no RGB working space on every platform, fused multiply-adds
included. The pixel algorithms refuse bounds whose width overflows a double. The inverse Gnomonic projection applies the
limit of 89.999 degrees of the direct one, a CR LF ends a line of the Terms of a distortion model, and the PlateCarree
and Mercator projections take points more than 180 degrees from their reference point modulo 360, as PixInsight does.

API. The constructors of property_value from scalars, strings and vectors are noexcept, and
from_float128_text() and from_complex128_text() take a std::string_view; the accessors of the built-in sources
and sinks are [[nodiscard]]; property_type_name() gives an empty name for a value outside the enumeration; the
members of diagnostic have default values. On Windows, stdio_source and stdio_sink no longer take a FILE* on a
pipe for one that can seek, and stream_io.h says that the C++ stream adapters cannot tell.

Build and packaging. The library of a Debug build is named openxisfd, so Debug and Release builds install side by
side in one prefix; the pkg-config file names the library of the configuration installed, and writes an absolute
install directory as it is. A static package finds LZ4 and Zstandard in openxisf-dependencies.cmake, which leaves the
module path of the consumer as it was when one is missing. The hardening flags use _FORTIFY_SOURCE=2 with GCC before
12, and only in the optimized configurations.

Platforms. CI builds and tests the oldest compilers supported: the MSVC of Visual Studio 2022, GCC 11 and Clang 15
with libstdc++, with the packages of Ubuntu 22.04, Clang 18 with libc++, and the AppleClang of the first Xcode 16, which
replaces Xcode 15; 0.5.0 named Clang 15 with libc++, which is not tested. CI also builds through the pkg-config file and
from the sources through FetchContent, runs ThreadSanitizer with oneTBB, builds the fuzz targets with a fuzzing engine
as OSS-Fuzz does, and builds without the SIMD kernels and as shared libraries on MinGW and macOS.

Conformance. The README lists every requirement of the specification with the tests that cover it, and the
abilities of a baseline decoder (spec §7.2) have tests of their own. The full sample set of PixInsight is read, and
units written with every option open in PixInsight 1.9.5 with the values written. The round-trip tests are byte-order
independent, which the s390x nightly job had shown they were not.

OpenXISF 0.5.0

Choose a tag to compare

@github-actions github-actions released this 05 Oct 23:36
003b29e

OpenXISF 0.5.0 reads the astrometric solutions of images, as the XISF specification defines them, and converts image coordinates to celestial coordinates and back with them. Before 1.0, minor versions may change the API.

Astrometric solutions

  • Reading a solution (<openxisf/astrometry.h>). astrometric_solution reads the solution of an image from its properties, the AstrometricSolution namespace of spec §11.5.3.7, in its three layers: the projection, with its reference point and linear transformation; the projective transformations; and the distortion models, surface splines of the six basis functions of the specification with Global, Local and Fallback terms. Each layer is checked for its required properties and their dimensions. status() says whether a layer is available or why not (a missing property, an inconsistent one, an unknown identifier, a lower layer that is not available), and problem() explains it. A solution of another major revision is not read at all, and unknown properties of a supported revision are ignored, as the versioning rules of the specification ask.
  • Converting coordinates. image_to_celestial() and celestial_to_image() go through the highest available layer, or a chosen one: the seven projections of the specification (Gnomonic, Stereographic, zenithal equal-area, Orthographic, Plate Carrée, Mercator and Hammer-Aitoff), the spherical rotation of Annex A with its default native coordinates, the projective transformations and the residuals of the distortion models. Each direction uses the transformation that the solution stores, never a numerical inversion, in double precision. A point beyond the domain of a projection has no coordinates. projection() gives the first layer with the defaults of the specification applied.
  • Writing. The writer keeps the properties of a solution as they are given. A solution describes the image it was computed for: an application that crops, resamples or otherwise changes the geometry of an image removes it with remove_astrometric_solution(), as the specification requires.
  • An astrometric_solution is immutable, and any number of threads can use it at once; its copies share their data. read_info prints the solution of each image, with the coordinates of its centre.

OpenXISF agrees within 3e-12 pixels with the coordinates that PixInsight 1.9.5 computes for its own solutions, where the specification expects implementations to agree within 1e-6 pixels, and within 1e-11 pixels with WCSLIB for linear solutions of every projection. Samples written by PixInsight with its coordinates, and WCSLIB's coordinates, are part of the tests.

Compatibility

  • The new header is included by <openxisf/openxisf.h>. The rest of the API is unchanged.
  • The properties of a solution of another major revision have types of their own: the reader no longer warns that their types differ from those of revision 1, and the writer no longer refuses them. Within revision 1, both check the types as before.

Not yet

Signed units. Distortion models are evaluated one point at a time, visiting every term of the model.

Building and testing

The library builds with CMake 3.25 or newer and installs a CMake package (find_package(openxisf CONFIG REQUIRED)) and a pkg-config file. Its dependencies are pugixml, zlib, LZ4 and Zstandard; oneTBB and OpenSSL are optional. See the README for the presets and options.

The tests of this release pass in CI on Linux (GCC 14 and Clang 18 with libstdc++ and libc++, x64 and arm64, with AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer, clang-tidy and fuzzing, and builds with oneTBB and OpenSSL), on Windows (MSVC x64 and arm64, clang-cl, MSYS2 UCRT64 and CLANG64) and on macOS (AppleClang, arm64 and x64), and the vcpkg port builds on all three.

The API documentation is attached as openxisf-0.5.0-docs.tar.gz.

OpenXISF 0.4.0

Choose a tag to compare

@github-actions github-actions released this 05 Oct 06:33
00ac59c

OpenXISF 0.4.0 implements the algorithms that the XISF specification defines, to show and convert images, and reads and writes data faster. Before 1.0, minor versions may change the API.

The algorithms of the specification

  • Colour transformations (<openxisf/color.h>, Annex B). color_converter works relative to one RGB working space, sRGB by default with its own functions, or one with a gamma exponent: it converts between RGB, CIE XYZ and the normalized CIE L*a*b* that XISF units store, and computes the colorimetric grayscale component. Its luminance coefficients are derived from the chromaticities of the primaries, as Annex B requires; luminance_coefficients() gives them to applications that build a working space of their own. convert_rgb_to_lab() converts the pixel data of an image to CIE L*a*b* before it is written, and convert_lab_to_rgb() converts them back after it is read, in place, through the representable range of the image and with its RGB working space. RGB, L*a*b* and grayscale components are clipped to [0, 1], and black stays exactly black.
  • Display functions (<openxisf/display.h>). apply_display_function() evaluates a display function for one component (clipping, midtones transfer and expansion), and midtones_transfer() is the midtones transfer function alone. adaptive_display_function() computes a display function from the median and the normalized median absolute deviation of each channel of an image, the adaptive algorithm of the specification: for each channel, or with one set of parameters for the three channels of an RGB image, which keeps its colour balance.
  • Orientation (<openxisf/orientation.h>). orient_pixels() turns the pixel data of a two-dimensional image, in either storage model, to one of the eight orientations of the specification, and oriented_geometry() gives the size of the result. As the specification requires, this is for showing images only: the reader never applies an orientation.
  • Property format specifiers (<openxisf/format.h>). format_value() writes a property value as text, as its format specifier asks: width, fill character and alignment, sign, precision, fixed, scientific or automatic notation (the g conversion of printf), Booleans as words or digits, and integers in binary, octal, decimal or hexadecimal, 128-bit ones included. The parts of complex numbers and the elements of vectors and matrices are formatted one by one, and format_element() writes a single element of a long vector. Width and precision count up to 1024, so that the format of a property read from a file cannot ask for gigabytes.
  • The new sample program preview writes an 8-bit PGM or PPM file of the first image of a unit, as an application shows it: converted from CIE L*a*b* when it is stored so, stretched with its display function or with an adaptive one, and turned to its orientation. read_info now writes property values with their format specifiers.

The CIE L*a*b* values agree with those of PixInsight 1.9.5 within 1e-6, and the adaptive display functions with those that PixInsight's own statistics give. Reference values for Annex B, computed by an independent script in 50-digit decimal arithmetic, are part of the tests.

Faster

  • Pixel data read into memory of the application go straight from the source into it when they are neither compressed nor converted to the other storage model, and compressed blocks are decompressed into it: reading 100 MiB from memory now takes about as long as copying them. A block that fails its checksum leaves zeros there, and limits::max_allocation applies only to the memory that the library allocates.
  • Byte shuffling uses SSE2 on x86-64 for items of 2, 4 and 8 bytes, 2.5 to 23 times faster than the portable code, behind the new CMake option OPENXISF_ENABLE_SIMD (on by default); arm64 still uses the portable code. Conversion between the planar and normal storage models is 2.5 to 3.8 times faster.
  • The new option OPENXISF_WITH_TBB (off by default; vcpkg feature tbb) compresses and decompresses the subblocks of a block in parallel with oneTBB, in the task arena of the calling thread, and converts large images in pieces; sources, sinks and progress functions are still called from the calling thread. On 8 threads, writing a 100 MiB frame in subblocks gets 2 to 4.1 times faster, and reading it 1.4 to 2.7 times, depending on the codec.
  • The new option OPENXISF_WITH_OPENSSL (off by default; vcpkg feature openssl) computes checksums with OpenSSL's libcrypto: SHA-1 3.6 times and SHA-256 6.3 times faster than the built-in code. A failure of libcrypto is reported with the new errc::hash_failure.
  • OPENXISF_BUILD_BENCHMARKS builds the benchmarks, with Google Benchmark.

Compatibility

  • The new headers are included by <openxisf/openxisf.h>. The rest of the API is unchanged, apart from errc::hash_failure, added at the end of errc.
  • A read into memory of the application that fails or is cancelled may leave part of the data there, as documented since 0.1.0, and now more of it, since data go straight into it; data that fail their checksum are never left there.

Not yet

Astrometric solutions and signed units. Float128 values are formatted from their nearest double. arm64 has no NEON kernels for byte shuffling yet.

Building and testing

The library builds with CMake 3.25 or newer and installs a CMake package (find_package(openxisf CONFIG REQUIRED)) and a pkg-config file. Its dependencies are pugixml, zlib, LZ4 and Zstandard; oneTBB and OpenSSL are optional. See the README for the presets and options.

The tests of this release pass in CI on Linux (GCC 14 and Clang 18 with libstdc++ and libc++, x64 and arm64, with AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer, clang-tidy and fuzzing, and builds with oneTBB and OpenSSL), on Windows (MSVC x64 and arm64, clang-cl, MSYS2 UCRT64 and CLANG64) and on macOS (AppleClang, arm64 and x64), and the vcpkg port builds on all three.

The API documentation is attached as openxisf-0.4.0-docs.tar.gz.

OpenXISF 0.3.0

Choose a tag to compare

@github-actions github-actions released this 04 Oct 19:53
8793529

OpenXISF 0.3.0 reads and writes distributed units, alongside the monolithic units of 0.1.0 and 0.2.0. Before 1.0, minor versions may change the API.

What it reads

  • A distributed unit is a header file (.xish) whose data blocks are external: in data blocks files (.xisb), each with a block index, or in other files that hold one block each, located by path() or url(), with or without an index-id. openxisf::reader recognizes a header file by its content, as before, and now reads its external blocks too.
  • read_options::resolver opens each external file once, when the unit is opened, and the reader keeps it open for later reads, from any number of threads. A unit opened from a path gets file_resolver() for the directory of its header file by default; a unit opened from a source gets no resolver unless the application gives one.
  • file_resolver() opens path(@header_dir/...) locations only inside the directory of the header file, once symbolic links and Windows junctions are followed, and only regular files. Absolute paths are opened only when file_resolver_options::absolute_paths allows them; on Windows, /c/dir/file names C:\dir\file, and network paths are refused. URLs are opened only by a resolver of the application, which can serve them from anywhere, memory included.
  • The block index of each data blocks file is checked as it is read: its signature, nodes inside the file, no cycles, at most limits::max_index_nodes nodes, and no more bytes in the nodes than in the file. An index-id that is missing, free or duplicated, a block outside its file, or an uncompressed length that disagrees with the header makes that block unavailable, with a diagnostic, and the rest of the unit stays readable. limits::max_external_files (256 by default) bounds the files that a unit opens.
  • Seven new error codes describe these problems. With read_options::strict, an external file that cannot be opened or read now fails the open with an io_error.

What it writes

  • writer::save_distributed() writes a header file and one data blocks file, to a path ending with .xish, with the .xisb next to it, or to two output sinks. The header locates every block by the name of the data blocks file, relative to its own directory, so the two files can be moved together. Blocks get random 64-bit identifiers and are aligned as in monolithic files; small blocks stay inline in the header.
  • Both files are complete before either replaces an existing one, and the data blocks file is replaced first. A header file left with another data blocks file, after a failure between the two, finds none of its blocks there, rather than wrong ones.
  • Every option of the writer applies to distributed units: compression, byte shuffling, subblocks, checksums and UUIDs.
  • The new sample program distributed writes a unit next to its data blocks file and reads it back, then writes it into memory and reads it with a resolver of its own.

Compatibility

  • PixInsight 1.9.4 and 1.9.5 read and write monolithic units only, so they cannot open the distributed units of this release. Every header that the tests write, header files included, validates against the official XISF 1.0 schema.
  • What 0.2.0 says about PixInsight still holds with PixInsight 1.9.5: it refuses units with SHA3-256 or SHA3-512 checksums, it does not open UInt64 or one-dimensional images, and the writer stores a subblock that its codec does not make smaller as it is, which is how PixInsight writes and reads such subblocks. The documentation of write_options::subblock_size now says so.
  • read_options holds a std::function now, so it is no longer trivially copyable; existing code that builds it with designated initializers compiles unchanged.

Not yet

The colour and display algorithms of the specification, property format rendering, astrometric solutions, and signed units. The writer writes one data blocks file per unit, with a single index node, and no url() or absolute locations.

Building and testing

The library builds with CMake 3.25 or newer and installs a CMake package (find_package(openxisf CONFIG REQUIRED)) and a pkg-config file. Its dependencies are pugixml, zlib, LZ4 and Zstandard. See the README for the presets and options.

The tests of this release pass in CI on Linux (GCC 14 and Clang 18 with libstdc++ and libc++, x64 and arm64, with AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer, clang-tidy and fuzzing), on Windows (MSVC x64 and arm64, clang-cl, MSYS2 UCRT64 and CLANG64) and on macOS (AppleClang, arm64 and x64), and the vcpkg port builds on all three.

The API documentation is attached as openxisf-0.3.0-docs.tar.gz.

OpenXISF 0.2.0

Choose a tag to compare

@github-actions github-actions released this 04 Oct 16:03
87361fc

OpenXISF 0.2.0 writes monolithic units (.xisf), alongside the reader of 0.1.0. Before 1.0, minor versions may change the API.

What it writes

  • openxisf::writer takes the model that the reader returns: the metadata of a unit, its images with their pixel data, properties of every type, tables, and what describes each image (FITS keywords, ICC profile, RGB working space, display function, colour filter array, resolution and thumbnail). A unit that was read can be written again.
  • The whole unit is checked against the specification before a byte of it is written. A validation_error names the object at fault by the path of its element, such as /xisf/Image[2]/Property[@id='Instrument:Filter'], and the attribute.
  • By default, blocks are written uncompressed and without checksums, and no UUIDs are generated, so that every XISF 1.0 decoder reads the result. On request, the writer compresses blocks with zlib, LZ4, LZ4HC or Zstandard, with byte shuffling and subblocks, adds SHA-1, SHA-2 or SHA-3 checksums, and gives images version 4 UUIDs.
  • A unit is saved to a path, whose file is replaced only once the new one is complete and can be flushed to disk first, or to a sink of the application, with progress and cancellation. One writer can save from several threads at once.
  • The headers that the writer produces validate against the official XISF 1.0 schema.
  • to_date_time() converts a std::chrono time point to a date_time property value. The new sample program write_image writes an RGB image with properties, FITS keywords and a thumbnail.

Compatibility

  • PixInsight 1.9.4 opens the units that the writer produces, within its own abilities. It refuses units with SHA3-256 or SHA3-512 checksums, which are optional for decoders, and it does not open UInt64 or one-dimensional images.
  • A subblock that its codec does not make smaller is stored as it is, with equal compressed and uncompressed sizes. That is how PixInsight writes such subblocks and how it reads them, but the specification does not describe it, and decoders that follow only the specification cannot read them. Without write_options::subblock_size, a block is divided into subblocks only when it is larger than its codec takes at once: about 2 GiB for LZ4 and LZ4HC, 4 GiB for zlib, and never for Zstandard.

Not yet

Distributed units (.xish and .xisb), the colour and display algorithms of the specification, property format rendering, astrometric solutions, and signed units. The writer writes attached and inline blocks in little-endian byte order, and writes an element that several images share once for each of them.

Building and testing

The library builds with CMake 3.25 or newer and installs a CMake package (find_package(openxisf CONFIG REQUIRED)) and a pkg-config file. Its dependencies are pugixml, zlib, LZ4 and Zstandard. See the README for the presets and options.

The tests of this release pass in CI on Linux (GCC 14 and Clang 18 with libstdc++ and libc++, x64 and arm64, with AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer, clang-tidy and fuzzing), on Windows (MSVC x64 and arm64, clang-cl, MSYS2 UCRT64 and CLANG64) and on macOS (AppleClang, arm64 and x64), and the vcpkg port builds on all three.

The API documentation is attached as openxisf-0.2.0-docs.tar.gz.

OpenXISF 0.1.0

Choose a tag to compare

@github-actions github-actions released this 03 Oct 23:34
6c8718e

The first release of OpenXISF, a C++20 library for XISF 1.0, Revision 1, written from the published specification and licensed under the Apache License 2.0.

This release reads monolithic units (.xisf). Writing comes in the next release. Before 1.0, minor versions may change the API.

What it reads

  • The file structure and the XML header, checked against the specification, with configurable safety limits for untrusted files.
  • Data blocks attached, embedded or inline, in either byte order, with SHA-1, SHA-2 and SHA-3 checksums verified before the data are used, and zlib, LZ4, LZ4HC and Zstandard compression, with byte shuffling and subblocks.
  • Properties of every type of the specification, with their format specifiers, and tables.
  • Images in every sample format, with their pixel data read in native byte order, planar or interleaved, into memory of the library or of the application, with progress and cancellation.
  • FITS keywords, ICC profiles, RGB working spaces, display functions, colour filter arrays, resolutions and thumbnails, also when images share them through references. They are loaded when a unit opens, or later on request (read_options::header_only and reader::load_ancillary_data()).

A problem confined to one object of a unit is reported as a diagnostic (reader::diagnostics()), and the rest of the unit stays readable; read_options::strict turns such problems into exceptions.

Not yet

Writing units, distributed units (.xish and .xisb), the colour and display algorithms of the specification, property format rendering, astrometric solutions, and signed units.

Building and testing

The library builds with CMake 3.25 or newer and installs a CMake package (find_package(openxisf CONFIG REQUIRED)) and a pkg-config file. Its dependencies are pugixml, zlib, LZ4 and Zstandard. See the README for the presets and options.

The tests of this release pass in CI on Linux (GCC 14 and Clang 18 with libstdc++ and libc++, x64 and arm64, with AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer, clang-tidy and fuzzing), and on Windows with MSVC, clang-cl and MSYS2 (GCC and Clang) outside CI. macOS was not tested for this release.

The API documentation is attached as openxisf-0.1.0-docs.tar.gz.