⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datablk.h

📁 jpeg 2000 压缩算法源代码 核心ebcot
💻 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 + -