aboutsummaryrefslogtreecommitdiff
path: root/src/include/imcompress.h
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-03-05 12:53:09 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-03-05 12:53:09 -0500
commit832b4b34ff8ce84a13751883c0822c16c152fe48 (patch)
treeedb4d7050c37ade55bc543de80e76e58c4486908 /src/include/imcompress.h
parent8f848043369b49e861942ce132181fed2c53c2d3 (diff)
downloadcalfuse-832b4b34ff8ce84a13751883c0822c16c152fe48.tar.gz
Massive rework
Diffstat (limited to 'src/include/imcompress.h')
-rw-r--r--src/include/imcompress.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/include/imcompress.h b/src/include/imcompress.h
new file mode 100644
index 0000000..c5ba7d2
--- /dev/null
+++ b/src/include/imcompress.h
@@ -0,0 +1,56 @@
+#define MAX_COMPRESS_DIM 6
+#define COMPRESS_NULL_VALUE -2147483647
+
+typedef struct {
+ char zcmptype[12]; /* compression type string */
+ int compress_type; /* type of compression algorithm */
+ int bitpix; /* FITS data type of image (BITPIX) */
+ int ndim; /* dimension of image */
+ long naxis[MAX_COMPRESS_DIM]; /* length of each axis */
+ int cn_compressed; /* column number for COMPRESSED_DATA column */
+ int cn_uncompressed; /* column number for UNCOMPRESSED_DATA column */
+ int cn_zscale; /* column number for CSCALE column */
+ int cn_zzero; /* column number for CZERO column */
+ int cn_zblank; /* column number for the CBLANK column */
+ double zscale; /* scaling value, if keyword and not column */
+ double zzero; /* zero pt, if keyword and not column */
+ int zblank; /* value for null pixels, if not a column */
+ long nrows; /* number of rows in table */
+ int ncols; /* number of columns in table */
+ int rice_blocksize; /* first compression parameter */
+ int rice_nbits; /* second compression parameter */
+ long tilesize[MAX_COMPRESS_DIM]; /* size of compression tiles */
+ long maxtilelen; /* max number of pixels in each image tile */
+ long maxelem; /* maximum length of variable length arrays */
+} CompressImageInfo;
+
+/* image compression routines */
+static int imcomp_get_image_params(fitsfile *infptr, CompressImageInfo *otb,
+ int *status);
+static int imcomp_init_table(fitsfile *outfptr,
+ CompressImageInfo *otb, int *status);
+static int imcomp_calc_max_elem (int nx, int blocksize);
+static int imcomp_copy_imheader(fitsfile *infptr, fitsfile *outfptr,
+ int *status);
+static int imcomp_img_to_tbl_special (char *card);
+static int imcomp_compress_image (fitsfile *infptr, fitsfile *outfptr,
+ CompressImageInfo *otb, int *status);
+
+/* image decompression routines */
+int fits_read_compressed_img_plane(fitsfile *fptr, int datatype,
+ int bytesperpixel, long nplane, long *firstcoord, long *lastcoord,
+ long *inc, long *naxes, int nullcheck, void *nullval,
+ void *array, char *nullarray, int *anynul, int *status);
+static int imcomp_get_table_params(fitsfile *infptr, CompressImageInfo *itb,
+ int *status);
+static int imcomp_copy_tblheader(fitsfile *infptr, fitsfile *outfptr,
+ int *status);
+static int imcomp_tbl_to_img_special (char *keyname);
+static int imcomp_decompress_tile (fitsfile *infptr, CompressImageInfo *itb,
+ int nrow, int tilesize, int datatype, int nullcheck,
+ void *nulval, void *buffer, char *bnullarray, int *anynul,
+ int *status);
+static int imcomp_copy_overlap (char *tile, int datatype, int ndim,
+ long *tfpixel, long *tlpixel, char *bnullarray, char *image,
+ long *fpixel, long *lpixel, int nullcheck, char *nullarray,
+ int *status);