Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 09:20:48

0001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0002  * Copyright by The HDF Group.                                               *
0003  * All rights reserved.                                                      *
0004  *                                                                           *
0005  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
0006  * terms governing use, modification, and redistribution, is contained in    *
0007  * the COPYING file, which can be found at the root of the source code       *
0008  * distribution tree, or in https://www.hdfgroup.org/licenses.               *
0009  * If you do not have access to either file, you may request a copy from     *
0010  * help@hdfgroup.org.                                                        *
0011  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
0012 
0013 #ifndef H5Zpublic_H
0014 #define H5Zpublic_H
0015 
0016 #include "H5public.h" /* Generic Functions                        */
0017 /**
0018  * \brief Filter identifiers
0019  *
0020 //! [FiltersIdTable]
0021 <table>
0022 <tr>
0023 <th>Values for #H5Z_filter_t</th><th>Description</th>
0024 </tr>
0025 <tr>
0026 <td><code>0-255</code></td>
0027 <td>These values are reserved for filters predefined and
0028        registered by the HDF5 library and of use to the general public.</td>
0029 </tr>
0030 <tr>
0031 <td><code>256-511</code></td>
0032 <td>Filter values in this range are intended for testing only and can be
0033     temporarily used by any organization. No attempts are made to resolve
0034     numbering conflicts, as all definitions are temporary.</td>
0035 </tr>
0036 <tr>
0037 <td><code>512-32,767</code></td>
0038 <td>Filter values within this range are designated for filters managed by
0039     The HDF Group, but they are nominally requested, developed, and supported
0040     by third parties. Please contact the
0041     <a href="mailto:help@hdfgroup.org">HDF5 development team</a>
0042     to reserve a value or range of values for use by your filters.</td>
0043 </tr>
0044 <tr>
0045 <td><code>32,768-65,535</code></td>
0046 <td>Filter values in this range are designated for internal company use or
0047     application testing when assessing a feature. The HDF Group does not
0048     track or document the use of filters within this range.
0049 </td>
0050 </tr>
0051 </table>
0052 //! [FiltersIdTable]
0053  */
0054 
0055 typedef int H5Z_filter_t;
0056 
0057 /* Filter IDs */
0058 /**
0059  * no filter
0060  */
0061 #define H5Z_FILTER_ERROR (-1)
0062 /**
0063  * reserved indefinitely
0064  */
0065 #define H5Z_FILTER_NONE 0
0066 /**
0067  * deflation like gzip
0068  */
0069 #define H5Z_FILTER_DEFLATE 1
0070 /**
0071  * shuffle the data
0072  */
0073 #define H5Z_FILTER_SHUFFLE 2
0074 /**
0075  * fletcher32 checksum of EDC
0076  */
0077 #define H5Z_FILTER_FLETCHER32 3
0078 /**
0079  * szip compression
0080  */
0081 #define H5Z_FILTER_SZIP 4
0082 /**
0083  * nbit compression
0084  */
0085 #define H5Z_FILTER_NBIT 5
0086 /**
0087  * scale+offset compression
0088  */
0089 #define H5Z_FILTER_SCALEOFFSET 6
0090 /**
0091  * filter ids below this value are reserved for library use
0092  */
0093 #define H5Z_FILTER_RESERVED 256
0094 /**
0095  * maximum filter id
0096  */
0097 #define H5Z_FILTER_MAX 65535
0098 
0099 /* General macros */
0100 /**
0101  * Symbol to remove all filters in H5Premove_filter()
0102  */
0103 #define H5Z_FILTER_ALL 0
0104 /**
0105  * Maximum number of filters allowed in a pipeline
0106  *
0107  * \internal (should probably be allowed to be an unlimited amount, but
0108  *            currently each filter uses a bit in a 32-bit field, so the format
0109  *            would have to be changed to accommodate that)
0110  */
0111 #define H5Z_MAX_NFILTERS 32
0112 
0113 /* Flags for filter definition (stored) */
0114 /**
0115  * definition flag mask
0116  */
0117 #define H5Z_FLAG_DEFMASK 0x00ff
0118 /**
0119  * filter is mandatory
0120  */
0121 #define H5Z_FLAG_MANDATORY 0x0000
0122 /**
0123  * filter is optional
0124  */
0125 #define H5Z_FLAG_OPTIONAL 0x0001
0126 
0127 /* Additional flags for filter invocation (not stored) */
0128 /**
0129  * invocation flag mask
0130  */
0131 #define H5Z_FLAG_INVMASK 0xff00
0132 /**
0133  * reverse direction; read
0134  */
0135 #define H5Z_FLAG_REVERSE 0x0100
0136 /**
0137  * skip EDC filters for read
0138  */
0139 #define H5Z_FLAG_SKIP_EDC 0x0200
0140 
0141 /* Special parameters for szip compression
0142  *
0143  * These are aliases for similarly-named definitions in szlib.h, which we
0144  * can't include directly due to the duplication of various symbols with the
0145  * zlib.h header file.
0146  *
0147  * The flag values are set to the same values as in szlib.h. The following
0148  * symbols are internal and defined in H5Zprivate.h:
0149  *
0150  * - H5_SZIP_LSB_OPTION_MASK
0151  * - H5_SZIP_MSB_OPTION_MASK
0152  * - H5_SZIP_RAW_OPTION_MASK
0153  *
0154  * TODO: These symbols should probably be deprecated and moved to H5Zprivate.h
0155  *       in the next major release of the library since they are only used
0156  *       internally:
0157  *
0158  * - H5_SZIP_ALLOW_K13_OPTION_MASK
0159  * - H5_SZIP_CHIP_OPTION_MASK
0160  */
0161 /**
0162  * \ingroup SZIP
0163  *
0164  * Used internally. Always added to the \p options_mask parameter of H5Pset_szip().
0165  */
0166 #define H5_SZIP_ALLOW_K13_OPTION_MASK 1
0167 /**
0168  * \ingroup SZIP
0169  *
0170  * Used internally. Always removed from the \p options_mask parameter of H5Pset_szip().
0171  */
0172 #define H5_SZIP_CHIP_OPTION_MASK 2
0173 /**
0174  * \ingroup SZIP
0175  *
0176  * Use the entropy coding method
0177  */
0178 #define H5_SZIP_EC_OPTION_MASK 4
0179 /**
0180  * \ingroup SZIP
0181  *
0182  * Use nearest neighbor preprocessing and then the entropy coding method
0183  */
0184 #define H5_SZIP_NN_OPTION_MASK 32
0185 /**
0186  * \ingroup SZIP
0187  *
0188  * The maximum number of pixels per block (see H5Pset_szip())
0189  */
0190 #define H5_SZIP_MAX_PIXELS_PER_BLOCK 32
0191 
0192 /* Macros for the shuffle filter */
0193 /**
0194  * \ingroup SHUFFLE
0195  * Number of parameters that users can set for the shuffle filter
0196  */
0197 #define H5Z_SHUFFLE_USER_NPARMS 0
0198 /**
0199  * \ingroup SHUFFLE
0200  * Total number of parameters for the shuffle filter
0201  */
0202 #define H5Z_SHUFFLE_TOTAL_NPARMS 1
0203 
0204 /* Macros for the szip filter */
0205 /**
0206  * \ingroup SZIP
0207  * Number of parameters that users can set for SZIP
0208  */
0209 #define H5Z_SZIP_USER_NPARMS 2
0210 /**
0211  * \ingroup SZIP
0212  * Total number of parameters for SZIP filter
0213  */
0214 #define H5Z_SZIP_TOTAL_NPARMS 4
0215 /**
0216  * \ingroup SZIP
0217  * "User" parameter for option mask
0218  */
0219 #define H5Z_SZIP_PARM_MASK 0
0220 /**
0221  * \ingroup SZIP
0222  * "User" parameter for pixels-per-block
0223  */
0224 #define H5Z_SZIP_PARM_PPB 1
0225 /**
0226  * \ingroup SZIP
0227  * "Local" parameter for bits-per-pixel
0228  */
0229 #define H5Z_SZIP_PARM_BPP 2
0230 /**
0231  * \ingroup SZIP
0232  * "Local" parameter for pixels-per-scanline
0233  */
0234 #define H5Z_SZIP_PARM_PPS 3
0235 
0236 /* Macros for the nbit filter */
0237 /**
0238  * \ingroup NBIT
0239  * Number of parameters that users can set for the N-bit filter
0240  */
0241 #define H5Z_NBIT_USER_NPARMS 0 /* Number of parameters that users can set */
0242 
0243 /* Macros for the scale offset filter */
0244 /**
0245  * \ingroup SCALEOFFSET
0246  * Number of parameters that users can set for the scale-offset filter
0247  */
0248 #define H5Z_SCALEOFFSET_USER_NPARMS 2
0249 
0250 /* Special parameters for ScaleOffset filter*/
0251 /**
0252  * \ingroup SCALEOFFSET */
0253 #define H5Z_SO_INT_MINBITS_DEFAULT 0
0254 /**
0255  * \ingroup SCALEOFFSET */
0256 typedef enum H5Z_SO_scale_type_t {
0257     H5Z_SO_FLOAT_DSCALE = 0,
0258     H5Z_SO_FLOAT_ESCALE = 1,
0259     H5Z_SO_INT          = 2
0260 } H5Z_SO_scale_type_t;
0261 
0262 /**
0263  * \ingroup FLETCHER32
0264  * Values to decide if EDC is enabled for reading data
0265  */
0266 typedef enum H5Z_EDC_t {
0267     H5Z_ERROR_EDC   = -1, /**< error value */
0268     H5Z_DISABLE_EDC = 0,
0269     H5Z_ENABLE_EDC  = 1,
0270     H5Z_NO_EDC      = 2 /**< sentinel */
0271 } H5Z_EDC_t;
0272 
0273 /* Bit flags for H5Zget_filter_info */
0274 #define H5Z_FILTER_CONFIG_ENCODE_ENABLED (0x0001)
0275 #define H5Z_FILTER_CONFIG_DECODE_ENABLED (0x0002)
0276 
0277 /**
0278  * Return values for filter callback function
0279  */
0280 typedef enum H5Z_cb_return_t {
0281     H5Z_CB_ERROR = -1, /**< error value */
0282     H5Z_CB_FAIL  = 0,  /**< I/O should fail if filter fails. */
0283     H5Z_CB_CONT  = 1,  /**< I/O continues if filter fails.   */
0284     H5Z_CB_NO    = 2   /**< sentinel */
0285 } H5Z_cb_return_t;
0286 
0287 //! <!-- [H5Z_filter_func_t_snip] -->
0288 /**
0289  *  Filter callback function definition
0290  */
0291 typedef H5Z_cb_return_t (*H5Z_filter_func_t)(H5Z_filter_t filter, void *buf, size_t buf_size, void *op_data);
0292 //! <!-- [H5Z_filter_func_t_snip] -->
0293 
0294 #ifdef __cplusplus
0295 extern "C" {
0296 #endif
0297 
0298 /**
0299  * \ingroup H5Z
0300  *
0301  * \brief Determines whether a filter is available
0302  *
0303  * \param[in] id Filter identifier
0304  * \return \htri_t
0305  *
0306  * \details H5Zfilter_avail() determines whether the filter specified in \p id
0307  *          is available to the application.
0308  *
0309  * \since 1.6.0
0310  */
0311 H5_DLL htri_t H5Zfilter_avail(H5Z_filter_t id);
0312 /**
0313  * \ingroup H5Z
0314  *
0315  * \brief Retrieves information about a filter
0316  *
0317  * \param[in] filter Filter identifier
0318  * \param[out] filter_config_flags A bit field encoding the returned filter
0319  *                                 information
0320  * \return \herr_t
0321  *
0322  * \details H5Zget_filter_info() retrieves information about a filter. At
0323  *          present, this means that the function retrieves a filter's
0324  *          configuration flags, indicating whether the filter is configured to
0325  *          decode data, encode data, neither, or both.
0326  *
0327  *          If \p filter_config_flags is not set to NULL prior to the function
0328  *          call, the returned parameter contains a bit field specifying the
0329  *          available filter configuration. The configuration flag values can
0330  *          then be determined through a series of bitwise AND operations, as
0331  *          described below.
0332  *
0333  *          Valid filter configuration flags include the following:
0334  *          <table>
0335  *            <tr><td>#H5Z_FILTER_CONFIG_ENCODE_ENABLED</td>
0336  *                <td>Encoding is enabled for this filter</td></tr>
0337  *            <tr><td>#H5Z_FILTER_CONFIG_DECODE_ENABLED</td>
0338  *                <td>Decoding is enabled for this filter</td></tr>
0339  *          </table>
0340  *
0341  *          A bitwise AND of the returned \p filter_config_flags and a valid
0342  *          filter configuration flag will reveal whether the related
0343  *          configuration option is available. For example, if the value of
0344  *          \code
0345  *          H5Z_FILTER_CONFIG_ENCODE_ENABLED & filter_config_flags
0346  *          \endcode
0347  *          is true, i.e., greater than 0 (zero), the queried filter
0348  *          is configured to encode data; if the value is \c false, i.e., equal to
0349  *          0 (zero), the filter is not so configured.
0350  *
0351  *          If a filter is not encode-enabled, the corresponding \c H5Pset_*
0352  *          function will return an error if the filter is added to a dataset
0353  *          creation property list (which is required if the filter is to be
0354  *          used to encode that dataset). For example, if the
0355  *          #H5Z_FILTER_CONFIG_ENCODE_ENABLED flag is not returned for the SZIP
0356  *          filter, #H5Z_FILTER_SZIP, a call to H5Pset_szip() will fail.
0357  *
0358  *          If a filter is not decode-enabled, the application will not be able
0359  *          to read an existing file encoded with that filter.
0360  *
0361  *          This function should be called, and the returned \p
0362  *          filter_config_flags should be analyzed, before calling any other function,
0363  *          such as H5Pset_szip(), that might require a particular filter
0364  *          configuration.
0365  *
0366  * \since 1.6.0
0367  */
0368 H5_DLL herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags);
0369 
0370 #ifdef __cplusplus
0371 }
0372 #endif
0373 
0374 #endif /* _H5Zpublic_H */