1 | /*============================================================================== |
---|
2 | The SZIP Science Data Lossless Compression Program is Copyright (C) 2001 Science |
---|
3 | & Technology Corporation @ UNM. All rights released. Copyright (C) 2003 Lowell |
---|
4 | H. Miles and Jack A. Venbrux. Licensed to ICs Corp. for distribution by the |
---|
5 | University of Illinois' National Center for Supercomputing Applications as a |
---|
6 | part of the HDF data storage and retrieval file format and software library |
---|
7 | products package. All rights reserved. Do not modify or use for other |
---|
8 | purposes. |
---|
9 | |
---|
10 | SZIP implements an extended Rice adaptive lossless compression algorithm |
---|
11 | for sample data. The primary algorithm was developed by R. F. Rice at |
---|
12 | Jet Propulsion Laboratory. |
---|
13 | |
---|
14 | SZIP embodies certain inventions patented by the National Aeronautics & |
---|
15 | Space Administration. United States Patent Nos. 5,448,642, 5,687,255, |
---|
16 | and 5,822,457 have been licensed to ICs Corp. for distribution with the |
---|
17 | HDF data storage and retrieval file format and software library products. |
---|
18 | All rights reserved. |
---|
19 | |
---|
20 | Revocable (in the event of breach by the user or if required by law), |
---|
21 | royalty-free, nonexclusive sublicense to use SZIP decompression software |
---|
22 | routines and underlying patents is hereby granted by ICs Corp. to all users |
---|
23 | of and in conjunction with HDF data storage and retrieval file format and |
---|
24 | software library products. |
---|
25 | |
---|
26 | Revocable (in the event of breach by the user or if required by law), |
---|
27 | royalty-free, nonexclusive sublicense to use SZIP compression software |
---|
28 | routines and underlying patents for non-commercial, scientific use only |
---|
29 | is hereby granted by ICs Corp. to users of and in conjunction with HDF |
---|
30 | data storage and retrieval file format and software library products. |
---|
31 | |
---|
32 | For commercial use license to SZIP compression software routines and underlying |
---|
33 | patents please contact ICs Corp. at ICs Corp., 721 Lochsa Street, Suite 8, |
---|
34 | Post Falls, ID 83854. (208) 262-2008. |
---|
35 | |
---|
36 | ==============================================================================*/ |
---|
37 | /********************************************************/ |
---|
38 | /* defines and declarations to interface to the szip */ |
---|
39 | /* functions in file rice.c. */ |
---|
40 | /* USE EXTREME CARE WHEN MODIFYING THIS FILE */ |
---|
41 | /********************************************************/ |
---|
42 | extern int szip_allow_encoding; |
---|
43 | |
---|
44 | #define SZ_ALLOW_K13_OPTION_MASK 1 |
---|
45 | #define SZ_CHIP_OPTION_MASK 2 |
---|
46 | #define SZ_EC_OPTION_MASK 4 |
---|
47 | #define SZ_LSB_OPTION_MASK 8 |
---|
48 | #define SZ_MSB_OPTION_MASK 16 |
---|
49 | #define SZ_NN_OPTION_MASK 32 |
---|
50 | #define SZ_RAW_OPTION_MASK 128 |
---|
51 | |
---|
52 | #define SZ_STREAM_ERROR (-1) |
---|
53 | #define SZ_MEM_ERROR (-2) |
---|
54 | #define SZ_INIT_ERROR (-3) |
---|
55 | #define SZ_PARAM_ERROR (-4) |
---|
56 | #define SZ_NO_ENCODER_ERROR (-5) |
---|
57 | |
---|
58 | #define SZ_MAX_BLOCKS_PER_SCANLINE 128 |
---|
59 | #define SZ_MAX_PIXELS_PER_BLOCK 32 |
---|
60 | #define SZ_MAX_PIXELS_PER_SCANLINE (SZ_MAX_BLOCKS_PER_SCANLINE)*(SZ_MAX_PIXELS_PER_BLOCK) |
---|
61 | |
---|
62 | long szip_compress_memory( |
---|
63 | int options_mask, |
---|
64 | int bits_per_pixel, |
---|
65 | int pixels_per_block, |
---|
66 | int pixels_per_scanline, |
---|
67 | const void *in, |
---|
68 | long pixels, |
---|
69 | char *out); |
---|
70 | |
---|
71 | long szip_uncompress_memory( |
---|
72 | int new_options_mask, |
---|
73 | int new_bits_per_pixel, |
---|
74 | int new_pixels_per_block, |
---|
75 | int new_pixels_per_scanline, |
---|
76 | const char *in, |
---|
77 | long in_bytes, |
---|
78 | void *out, |
---|
79 | long out_pixels); |
---|
80 | |
---|
81 | int szip_check_params( |
---|
82 | int bits_per_pixel, |
---|
83 | int pixels_per_block, |
---|
84 | int pixels_per_scanline, |
---|
85 | long image_pixels, |
---|
86 | char **msg); |
---|