Changeset 41474 for trunk/Ohana/src/libfits/matrix/F_compress_M.c
- Timestamp:
- Jan 24, 2021, 3:37:52 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libfits/matrix/F_compress_M.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libfits/matrix/F_compress_M.c
r39457 r41474 76 76 if (!gfits_modify (theader, "ZCMPTYPE", "%s", 1, zcmptype)) ESCAPE; 77 77 78 // define compression-specific keywords, update header as needed.79 if (!strcasecmp(zcmptype, "GZIP_1") || !strcasecmp(zcmptype, "GZIP_2")) {80 if ((header[0].bitpix == -32) || (header[0].bitpix == -64)) {81 if (!gfits_modify (theader, "ZQUANTIZ", "%s", 1, "NONE")) ESCAPE;82 }83 }84 85 78 if (!gfits_modify_alt (theader, "ZSIMPLE", "%t", 1, TRUE)) ESCAPE; 86 79 // gfits_modify (header, "ZTENSION", "%s", 1, exttype); … … 124 117 int oblank = 32767; 125 118 // gfits_modify (header, "BLANK", "%d", 1, oblank); 119 120 // define compression-specific keywords, update header as needed. 121 if (!strcasecmp(zcmptype, "GZIP_1") || !strcasecmp(zcmptype, "GZIP_2")) { 122 if ((header[0].bitpix == -32) || (header[0].bitpix == -64)) { 123 if (!gfits_modify (theader, "ZQUANTIZ", "%s", 1, "NONE")) ESCAPE; 124 } 125 } 126 126 127 127 # if (0) … … 159 159 unsigned long int max_tile_size = gfits_imtile_maxsize (matrix, ztile); 160 160 161 // size of a pixel in the raw pixel buffer (before compression) 162 int raw_pixsize = gfits_uncompressed_data_pixsize (zcmptype, header[0].bitpix, NULL, NULL, 0); 163 int raw_bitpix = gfits_uncompressed_data_bitpix (zcmptype, header[0].bitpix, NULL, NULL, 0); 161 // size of a pixel in the compressed data (cmp_pixsize), used for byteswap below 164 162 int cmp_pixsize = gfits_compressed_data_pixsize (zcmptype, header[0].bitpix, NULL, NULL, 0); 163 164 // size of a pixel in the raw pixel buffer (before compression) (last option says RICE uses header.bitpix) 165 int raw_pixsize = gfits_uncompressed_data_pixsize (zcmptype, header[0].bitpix, NULL, NULL, 0, TRUE); 166 167 // we also need the bitpix value for the raw uncompressed buffer to distinguish int and floats 168 int raw_bitpix = gfits_uncompressed_data_bitpix (zcmptype, header[0].bitpix, NULL, NULL, 0, TRUE); 165 169 166 170 // define compression-specific keywords, update header as needed. … … 237 241 } 238 242 239 // GZIP_1 is swapped before compression; GZIP_2 implies swapping. All other 240 // compression modes require swapping after compression (compresssion & decompression 241 // operate on native ENDIAN) 242 if (strcasecmp(zcmptype, "NONE_2") && // strcasecmp(zcmptype, "NONE") && 243 strcasecmp(zcmptype, "GZIP_1") && 244 strcasecmp(zcmptype, "GZIP_2") && 245 strcasecmp(zcmptype, "RICE_1") && 246 strcasecmp(zcmptype, "RICE_ONE")) { 247 // Nzdata is number of bytes 248 if (!gfits_byteswap_zdata (zdata, Nzdata, cmp_pixsize)) ESCAPE; 249 } 243 // BYTESWAP the compressed data after compressing. Compression algorithms which do 244 // not need to byteswap here return 1 for cmp_pixsize. GZIP_1 is swapped before 245 // compression; GZIP_2 implies swapping. All other compression modes require swapping 246 // after compression (the compresssion & decompression functions operate on native 247 // ENDIAN data values). 248 if (!gfits_byteswap_zdata (zdata, Nzdata, cmp_pixsize)) ESCAPE; 250 249 251 250 if (VERBOSE_DUMP && (i == 0)) {
Note:
See TracChangeset
for help on using the changeset viewer.
