- Timestamp:
- Jun 3, 2015, 7:00:55 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/matrix/F_uncompress_M.c
r38355 r38356 2 2 # include <gfitsio.h> 3 3 # include <zlib.h> 4 # define VERBOSE_DUMP 0 4 5 5 6 # define ESCAPE { \ … … 242 243 // zdata_pixsize = gfits_vartable_heap_pixsize (zdef.format); XXX 243 244 244 // size of a pixel in the final image (not needed)245 // idata_pixsize = abs(header[0].bitpix) / 8;246 247 245 // size of a pixel in the output from the decompression routine 248 246 int cmp_pixsize = gfits_compressed_data_pixsize (cmptype, header[0].bitpix, optname, optvalue, Noptions); … … 250 248 int raw_pixsize = gfits_uncompressed_data_pixsize (cmptype, header[0].bitpix, optname, optvalue, Noptions); 251 249 250 // size of a pixel in the final image (not needed) 251 // int tile_pixsize = abs(header[0].bitpix) / 8; 252 // fprintf (stderr, "raw_pixsize: %d, cmp_pixsize: %d, tile_pixsize: %d, raw_bitpix: %d\n", raw_pixsize, cmp_pixsize, tile_pixsize, raw_bitpix); 253 252 254 int Nout_alloc = raw_pixsize*max_tile_size; 253 255 ALLOCATE (out, char, Nout_alloc); … … 255 257 off_t row; 256 258 257 if ( 0) {259 if (VERBOSE_DUMP) { 258 260 int k; 259 261 fprintf (stderr, "unc tbl: "); … … 273 275 if (!zdata) ESCAPE; 274 276 275 if (strcasecmp(cmptype, "GZIP_1")) { 276 if (!gfits_byteswap_zdata (zdata, Nzdata, cmp_pixsize)) ESCAPE; 277 } 278 279 if (0 && (row == 0)) { 277 if (VERBOSE_DUMP && (row == 0)) { 280 278 int k; 281 279 fprintf (stderr, "unc dat: "); … … 284 282 } 285 283 284 if (strcasecmp(cmptype, "GZIP_1")) { 285 // Nzdata is number of bytes 286 if (!gfits_byteswap_zdata (zdata, Nzdata, cmp_pixsize)) ESCAPE; 287 } 288 289 if (VERBOSE_DUMP && (row == 0)) { 290 int k; 291 fprintf (stderr, "unc SWP: "); 292 for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); } 293 fprintf (stderr, "\n"); 294 fprintf (stderr, "Nout : %d -> ", Nout); 295 } 296 286 297 // gfits_uncompress_data uncompresses from zdata to the temporary output buffer which must be allocated 287 298 // XXX the tile must not be > 2GB 299 // Nout going in is number of bytes 288 300 if (!gfits_uncompress_data ((char *)zdata, Nzdata, cmptype, optname, optvalue, Noptions, out, &Nout, raw_pixsize)) ESCAPE; 289 301 290 if ( 0&& (row == 0)) {302 if (VERBOSE_DUMP && (row == 0)) { 291 303 int k; 304 fprintf (stderr, "%d\n", Nout); 292 305 fprintf (stderr, "unc swp: "); 293 306 for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", out[k]); } … … 296 309 297 310 if (!strcasecmp(cmptype, "GZIP_1")) { 298 if (!gfits_byteswap_zdata (out, Nout, raw_pixsize)) ESCAPE; 311 // Nout is number of pixels 312 if (!gfits_byteswap_zdata (out, Nout * raw_pixsize, raw_pixsize)) ESCAPE; 299 313 } 300 314 301 if ( 0&& (row == 0)) {315 if (VERBOSE_DUMP && (row == 0)) { 302 316 int k; 303 317 fprintf (stderr, "unc raw: "); … … 309 323 if (!gfits_distribute_data (matrix, out, Nout, raw_bitpix, otile, oblank, ztile, zblank, zscale, zzero)) ESCAPE; 310 324 311 if ( 0&& (row == 0)) {325 if (VERBOSE_DUMP && (row == 0)) { 312 326 int k; 313 327 fprintf (stderr, "unc mat: ");
Note:
See TracChangeset
for help on using the changeset viewer.
