IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18272


Ignore:
Timestamp:
Jun 22, 2008, 8:56:18 AM (18 years ago)
Author:
eugene
Message:

the CFITSIO version of rice compression has added support for short and byte output data

File:
1 edited

Legend:

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

    r15657 r18272  
    66int fits_rcomp(int a[], int nx, unsigned char *c, int clen, int nblock);
    77int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock);
     8int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock);
     9int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock);
    810
    911/* functions defined in fits_hcompress.c */
     
    6062    // fprintf (stderr, "%d comp bytes; %d uncomp 'pixels', totals: %d %d\n", Nzdata, Npix, Ninsum, Noutsum);
    6163
    62     // rice decompression from the CFITSIO source tree : we need to tell it the expected number of pixels
    63     // is also REQUIRES 4byte output, which is fairly stupid.
    64     if (fits_rdecomp ((unsigned char *) zdata, Nzdata, (unsigned int *) outdata, Npix, blocksize)) {
    65       fprintf (stderr, "error in rice decompression\n");
    66       return (FALSE);
     64    switch (out_pixsize) {
     65      case 4:
     66        // rice decompression from the CFITSIO source tree : we need to tell it the expected number of pixels
     67        // is also REQUIRES 4byte output, which is fairly stupid.
     68        if (fits_rdecomp ((unsigned char *) zdata, Nzdata, (unsigned int *) outdata, Npix, blocksize)) {
     69          fprintf (stderr, "error in rice decompression\n");
     70          return (FALSE);
     71        }
     72        return (TRUE);
     73
     74      case 2:
     75        if (fits_rdecomp_short ((unsigned char *) zdata, Nzdata, (unsigned short *) outdata, Npix, blocksize)) {
     76          fprintf (stderr, "error in rice decompression\n");
     77          return (FALSE);
     78        }
     79        return (TRUE);
     80
     81      case 1:
     82        if (fits_rdecomp_byte ((unsigned char *) zdata, Nzdata, (unsigned char *) outdata, Npix, blocksize)) {
     83          fprintf (stderr, "error in rice decompression\n");
     84          return (FALSE);
     85        }
     86        return (TRUE);
     87       
     88      default:
     89        fprintf (stderr, "invalid output pixel size %d\n", out_pixsize);
     90        return (FALSE);
    6791    }
    68     return (TRUE);
     92   
    6993  }
    7094 
Note: See TracChangeset for help on using the changeset viewer.