ext
laslib
src
integercompressor.hpp
Go to the documentation of this file.
1
/*
2
===============================================================================
3
4
FILE: integercompressor.hpp
5
6
CONTENTS:
7
8
This compressor provides three different contexts for encoding integer
9
numbers whose range may lie anywhere between 1 and 31 bits, which is
10
specified with the SetPrecision function.
11
12
The compressor encodes two things:
13
14
(1) the number k of miss-predicted low-order bits and
15
(2) the k-bit number that corrects the missprediction
16
17
The k-bit number is usually coded broken in two chunks. The highest
18
bits are compressed using an arithmetic range table. The lower bits
19
are stored raw without predicive coding. How many of the higher bits
20
are compressed can be specified with bits_high. The default is 8.
21
22
PROGRAMMERS:
23
24
martin.isenburg@gmail.com
25
26
COPYRIGHT:
27
28
(c) 2005-2011, Martin Isenburg, LASSO - tools to catch reality
29
30
This is free software; you can redistribute and/or modify it under the
31
terms of the GNU Lesser General Licence as published by the Free Software
32
Foundation. See the COPYING file for more information.
33
34
This software is distributed WITHOUT ANY WARRANTY and without even the
35
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36
37
CHANGE HISTORY:
38
39
10 January 2011 -- licensing change for LGPL release and liblas integration
40
10 December 2010 -- unified for all entropy coders at Baeckerei Schaefer
41
31 October 2009 -- switched from the Rangecoder to the Entropycoder
42
30 September 2005 -- now splitting the corrector into raw and compressed bits
43
13 July 2005 -- created after returning with many mosquito bites from OBX
44
45
===============================================================================
46
*/
47
#ifndef INTEGER_COMPRESSOR_HPP
48
#define INTEGER_COMPRESSOR_HPP
49
50
#include "
entropyencoder.hpp
"
51
#include "
entropydecoder.hpp
"
52
53
class
IntegerCompressor
54
{
55
public
:
56
57
// Constructor & Deconstructor
58
IntegerCompressor
(
EntropyEncoder
*
enc
,
U32
bits
=16,
U32
contexts
=1,
U32
bits_high
=8,
U32
range
=0);
59
IntegerCompressor
(
EntropyDecoder
*
dec
,
U32
bits
=16,
U32
contexts
=1,
U32
bits_high
=8,
U32
range
=0);
60
~IntegerCompressor
();
61
62
// Manage Compressor
63
void
initCompressor
();
64
void
compress
(
I32
iPred,
I32
iReal,
U32
context=0);
65
66
// Manage Decompressor
67
void
initDecompressor
();
68
I32
decompress
(
I32
iPred,
U32
context=0);
69
70
// Get the k corrector bits from the last compress/decompress call
71
U32
getK
()
const
{
return
k
;};
72
73
private
:
74
void
writeCorrector
(
I32
c, EntropyModel* model);
75
I32
readCorrector
(EntropyModel* model);
76
77
U32
k
;
78
79
U32
contexts
;
80
U32
bits_high
;
81
82
U32
bits
;
83
U32
range
;
84
85
U32
corr_bits
;
86
U32
corr_range
;
87
I32
corr_min
;
88
I32
corr_max
;
89
90
EntropyEncoder
*
enc
;
91
EntropyDecoder
*
dec
;
92
93
EntropyModel**
mBits
;
94
95
EntropyModel**
mCorrector
;
96
97
int
**
corr_histogram
;
98
};
99
100
#endif
IntegerCompressor::getK
U32 getK() const
Definition:
integercompressor.hpp:71
IntegerCompressor::decompress
I32 decompress(I32 iPred, U32 context=0)
Definition:
integercompressor.cpp:319
IntegerCompressor::initDecompressor
void initDecompressor()
Definition:
integercompressor.cpp:274
IntegerCompressor::~IntegerCompressor
~IntegerCompressor()
Definition:
integercompressor.cpp:158
IntegerCompressor::mBits
EntropyModel ** mBits
Definition:
integercompressor.hpp:93
U32
unsigned int U32
Definition:
mydefs.hpp:39
IntegerCompressor::dec
EntropyDecoder * dec
Definition:
integercompressor.hpp:91
IntegerCompressor::corr_histogram
int ** corr_histogram
Definition:
integercompressor.hpp:97
entropydecoder.hpp
IntegerCompressor::mCorrector
EntropyModel ** mCorrector
Definition:
integercompressor.hpp:95
IntegerCompressor::corr_min
I32 corr_min
Definition:
integercompressor.hpp:87
IntegerCompressor
Definition:
integercompressor.hpp:53
IntegerCompressor::initCompressor
void initCompressor()
Definition:
integercompressor.cpp:218
EntropyEncoder
Definition:
entropyencoder.hpp:38
IntegerCompressor::corr_max
I32 corr_max
Definition:
integercompressor.hpp:88
IntegerCompressor::corr_range
U32 corr_range
Definition:
integercompressor.hpp:86
IntegerCompressor::IntegerCompressor
IntegerCompressor(EntropyEncoder *enc, U32 bits=16, U32 contexts=1, U32 bits_high=8, U32 range=0)
Definition:
integercompressor.cpp:46
IntegerCompressor::readCorrector
I32 readCorrector(EntropyModel *model)
Definition:
integercompressor.cpp:466
IntegerCompressor::bits_high
U32 bits_high
Definition:
integercompressor.hpp:80
IntegerCompressor::corr_bits
U32 corr_bits
Definition:
integercompressor.hpp:85
I32
int I32
Definition:
mydefs.hpp:35
IntegerCompressor::writeCorrector
void writeCorrector(I32 c, EntropyModel *model)
Definition:
integercompressor.cpp:363
IntegerCompressor::contexts
U32 contexts
Definition:
integercompressor.hpp:79
entropyencoder.hpp
IntegerCompressor::enc
EntropyEncoder * enc
Definition:
integercompressor.hpp:90
IntegerCompressor::k
U32 k
Definition:
integercompressor.hpp:77
IntegerCompressor::compress
void compress(I32 iPred, I32 iReal, U32 context=0)
Definition:
integercompressor.cpp:263
IntegerCompressor::bits
U32 bits
Definition:
integercompressor.hpp:82
IntegerCompressor::range
U32 range
Definition:
integercompressor.hpp:83
EntropyDecoder
Definition:
entropydecoder.hpp:38
lvr2
Author(s): Thomas Wiemann
, Sebastian Pütz
, Alexander Mock
, Lars Kiesow
, Lukas Kalbertodt
, Tristan Igelbrink
, Johan M. von Behren
, Dominik Feldschnieders
, Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06