IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15656


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

working on decompress

Location:
trunk/Ohana/src/libfits
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libfits/include/gfitsio.h

    r15655 r15656  
    158158int     gfits_extension_is_compressed  PROTO((Header *header));
    159159int     gfits_tile_size                PROTO((Matrix *matrix, int *otile, int *ztile));
    160 int     gfits_uncompressed_data_pixsize PROTO((char *cmptype));
     160int     gfits_uncompressed_data_pixsize PROTO((char *cmptype, int out_bitpix));
    161161int     gfits_vartable_heap_pixsize    PROTO((char format));
    162162
  • 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);
  • trunk/Ohana/src/libfits/matrix/F_uncompress_data.c

    r15649 r15656  
    2626  static int Noutsum = 0;
    2727
    28   if (!strcasecmp(cmptype, "GZIP")) {
    29     unsigned long tNout = *Nout;
     28  if (!strcasecmp(cmptype, "GZIP_1")) {
     29    unsigned long tNout = *Nout * out_pixsize;
    3030    // uncompress does not require us to know the expected number of pixel; it tells us the number
    3131    status = uncompress ((Bytef *) outdata, &tNout, (Bytef *) zdata, Nzdata);
     
    3838  }
    3939
    40   if (!strcasecmp(cmptype, "RICE") || !strcasecmp(cmptype, "RICE_1")) {
     40  if (!strcasecmp(cmptype, "RICE_1")) {
    4141    int i, blocksize;
    4242    // look for the BLOCKSIZE
     
    6969  }
    7070 
    71   if (!strcasecmp(cmptype, "PLIO")) {
     71  if (!strcasecmp(cmptype, "PLIO_1")) {
    7272    int Npix;
    73     Npix = pl_l2pi ((short *) zdata, 0, (int *) outdata, *Nout);
     73    Npix = pl_l2pi ((short *) zdata, 1, (int *) outdata, *Nout);
    7474    if (Npix != *Nout) {
    7575      fprintf (stderr, "error in plio decompression\n");
     
    7979  }
    8080
    81   if (!strcasecmp(cmptype, "HCOMPRESS")) {
     81  if (!strcasecmp(cmptype, "HCOMPRESS_1")) {
    8282    int Nx, Ny, scale;
    8383    status = 0;
Note: See TracChangeset for help on using the changeset viewer.