Point Cloud Library (PCL)  1.9.1
lzf.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de>
6  * Copyright (c) 2010-2011, Willow Garage, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * $Id$
35  *
36  */
37 
38 #ifndef PCL_IO_LZF_H
39 #define PCL_IO_LZF_H
40 
41 #include <pcl/pcl_macros.h>
42 
43 namespace pcl
44 {
45  /** \brief Compress in_len bytes stored at the memory block starting at
46  * \a in_data and write the result to \a out_data, up to a maximum length
47  * of \a out_len bytes using Marc Lehmann's LZF algorithm.
48  *
49  * If the output buffer is not large enough or any error occurs return 0,
50  * otherwise return the number of bytes used, which might be considerably
51  * more than in_len (but less than 104% of the original size), so it
52  * makes sense to always use out_len == in_len - 1), to ensure _some_
53  * compression, and store the data uncompressed otherwise (with a flag, of
54  * course.
55  *
56  * \note The buffers must not be overlapping.
57  *
58  * \param[in] in_data the input uncompressed buffer
59  * \param[in] in_len the length of the input buffer
60  * \param[out] out_data the output buffer where the compressed result will be stored
61  * \param[out] out_len the length of the output buffer
62  *
63  */
64  PCL_EXPORTS unsigned int
65  lzfCompress (const void *const in_data, unsigned int in_len,
66  void *out_data, unsigned int out_len);
67 
68  /** \brief Decompress data compressed with the \a lzfCompress function and
69  * stored at location \a in_data and length \a in_len. The result will be
70  * stored at \a out_data up to a maximum of \a out_len characters.
71  *
72  * If the output buffer is not large enough to hold the decompressed
73  * data, a 0 is returned and errno is set to E2BIG. Otherwise the number
74  * of decompressed bytes (i.e. the original length of the data) is
75  * returned.
76  *
77  * If an error in the compressed data is detected, a zero is returned and
78  * errno is set to EINVAL.
79  *
80  * This function is very fast, about as fast as a copying loop.
81  * \param[in] in_data the input compressed buffer
82  * \param[in] in_len the length of the input buffer
83  * \param[out] out_data the output buffer (must be resized to \a out_len)
84  * \param[out] out_len the length of the output buffer
85  */
86  PCL_EXPORTS unsigned int
87  lzfDecompress (const void *const in_data, unsigned int in_len,
88  void *out_data, unsigned int out_len);
89 }
90 
91 #endif /* PCL_IO_LZF */
92 
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
PCL_EXPORTS unsigned int lzfCompress(const void *const in_data, unsigned int in_len, void *out_data, unsigned int out_len)
Compress in_len bytes stored at the memory block starting at in_data and write the result to out_data...
PCL_EXPORTS unsigned int lzfDecompress(const void *const in_data, unsigned int in_len, void *out_data, unsigned int out_len)
Decompress data compressed with the lzfCompress function and stored at location in_data and length in...