AlternativeUniversity.net
Alternative University

Computer Science

Raster Image Storage

Higher Precision Extended Range

XRH File Format 4.0

JP2K Compression

If the Compression Type integer of a Channel Block is 0x4A503200040000 (JP2K), the Channel Block Data is a JP2K Compression Stream, after which the end-of-channel-block marker follows the JP2K Compression Stream.


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

The JP2K Compression Stream includes a JPEG 2000 J2K code stream generated by OpenJPEG. The J2K code stream compresses 32-bit IEEE floating point numbers encoded as 24-bit unsigned integers (see the Data Types page of this specification).


JP2K Compression Stream

The JP2K Compression Stream begins with a 4-byte start-of-jp2k marker (ASCII string SJ2\0),

followed with a 64-bit Size integer that stores the Size (in bytes) of the JP2K Compression Stream (including the start-of-jp2k marker and this Size integer),

followed with a 64-bit Compression Type integer (0x4A503200040000),

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 Sample Definition integer which must equal the Channel Block Sample Definition,

followed with a 32-bit IEEE floating point number that stores the bias that is added to make all numbers of the channel non-negative (zero if no bias is needed),

followed with a 32-bit IEEE floating point number that stores the scalar that is applied to each sample (see the Data Types page of this specification),

followed with 16 bytes that are reserved for future use and must be zero,

followed with a 64-bit Size integer that stores the size of the J2K code stream that is genereted with OpenJPEG,

followed with the compressed OpenJPEG J2K code stream,

which is followed with the end-of-jp2k marker (ASCII string EJ2\0) that marks the end of the JP2K Compression Stream for the channel.


Figure 2:  JP2K Compression Stream (shown yellow and light brown) as the Data of a Channel Block in an XRH 4.0 file. The J2K Code Stream (generated by OpenJPEG) is depicted light brown. The byte offset (number of bytes) from the beginning of the JP2K Compression Stream to the beginning of the J2K Code Stream is 64 bytes.

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

The first four bytes of a JP2K Compression Stream store the value 0x534A3200 (ASCII string SJ2\0) which marks the start-of-jp2k.

The last 4 bytes of a JP2K Compression Stream store the value 0x454A3200 (ASCII string EJ2\0) which marks the end-of-jp2k (the last 4 bytes of the JP2K Compression Stream).


Sample Definition

The Sample Definition is an unsigned integer that specifies the Storage Data Type in the upper byte, the Padding (number of bits between samples) in the second byte, and the Sample Width (number of bits wide) in the lower two bytes.

For a JP2K Compression Stream, the Storage Data Type must be STOR_USI_FLOAT24 or STOR_UINT.

If the Storage Data Type is STOR_USI_FLOAT24, the Sample Width must be 24, and the Padding must be 8.

If the Storage Data Type is STOR_UINT, the Sample Width must be 24 or 16. If the Sample Width is 24, the Padding must be 8. If the Sample Width is 16, the Padding must be 16.


< Prev: SZMOD Compression    
    Next: Color Transformations >
XRH 4.0 File Format
Page 1 : 
Page 2 : 
Page 3 : 
Page 4 : 
Page 5 : 
Page 6 : 
Page 7 : 
Page 8 : 
Page 9 : 
Page 10 : 
Page 11 : 
Page 12 : 
Introduction
Data Types
File Layout & Header
Comments
Custom Properties
Channel Names
Channels
Zebra Compression
SZMOD Compression
JP2K Compression (this page)
Color Transformations
Example Images