Menu

[r357]: / libPPM.hpp  Maximize  Restore  History

Download this file

124 lines (108 with data), 3.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* This file is part of libPPM, a library implementing a SSE PPM
* model for general purpose compression
* Copyright (C) 2004-2011 Niels Fröhling
*
* libPPM.hpp: global header
* Copyright 2004-2011 Niels Fröhling
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef NDEBUG
//#define LOG
#endif
#include "libstreamIO.hpp"
#include "libcoding.hpp"
#ifndef log2
#define log2(v) (log10(v) / log10(2.0))
#endif
#ifndef SLOG2
#define SLOG2
/* return the next power-of-2 number that can contain the given number:
* 32 -> 32
* 33 -> 64
*/
static inline int slog2(register int in) {
#if 1
int lg = 0;
in <<= 1;
in -= 1;
while ((in >>= 1) > 0)
lg++;
return lg;
#else
__asm {
bsf eax, eax
}
#endif
}
#endif
#ifndef _TRUE
#define _TRUE
typedef enum {
FALSE = 0,
TRUE = ~FALSE
} boolean;
#endif
#ifndef NULL
#define NULL (/*(void *)*/0)
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
/* these datatypes are optimized to the smallest size not the best speed */
#ifndef ORD_INITIAL
typedef short int ord;
#define ORD_MAX_BITS ((sizeof(ord) * 8) - 1)
#define ORD_SCALE_BITS ((sizeof(ord) * 8) - 2)
#define ORD_INVALID -1
#define ORD_INITIAL 0
#endif
#ifndef SYM_INITIAL
typedef short int sym;
#define SYM_MAX_BITS ((sizeof(sym) * 8) - 1)
#define SYM_SCALE_BITS ((sizeof(sym) * 8) - 2)
#define SYM_INVALID -1
#define SYM_INITIAL 0
#endif
#ifndef CNT_INITIAL
typedef unsigned short int cnt;
typedef unsigned short int fix;
#define CNT_MAX_BITS ((sizeof(cnt) * 8) - 1)
#define CNT_SCALE_BITS ((sizeof(cnt) * 8) - 2)
#define CNT_INVALID 0x7FFF
#define CNT_INITIAL 0
#endif
#ifndef HSH_INITIAL
typedef unsigned long int hsh;
#define HSH_MAX_BITS ((sizeof(hsh) * 8) - 0)
#define HSH_SCALE_BITS ((sizeof(hsh) * 8) - 1)
#define HSH_INVALID 0xFFFF
#define HSH_INITIAL 0
#endif
#ifndef PROB_INITIAL
typedef long int prob;
#define PROB_MAX_BITS ((sizeof(prob) * 8) - 1)
#define PROB_SCALE_BITS ((sizeof(prob) * 8) - 2)
#define PROB_INVALID 0x7FFFFFFF
#define PROB_INITIAL 0
#endif
typedef short int bits;
#include "libPPM-0.0.0/Context.hpp"
#include "libPPM-0.0.0/DecisionContext.hpp"
#include "libPPM-0.0.0/OverfitContext.hpp"
#include "libPPM-0.0.0/Predictor.hpp"
#include "libPPM-0.0.0/Stream.hpp"
//Concepts and Papers:
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.