1 /* This code is part of the tng compression routines.
3 * Written by Daniel Spangberg
4 * Copyright (c) 2010, 2013, The GROMACS development team.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the Revised BSD License.
15 /* Compress the integers (positive, small integers are preferable)
16 using bwlzh compression. The unsigned char *output should be
17 allocated to be able to hold worst case. You can obtain this length
18 conveniently by calling comp_get_buflen()
20 void DECLSPECDLLEXPORT
bwlzh_compress(unsigned int *vals
, const int nvals
,
21 unsigned char *output
, int *output_len
);
23 void DECLSPECDLLEXPORT
bwlzh_compress_no_lz77(unsigned int *vals
, const int nvals
,
24 unsigned char *output
, int *output_len
);
26 int DECLSPECDLLEXPORT
bwlzh_get_buflen(const int nvals
);
28 void DECLSPECDLLEXPORT
bwlzh_decompress(unsigned char *input
, const int nvals
,
32 /* The routines below are mostly useful for testing, and for internal
33 use by the library. */
35 void DECLSPECDLLEXPORT
bwlzh_compress_verbose(unsigned int *vals
, const int nvals
,
36 unsigned char *output
, int *output_len
);
38 void DECLSPECDLLEXPORT
bwlzh_compress_no_lz77_verbose(unsigned int *vals
, const int nvals
,
39 unsigned char *output
, int *output_len
);
41 void DECLSPECDLLEXPORT
bwlzh_decompress_verbose(unsigned char *input
, const int nvals
,
44 /* Compress the integers (positive, small integers are preferable)
45 using huffman coding, with automatic selection of how to handle the
46 huffman dictionary. The unsigned char *huffman should be allocated
47 to be able to hold worst case. You can obtain this length
48 conveniently by calling comp_huff_buflen()
50 void Ptngc_comp_huff_compress(unsigned int *vals
, const int nvals
,
51 unsigned char *huffman
, int *huffman_len
);
53 int Ptngc_comp_huff_buflen(const int nvals
);
55 void Ptngc_comp_huff_decompress(unsigned char *huffman
, const int huffman_len
,
59 /* the value pointed to by chosen_algo should be
60 sent as -1 for autodetect. */
61 void Ptngc_comp_huff_compress_verbose(unsigned int *vals
, int nvals
,
62 unsigned char *huffman
, int *huffman_len
,
64 int *huffman_lengths
,int *chosen_algo
,
67 #define N_HUFFMAN_ALGO 3
68 char *Ptngc_comp_get_huff_algo_name(const int algo
);
69 char *Ptngc_comp_get_algo_name(const int algo
);