MISR Toolkit  1.5.1
szlib.h
Go to the documentation of this file.
1 /* szlib.h -- defines, typedefs, and data structures for szlib API functions. */
2 
3 /*==============================================================================
4 The SZIP Science Data Lossless Compression Program is Copyright (C) 2001 Science
5 & Technology Corporation @ UNM. All rights released. Copyright (C) 2003 Lowell
6 H. Miles and Jack A. Venbrux. Licensed to ICs Corp. for distribution by the
7 University of Illinois' National Center for Supercomputing Applications as a
8 part of the HDF data storage and retrieval file format and software library
9 products package. All rights reserved. Do not modify or use for other
10 purposes.
11 
12 SZIP implements an extended Rice adaptive lossless compression algorithm
13 for sample data. The primary algorithm was developed by R. F. Rice at
14 Jet Propulsion Laboratory.
15 
16 SZIP embodies certain inventions patented by the National Aeronautics &
17 Space Administration. United States Patent Nos. 5,448,642, 5,687,255,
18 and 5,822,457 have been licensed to ICs Corp. for distribution with the
19 HDF data storage and retrieval file format and software library products.
20 All rights reserved.
21 
22 Revocable (in the event of breach by the user or if required by law),
23 royalty-free, nonexclusive sublicense to use SZIP decompression software
24 routines and underlying patents is hereby granted by ICs Corp. to all users
25 of and in conjunction with HDF data storage and retrieval file format and
26 software library products.
27 
28 Revocable (in the event of breach by the user or if required by law),
29 royalty-free, nonexclusive sublicense to use SZIP compression software
30 routines and underlying patents for non-commercial, scientific use only
31 is hereby granted by ICs Corp. to users of and in conjunction with HDF
32 data storage and retrieval file format and software library products.
33 
34 For commercial use license to SZIP compression software routines and underlying
35 patents please contact ICs Corp. at ICs Corp., 721 Lochsa Street, Suite 8,
36 Post Falls, ID 83854. (208) 262-2008.
37 
38 ==============================================================================*/
39 #ifndef _SZLIB_H
40 #define _SZLIB_H
41 
42 #include "ricehdf.h"
43 #include "szip_adpt.h"
44 
45 #define SZLIB_VERSION "2.1.1"
46 
47 /*
48  The application must update next_in and avail_in when avail_in has
49  dropped to zero. It must update next_out and avail_out when avail_out
50  has dropped to zero. The application must initialize zalloc, zfree and
51  opaque before calling the init function. All other fields are set by the
52  compression library and must not be updated by the application.
53 
54  The fields total_in and total_out can be used for statistics or
55  progress reports. After compression, total_in holds the total size of
56  the uncompressed data and may be saved for use in the decompressor
57  (particularly if the decompressor wants to decompress everything in
58  a single step).
59 */
60 
61 #define SZ_NULL 0
62 
63 /*** API flush values ***/
64 #define SZ_NO_FLUSH 0
65 #define SZ_FINISH 4
66 
67 /*** API state values ***/
68 #define SZ_INPUT_IMAGE 5
69 #define SZ_OUTPUT_IMAGE 6
70 
71 /*** API return values ***/
72 #define SZ_OK 0
73 #define SZ_STREAM_END 1
74 #define SZ_OUTBUFF_FULL 2
75 
76 /*** API error values defined in ricehdf.h ***/
77 /* SZ_STREAM_ERROR */
78 /* SZ_MEM_ERROR */
79 /* SZ_INIT_ERROR */
80 /* SZ_PARAM_ERROR */
81 /* SZ_NO_ENCODER_ERROR */
82 
83 /*** API options_mask values defined in ricehdf.h ***/
84 /* SZ_ALLOW_K13_OPTION_MASK */
85 /* SZ_CHIP_OPTION_MASK */
86 /* SZ_EC_OPTION_MASK */
87 /* SZ_LSB_OPTION_MASK */
88 /* SZ_MSB_OPTION_MASK */
89 /* SZ_NN_OPTION_MASK */
90 /* SZ_RAW_OPTION_MASK */
91 
92 /*** API MAX limits defined in ricehdf.h ***/
93 /* SZ_MAX_BLOCKS_PER_SCANLINE */
94 /* SZ_MAX_PIXELS_PER_BLOCK */
95 /* SZ_MAX_PIXELS_PER_SCANLINE */
96 
97 typedef struct sz_hidden_data_s
98  {
99  char *image_in;
100  long avail_in;
101  char *next_in;
102 
103  char *image_out;
104  long avail_out;
105  char *next_out;
106  } sz_hidden_data;
107 
108 typedef struct sz_stream_s
109  {
110  char *next_in; /* next input byte */
111  unsigned int avail_in; /* number of bytes available at next_in */
112  unsigned long total_in; /* total nb of input bytes read so far */
113 
114  char *next_out; /* next output byte should be put there */
115  unsigned int avail_out; /* remaining free space at next_out */
116  unsigned long total_out; /* total nb of bytes output so far */
117 
118  char *msg;
119  int state;
120 
121  void *hidden; /* this data hidden from user */
122 
123  int options_mask;
124  int bits_per_pixel;
125  int pixels_per_block;
126  int pixels_per_scanline;
127  long image_pixels;
128  } sz_stream;
129 
131 
132 typedef struct SZ_com_t_s
133  {
134  int options_mask;
135  int bits_per_pixel;
136  int pixels_per_block;
137  int pixels_per_scanline;
138  } SZ_com_t;
139 
140 __SZ_DLL__ int SZ_BufftoBuffCompress(void *dest, size_t *destLen, const void *source, size_t sourceLen, SZ_com_t *param);
141 __SZ_DLL__ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen, const void *source, size_t sourceLen, SZ_com_t *param);
142 
144 __SZ_DLL__ int SZ_Decompress(sz_stream *strm, int flush);
146 
148 __SZ_DLL__ int SZ_Compress(sz_stream *strm, int flush);
151 
152 #endif /* _SZLIB_H */
__SZ_DLL__ int SZ_DecompressInit(sz_stream *strm)
long avail_in
Definition: szlib.h:100
#define __SZ_DLL__
Definition: szip_adpt.h:47
sz_stream * sz_streamp
Definition: szlib.h:130
__SZ_DLL__ int SZ_CompressEnd(sz_stream *strm)
char * image_out
Definition: szlib.h:103
struct sz_stream_s sz_stream
__SZ_DLL__ int SZ_CompressInit(sz_stream *strm)
__SZ_DLL__ int SZ_Decompress(sz_stream *strm, int flush)
char * next_in
Definition: szlib.h:101
__SZ_DLL__ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen, const void *source, size_t sourceLen, SZ_com_t *param)
__SZ_DLL__ int SZ_Compress(sz_stream *strm, int flush)
long avail_out
Definition: szlib.h:104
char * image_in
Definition: szlib.h:99
__SZ_DLL__ int SZ_DecompressEnd(sz_stream *strm)
struct SZ_com_t_s SZ_com_t
__SZ_DLL__ int SZ_encoder_enabled(void)
char * next_out
Definition: szlib.h:105
struct sz_hidden_data_s sz_hidden_data
__SZ_DLL__ int SZ_BufftoBuffCompress(void *dest, size_t *destLen, const void *source, size_t sourceLen, SZ_com_t *param)

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52