Point Cloud Library (PCL)  1.14.0-dev
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 #pragma once
39 
40 #include <pcl/pcl_macros.h>
41 
42 namespace pcl
43 {
44  /** \brief Compress in_len bytes stored at the memory block starting at
45  * \a in_data and write the result to \a out_data, up to a maximum length
46  * of \a out_len bytes using Marc Lehmann's LZF algorithm.
47  *
48  * If the output buffer is not large enough or any error occurs return 0,
49  * otherwise return the number of bytes used, which might be considerably
50  * more than in_len (but less than 104% of the original size), so it
51  * makes sense to always use out_len == in_len - 1), to ensure _some_
52  * compression, and store the data uncompressed otherwise (with a flag, of
53  * course.
54  *
55  * \note The buffers must not be overlapping.
56  *
57  * \param[in] in_data the input uncompressed buffer
58  * \param[in] in_len the length of the input buffer
59  * \param[out] out_data the output buffer where the compressed result will be stored
60  * \param[in] out_len the length of the output buffer
61  *
62  */
63  PCL_EXPORTS unsigned int
64  lzfCompress (const void *const in_data, unsigned int in_len,
65  void *out_data, unsigned int out_len);
66 
67  /** \brief Decompress data compressed with the \a lzfCompress function and
68  * stored at location \a in_data and length \a in_len. The result will be
69  * stored at \a out_data up to a maximum of \a out_len characters.
70  *
71  * If the output buffer is not large enough to hold the decompressed
72  * data, a 0 is returned and errno is set to E2BIG. Otherwise the number
73  * of decompressed bytes (i.e. the original length of the data) is
74  * returned.
75  *
76  * If an error in the compressed data is detected, a zero is returned and
77  * errno is set to EINVAL.
78  *
79  * This function is very fast, about as fast as a copying loop.
80  * \param[in] in_data the input compressed buffer
81  * \param[in] in_len the length of the input buffer
82  * \param[out] out_data the output buffer (must be resized to \a out_len)
83  * \param[in] out_len the length of the output buffer
84  */
85  PCL_EXPORTS unsigned int
86  lzfDecompress (const void *const in_data, unsigned int in_len,
87  void *out_data, unsigned int out_len);
88 }
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...
Defines all the PCL and non-PCL macros used.
#define PCL_EXPORTS
Definition: pcl_macros.h:323