Alternative University

Computer Science

Raster Image Storage

Higher Precision Extended Range

XRH File Format 2.0

SZMOD Compression

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

Figure 8.1:  Channel Block (image plane) of an XRH 2.0 file, with Compression Type set to 0x535A4D00020000, stores an SZMod Compression Stream as the Channel Block Data (yellow in this diagram).

SZMod is a modular port of SZ version 2.1 o.

On both 32-bit and 64-bit systems, SZMod generates and decodes the same SZ code stream that SZ 2.1.x generates and decodes on 64-bit systems, provided that SZ 2.1.x used Zstandard (not ZLIB) in the lossless compression stage (the final encoding step). While SZ supports either Zstandard or ZLIB, SZMod only supports Zstandard, because Zstandard supports larger memory buffers.


SZMod Compression Stream

The SZMod Compression Stream begins with a 4-byte start-of-szmod marker (ASCII string SSZ\0), followed with a 64-bit Size integer that stores the Size of the SZMod Compression Stream (including the start-of-szmod marker and this Size integer), followed with a 64-bit Compression Type integer (0x535A4D00020000), followed with a 32-bit Sample Stride integer (must equal the Channel Block Sample Stride), followed with a 32-bit integer that stores the Image Width (same as 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 code stream, followed with the SZ 2.1 code stream, followed with an internal 32-bit cyclical redundancy check (CRC32) of the SZ 2.1 code stream (described below), which is followed with the end-of-szmod marker (ASCII string ESZ\0) that marks the end of the SZMod Compression Stream.

Figure 8.2:  SZMod Compression Stream as the Data of a Channel Block.

Note: The SZMod 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 SZMod Compression Stream store the value 0x53535A00 (ASCII string SSZ\0) which marks the start-of-sz.

Start of SZMod Stream Marker:  SSZ\0

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

End of SZMod Stream Marker:  ESZ\0

The Internal SZ 2.1 CRC is the 32-bit cyclical redundancy check of the SZ 2.1 code stream before the final compression step. This is the CRC 32 of the lossy SZ code stream after Huffman encoding before the final Zstandard compression. Use of this field is optional. It may be required by an application. All of our applications require this. Applications that do not use this field should store zero in this field.


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

Return to Computer Science

Return to Alternative University

Copyright © 2021 Arc Math Software, All rights reserved
Arc Math Software, P.O. Box 221190, Sacramento CA 95822 USA   Contact
2021–Sep–20  08:58  UTC