IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 29, 2015, 5:24:53 PM (11 years ago)
Author:
eugene
Message:

table compression is internally consistent (tables can be generated and compressed)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_data.c

    r38329 r38334  
    2727int gfits_compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
    2828
    29 static int pass = 0;
    30 
    3129int gfits_compress_data (char *zdata, int *Nzdata, char *cmptype,
    3230                         char **optname, char **optvalue, int Nopt,
     
    3432
    3533  int status;
     34
     35  // do not actually compress : this is used for testing
     36  if (!strcasecmp(cmptype, "NONE")) {
     37    unsigned long Nbytes = Nrawpix * rawpix_size;
     38
     39    memcpy (zdata, rawdata, Nbytes);
     40    *Nzdata = Nbytes;
     41    return (TRUE);
     42  }
    3643
    3744  if (!strcasecmp(cmptype, "GZIP_1")) {
     
    4956      fprintf (stderr, "error in compress (GZIP)\n");
    5057      return (FALSE);
    51     }
    52 
    53     // test of deflate (vs I/O)
    54     {
    55       char *srcbuf, *tgtbuf;
    56       ALLOCATE (srcbuf, char, destLen);
    57       memcpy (srcbuf, zdata, destLen);
    58 
    59       ALLOCATE (tgtbuf, char, Nbytes);
    60      
    61       uLongf Ndeflate = Nbytes;
    62       status = gfits_uncompress ((Bytef *) tgtbuf, &Ndeflate, (Bytef *) zdata, destLen);
    63       if (status != Z_OK) {
    64         fprintf (stderr, "error in uncompress (GZIP) : %d vs %d\n", status, Z_OK);
    65         return (FALSE);
    66       }
    67      
    68       myAssert (Ndeflate == Nbytes, "invalid output size?");
    69 
    70       int i;
    71       for (i = 0; i < Ndeflate; i++) {
    72         myAssert (rawdata[i] == tgtbuf[i], "data mismatch?");
    73       }
    74 
    75     }
    76 
    77     if (pass == 0) {
    78       int i;
    79       for (i = 0; i < 32; i++) {
    80         fprintf (stderr, "0x%02hhx ", zdata[i]);
    81       }
    82       fprintf (stderr, "\n");
    83       pass = 1;
    8458    }
    8559    return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.