1 /*
2 ===============================================================================
3 
4   PROGRAMMERS:
5 
6     martin.isenburg@rapidlasso.com  -  http://rapidlasso.com
7     uday.karan@gmail.com - Hobu, Inc.
8     andrew.bell.ia@gmail.com - Hobu Inc.
9 
10   COPYRIGHT:
11 
12     (c) 2007-2014, martin isenburg, rapidlasso - tools to catch reality
13     (c) 2014, Uday Verma, Hobu, Inc.
14 
15     This is free software; you can redistribute and/or modify it under the
16     terms of the GNU Lesser General Licence as published by the Free Software
17     Foundation. See the COPYING file for more information.
18 
19     This software is distributed WITHOUT ANY WARRANTY and without even the
20     implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 
22 ===============================================================================
23 */
24 
25 #include <deque>
26 
27 namespace lazperf
28 {
29 namespace detail
30 {
31 
32 class Byte10Base
33 {
34 protected:
35     Byte10Base(size_t count);
36 
37     size_t count_;
38     bool have_last_;
39     std::vector<uint8_t> lasts_;
40     std::vector<uint8_t> diffs_;
41     std::deque<models::arithmetic> models_;
42 };
43 
44 class Byte10Compressor : public Byte10Base
45 {
46 public:
47     Byte10Compressor(encoders::arithmetic<OutCbStream>& encoder, size_t count);
48 
49     const char *compress(const char *buf);
50 
51 private:
52     encoders::arithmetic<OutCbStream>& enc_;
53 };
54 
55 class Byte10Decompressor : public Byte10Base
56 {
57 public:
58     Byte10Decompressor(decoders::arithmetic<InCbStream>& decoder, size_t count);
59 
60     char *decompress(char *buf);
61 
62 private:
63     decoders::arithmetic<InCbStream>& dec_;
64 };
65 
66 } // namespace detail
67 } // namespace lazperf
68