IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 20, 2007, 12:09:06 AM (19 years ago)
Author:
eugene
Message:

working on decompress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libfits/matrix/F_compress_M.c

    r15655 r15656  
    3030int gfits_uncompress_image (Header *header, Matrix *matrix, FTable *ftable) {
    3131
    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;
    3333  char cmptype[80];
    3434  char zaxis[10], naxis[10], key[10], word[81], exttype[81], checksum[81], datasum[81];
     
    183183
    184184  // 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);
    186186  ALLOCATE (out, char, odata_pixsize*max_tile_size);
    187187
     
    201201
    202202    // 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);
    204204
    205205    // copy the uncompressed pixels into their correct locations           
     
    346346    // determine the offset of the next line relative to the start position
    347347    offset = counter[matrix->Naxes - 1];
    348     for (j = 1; j < matrix->Naxes; j++) {
     348    for (j = matrix->Naxes - 2; j >= 0; j--) {
    349349      offset = offset*matrix->Naxis[j] + counter[j];
    350350    }     
     
    436436}
    437437
    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")) {
     438int gfits_uncompressed_data_pixsize (char *cmptype, int out_bitpix) {
     439
     440  if (!strcasecmp(cmptype, "GZIP_1")) {
    444441    return (4);
    445442  }
    446   if (!strcasecmp(cmptype, "PLIO")) {
     443  if (!strcasecmp(cmptype, "RICE_1")) {
     444    return (4);
     445  }
     446  if (!strcasecmp(cmptype, "PLIO_1")) {
    447447    return (1);
    448448  }
    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);
    451453  }
    452454  return (0);
Note: See TracChangeset for help on using the changeset viewer.