?? datablk.h
字號:
ByteToBitInput(ByteInputBuffer *pIn)
{
m_nBitPosition=-1;
m_pIn=0;
m_pIn=pIn;
}
int ByteToBitInput::ReadBit()
{
if (m_nBitPosition < 0)
{
if ((m_BitBuffer&0xFF) != 0xFF)
{ // Normal byte to read
m_BitBuffer = m_pIn->Read();
m_nBitPosition = 7;
}
else
{ // Previous byte is 0xFF => there was bit stuffing
m_BitBuffer = m_pIn->Read();
m_nBitPosition = 6;
}
}
int returnbit=(m_BitBuffer>>m_nBitPosition)&0x01;
// return (m_nBitBuffer>>m_nBitPosition--);
m_nBitPosition--;
return returnbit;
}
void ByteToBitInput::SetBufferArray(BYTE *pByteBuffer, int nByteBufLength, int nOffset, int nLength)
{
m_pIn->SetBufferArray(pByteBuffer,nByteBufLength,nOffset,nLength);
m_BitBuffer = 0; // reset any bit stuffing state
m_nBitPosition= -1;
}
/**
* Flushes (i.e. empties) the bit buffer, without loading any new
* bytes. This realigns the input at the next byte boundary, if not
* already at one.
* */
void ByteToBitInput::Flush()
{
m_BitBuffer = 0; // reset any bit stuffing state
m_nBitPosition = -1;
}
/**
* Checks for past errors in the decoding process by verifying the byte
* padding with an alternating sequence of 0's and 1's. If an error is
* detected it means that the raw bit stream has been wrongly decoded or
* that the raw terminated segment length is too long. If no errors are
* detected it does not necessarily mean that the raw bit stream has been
* corre
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -