#include "arithcodec.h"
#include "unroll.h"
Go to the source code of this file.
Defines | |
| #define | OUTPUT_BIT(b) |
| Output one bit to output device. More... | |
| #define | UNGET_BIT(b) |
| Return bit to input stream. More... | |
| #define | ADD_NEXT_INPUT_BIT(v, garbageBits) |
| Read one bit from input device. More... | |
| #define | ORIG_BIT_PLUS_FOLLOW(b) |
| #define | BIT_PLUS_FOLLOW(x) |
| #define | ENCODE_RENORMALISE |
| #define | DECODE_RENORMALISE |
| #define | UNROLL_NUM B_BITS - F_BITS - 1 |
| #define | UNROLL_CODE |
| #define | UNROLL_NUM B_BITS - F_BITS - 1 |
| #define | UNROLL_CODE |
| #define | UNROLL_NUM F_BITS - 1 |
| #define | UNROLL_CODE |
| #define | UNROLL_NUM B_BITS - F_BITS - 1 |
| #define | UNROLL_CODE |
Functions | |
| if (high< total) out_R=temp2-temp | |
| if (outBitsOutstanding > MAX_BITS_OUTSTANDING) FATAL("Bits_outstanding limit reached-File too large!") | |
Variables | |
|
UNROLL_CODE UNROLL_CODE UNROLL_CODE UNROLL_CODE | out_L = temp |
| else | out_R = temp |
| ENCODE_RENORMALISE | |
|
UNROLL_CODE UNROLL_CODE UNROLL_CODE UNROLL_CODE | A = in_D |
| target = 0 | |
|
UNROLL_CODE UNROLL_CODE UNROLL_CODE UNROLL_CODE | in_D = temp |
| else | in_R = temp |
| DECODE_RENORMALISE | |
This file contains definitions of class ArithCodec methods.
Definition in file arithcodec.cpp.
|
|
Value: { \
if (inBitPtr == 0) \
{ \
if (inputDevice->getChar(&inBuffer) == EndOfFile) \
{ \
inGarbage++; \
if ((FreqValue)((inGarbage-1)*8) >= garbageBits) \
FATAL("Bad input file - attempted read past end of file."); \
} \
inBitPtr = (1<<(BYTE_SIZE-1)); \
} \
v <<= 1; \
\
if (inBuffer & inBitPtr) \
v++; \
\
inBitPtr >>= 1; \
}
Macro shifts \v left and sets its leas significant bit to the value of read bit.
Definition at line 121 of file arithcodec.cpp. |
|
|
Value: { \
if (ignoreFirstBit) \
ignoreFirstBit = 0; \
else \
ORIG_BIT_PLUS_FOLLOW(x); \
}
Definition at line 166 of file arithcodec.cpp. |
|
|
Value: { \
while (in_R <= Quarter) \
{ \
in_R <<= 1; \
in_V <<= 1; \
ADD_NEXT_INPUT_BIT(in_D,B_BITS); \
if (in_D & 1) \
in_V++; \
} \
}Definition at line 218 of file arithcodec.cpp. |
|
|
Value: { \
while (out_R <= Quarter) \
{ \
if (out_L >= Half) \
{ \
BIT_PLUS_FOLLOW(1); \
out_L -= Half; \
} \
else \
if (out_L+out_R <= Half) \
{ \
BIT_PLUS_FOLLOW(0); \
} \
else \
{ \
outBitsOutstanding++; \
out_L -= Quarter; \
} \
out_L <<= 1; \
out_R <<= 1; \
} \
}Definition at line 188 of file arithcodec.cpp. Referenced by ArithCodec::arithmeticEncode. |
|
|
Value: { \
OUTPUT_BIT(b); \
\
while (outBitsOutstanding > 0) \
{ \
OUTPUT_BIT(!b); \
outBitsOutstanding--; \
} \
}
Definition at line 148 of file arithcodec.cpp. |
|
|
Value: { \
outBuffer <<= 1; \
if (b) \
outBuffer |= 1; \
outBitsToGo--; \
if (outBitsToGo == 0) \
{ \
outputDevice->putChar(outBuffer); \
numberOfBytes++; \
outBitsToGo = BYTE_SIZE; \
outBuffer = 0; \
} \
}
When BYTE_SIZE bits are queued in outBuffer, these are output to the output device.
Definition at line 73 of file arithcodec.cpp. |
|
|
Value: { \
inBitPtr <<= 1; \
\
if (inBitPtr == 0) \
inBitPtr = 1; \
\
\
inBuffer = inBuffer & (inBitPtr - 1); \
if (b) \
\
inBuffer |= inBitPtr; \
}
Only guaranteed to be able to backup by 1 bit.
Definition at line 97 of file arithcodec.cpp. |
|
|
Value: M <<= 1; temp <<= 1; temp2 <<= 1; \
if (M & Half) \
{ \
temp += low; temp2 += high; \
} |
|
|
Value: A <<= 1; target <<= 1; \
if (A >= M) \
{ \
A -= M; target++; \
} |
|
|
Value: A <<= 1; in_r <<= 1; \
if (A >= M) \
{ \
A -= M; in_r++; \
} |
|
|
Value: A <<= 1; temp <<= 1; temp2 <<= 1; \
if (A >= M) \
{ \
A -= M; temp += low; temp2 += high; \
} |
1.2.14 written by Dimitri van Heesch,
© 1997-2002