2
#include "LSBFEncoder.h"
7
void CEncoder::WriteBits(UINT32 aValue, UINT32 aNumBits)
11
UINT32 aNumNewBits = MyMin(aNumBits, m_BitPos);
12
aNumBits -= aNumNewBits;
14
UINT32 aMask = (1 << aNumNewBits) - 1;
15
m_CurByte |= (aValue & aMask) << (8 - m_BitPos);
16
aValue >>= aNumNewBits;
18
m_BitPos -= aNumNewBits;
22
m_Stream.WriteByte(m_CurByte);
30
void CReverseEncoder::WriteBits(UINT32 aValue, UINT32 aNumBits)
32
UINT32 aReverseValue = 0;
33
for(UINT32 i = 0; i < aNumBits; i++)
36
aReverseValue |= aValue & 1;
39
m_Encoder->WriteBits(aReverseValue, aNumBits);