Alternative University

Computer Science

Raster Image Storage

Higher Precision Extended Range

XRH File Format 1.0

SZ219 Compression

If the Compression Type integer of a Channel Block is 0x535A02010900 (SZ219), an SZ219 Compression Stream immediately follows the Compression Type integer, after which the end-of-channel-block marker follows the SZ219 Compression Stream.

Figure 1:  Channel Block (image plane) of an XRH 1.0 file, with Compression Type set to 0x535A02010900, stores an SZ219 Compression Stream as the Channel Block Data (yellow in this diagram).

An SZ219 Compression Stream stores an SZ version 2.1.9 code stream, along with information about the code stream.

SZ version 2.1.9 o is a newly improved high quality lossy compression method under development at Argonne National Laboratory.

We have placed the following restrictions on SZ version 2.1.9 code streams:

  • The SZ version 2.1.9 code stream must be 64-bit even on 32-bit systems. This is done automatically with the SZ version 2.1.9 source code that is included in XRHLIB.
  • The lossless compression stage (the final encoding step) of SZ version 2.1.9 must use Zstandard (not zlib). This is done automatically with the SZ version 2.1.9 source code that is included in XRHLIB.
  • The SZ version 2.1.9 code stream must generate cyclical redundancy checks right before and after the final encoding step. This is done automatically with the SZ version 2.1.9 source code that is included in XRHLIB.

SZ219 Compression Stream

The SZ219 Compression Stream begins with a 4-byte start-of-sz marker (ASCII string SSZ\0), followed with a 64-bit Compression Type integer (0x535A02010900), followed with a 32-bit Version integer (must be 1), followed with a 32-bit Sample Stride integer that (must equal the Channel Block Sample Stride), followed with a 32-bit integer that stores the Image Width (must equal the File Header Image Width), followed with a 32-bit integer that stores the Image Height (same as File Header Image Height), followed with a 32-bit integer that stores the SZ Error Bound Type (0=ABS or 1=REL), followed with a 64-bit floating point number that specfies the Error Bound (absErrBound for ABS or relBoundRatio for REL), followed with a 64-bit Size integer that stores the size of the SZ version 2.1.9 code stream, followed with the SZ version 2.1.9 code stream, followed with a 32-bit cyclical redundancy check (CRC32) of the SZ version 2.1.9 code stream, followed with an internal CRC32 of the SZ stream (described below), which is followed with the end-of-sz marker (ASCII string ESZ\0) that marks the end of the SZ219 Compression Stream.

Figure 2:  SZ219 Compression Stream as the Data of a Channel block.

Note: The SZ219 Compression Stream is self-contained and may be used in any file format (not just in an XRH file).

The first four bytes of an SZ219 Compression Stream store the value 0x53535A00 (ASCII string SSZ\0) which marks the start-of-sz.

Start of SZ219 Stream Marker:  SSZ\0

The last 4 bytes of an SZ219 Compression Stream store the value 0x45535A00 (ASCII string ESZ\0) which marks the end-of-sz (the last 4 bytes of the SZ219 Compression Stream).

End of SZ219 Stream Marker:  ESZ\0

The CRC 32 of the SZ code stream is the standard 32-bit cyclical redundancy check of the code stream that is returned by the SZ_compress() function of the SZ 2.1.9 source code.

The Internal SZ CRC is the 32-bit cyclical redundancy check of the SZ code stream before the final compression step. This is the CRC 32 of the lossy SZ compression stream after Huffman encoding before the final Zstandard compression. For an example, see the XRHLIB source code.


< Previous: Zebra Compression    
    Next: Color Transformations >
XRH File Format
Page 1 : 
Page 2 : 
Page 3 : 
Page 4 : 
Page 5 : 
Page 6 : 
Page 7 : 
Page 8 : 
Page 9 : 
Introduction
File Layout & Header
Comments
Custom Properties
Channel Names
Channels
Zebra Compression
SZ219 Compression (this page)
Color Transformations

Return to Computer Science

Return to Alternative University

Copyright © 2020 Arc Math Software, All rights reserved
Arc Math Software, P.O. Box 221190, Sacramento CA 95822 USA   Contact
2020–Nov–25  18:40  UTC