diff options
author | Xiaowen Wu <wuxiaowe@ncsa.uiuc.edu> | 2005-04-27 16:59:11 (GMT) |
---|---|---|
committer | Xiaowen Wu <wuxiaowe@ncsa.uiuc.edu> | 2005-04-27 16:59:11 (GMT) |
commit | 2ae18539b1f95054255133ecc8c7024da3369752 (patch) | |
tree | 62ed9feda879812ab240a01dcfbb75f4ed7332b6 /src/H5Zscaleoffset.c | |
parent | 192631a52e383f978fc830f38d49c6be27a98d3a (diff) | |
download | hdf5-2ae18539b1f95054255133ecc8c7024da3369752.zip hdf5-2ae18539b1f95054255133ecc8c7024da3369752.tar.gz hdf5-2ae18539b1f95054255133ecc8c7024da3369752.tar.bz2 |
[svn-r10681] Purpose:
Slight modification.
Description:
Several constants were added for the scaleoffset filter in
file H5Zpublic.h and corresponding changes needs to be made
in H5Zscaleoffset.c.
Solution:
Slight modification of codes.
Platforms tested:
heping, shanti
Misc. update:
Diffstat (limited to 'src/H5Zscaleoffset.c')
-rw-r--r-- | src/H5Zscaleoffset.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 9c3ecd7..81e5eb5 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -314,7 +314,7 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_1(i, type, filval_buf, filval) \ - if(*minbits == 0) { /* minbits not set yet, calculate max, min, and minbits */ \ + if(*minbits == H5_SO_INT_MINIMUMBITS_DEFAULT ) { /* minbits not set yet, calculate max, min, and minbits */\ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_1(type, max, min, minbits) \ span = max - min + 1; \ @@ -326,7 +326,7 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ for(i = 0; i < d_nelmts; i++) \ buf[i] = (buf[i] == filval)?(((type)1 << *minbits) - 1):(buf[i] - min); \ } else { /* fill value undefined */ \ - if(*minbits == 0) { /* minbits not set yet, calculate max, min, and minbits */ \ + if(*minbits == H5_SO_INT_MINIMUMBITS_DEFAULT ) { /* minbits not set yet, calculate max, min, and minbits */\ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_1(type, max, min, minbits) \ span = max - min + 1; \ @@ -347,7 +347,7 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ \ if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_1(i, type, filval_buf, filval) \ - if(*minbits == 0) { /* minbits not set yet, calculate max, min, and minbits */ \ + if(*minbits == H5_SO_INT_MINIMUMBITS_DEFAULT ) { /* minbits not set yet, calculate max, min, and minbits */\ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_2(type, max, min, minbits) \ span = max - min + 1; \ @@ -359,7 +359,7 @@ H5Z_class_t H5Z_SCALEOFFSET[1] = {{ for(i = 0; i < d_nelmts; i++) \ buf[i] = (buf[i] == filval)?(((unsigned type)1 << *minbits) - 1):(buf[i] - min); \ } else { /* fill value undefined */ \ - if(*minbits == 0) { /* minbits not set yet, calculate max, min, and minbits */ \ + if(*minbits == H5_SO_INT_MINIMUMBITS_DEFAULT ) { /* minbits not set yet, calculate max, min, and minbits */\ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ H5Z_scaleoffset_check_2(type, max, min, minbits) \ span = max - min + 1; \ @@ -969,23 +969,24 @@ H5Z_filter_scaleoffset (unsigned flags, size_t cd_nelmts, const unsigned cd_valu scale_factor = cd_values[H5Z_SCALEOFFSET_PARM_SCALEFACTOR]; scale_type = cd_values[H5Z_SCALEOFFSET_PARM_SCALETYPE]; - /* check and assign proper values set by user to related parameters - * scale type = 0: floating-point type, variable-minimum-bits method, - * scale factor is decimal scale factor - * scale type = 1: floating-point type, fixed-minimum-bits method, - * scale factor is the fixed minimum number of bits - * scale type = other: integer type, scale_factor is minimum number of bits + /* check and assign proper values set by user to related parameters + * scale type can be H5_SO_FLOAT_DSCALE (0), H5_SO_FLOAT_ESCALE (1) or H5_SO_INT (other) + * H5_SO_FLOAT_DSCALE : floating-point type, variable-minimum-bits method, + * scale factor is decimal scale factor + * H5_SO_FLOAT_ESCALE : floating-point type, fixed-minimum-bits method, + * scale factor is the fixed minimum number of bits + * H5_SO_INT : integer type, scale_factor is minimum number of bits */ if(dtype_class==H5Z_SCALEOFFSET_CLS_FLOAT) { /* floating-point type */ - if(scale_type!=0 && scale_type!=1) + if(scale_type!=H5_SO_FLOAT_DSCALE && scale_type!=H5_SO_FLOAT_ESCALE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "scale type must be 0 or 1") } else if(dtype_class==H5Z_SCALEOFFSET_CLS_INTEGER) { /* integer type */ - if(scale_type==0 || scale_type==1) + if(scale_type==H5_SO_FLOAT_DSCALE || scale_type==H5_SO_FLOAT_ESCALE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "scale type cannot be 0 or 1") } - if(scale_type==0) { /* floating-point type, variable-minimum-bits */ + if(scale_type==H5_SO_FLOAT_DSCALE) { /* floating-point type, variable-minimum-bits */ D_val = scale_factor; } else { /* integer type, or floating-point type with fixed-minimum-bits method */ if(scale_factor>cd_values[H5Z_SCALEOFFSET_PARM_SIZE]*8) @@ -1255,7 +1256,7 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse if(filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ H5Z_scaleoffset_get_filval_1(i, signed char, filval_buf, filval); - if(*minbits == 0) { /* minbits not set yet, calculate max, min, and minbits */ + if(*minbits == H5_SO_INT_MINIMUMBITS_DEFAULT ) { /* minbits not set yet, calculate max, min, and minbits */ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) if((unsigned char)(max - min) > (unsigned char)(~(unsigned char)0 - 2)) { *minbits = sizeof(signed char)*8; return; } @@ -1268,7 +1269,7 @@ H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffse for(i = 0; i < d_nelmts; i++) buf[i] = (buf[i] == filval)?(((unsigned char)1 << *minbits) - 1):(buf[i] - min); } else { /* fill value undefined */ - if(*minbits == 0) { /* minbits not set yet, calculate max, min, and minbits */ + if(*minbits == H5_SO_INT_MINIMUMBITS_DEFAULT ) { /* minbits not set yet, calculate max, min, and minbits */ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) if((unsigned char)(max - min) > (unsigned char)(~(unsigned char)0 - 2)) { *minbits = sizeof(signed char)*8; |