Changeset 15656
- Timestamp:
- Nov 20, 2007, 12:09:06 AM (18 years ago)
- Location:
- trunk/Ohana/src/libfits
- Files:
-
- 3 edited
-
include/gfitsio.h (modified) (1 diff)
-
matrix/F_compress_M.c (modified) (5 diffs)
-
matrix/F_uncompress_data.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libfits/include/gfitsio.h
r15655 r15656 158 158 int gfits_extension_is_compressed PROTO((Header *header)); 159 159 int gfits_tile_size PROTO((Matrix *matrix, int *otile, int *ztile)); 160 int gfits_uncompressed_data_pixsize PROTO((char *cmptype ));160 int gfits_uncompressed_data_pixsize PROTO((char *cmptype, int out_bitpix)); 161 161 int gfits_vartable_heap_pixsize PROTO((char format)); 162 162 -
trunk/Ohana/src/libfits/matrix/F_compress_M.c
r15655 r15656 30 30 int gfits_uncompress_image (Header *header, Matrix *matrix, FTable *ftable) { 31 31 32 int i, j, status, zimage, zcol, Nzrows, Nout, Nzdata, max_tile_size , bytes_per_pixel;32 int i, j, status, zimage, zcol, Nzrows, Nout, Nzdata, max_tile_size; 33 33 char cmptype[80]; 34 34 char zaxis[10], naxis[10], key[10], word[81], exttype[81], checksum[81], datasum[81]; … … 183 183 184 184 // size of a pixel in the output from the decompression routine 185 odata_pixsize = gfits_uncompressed_data_pixsize (cmptype );185 odata_pixsize = gfits_uncompressed_data_pixsize (cmptype, header[0].bitpix); 186 186 ALLOCATE (out, char, odata_pixsize*max_tile_size); 187 187 … … 201 201 202 202 // gfits_uncompress_data uncompresses from zdata to the temporary output buffer which must be allocated 203 if (!gfits_uncompress_data ((char *)zdata, Nzdata, cmptype, optname, optvalue, Noptions, out, &Nout, bytes_per_pixel)) return (FALSE);203 if (!gfits_uncompress_data ((char *)zdata, Nzdata, cmptype, optname, optvalue, Noptions, out, &Nout, odata_pixsize)) return (FALSE); 204 204 205 205 // copy the uncompressed pixels into their correct locations … … 346 346 // determine the offset of the next line relative to the start position 347 347 offset = counter[matrix->Naxes - 1]; 348 for (j = 1; j < matrix->Naxes; j++) {348 for (j = matrix->Naxes - 2; j >= 0; j--) { 349 349 offset = offset*matrix->Naxis[j] + counter[j]; 350 350 } … … 436 436 } 437 437 438 int gfits_uncompressed_data_pixsize (char *cmptype) { 439 440 if (!strcasecmp(cmptype, "GZIP")) { 441 return (0); 442 } 443 if (!strcasecmp(cmptype, "RICE") || !strcasecmp(cmptype, "RICE_1")) { 438 int gfits_uncompressed_data_pixsize (char *cmptype, int out_bitpix) { 439 440 if (!strcasecmp(cmptype, "GZIP_1")) { 444 441 return (4); 445 442 } 446 if (!strcasecmp(cmptype, "PLIO")) { 443 if (!strcasecmp(cmptype, "RICE_1")) { 444 return (4); 445 } 446 if (!strcasecmp(cmptype, "PLIO_1")) { 447 447 return (1); 448 448 } 449 if (!strcasecmp(cmptype, "HCOMPRESS")) { 450 return (4); 449 if (!strcasecmp(cmptype, "HCOMPRESS_1")) { 450 if (out_bitpix == 8) return (4); 451 if (out_bitpix == 16) return (4); 452 return (8); 451 453 } 452 454 return (0); -
trunk/Ohana/src/libfits/matrix/F_uncompress_data.c
r15649 r15656 26 26 static int Noutsum = 0; 27 27 28 if (!strcasecmp(cmptype, "GZIP ")) {29 unsigned long tNout = *Nout ;28 if (!strcasecmp(cmptype, "GZIP_1")) { 29 unsigned long tNout = *Nout * out_pixsize; 30 30 // uncompress does not require us to know the expected number of pixel; it tells us the number 31 31 status = uncompress ((Bytef *) outdata, &tNout, (Bytef *) zdata, Nzdata); … … 38 38 } 39 39 40 if (!strcasecmp(cmptype, "RICE ") || !strcasecmp(cmptype, "RICE_1")) {40 if (!strcasecmp(cmptype, "RICE_1")) { 41 41 int i, blocksize; 42 42 // look for the BLOCKSIZE … … 69 69 } 70 70 71 if (!strcasecmp(cmptype, "PLIO ")) {71 if (!strcasecmp(cmptype, "PLIO_1")) { 72 72 int Npix; 73 Npix = pl_l2pi ((short *) zdata, 0, (int *) outdata, *Nout);73 Npix = pl_l2pi ((short *) zdata, 1, (int *) outdata, *Nout); 74 74 if (Npix != *Nout) { 75 75 fprintf (stderr, "error in plio decompression\n"); … … 79 79 } 80 80 81 if (!strcasecmp(cmptype, "HCOMPRESS ")) {81 if (!strcasecmp(cmptype, "HCOMPRESS_1")) { 82 82 int Nx, Ny, scale; 83 83 status = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
