ucl.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /* ucl.h -- prototypes for the UCL real-time data compression library
  2. This file is part of the UCL data compression library.
  3. Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
  4. Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
  5. Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
  6. Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
  7. Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
  8. Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
  9. Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
  10. All Rights Reserved.
  11. The UCL library is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License as
  13. published by the Free Software Foundation; either version 2 of
  14. the License, or (at your option) any later version.
  15. The UCL library is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU General Public License for more details.
  19. You should have received a copy of the GNU General Public License
  20. along with the UCL library; see the file COPYING.
  21. If not, write to the Free Software Foundation, Inc.,
  22. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. Markus F.X.J. Oberhumer
  24. <markus@oberhumer.com>
  25. http://www.oberhumer.com/opensource/ucl/
  26. */
  27. #ifndef __UCL_H
  28. #define __UCL_H
  29. #ifndef __UCLCONF_H
  30. #include "uclconf.h"
  31. #endif
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /***********************************************************************
  36. //
  37. ************************************************************************/
  38. /* note: to use default values pass -1, i.e. initialize
  39. * this struct by a memset(x,0xff,sizeof(x)) */
  40. struct ucl_compress_config_t
  41. {
  42. int bb_endian;
  43. int bb_size;
  44. ucl_uint max_offset;
  45. ucl_uint max_match;
  46. int s_level;
  47. int h_level;
  48. int p_level;
  49. int c_flags;
  50. ucl_uint m_size;
  51. };
  52. #define ucl_compress_config_p ucl_compress_config_t __UCL_MMODEL *
  53. /***********************************************************************
  54. // compressors
  55. ************************************************************************/
  56. UCL_EXTERN(int)
  57. ucl_nrv2b_99_compress ( const ucl_bytep src, ucl_uint src_len,
  58. ucl_bytep dst, ucl_uintp dst_len,
  59. ucl_progress_callback_p cb,
  60. int level,
  61. const struct ucl_compress_config_p conf,
  62. ucl_uintp result );
  63. UCL_EXTERN(int)
  64. ucl_nrv2d_99_compress ( const ucl_bytep src, ucl_uint src_len,
  65. ucl_bytep dst, ucl_uintp dst_len,
  66. ucl_progress_callback_p cb,
  67. int level,
  68. const struct ucl_compress_config_p conf,
  69. ucl_uintp result );
  70. UCL_EXTERN(int)
  71. ucl_nrv2e_99_compress ( const ucl_bytep src, ucl_uint src_len,
  72. ucl_bytep dst, ucl_uintp dst_len,
  73. ucl_progress_callback_p cb,
  74. int level,
  75. const struct ucl_compress_config_p conf,
  76. ucl_uintp result );
  77. /***********************************************************************
  78. // decompressors
  79. ************************************************************************/
  80. UCL_EXTERN(int)
  81. ucl_nrv2b_decompress_8 ( const ucl_bytep src, ucl_uint src_len,
  82. ucl_bytep dst, ucl_uintp dst_len,
  83. ucl_voidp wrkmem );
  84. UCL_EXTERN(int)
  85. ucl_nrv2b_decompress_le16 ( const ucl_bytep src, ucl_uint src_len,
  86. ucl_bytep dst, ucl_uintp dst_len,
  87. ucl_voidp wrkmem );
  88. UCL_EXTERN(int)
  89. ucl_nrv2b_decompress_le32 ( const ucl_bytep src, ucl_uint src_len,
  90. ucl_bytep dst, ucl_uintp dst_len,
  91. ucl_voidp wrkmem );
  92. UCL_EXTERN(int)
  93. ucl_nrv2b_decompress_safe_8 ( const ucl_bytep src, ucl_uint src_len,
  94. ucl_bytep dst, ucl_uintp dst_len,
  95. ucl_voidp wrkmem );
  96. UCL_EXTERN(int)
  97. ucl_nrv2b_decompress_safe_le16 ( const ucl_bytep src, ucl_uint src_len,
  98. ucl_bytep dst, ucl_uintp dst_len,
  99. ucl_voidp wrkmem );
  100. UCL_EXTERN(int)
  101. ucl_nrv2b_decompress_safe_le32 ( const ucl_bytep src, ucl_uint src_len,
  102. ucl_bytep dst, ucl_uintp dst_len,
  103. ucl_voidp wrkmem );
  104. UCL_EXTERN(int)
  105. ucl_nrv2d_decompress_8 ( const ucl_bytep src, ucl_uint src_len,
  106. ucl_bytep dst, ucl_uintp dst_len,
  107. ucl_voidp wrkmem );
  108. UCL_EXTERN(int)
  109. ucl_nrv2d_decompress_le16 ( const ucl_bytep src, ucl_uint src_len,
  110. ucl_bytep dst, ucl_uintp dst_len,
  111. ucl_voidp wrkmem );
  112. UCL_EXTERN(int)
  113. ucl_nrv2d_decompress_le32 ( const ucl_bytep src, ucl_uint src_len,
  114. ucl_bytep dst, ucl_uintp dst_len,
  115. ucl_voidp wrkmem );
  116. UCL_EXTERN(int)
  117. ucl_nrv2d_decompress_safe_8 ( const ucl_bytep src, ucl_uint src_len,
  118. ucl_bytep dst, ucl_uintp dst_len,
  119. ucl_voidp wrkmem );
  120. UCL_EXTERN(int)
  121. ucl_nrv2d_decompress_safe_le16 ( const ucl_bytep src, ucl_uint src_len,
  122. ucl_bytep dst, ucl_uintp dst_len,
  123. ucl_voidp wrkmem );
  124. UCL_EXTERN(int)
  125. ucl_nrv2d_decompress_safe_le32 ( const ucl_bytep src, ucl_uint src_len,
  126. ucl_bytep dst, ucl_uintp dst_len,
  127. ucl_voidp wrkmem );
  128. UCL_EXTERN(int)
  129. ucl_nrv2e_decompress_8 ( const ucl_bytep src, ucl_uint src_len,
  130. ucl_bytep dst, ucl_uintp dst_len,
  131. ucl_voidp wrkmem );
  132. UCL_EXTERN(int)
  133. ucl_nrv2e_decompress_le16 ( const ucl_bytep src, ucl_uint src_len,
  134. ucl_bytep dst, ucl_uintp dst_len,
  135. ucl_voidp wrkmem );
  136. UCL_EXTERN(int)
  137. ucl_nrv2e_decompress_le32 ( const ucl_bytep src, ucl_uint src_len,
  138. ucl_bytep dst, ucl_uintp dst_len,
  139. ucl_voidp wrkmem );
  140. UCL_EXTERN(int)
  141. ucl_nrv2e_decompress_safe_8 ( const ucl_bytep src, ucl_uint src_len,
  142. ucl_bytep dst, ucl_uintp dst_len,
  143. ucl_voidp wrkmem );
  144. UCL_EXTERN(int)
  145. ucl_nrv2e_decompress_safe_le16 ( const ucl_bytep src, ucl_uint src_len,
  146. ucl_bytep dst, ucl_uintp dst_len,
  147. ucl_voidp wrkmem );
  148. UCL_EXTERN(int)
  149. ucl_nrv2e_decompress_safe_le32 ( const ucl_bytep src, ucl_uint src_len,
  150. ucl_bytep dst, ucl_uintp dst_len,
  151. ucl_voidp wrkmem );
  152. /***********************************************************************
  153. // assembler decompressors [TO BE ADDED]
  154. ************************************************************************/
  155. /***********************************************************************
  156. // test an overlapping in-place decompression within a buffer:
  157. // - try a virtual decompression from &buf[src_off] -> &buf[0]
  158. // - no data is actually written
  159. // - only the bytes at buf[src_off .. src_off+src_len] will get accessed
  160. ************************************************************************/
  161. UCL_EXTERN(int)
  162. ucl_nrv2b_test_overlap_8 ( const ucl_bytep buf, ucl_uint src_off,
  163. ucl_uint src_len, ucl_uintp dst_len,
  164. ucl_voidp wrkmem );
  165. UCL_EXTERN(int)
  166. ucl_nrv2b_test_overlap_le16 ( const ucl_bytep buf, ucl_uint src_off,
  167. ucl_uint src_len, ucl_uintp dst_len,
  168. ucl_voidp wrkmem );
  169. UCL_EXTERN(int)
  170. ucl_nrv2b_test_overlap_le32 ( const ucl_bytep buf, ucl_uint src_off,
  171. ucl_uint src_len, ucl_uintp dst_len,
  172. ucl_voidp wrkmem );
  173. UCL_EXTERN(int)
  174. ucl_nrv2d_test_overlap_8 ( const ucl_bytep buf, ucl_uint src_off,
  175. ucl_uint src_len, ucl_uintp dst_len,
  176. ucl_voidp wrkmem );
  177. UCL_EXTERN(int)
  178. ucl_nrv2d_test_overlap_le16 ( const ucl_bytep buf, ucl_uint src_off,
  179. ucl_uint src_len, ucl_uintp dst_len,
  180. ucl_voidp wrkmem );
  181. UCL_EXTERN(int)
  182. ucl_nrv2d_test_overlap_le32 ( const ucl_bytep buf, ucl_uint src_off,
  183. ucl_uint src_len, ucl_uintp dst_len,
  184. ucl_voidp wrkmem );
  185. UCL_EXTERN(int)
  186. ucl_nrv2e_test_overlap_8 ( const ucl_bytep buf, ucl_uint src_off,
  187. ucl_uint src_len, ucl_uintp dst_len,
  188. ucl_voidp wrkmem );
  189. UCL_EXTERN(int)
  190. ucl_nrv2e_test_overlap_le16 ( const ucl_bytep buf, ucl_uint src_off,
  191. ucl_uint src_len, ucl_uintp dst_len,
  192. ucl_voidp wrkmem );
  193. UCL_EXTERN(int)
  194. ucl_nrv2e_test_overlap_le32 ( const ucl_bytep buf, ucl_uint src_off,
  195. ucl_uint src_len, ucl_uintp dst_len,
  196. ucl_voidp wrkmem );
  197. #ifdef __cplusplus
  198. } /* extern "C" */
  199. #endif
  200. #endif /* already included */