48 uint32_t symbol = (uint32_t) aValue;
57 WriteU8( (uint8_t) ( 0x00FF & uValue ) );
58 WriteU8( (uint8_t) ( 0x00FF & ( uValue >> 8 ) ) );
64 WriteU16( (uint16_t) ( 0x0000FFFF & uValue ) );
65 WriteU16( (uint16_t) ( 0x0000FFFF & ( uValue >> 16 ) ) );
71 WriteU32( (uint32_t) ( 0x00000000FFFFFFFF & uValue ) );
72 WriteU32( (uint32_t) ( 0x00000000FFFFFFFF & ( uValue >> 32 ) ) );
85 std::memcpy( &uValue, &fValue,
sizeof( fValue ) );
93 std::memcpy( &uValue, &aValue,
sizeof( aValue ) );
169 WriteU16( (uint16_t) aStr.length() );
171 for(
size_t i = 0; i < aStr.length(); i++ )
178 int32_t uBitCount = 0;
181 uBitCount = ( 8 - ( uBitCount & 7 ) ) & 7;
208 int dataSize =
static_cast<int>( std::ceil(
static_cast<double>( b->GetDataSize() ) / 4.0 ) );
210 static_cast<int>( std::ceil(
static_cast<double>( b->GetMetaDataSize() ) / 4.0 ) );
216 for(
int i = 0; i < dataSize; i++ )
221 for(
int i = 0; i < metaDataSize; i++ )
236 std::shared_ptr<DATA_BLOCK> ret = std::make_shared<DATA_BLOCK>();
238 ret->SetDataSize( numBytes );
256 uint32_t totalCumFreq = 0;
257 uint32_t symbolCumFreq = 0;
258 uint32_t symbolFreq = 0;
261 symbolCumFreq =
m_contextManager->GetCumulativeSymbolFrequency( aContext, aSymbol );
264 if( 0 == symbolFreq )
267 symbolCumFreq =
m_contextManager->GetCumulativeSymbolFrequency( aContext, aSymbol );
277 m_high =
m_low - 1 + range * ( symbolCumFreq + symbolFreq ) / totalCumFreq;
278 m_low =
m_low + range * symbolCumFreq / totalCumFreq;
284 uint32_t bit =
m_low >> 15;
void WriteF64(double aValue)
void swapBits8(uint32_t &rValue)
changes the ordering of an 8 bit value so that the first 4 bits become the last 4 bits and the last 4...
void WriteU8(uint8_t aValue)
uint32_t m_underflow
stores the number of bits of underflow cause dby the limited range of high and low
void GetBitCount(int32_t &rCount)
Returns the number of bits written.
void WriteU16(uint16_t uValue)
void checkPosition()
Checks that the array allocated for writing is large enough.
void WriteI32(int32_t iValue)
void WriteU32(uint32_t uValue)
std::shared_ptr< DATA_BLOCK > GetDataBlock()
void WriteDataBlock(std::shared_ptr< DATA_BLOCK > b)
uint32_t m_high
high and low are the upper and lower limits on the probability
void WriteF32(float fValue)
void WriteString(const std::string &aStr)
void WriteCompressedU16(uint32_t aContext, uint16_t uValue)
std::vector< uint32_t > m_data
uint32_t m_dataLocalNext
The value of the data after m_dataLocal.
void writeSymbol(uint32_t aContext, uint32_t aSymbol, bool &rEscape)
std::unique_ptr< CONTEXT_MANAGER > m_contextManager
void incrementPosition()
Updates the values of the datablock stored in dataLocal and dataLocalNext to the next values in the d...
void WriteU64(uint64_t uValue)
uint32_t m_dataLocal
The local value of the data corresponding to m_dataPosition.
void WriteCompressedU32(uint32_t aContext, uint32_t uValue)
void writeBit(uint32_t aBit)
bool m_compressed
Indicates if a compressed value was written.
int32_t m_dataBitOffset
The offset into data local that the next write occur.
void WriteCompressedU8(uint32_t aContext, uint8_t uValue)
const int32_t m_dataSizeIncrement
static const uint32_t MaxRange
The largest allowable static context.
static const uint32_t Swap8[]
static const uint32_t Context8
Uncompressed U8 Context.
static const uint32_t HalfMask
Bit masks for reading and writing symbols.
static const uint32_t QuarterMask
Masks all but the 2nd most significan bit.