#include "context.h"
Go to the source code of this file.
Defines | |
#define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
Returns minimum of a and b. | |
#define | INCR_SYMBOL_PROB_ACTUAL(symbol, inc) |
Increments the specified symbol probability by the inc amount. More... | |
#define | INCR_SYMBOL_PROB_MPS(symbol) |
#define | INCR_SYMBOL_PROB(symbol, low1, high1, inc1) |
#define | GET_COUNT(symbol, c) |
#define | ADJUST_ZERO_FREQ() |
#define | ZERO_FREQ_PROB ((FreqValue)nSingletons) |
Defines the count for the escape symbol. More... |
This file contains definitions of class Context methods.
Definition in file context.cpp.
|
Value: { \ FreqValue diff; \ diff = ZERO_FREQ_PROB - tree[1]; \ if (diff != 0) \ INCR_SYMBOL_PROB(1, 0, tree[1], diff); \ } Definition at line 141 of file context.cpp. Referenced by Context::decode, Context::encode, Context::halveContext, Context::installSymbol, Context::purgeContext, and Context::setType. |
|
Value: { \ if ((symbol) & 1) \ c = tree[symbol]; \ else \ { \ int q = symbol + 1; \ int z = MIN(FORW(symbol), maxLength + 1); \ c = tree[symbol]; \ while (q < z) \ { \ c -= tree[q]; \ q = FORW(q); \ } \ } \ }
Definition at line 119 of file context.cpp. Referenced by Context::decode, and Context::getInterval. |
|
Value: { \ FreqValue _low = low1; \ FreqValue _high = high1; \ INCR_SYMBOL_PROB_ACTUAL(symbol, inc1) \ INCR_SYMBOL_PROB_MPS(symbol) \ } Definition at line 89 of file context.cpp. Referenced by Context::decode, Context::encode, and Context::installSymbol. |
|
Value: FreqValue _inc = (inc); \ int p = symbol; \ \ while (p > 0) \ { \ tree[p] += _inc; \ p = BACK(p); \ } \ total += _inc; \
If the most probable symbol is maintined at the end of the coding range (MOST_PROB_AT_END defined), then both INCR_SYMBOL_PROB_ACTUAL and INCR_SYMBOL_PROB_MPS are used. Otherwise, just INCR_SYMBOL_PROB_ACTUAL is used.
Definition at line 49 of file context.cpp. |
|
Value: { \ if (symbol == mostFreqSymbol) \ mostFreqCount += _inc; \ else \ if ((_high) - (_low) + (_inc) > mostFreqCount) \ { \ mostFreqSymbol = symbol; \ mostFreqCount = (_high) - (_low) + (_inc); \ mostFreqPos = _low; \ } \ else \ if (symbol < mostFreqSymbol) \ mostFreqPos += _inc; \ }
Definition at line 67 of file context.cpp. |
|
Defines the count for the escape symbol.
We implemented a variation of the XC method (which we call AX). We create a special escape symbol, which we keep up to date with the count of "number of singletons + 1". To achieve this, but still be efficient with static contexts, we falsely increment the number of singletons at the start of modeling for dynamic contexts, and keep it at 0 for static contexts. This way, nSingletons is always our zero frequency probability, without the need to check if the context is static or dynamic (remember that this operation would be done for each symbol coded). Definition at line 156 of file context.cpp. Referenced by Context::encode, and Context::halveContext. |