summaryrefslogtreecommitdiff
path: root/include/compression
diff options
context:
space:
mode:
Diffstat (limited to 'include/compression')
-rw-r--r--include/compression/bwlzh.h74
-rw-r--r--include/compression/bwt.h28
-rw-r--r--include/compression/coder.h42
-rw-r--r--include/compression/dict.h23
-rw-r--r--include/compression/fixpoint.h45
-rw-r--r--include/compression/huffman.h35
-rw-r--r--include/compression/lz77.h27
-rw-r--r--include/compression/merge_sort.h22
-rw-r--r--include/compression/mtf.h37
-rw-r--r--include/compression/my64bit.h67
-rw-r--r--include/compression/rle.h24
-rw-r--r--include/compression/tng_compress.h165
-rw-r--r--include/compression/vals16.h23
-rw-r--r--include/compression/warnmalloc.h32
-rw-r--r--include/compression/widemuldiv.h33
15 files changed, 677 insertions, 0 deletions
diff --git a/include/compression/bwlzh.h b/include/compression/bwlzh.h
new file mode 100644
index 0000000..3e58d2d
--- /dev/null
+++ b/include/compression/bwlzh.h
@@ -0,0 +1,74 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef BWLZH_H
+#define BWLZH_H
+
+/* Compress the integers (positive, small integers are preferable)
+ using bwlzh compression. The unsigned char *output should be
+ allocated to be able to hold worst case. You can obtain this length
+ conveniently by calling comp_get_buflen()
+*/
+void DECLSPECDLLEXPORT bwlzh_compress(unsigned int *vals, int nvals,
+ unsigned char *output, int *output_len);
+
+void DECLSPECDLLEXPORT bwlzh_compress_no_lz77(unsigned int *vals, int nvals,
+ unsigned char *output, int *output_len);
+
+int DECLSPECDLLEXPORT bwlzh_get_buflen(int nvals);
+
+void DECLSPECDLLEXPORT bwlzh_decompress(unsigned char *input, int nvals,
+ unsigned int *vals);
+
+
+/* The routines below are mostly useful for testing, and for internal
+ use by the library. */
+
+void DECLSPECDLLEXPORT bwlzh_compress_verbose(unsigned int *vals, int nvals,
+ unsigned char *output, int *output_len);
+
+void DECLSPECDLLEXPORT bwlzh_compress_no_lz77_verbose(unsigned int *vals, int nvals,
+ unsigned char *output, int *output_len);
+
+void DECLSPECDLLEXPORT bwlzh_decompress_verbose(unsigned char *input, int nvals,
+ unsigned int *vals);
+
+/* Compress the integers (positive, small integers are preferable)
+ using huffman coding, with automatic selection of how to handle the
+ huffman dictionary. The unsigned char *huffman should be allocated
+ to be able to hold worst case. You can obtain this length
+ conveniently by calling comp_huff_buflen()
+*/
+void Ptngc_comp_huff_compress(unsigned int *vals, int nvals,
+ unsigned char *huffman, int *huffman_len);
+
+int Ptngc_comp_huff_buflen(int nvals);
+
+void Ptngc_comp_huff_decompress(unsigned char *huffman, int huffman_len,
+ unsigned int *vals);
+
+
+/* the value pointed to by chosen_algo should be
+ sent as -1 for autodetect. */
+void Ptngc_comp_huff_compress_verbose(unsigned int *vals, int nvals,
+ unsigned char *huffman, int *huffman_len,
+ int *huffdatalen,
+ int *huffman_lengths,int *chosen_algo,
+ int isvals16);
+
+#define N_HUFFMAN_ALGO 3
+char *Ptngc_comp_get_huff_algo_name(int algo);
+char *Ptngc_comp_get_algo_name(int algo);
+
+
+#endif
diff --git a/include/compression/bwt.h b/include/compression/bwt.h
new file mode 100644
index 0000000..e95f7ee
--- /dev/null
+++ b/include/compression/bwt.h
@@ -0,0 +1,28 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef BWT_H
+#define BWT_H
+
+void Ptngc_comp_to_bwt(unsigned int *vals, int nvals,
+ unsigned int *output, int *index);
+
+void Ptngc_comp_from_bwt(unsigned int *input, int nvals, int index,
+ unsigned int *vals);
+
+void Ptngc_bwt_merge_sort_inner(int *indices, int nvals,unsigned int *vals,
+ int start, int end,
+ unsigned int *nrepeat,
+ int *workarray);
+
+#endif
diff --git a/include/compression/coder.h b/include/compression/coder.h
new file mode 100644
index 0000000..5cef38a
--- /dev/null
+++ b/include/compression/coder.h
@@ -0,0 +1,42 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+#ifndef CODER_H
+#define CODER_H
+
+struct coder
+{
+ unsigned int pack_temporary;
+ int pack_temporary_bits;
+ int stat_overflow;
+ int stat_numval;
+};
+
+struct coder *Ptngc_coder_init(void);
+void Ptngc_coder_deinit(struct coder *coder);
+unsigned char *Ptngc_pack_array(struct coder *coder,int *input, int *length, int coding, int coding_parameter, int natoms, int speed);
+int Ptngc_unpack_array(struct coder *coder,unsigned char *packed,int *output, int length, int coding, int coding_parameter, int natoms);
+unsigned char *Ptngc_pack_array_xtc2(struct coder *coder,int *input, int *length);
+int Ptngc_unpack_array_xtc2(struct coder *coder,unsigned char *packed,int *output, int length);
+unsigned char *Ptngc_pack_array_xtc3(int *input, int *length, int natoms, int speed);
+int Ptngc_unpack_array_xtc3(unsigned char *packed,int *output, int length, int natoms);
+
+void Ptngc_out8bits(struct coder *coder, unsigned char **output);
+void Ptngc_pack_flush(struct coder *coder,unsigned char **output);
+void Ptngc_write_pattern(struct coder *coder,unsigned int pattern, int nbits, unsigned char **output);
+
+void Ptngc_writebits(struct coder *coder,unsigned int value,int nbits, unsigned char **output_ptr);
+void Ptngc_write32bits(struct coder *coder,unsigned int value,int nbits, unsigned char **output_ptr);
+void Ptngc_writemanybits(struct coder *coder,unsigned char *value,int nbits, unsigned char **output_ptr);
+
+
+#endif
diff --git a/include/compression/dict.h b/include/compression/dict.h
new file mode 100644
index 0000000..e29b17f
--- /dev/null
+++ b/include/compression/dict.h
@@ -0,0 +1,23 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef DICT_H
+#define DICT_H
+
+void Ptngc_comp_canonical_dict(unsigned int *dict, int *ndict);
+
+void Ptngc_comp_make_dict_hist(unsigned int *vals, int nvals,
+ unsigned int *dict, int *ndict,
+ unsigned int *hist);
+
+#endif
diff --git a/include/compression/fixpoint.h b/include/compression/fixpoint.h
new file mode 100644
index 0000000..d20d5e1
--- /dev/null
+++ b/include/compression/fixpoint.h
@@ -0,0 +1,45 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+#ifndef FIXPOINT_H
+#define FIXPOINT_H
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "my64bit.h"
+
+/* There are at least 32 bits available in a long. */
+typedef unsigned long fix_t;
+
+/* Positive double to 32 bit fixed point value */
+fix_t Ptngc_ud_to_fix_t(double d,double max);
+
+/* double to signed 32 bit fixed point value */
+fix_t Ptngc_d_to_fix_t(double d,double max);
+
+/* 32 bit fixed point value to positive double */
+double Ptngc_fix_t_to_ud(fix_t f, double max);
+
+/* signed 32 bit fixed point value to double */
+double Ptngc_fix_t_to_d(fix_t f, double max);
+
+/* Convert a floating point variable to two 32 bit integers with range
+ -2.1e9 to 2.1e9 and precision to somewhere around 1e-9. */
+void Ptngc_d_to_i32x2(double d, fix_t *hi, fix_t *lo);
+
+/* Convert two 32 bit integers to a floating point variable
+ -2.1e9 to 2.1e9 and precision to somewhere around 1e-9. */
+double Ptngc_i32x2_to_d(fix_t hi, fix_t lo);
+
+#endif
diff --git a/include/compression/huffman.h b/include/compression/huffman.h
new file mode 100644
index 0000000..c36e94d
--- /dev/null
+++ b/include/compression/huffman.h
@@ -0,0 +1,35 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef HUFFMAN_H
+#define HUFFMAN_H
+
+void Ptngc_comp_conv_to_huffman(unsigned int *vals, int nvals,
+ unsigned int *dict, int ndict,
+ unsigned int *prob,
+ unsigned char *huffman,
+ int *huffman_len,
+ unsigned char *huffman_dict,
+ int *huffman_dictlen,
+ unsigned int *huffman_dict_unpacked,
+ int *huffman_dict_unpackedlen);
+
+void Ptngc_comp_conv_from_huffman(unsigned char *huffman,
+ unsigned int *vals, int nvals,
+ int ndict,
+ unsigned char *huffman_dict,
+ int huffman_dictlen,
+ unsigned int *huffman_dict_unpacked,
+ int huffman_dict_unpackedlen);
+
+#endif
diff --git a/include/compression/lz77.h b/include/compression/lz77.h
new file mode 100644
index 0000000..e811256
--- /dev/null
+++ b/include/compression/lz77.h
@@ -0,0 +1,27 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef LZ77_H
+#define LZ77_H
+
+void Ptngc_comp_to_lz77(unsigned int *vals, int nvals,
+ unsigned int *data, int *ndata,
+ unsigned int *len, int *nlens,
+ unsigned int *offsets, int *noffsets);
+
+void Ptngc_comp_from_lz77(unsigned int *data, int ndata,
+ unsigned int *len, int nlens,
+ unsigned int *offsets, int noffsets,
+ unsigned int *vals, int nvals);
+
+#endif
diff --git a/include/compression/merge_sort.h b/include/compression/merge_sort.h
new file mode 100644
index 0000000..970d5ee
--- /dev/null
+++ b/include/compression/merge_sort.h
@@ -0,0 +1,22 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef MERGE_SORT_H
+#define MERGE_SORT_H
+
+void Ptngc_merge_sort(void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *v1,const void *v2,const void *private),
+ void *private);
+
+
+#endif
diff --git a/include/compression/mtf.h b/include/compression/mtf.h
new file mode 100644
index 0000000..9c5e175
--- /dev/null
+++ b/include/compression/mtf.h
@@ -0,0 +1,37 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef MTF_H
+#define MTF_H
+
+void Ptngc_comp_conv_to_mtf(unsigned int *vals, int nvals,
+ unsigned int *dict, int ndict,
+ unsigned int *valsmtf);
+
+void Ptngc_comp_conv_from_mtf(unsigned int *valsmtf, int nvals,
+ unsigned int *dict, int ndict,
+ unsigned int *vals);
+
+void Ptngc_comp_conv_to_mtf_partial(unsigned int *vals, int nvals,
+ unsigned int *valsmtf);
+
+void Ptngc_comp_conv_from_mtf_partial(unsigned int *valsmtf, int nvals,
+ unsigned int *vals);
+
+void Ptngc_comp_conv_to_mtf_partial3(unsigned int *vals, int nvals,
+ unsigned char *valsmtf);
+
+void Ptngc_comp_conv_from_mtf_partial3(unsigned char *valsmtf, int nvals,
+ unsigned int *vals);
+
+#endif
diff --git a/include/compression/my64bit.h b/include/compression/my64bit.h
new file mode 100644
index 0000000..fb2d5d0
--- /dev/null
+++ b/include/compression/my64bit.h
@@ -0,0 +1,67 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+/* Here presence of 64 bit integers are checked for. If on windows
+ define USE_WINDOWS if it does not get defined automatically.
+ If on UNIX, define the sizes of SIZEOF_INT, SIZEOF_LONG, SIZEOF_LONG_LONG
+ If none of these symbols are defined, stdint.h is included (if on C99
+ or USE_STDINT is defined) and 64 bit integers are assumed to be
+ present. If none of this is fulfilled, 64 bit integers are not
+ available. */
+
+#ifndef MY64BIT_H
+#define MY64BIT_H
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+/* The USE_WINDOWS symbol should be automatically defined in tng_compress.h */
+#include "tng_compress.h"
+
+#ifdef USE_WINDOWS
+typedef __int64 my_int64_t;
+typedef unsigned __int64 my_uint64_t;
+#define HAVE64BIT
+#else /* USE_WINDOWS */
+/* UNIX. Use config.h */
+#if SIZEOF_INT >= 8
+typedef int my_int64_t;
+typedef unsigned int my_uint64_t;
+#define HAVE64BIT
+#else /* SIZEOF_INT */
+#if SIZEOF_LONG >= 8
+typedef long my_int64_t;
+typedef unsigned long my_uint64_t;
+#define HAVE64BIT
+#else /* SIZEOF_LONG */
+#if SIZEOF_LONG_LONG >= 8
+typedef long long my_int64_t;
+typedef unsigned long long my_uint64_t;
+#define HAVE64BIT
+#else /* SIZEOF_LONG_LONG */
+#if HAVE_STDINT_H
+typedef int64_t my_int64_t;
+typedef uint64_t my_uint64_t;
+#define HAVE64BIT
+#endif /* STDINT_H */
+#endif /* SIZEOF_LONG_LONG */
+#endif /* SIZEOF_LONG */
+#endif /* SIZEOF_INT */
+#endif /* USE_WINDOWS */
+
+#endif
diff --git a/include/compression/rle.h b/include/compression/rle.h
new file mode 100644
index 0000000..3adf8dc
--- /dev/null
+++ b/include/compression/rle.h
@@ -0,0 +1,24 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef RLE_H
+#define RLE_H
+
+void Ptngc_comp_conv_to_rle(unsigned int *vals, int nvals,
+ unsigned int *rle, int *nrle,
+ int min_rle);
+
+void Ptngc_comp_conv_from_rle(unsigned int *rle,
+ unsigned int *vals, int nvals);
+
+#endif
diff --git a/include/compression/tng_compress.h b/include/compression/tng_compress.h
new file mode 100644
index 0000000..eefcfaa
--- /dev/null
+++ b/include/compression/tng_compress.h
@@ -0,0 +1,165 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+#ifndef TNG_COMPRESS_H
+#define TNG_COMPRESS_H
+
+#ifndef USE_WINDOWS
+#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
+#define USE_WINDOWS
+#endif /* win32... */
+#endif /* not defined USE_WINDOWS */
+
+#ifdef USE_WINDOWS
+#define DECLSPECDLLEXPORT __declspec(dllexport)
+#else
+#define DECLSPECDLLEXPORT
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* tng_compress_pos expects positions to have the order:
+ first xyz, then sorted in atom order
+ then all the frames repeated, i.e.:
+ nframes * [
+ natoms* [
+ x, y, z
+ ]
+ ]
+ desired_precision what to round the numbers to, i.e. integers will be created as:
+ round(pos[]/desired_precision).
+
+ algo should first be determined by calling
+ tng_compress_pos_find_algo
+
+ The compressed data is returned in a malloced pointer (so free can
+ be called to free the memory), the number of chars in the compressed
+ data is put into *nitems.
+*/
+
+char DECLSPECDLLEXPORT *tng_compress_pos(double *pos, int natoms, int nframes,
+ double desired_precision,
+ int speed, int *algo,
+ int *nitems);
+
+
+/* The tng_compress_pos_find_algo works the same as tng_compress_pos, but
+ it performs benchmarking to find the algorithms with the best
+ compression ratio.
+ The search is controlled by giving speed:
+ speed=1: Fast algorithms only. This excludes all BWLZH algorithms and
+ the XTC3 algorithm.
+ speed=2: Same as 1 and also includes the XTC3 algorithm using base compression
+ only.
+ speed=3: Same as 2 and also includes the XTC3 algorithm which will use BWLZH
+ compression when it seems likely to give better
+ compression. Also includes the interframe BWLZH algorithm for
+ coordinates and velocities.
+ speed=4: Enable the inter frame BWLZH algorithm for the coordinates.
+ The one-to-one BWLZH algorithm is enabled for velocities.
+ speed=5: Enable the LZ77 part of the BWLZH algorithm.
+ speed=6: Enable the intra frame BWLZH algorithm for the coordinates. Always try
+ the BWLZH compression in the XTC3 algorithm.
+
+ Set speed=0 to allow tng_compression to set the default speed (which is currently 2).
+ For very good compression it makes sense to choose speed=4 or speed=5
+
+ The number of items required in the algorithm array can be found
+ by calling tng_compress_nalgo
+*/
+
+char DECLSPECDLLEXPORT *tng_compress_pos_find_algo(double *pos, int natoms, int nframes,
+ double desired_precision,
+ int speed,
+ int *algo,
+ int *nitems);
+
+/* This returns the number of integers required for the storage of the algorithm
+ with the best compression ratio. */
+int DECLSPECDLLEXPORT tng_compress_nalgo(void);
+
+/* The following two routines does the same as the compression of the
+ positions, but compresses velocities instead. The algorithm
+ selection for velocities is different, so the position and
+ velocities routines should not be mixed. */
+
+char DECLSPECDLLEXPORT *tng_compress_vel(double *vel, int natoms, int nframes,
+ double desired_precision,
+ int speed, int *algo,
+ int *nitems);
+
+char DECLSPECDLLEXPORT *tng_compress_vel_find_algo(double *vel, int natoms, int nframes,
+ double desired_precision,
+ int speed,
+ int *algo,
+ int *nitems);
+
+/* From a compressed block, obtain information about
+ whether it is a position or velocity block:
+ *vel=1 means velocity block, *vel=0 means position block.
+ It also gives info about the number of atoms,
+ frames, and the precision used to compress the block, and the algorithms used to
+ compress the block. The return value=0 if the block looks like a tng compressed block,
+ and 1 otherwise. If the return value is 1 no information is returned. */
+int DECLSPECDLLEXPORT tng_compress_inquire(char *data,int *vel, int *natoms,
+ int *nframes, double *precision,
+ int *algo);
+
+/* Uncompresses any tng compress block, positions or velocities. It determines whether it is positions or velocities from the data buffer. The return value is 0 if ok, and 1 if not.
+*/
+int DECLSPECDLLEXPORT tng_compress_uncompress(char *data,double *posvel);
+
+
+ /* Compression algorithms (matching the original trajng
+ assignments) The compression backends require that some of the
+ algorithms must have the same value. */
+
+#define TNG_COMPRESS_ALGO_STOPBIT 1
+#define TNG_COMPRESS_ALGO_TRIPLET 2
+#define TNG_COMPRESS_ALGO_BWLZH1 8
+#define TNG_COMPRESS_ALGO_BWLZH2 9
+
+#define TNG_COMPRESS_ALGO_POS_STOPBIT_INTER TNG_COMPRESS_ALGO_STOPBIT
+#define TNG_COMPRESS_ALGO_POS_TRIPLET_INTER TNG_COMPRESS_ALGO_TRIPLET
+#define TNG_COMPRESS_ALGO_POS_TRIPLET_INTRA 3
+#define TNG_COMPRESS_ALGO_POS_XTC2 5
+#define TNG_COMPRESS_ALGO_POS_TRIPLET_ONETOONE 7
+#define TNG_COMPRESS_ALGO_POS_BWLZH_INTER TNG_COMPRESS_ALGO_BWLZH1
+#define TNG_COMPRESS_ALGO_POS_BWLZH_INTRA TNG_COMPRESS_ALGO_BWLZH2
+#define TNG_COMPRESS_ALGO_POS_XTC3 10
+#define TNG_COMPRESS_ALGO_VEL_STOPBIT_ONETOONE TNG_COMPRESS_ALGO_STOPBIT
+#define TNG_COMPRESS_ALGO_VEL_TRIPLET_INTER TNG_COMPRESS_ALGO_TRIPLET
+#define TNG_COMPRESS_ALGO_VEL_TRIPLET_ONETOONE 3
+#define TNG_COMPRESS_ALGO_VEL_STOPBIT_INTER 6
+#define TNG_COMPRESS_ALGO_VEL_BWLZH_INTER TNG_COMPRESS_ALGO_BWLZH1
+#define TNG_COMPRESS_ALGO_VEL_BWLZH_ONETOONE TNG_COMPRESS_ALGO_BWLZH2
+#define TNG_COMPRESS_ALGO_MAX 11
+
+
+
+/* Obtain strings describing the actual algorithms. These point to static memory, so should
+ not be freed. */
+char DECLSPECDLLEXPORT *tng_compress_initial_pos_algo(int *algo);
+char DECLSPECDLLEXPORT *tng_compress_pos_algo(int *algo);
+char DECLSPECDLLEXPORT *tng_compress_initial_vel_algo(int *algo);
+char DECLSPECDLLEXPORT *tng_compress_vel_algo(int *algo);
+
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+
+#endif
diff --git a/include/compression/vals16.h b/include/compression/vals16.h
new file mode 100644
index 0000000..a8acdf4
--- /dev/null
+++ b/include/compression/vals16.h
@@ -0,0 +1,23 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef VALS16_H
+#define VALS16_H
+
+void Ptngc_comp_conv_to_vals16(unsigned int *vals,int nvals,
+ unsigned int *vals16, int *nvals16);
+
+void Ptngc_comp_conv_from_vals16(unsigned int *vals16,int nvals16,
+ unsigned int *vals, int *nvals);
+
+#endif
diff --git a/include/compression/warnmalloc.h b/include/compression/warnmalloc.h
new file mode 100644
index 0000000..c2eb28d
--- /dev/null
+++ b/include/compression/warnmalloc.h
@@ -0,0 +1,32 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef WARNMALLOC_H
+#define WARNMALLOC_H
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "tng_compress.h"
+
+void DECLSPECDLLEXPORT *Ptngc_warnmalloc_x(size_t size, char *file, int line);
+
+#define warnmalloc(size) Ptngc_warnmalloc_x(size,__FILE__,__LINE__)
+
+void DECLSPECDLLEXPORT *Ptngc_warnrealloc_x(void *old, size_t size, char *file, int line);
+
+#define warnrealloc(old,size) Ptngc_warnrealloc_x(old,size,__FILE__,__LINE__)
+
+
+#endif
diff --git a/include/compression/widemuldiv.h b/include/compression/widemuldiv.h
new file mode 100644
index 0000000..b7574fa
--- /dev/null
+++ b/include/compression/widemuldiv.h
@@ -0,0 +1,33 @@
+/* This code is part of the tng compression routines.
+ *
+ * Written by Daniel Spangberg
+ * Copyright (c) 2010, 2013, The GROMACS development team.
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ */
+
+
+#ifndef WIDEMULDIV_H
+#define WIDEMULDIV_H
+
+/* Multiply two 32 bit unsigned integers returning a 64 bit unsigned value (in two integers) */
+void Ptngc_widemul(unsigned int i1, unsigned int i2, unsigned int *ohi, unsigned int *olo);
+
+/* Divide a 64 bit unsigned value in hi:lo with the 32 bit value i and
+ return the result in result and the remainder in remainder */
+void Ptngc_widediv(unsigned int hi, unsigned int lo, unsigned int i, unsigned int *result, unsigned int *remainder);
+
+/* Add a unsigned int to a largeint. */
+void Ptngc_largeint_add(unsigned int v1, unsigned int *largeint, int n);
+
+/* Multiply v1 with largeint_in and return result in largeint_out */
+void Ptngc_largeint_mul(unsigned int v1, unsigned int *largeint_in, unsigned int *largeint_out, int n);
+
+/* Return the remainder from dividing largeint_in with v1. Result of the division is returned in largeint_out */
+unsigned int Ptngc_largeint_div(unsigned int v1, unsigned int *largeint_in, unsigned int *largeint_out, int n);
+
+#endif
contact: Jan Huwald // Impressum