summaryrefslogtreecommitdiffstats
path: root/doc/html/RM_H5Z.html
blob: 333d3947ebe64e91053c2247908fae72b73bcad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<html>
<head>
<title>
HDF5/H5Z API Specification
</title>

<!-- #BeginLibraryItem "/ed_libs/styles_RM.lbi" --><link href="ed_styles/RMelect.css" rel="stylesheet" type="text/css"><!-- #EndLibraryItem --></head>

<body bgcolor="#FFFFFF">


<!-- #BeginLibraryItem "/ed_libs/NavBar_RM.lbi" --><hr>
<center>
<table border=0 width=98%>
<tr><td valign=top align=left>
<a href="index.html">HDF5 documents and links</a>&nbsp;<br>
<a href="H5.intro.html">Introduction to HDF5</a>&nbsp;<br>
<a href="H5.user.html">HDF5 User Guide</a>&nbsp;<br>
<!--
<a href="Glossary.html">Glossary</a><br>
-->
</td>
<td valign=top align=right>
And in this document, the 
<a href="RM_H5Front.html">HDF5 Reference Manual</a>&nbsp;&nbsp;
<br>
<a href="RM_H5.html">H5</a>&nbsp;&nbsp;
<a href="RM_H5A.html">H5A</a>&nbsp;&nbsp;
<a href="RM_H5D.html">H5D</a>&nbsp;&nbsp;
<a href="RM_H5E.html">H5E</a>&nbsp;&nbsp;
<a href="RM_H5F.html">H5F</a>&nbsp;&nbsp;
<a href="RM_H5G.html">H5G</a>&nbsp;&nbsp;
<a href="RM_H5I.html">H5I</a>&nbsp;&nbsp;
<a href="RM_H5P.html">H5P</a>&nbsp;&nbsp;
<br>
<a href="RM_H5R.html">H5R</a>&nbsp;&nbsp;
<a href="RM_H5S.html">H5S</a>&nbsp;&nbsp;
<a href="RM_H5T.html">H5T</a>&nbsp;&nbsp;
<a href="RM_H5Z.html">H5Z</a>&nbsp;&nbsp;
<a href="Tools.html">Tools</a>&nbsp;&nbsp;
<a href="PredefDTypes.html">Datatypes</a>&nbsp;&nbsp;
</td></tr>
</table>
</center>
<hr>
<!-- #EndLibraryItem --><center>
<h1>H5Z: Filter and Compression Interface</h1>
</center>

<h2>Filter and Compression API Functions</h2>

These functions enable the user to configure new filters
for the local environment.

<table border=0 width=80%>
<tr><td valign=top>
<ul>
    <li><a href="#Compression-Register">H5Zregister</a>
</ul>
</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign=top>
<ul>
    <li><a href="#Compression-Unregister">H5Zunregister</a>
</ul>
</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign=top>
<ul>
    <li><a href="#Compression-FilterAvail">H5Zfilter_avail</a>
</ul>
</td></tr>
</table>

<p>
HDF5 supports a filter pipeline that provides the capability for standard 
and customized raw data processing during I/O operations.  
HDF5 is distributed with a small set of standard filters such as 
compression (gzip and a shuffling algorithm) and 
error checking (Fletcher32 checksum).
For further flexibility, the library includes tools enabling a 
user application to extend the pipeline through the 
creation and registration of customized filters.
<p>
As mentioned above, one set of filters distributed with HDF5 provides 
built-in methods for raw data compression.  
The flexibility of the filter pipeline implementation enables the 
definition of additional compression methods by a user application.
A compression method<br>
&nbsp;&mdash;&nbsp;
    is associated with a dataset when the dataset is created,<br>
&nbsp;&mdash;&nbsp;
    can be used only with chunked data (ie., datasets stored in the
    <code>H5D_CHUNKED</code> storage layout), and<br>
&nbsp;&mdash;&nbsp;
    is applied independently to each chunk of the dataset.
<p>
The HDF5 library does not support compression for contiguous datasets 
because of the difficulty of implementing random access for partial I/O. 
Compact dataset compression is not supported because it would not produce 
significant results.
<p>
See <a href="Datasets.html"><cite>The Dataset Interface (H5D)</cite></a> 
in the <cite>HDF5 User's Guide</cite> for further information regarding 
data compression.

<hr>
<dl>
<dt><strong>Name:</strong> <a name="Compression-Register">H5Zregister</a>
<dt><strong>Signature:</strong>
    <dd><em>herr_t</em> <code>H5Zregister</code>(<em>H5Z_filter_t</em> <code>filter</code>,
        <em>const char *</em><code>comment</code>,
        <em>H5Z_func_t</em> <code>function</code>
    )
<dt><strong>Purpose:</strong>
    <dd> Registers new filter.
<dt><strong>Description:</strong>
    <dd><code>H5Zregister</code> registers a new filter with the
         HDF5 library.  
	 <p>
	 Making a new filter available to an application is a two-step
	 process.  The first step is to <span class="termEmphasis">define</span> 
	 the new filter <code>function</code> as described below.
	 This step can be skipped only when the filter is predifined, as is 
	 the case with the Fletcher32 checksum and shuffle filters that
	 are distributed with the HDF5 Library.
	 This call to <code>H5Zregister</code>, 
	 <span class="termEmphasis">registering</span> the filter with the 
	 library, is the second step.  
	 <p>
	 The new filter is specified by the filter identifier 
	 <code>filter</code>.  
         <p>
         <code>comment</code> is used for debugging and may be 
	 the null pointer. 
         <p>
         <code>function</code> is a user-defined function 
	 which performs the action of the filter.
         <p>
         The statistics associated with a filter are not reset
         by this function; they accumulate over the life of the library.

    <p><strong>New filters.</strong>   Before a filter can be 
         linked into an application with <code>H5Zregister</code>, 
         the filter must be defined as described in the HDF5 Library 
	 header file <code>H5Zpublic.h</code>:

    <dir>
          <em>typedef size_t</em> (*<code>H5Z_func_t</code>)
          (<em>unsigned int</em> <code>flags</code>,
          <em>size_t</em> <code>cd_nelmts</code>,
          <em>const unsigned int</em> <code>cd_values[]</code>,
          <em>size_t</em> <code>nbytes</code>,
          <em>size_t *</em><code>buf_size</code>,
          <em>void **</em><code>buf</code>)
    </dir>

    <p>The parameters <code>flags</code>, <code>cd_nelmts</code>, 
      and <code>cd_values</code> are the same as for the function
      <code>H5Pset_filter</code>.
      The additional flag <code>H5Z_FLAG_REVERSE</code> is set when 
      the filter is called as part of the input pipeline. 
      The parameter <code>*buf</code> points to the input buffer 
      which has a size of <code>*buf_size</code> bytes,
      <code>nbytes</code> of which are valid data. 
    <p>The filter should perform the transformation in place if
      possible and return the number of valid bytes or zero for
      failure.  If the transformation cannot be done in place, 
      then the filter should allocate a new buffer with
      <code>malloc()</code> and assign it to <code>*buf</code>,
      assigning the allocated size of that buffer to
      <code>*buf_size</code>. 
      The old buffer should be freed by calling <code>free()</code>.

<dt><strong>Parameters:</strong>
    <dl>
        <dt><em>H5Z_filter_t</em> <code>method</code>
            <dd>IN: Filter identifier.
        <dt><em>const char *</em><code>comment</code>
            <dd>IN: String associated with the filter;  
                used for debugging purposes only.
		May be the null pointer.
        <dt><em>H5Z_func_t</em> <code>function</code>
            <dd>IN: Filter function.
    </dl>
<dt><strong>Returns:</strong>
    <dd>Returns a non-negative value if successful;
        otherwise returns a negative value.
</dl>




<hr>
<dl>
  <dt><strong>Name:</strong> <a name="Compression-Unregister">H5Zunregister</a>
  <dt><strong>Signature:</strong>
    <dd><em>herr_t</em> <code>H5Zunregister</code>(<em>H5Z_filter_t</em> <code>filter</code>)
  <dt><strong>Purpose:</strong>
    <dd>Unregisters a filter.
  <dt><strong>Description:</strong>
    <dd><code>H5Zunregister</code> unregisters the filter 
        specified in <code>filter</code>.  
	<p>
	After a call to <code>H5Zunregister</code>, the filter
	specified in <code>filter</code> will no longer be 
	available to the application.
  <dt><strong>Parameters:</strong>
    <dl>
        <dt><em>H5Z_filter_t</em> <code>filter</code>
            <dd>IN: Identifier of the filter to be unregistered.
    </dl>
  <dt><strong>Returns:</strong>
    <dd>Returns a non-negative value if successful;
        otherwise returns a negative value.
  <!--
  <dt><strong>Non-C API(s):</strong>
    <dd><a href="fortran/h5p_FORTRAN.html#h5pget_nfilters_f" 
        target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
  -->   <!--
        <img src="Graphics/Java.gif"> 
        <img src="Graphics/C++.gif">
        -->
</dl>

<hr>
<dl>
  <dt><strong>Name:</strong> <a name="Compression-FilterAvail">H5Zfilter_avail</a>
  <dt><strong>Signature:</strong>
    <dd><em>herr_t</em> <code>H5Zfilter_avail</code>(<em>H5Z_filter_t</em> <code>filter</code>)
  <dt><strong>Purpose:</strong>
    <dd>Determines whether a filter is available.
  <dt><strong>Description:</strong>
    <dd><code>H5Zfilter_avail</code> determines whether the filter 
        specified in <code>filter</code> is available to the application.
  <dt><strong>Parameters:</strong>
    <dl>
        <dt><em>H5Z_filter_t</em> <code>filter</code>
            <dd>IN: Filter identifier.
    </dl>
  <dt><strong>Returns:</strong>
    <dd>Returns a non-negative value if successful;
        otherwise returns a negative value.
  <!--
  <dt><strong>Non-C API(s):</strong>
    <dd><a href="fortran/h5p_FORTRAN.html#h5pget_nfilters_f" 
        target="FortranWin"><img src="Graphics/FORTRAN.gif" border=0></a>
  -->   <!--
        <img src="Graphics/Java.gif"> 
        <img src="Graphics/C++.gif">
        -->
</dl>








<!-- #BeginLibraryItem "/ed_libs/NavBar_RM.lbi" --><hr>
<center>
<table border=0 width=98%>
<tr><td valign=top align=left>
<a href="index.html">HDF5 documents and links</a>&nbsp;<br>
<a href="H5.intro.html">Introduction to HDF5</a>&nbsp;<br>
<a href="H5.user.html">HDF5 User Guide</a>&nbsp;<br>
<!--
<a href="Glossary.html">Glossary</a><br>
-->
</td>
<td valign=top align=right>
And in this document, the 
<a href="RM_H5Front.html">HDF5 Reference Manual</a>&nbsp;&nbsp;
<br>
<a href="RM_H5.html">H5</a>&nbsp;&nbsp;
<a href="RM_H5A.html">H5A</a>&nbsp;&nbsp;
<a href="RM_H5D.html">H5D</a>&nbsp;&nbsp;
<a href="RM_H5E.html">H5E</a>&nbsp;&nbsp;
<a href="RM_H5F.html">H5F</a>&nbsp;&nbsp;
<a href="RM_H5G.html">H5G</a>&nbsp;&nbsp;
<a href="RM_H5I.html">H5I</a>&nbsp;&nbsp;
<a href="RM_H5P.html">H5P</a>&nbsp;&nbsp;
<br>
<a href="RM_H5R.html">H5R</a>&nbsp;&nbsp;
<a href="RM_H5S.html">H5S</a>&nbsp;&nbsp;
<a href="RM_H5T.html">H5T</a>&nbsp;&nbsp;
<a href="RM_H5Z.html">H5Z</a>&nbsp;&nbsp;
<a href="Tools.html">Tools</a>&nbsp;&nbsp;
<a href="PredefDTypes.html">Datatypes</a>&nbsp;&nbsp;
</td></tr>
</table>
</center>
<hr>
<!-- #EndLibraryItem -->

<!-- #BeginLibraryItem "/ed_libs/Footer.lbi" --><address>
<a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a> 
<br>
Describes HDF5 Release 1.5, Unreleased Development Branch
</address><!-- #EndLibraryItem --> 

Last modified:  2 April 2003
 
</body>
</html>