ext
laslib
src
arithmeticmodel.hpp
Go to the documentation of this file.
1
/*
2
===============================================================================
3
4
FILE: arithmeticmodel.hpp
5
6
CONTENTS:
7
8
A modular C++ wrapper for an adapted version of Amir Said's FastAC Code.
9
see: http://www.cipr.rpi.edu/~said/FastAC.html
10
11
PROGRAMMERS:
12
13
martin.isenburg@gmail.com
14
15
COPYRIGHT:
16
17
(c) 2009-2011, Martin Isenburg, LASSO - tools to catch reality
18
19
This is free software; you can redistribute and/or modify it under the
20
terms of the GNU Lesser General Licence as published by the Free Software
21
Foundation. See the COPYING file for more information.
22
23
This software is distributed WITHOUT ANY WARRANTY and without even the
24
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25
26
CHANGE HISTORY:
27
28
10 January 2011 -- licensing change for LGPL release and liblas integration
29
8 December 2010 -- unified framework for all entropy coders
30
30 October 2009 -- refactoring Amir Said's FastAC code
31
32
===============================================================================
33
*/
34
#ifndef ARITHMETIC_MODEL_H
35
#define ARITHMETIC_MODEL_H
36
37
#include <stdio.h>
38
#include <stdlib.h>
39
40
#include "
mydefs.hpp
"
41
42
/* this header byte needs to change in case incompatible change happen */
43
#define AC_HEADER_BYTE 2
44
#define AC_BUFFER_SIZE 1024
45
46
const
U32
AC__MinLength
= 0x01000000U;
// threshold for renormalization
47
const
U32
AC__MaxLength
= 0xFFFFFFFFU;
// maximum AC interval length
48
49
// Maximum values for binary models
50
const
U32
BM__LengthShift
= 13;
// length bits discarded before mult.
51
const
U32
BM__MaxCount
= 1 <<
BM__LengthShift
;
// for adaptive models
52
53
// Maximum values for general models
54
const
U32
DM__LengthShift
= 15;
// length bits discarded before mult.
55
const
U32
DM__MaxCount
= 1 <<
DM__LengthShift
;
// for adaptive models
56
57
class
ArithmeticModel
58
{
59
public
:
60
ArithmeticModel
(
U32
symbols
,
BOOL
compress
);
61
~ArithmeticModel
();
62
63
I32
init
(
U32
* table=0);
64
65
private
:
66
void
update
();
67
U32
*
distribution
, *
symbol_count
, *
decoder_table
;
68
U32
total_count
,
update_cycle
,
symbols_until_update
;
69
U32
symbols
,
last_symbol
,
table_size
,
table_shift
;
70
BOOL
compress
;
71
friend
class
ArithmeticEncoder
;
72
friend
class
ArithmeticDecoder
;
73
};
74
75
class
ArithmeticBitModel
76
{
77
public
:
78
ArithmeticBitModel
();
79
~ArithmeticBitModel
();
80
81
void
init
();
82
83
private
:
84
void
update
();
85
U32
update_cycle
,
bits_until_update
;
86
U32
bit_0_prob
,
bit_0_count
,
bit_count
;
87
friend
class
ArithmeticEncoder
;
88
friend
class
ArithmeticDecoder
;
89
};
90
91
#endif
ArithmeticModel::table_size
U32 table_size
Definition:
arithmeticmodel.hpp:69
ArithmeticBitModel
Definition:
arithmeticmodel.hpp:75
ArithmeticModel
Definition:
arithmeticmodel.hpp:57
ArithmeticModel::last_symbol
U32 last_symbol
Definition:
arithmeticmodel.hpp:69
I32
int I32
Definition:
mydefs.hpp:35
ArithmeticModel::ArithmeticModel
ArithmeticModel(U32 symbols, BOOL compress)
Definition:
arithmeticmodel.cpp:75
ArithmeticModel::table_shift
U32 table_shift
Definition:
arithmeticmodel.hpp:69
ArithmeticModel::decoder_table
U32 * decoder_table
Definition:
arithmeticmodel.hpp:67
ArithmeticModel::distribution
U32 * distribution
Definition:
arithmeticmodel.hpp:67
ArithmeticBitModel::bit_0_count
U32 bit_0_count
Definition:
arithmeticmodel.hpp:86
ArithmeticBitModel::~ArithmeticBitModel
~ArithmeticBitModel()
Definition:
arithmeticmodel.cpp:180
ArithmeticDecoder
Definition:
arithmeticdecoder.hpp:39
ArithmeticBitModel::update_cycle
U32 update_cycle
Definition:
arithmeticmodel.hpp:85
ArithmeticBitModel::init
void init()
Definition:
arithmeticmodel.cpp:184
BM__LengthShift
const U32 BM__LengthShift
Definition:
arithmeticmodel.hpp:50
ArithmeticModel::compress
BOOL compress
Definition:
arithmeticmodel.hpp:70
ArithmeticModel::update
void update()
Definition:
arithmeticmodel.cpp:131
ArithmeticModel::update_cycle
U32 update_cycle
Definition:
arithmeticmodel.hpp:68
ArithmeticEncoder
Definition:
arithmeticencoder.hpp:39
ArithmeticModel::~ArithmeticModel
~ArithmeticModel()
Definition:
arithmeticmodel.cpp:82
ArithmeticBitModel::bits_until_update
U32 bits_until_update
Definition:
arithmeticmodel.hpp:85
mydefs.hpp
ArithmeticModel::symbols_until_update
U32 symbols_until_update
Definition:
arithmeticmodel.hpp:68
ArithmeticBitModel::ArithmeticBitModel
ArithmeticBitModel()
Definition:
arithmeticmodel.cpp:175
ArithmeticBitModel::update
void update()
Definition:
arithmeticmodel.cpp:194
ArithmeticBitModel::bit_count
U32 bit_count
Definition:
arithmeticmodel.hpp:86
BOOL
int BOOL
Definition:
mydefs.hpp:57
AC__MinLength
const U32 AC__MinLength
Definition:
arithmeticmodel.hpp:46
AC__MaxLength
const U32 AC__MaxLength
Definition:
arithmeticmodel.hpp:47
ArithmeticModel::symbols
U32 symbols
Definition:
arithmeticmodel.hpp:69
ArithmeticBitModel::bit_0_prob
U32 bit_0_prob
Definition:
arithmeticmodel.hpp:86
BM__MaxCount
const U32 BM__MaxCount
Definition:
arithmeticmodel.hpp:51
U32
unsigned int U32
Definition:
mydefs.hpp:39
ArithmeticModel::init
I32 init(U32 *table=0)
Definition:
arithmeticmodel.cpp:87
ArithmeticModel::total_count
U32 total_count
Definition:
arithmeticmodel.hpp:68
DM__LengthShift
const U32 DM__LengthShift
Definition:
arithmeticmodel.hpp:54
ArithmeticModel::symbol_count
U32 * symbol_count
Definition:
arithmeticmodel.hpp:67
DM__MaxCount
const U32 DM__MaxCount
Definition:
arithmeticmodel.hpp:55
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 Wed Mar 2 2022 00:37:22