本文整理汇总了C++中CGolombBuffer::BitRead方法的典型用法代码示例。如果您正苦于以下问题:C++ CGolombBuffer::BitRead方法的具体用法?C++ CGolombBuffer::BitRead怎么用?C++ CGolombBuffer::BitRead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGolombBuffer
的用法示例。
在下文中一共展示了CGolombBuffer::BitRead方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParsePage
HRESULT CDVBSub::ParsePage(CGolombBuffer& gb, WORD wSegLength, CAutoPtr<DVB_PAGE>& pPage)
{
HRESULT hr = S_OK;
WORD wEnd = (WORD)gb.GetPos() + wSegLength;
int nPos = 0;
pPage.Attach (DNew DVB_PAGE());
pPage->PageTimeOut = gb.ReadByte();
pPage->PageVersionNumber = (BYTE)gb.BitRead(4);
pPage->PageState = (BYTE)gb.BitRead(2);
pPage->RegionCount = 0;
gb.BitRead(2); // Reserved
while (gb.GetPos() < wEnd)
{
if (nPos < MAX_REGIONS)
{
pPage->Regions[nPos].Id = gb.ReadByte();
gb.ReadByte(); // Reserved
pPage->Regions[nPos].HorizAddr = gb.ReadShort();
pPage->Regions[nPos].VertAddr = gb.ReadShort();
pPage->RegionCount++;
}
nPos++;
}
return S_OK;
}
示例2:
HRESULT CMpeg2DataParser::ParsePAT()
{
HRESULT hr;
CComPtr<ISectionList> pSectionList;
DWORD dwLength;
PSECTION data;
WORD wTSID;
WORD wSectionLength;
CheckNoLog (m_pData->GetSection (PID_PAT, SI_PAT, &m_Filter, 5000, &pSectionList));
CheckNoLog (pSectionList->GetSectionData (0, &dwLength, &data));
CGolombBuffer gb ((BYTE*)data, dwLength);
// program_association_section()
CheckNoLog (ParseSIHeader (gb, SI_PAT, wSectionLength, wTSID));
while (gb.GetSize() - gb.GetPos() > 4) {
WORD program_number = gb.BitRead(16); // program_number
gb.BitRead(3); // reserved
if (program_number==0) {
gb.BitRead(13); // network_PID
} else {
WORD program_map_PID = gb.BitRead(13); // program_map_PID
if (Channels.Lookup(program_number)) {
Channels [program_number].SetPMT (program_map_PID);
ParsePMT (Channels [program_number]);
}
}
}
return S_OK;
}
示例3: ParseObject
HRESULT CDVBSub::ParseObject(CGolombBuffer& gb, WORD wSegLength)
{
HRESULT hr = E_FAIL;
if (m_pCurrentPage && wSegLength > 2) {
CompositionObject* pObject = DNew CompositionObject();
BYTE object_coding_method;
pObject->m_object_id_ref = gb.ReadShort();
pObject->m_version_number = (BYTE)gb.BitRead(4);
object_coding_method = (BYTE)gb.BitRead(2); // object_coding_method
gb.BitRead(1); // non_modifying_colour_flag
gb.BitRead(1); // reserved
if (object_coding_method == 0x00) {
pObject->SetRLEData(gb.GetBufferPos(), wSegLength - 3, wSegLength - 3);
gb.SkipBytes(wSegLength - 3);
m_pCurrentPage->Objects.AddTail(pObject);
hr = S_OK;
} else {
delete pObject;
hr = E_NOTIMPL;
}
}
return hr;
}
示例4: while
void CompositionObject::Dvb4PixelsCodeString(SubPicDesc& spd, CGolombBuffer& gb, short& nX, short& nY)
{
bool bQuit = false;
while (!bQuit && !gb.IsEOF()) {
short nCount = 0;
BYTE nPaletteIndex = 0;
BYTE bTemp = (BYTE)gb.BitRead(4);
if (bTemp != 0) {
nPaletteIndex = bTemp;
nCount = 1;
} else {
if (gb.BitRead(1) == 0) { // switch_1
nCount = (short)gb.BitRead(3); // run_length_3-9
if (nCount != 0) {
nCount += 2;
} else {
bQuit = true;
}
} else {
if (gb.BitRead(1) == 0) { // switch_2
nCount = 4 + (short)gb.BitRead(2); // run_length_4-7
nPaletteIndex = (BYTE)gb.BitRead(4); // 4-bit_pixel-code
} else {
switch (gb.BitRead(2)) { // switch_3
case 0:
nCount = 1;
break;
case 1:
nCount = 2;
break;
case 2: // if (switch_3 == '10')
nCount = 9 + (short)gb.BitRead(4); // run_length_9-24
nPaletteIndex = (BYTE)gb.BitRead(4); // 4-bit_pixel-code
break;
case 3:
nCount = 25 + gb.ReadByte(); // run_length_25-280
nPaletteIndex = (BYTE)gb.BitRead(4); // 4-bit_pixel-code
break;
}
}
}
}
#if 0
if (nX + nCount > m_width) {
ASSERT(FALSE);
break;
}
#endif
if (nCount > 0) {
FillSolidRect(spd, nX, nY, nCount, 1, m_Colors[nPaletteIndex]);
nX += nCount;
}
}
gb.BitByteAlign();
}
示例5: ParseClut
HRESULT CDVBSub::ParseClut(CGolombBuffer& gb, WORD wSegLength)
{
HRESULT hr = E_POINTER;
if (m_pCurrentPage) {
size_t nExpectedSize = 2;
size_t nEnd = gb.GetPos() + wSegLength;
BYTE id = gb.ReadByte();
POSITION posClut = FindClut(m_pCurrentPage, id);
if (!posClut) {
posClut = m_pCurrentPage->CLUTs.AddTail(CAutoPtr<DVB_CLUT>(DEBUG_NEW DVB_CLUT()));
}
const auto& pClut = m_pCurrentPage->CLUTs.GetAt(posClut);
pClut->id = id;
pClut->version_number = (BYTE)gb.BitRead(4);
gb.BitRead(4); // Reserved
pClut->size = 0;
while (gb.GetPos() < nEnd) {
nExpectedSize += 2;
pClut->palette[pClut->size].entry_id = gb.ReadByte();
BYTE _2_bit = (BYTE)gb.BitRead(1);
BYTE _4_bit = (BYTE)gb.BitRead(1);
BYTE _8_bit = (BYTE)gb.BitRead(1);
UNREFERENCED_PARAMETER(_2_bit);
UNREFERENCED_PARAMETER(_4_bit);
UNREFERENCED_PARAMETER(_8_bit);
gb.BitRead(4); // Reserved
if (gb.BitRead(1)) {
nExpectedSize += 4;
pClut->palette[pClut->size].Y = gb.ReadByte();
pClut->palette[pClut->size].Cr = gb.ReadByte();
pClut->palette[pClut->size].Cb = gb.ReadByte();
pClut->palette[pClut->size].T = 0xff - gb.ReadByte();
} else {
nExpectedSize += 2;
pClut->palette[pClut->size].Y = (BYTE)gb.BitRead(6) << 2;
pClut->palette[pClut->size].Cr = (BYTE)gb.BitRead(4) << 4;
pClut->palette[pClut->size].Cb = (BYTE)gb.BitRead(4) << 4;
pClut->palette[pClut->size].T = 0xff - ((BYTE)gb.BitRead(2) << 6);
}
if (!pClut->palette[pClut->size].Y) {
pClut->palette[pClut->size].Cr = 0;
pClut->palette[pClut->size].Cb = 0;
pClut->palette[pClut->size].T = 0;
}
pClut->size++;
}
hr = (wSegLength == nExpectedSize) ? S_OK : E_UNEXPECTED;
}
return hr;
}
示例6: ParseClut
HRESULT CDVBSub::ParseClut(CGolombBuffer& gb, WORD wSegLength)
{
HRESULT hr = S_OK;
int nEnd = gb.GetPos() + wSegLength;
BYTE CLUT_id = gb.ReadByte();
if (m_pCurrentPage != NULL) {
CDVBSub::DVB_CLUT DummyClut;
CDVBSub::DVB_CLUT* pClut = FindClut(m_pCurrentPage, CLUT_id);
if (pClut == NULL) {
pClut = &DummyClut;
}
pClut->id = CLUT_id;
pClut->version_number = (BYTE)gb.BitRead(4);
gb.BitRead(4); // Reserved
pClut->Size = 0;
while (gb.GetPos() < nEnd) {
BYTE entry_id = gb.ReadByte();
BYTE _2_bit = (BYTE)gb.BitRead(1);
BYTE _4_bit = (BYTE)gb.BitRead(1);
BYTE _8_bit = (BYTE)gb.BitRead(1);
UNREFERENCED_PARAMETER(_2_bit);
UNREFERENCED_PARAMETER(_4_bit);
UNREFERENCED_PARAMETER(_8_bit);
gb.BitRead(4); // Reserved
pClut->Palette[entry_id].entry_id = entry_id;
if (gb.BitRead(1)) {
pClut->Palette[entry_id].Y = gb.ReadByte();
pClut->Palette[entry_id].Cr = gb.ReadByte();
pClut->Palette[entry_id].Cb = gb.ReadByte();
pClut->Palette[entry_id].T = 0xff-gb.ReadByte();
} else {
pClut->Palette[entry_id].Y = (BYTE)gb.BitRead(6)<<2;
pClut->Palette[entry_id].Cr = (BYTE)gb.BitRead(4)<<4;
pClut->Palette[entry_id].Cb = (BYTE)gb.BitRead(4)<<4;
pClut->Palette[entry_id].T = 0xff-((BYTE)gb.BitRead(2)<<6);
}
if (!pClut->Palette[entry_id].Y) {
pClut->Palette[entry_id].Cr = 0;
pClut->Palette[entry_id].Cb = 0;
pClut->Palette[entry_id].T = 0;
}
pClut->Size = max (pClut->Size, entry_id + 1);
}
if (DummyClut.Size) {
m_pCurrentPage->Clut.AddTail(DummyClut);
}
}
return hr;
}
示例7: while
void CompositionObject::Dvb2PixelsCodeString(SubPicDesc& spd, CGolombBuffer& gb, short& nX, short& nY)
{
BYTE bTemp;
BYTE nPaletteIndex = 0;
short nCount;
bool bQuit = false;
while (!bQuit && !gb.IsEOF()) {
nCount = 0;
nPaletteIndex = 0;
bTemp = (BYTE)gb.BitRead(2);
if (bTemp != 0) {
nPaletteIndex = bTemp;
nCount = 1;
} else {
if (gb.BitRead(1) == 1) { // switch_1
nCount = 3 + (short)gb.BitRead(3); // run_length_3-9
nPaletteIndex = (BYTE)gb.BitRead(2);
} else {
if (gb.BitRead(1) == 0) { // switch_2
switch (gb.BitRead(2)) { // switch_3
case 0:
bQuit = true;
break;
case 1:
nCount = 2;
break;
case 2: // if (switch_3 == '10')
nCount = 12 + (short)gb.BitRead(4); // run_length_12-27
nPaletteIndex = (BYTE)gb.BitRead(2); // 4-bit_pixel-code
break;
case 3:
nCount = 29 + gb.ReadByte(); // run_length_29-284
nPaletteIndex = (BYTE)gb.BitRead(2); // 4-bit_pixel-code
break;
}
} else {
nCount = 1;
}
}
}
if (nX + nCount > m_width) {
ASSERT(FALSE);
break;
}
if (nCount > 0) {
FillSolidRect(spd, nX, nY, nCount, 1, m_Colors[nPaletteIndex]);
nX += nCount;
}
}
gb.BitByteAlign();
}
示例8: ParseDisplay
HRESULT CDVBSub::ParseDisplay(CGolombBuffer& gb, WORD wSegLength)
{
m_Display.version_number = (BYTE)gb.BitRead(4);
m_Display.display_window_flag = (BYTE)gb.BitRead(1);
gb.BitRead(3); // reserved
m_Display.width = gb.ReadShort();
m_Display.height = gb.ReadShort();
if (m_Display.display_window_flag) {
m_Display.horizontal_position_minimun = gb.ReadShort();
m_Display.horizontal_position_maximum = gb.ReadShort();
m_Display.vertical_position_minimun = gb.ReadShort();
m_Display.vertical_position_maximum = gb.ReadShort();
}
return S_OK;
}
示例9: while
void CompositionObject::Dvb8PixelsCodeString(SubPicDesc& spd, CGolombBuffer& gb, SHORT& nX, SHORT& nY)
{
BYTE bTemp;
BYTE nPaletteIndex = 0;
SHORT nCount;
bool bQuit = false;
while(!bQuit && !gb.IsEOF())
{
nCount = 0;
nPaletteIndex = 0;
bTemp = gb.ReadByte();
if(bTemp != 0)
{
nPaletteIndex = bTemp;
nCount = 1;
}
else
{
if(gb.BitRead(1) == 0) // switch_1
{
nCount = (SHORT)gb.BitRead(7); // run_length_1-127
if(nCount == 0)
bQuit = true;
}
else
{
nCount = (SHORT)gb.BitRead(7); // run_length_3-127
nPaletteIndex = gb.ReadByte();
}
}
if(nX + nCount > m_width)
{
ASSERT(FALSE);
break;
}
if(nCount > 0)
{
FillSolidRect(spd, nX, nY, nCount, 1, m_Colors[nPaletteIndex]);
nX += nCount;
}
}
gb.BitByteAlign();
}
示例10: ParseDisplay
HRESULT CDVBSub::ParseDisplay(CGolombBuffer& gb, WORD wSegLength)
{
int nExpectedSize = 5;
m_displayInfo.version_number = (BYTE)gb.BitRead(4);
m_displayInfo.display_window_flag = (BYTE)gb.BitRead(1);
gb.BitRead(3); // reserved
m_displayInfo.width = gb.ReadShort() + 1;
m_displayInfo.height = gb.ReadShort() + 1;
if (m_displayInfo.display_window_flag) {
nExpectedSize += 8;
m_displayInfo.horizontal_position_minimun = gb.ReadShort();
m_displayInfo.horizontal_position_maximum = gb.ReadShort();
m_displayInfo.vertical_position_minimun = gb.ReadShort();
m_displayInfo.vertical_position_maximum = gb.ReadShort();
}
return (wSegLength == nExpectedSize) ? S_OK : E_UNEXPECTED;
}
示例11: HrdParameters
int HrdParameters(CGolombBuffer& gb)
{
UINT64 cnt = gb.UExpGolombRead(); // cpb_cnt_minus1
if (cnt > 32U) {
return -1;
}
gb.BitRead(4); // bit_rate_scale
gb.BitRead(4); // cpb_size_scale
for (unsigned int i = 0; i <= cnt; i++ ) {
gb.UExpGolombRead(); // bit_rate_value_minus1
gb.UExpGolombRead(); // cpb_size_value_minus1
gb.BitRead(1); // cbr_flag
}
gb.BitRead(5); // initial_cpb_removal_delay_length_minus1
gb.BitRead(5); // cpb_removal_delay_length_minus1
gb.BitRead(5); // dpb_output_delay_length_minus1
gb.BitRead(5); // time_offset_length
return 0;
}
示例12: ParseClut
HRESULT CDVBSub::ParseClut(CGolombBuffer& gb, WORD wSegLength)
{
HRESULT hr = S_OK;
WORD wEnd = (WORD)gb.GetPos() + wSegLength;
CDVBSub::DVB_CLUT* pClut;
pClut = FindClut (m_pCurrentPage, gb.ReadByte());
// ASSERT (pClut != NULL);
if (pClut != NULL)
{
pClut->version_number = (BYTE)gb.BitRead(4);
gb.BitRead(4); // Reserved
pClut->Size = 0;
while (gb.GetPos() < wEnd)
{
BYTE entry_id = gb.ReadByte()+1;
BYTE _2_bit = (BYTE)gb.BitRead(1);
BYTE _4_bit = (BYTE)gb.BitRead(1);
BYTE _8_bit = (BYTE)gb.BitRead(1);
gb.BitRead(4); // Reserved
pClut->Palette[entry_id].entry_id = entry_id;
if (gb.BitRead(1))
{
pClut->Palette[entry_id].Y = gb.ReadByte();
pClut->Palette[entry_id].Cr = gb.ReadByte();
pClut->Palette[entry_id].Cb = gb.ReadByte();
pClut->Palette[entry_id].T = 255-gb.ReadByte();
}
else
{
pClut->Palette[entry_id].Y = (BYTE)gb.BitRead(6)<<2;
pClut->Palette[entry_id].Cr = (BYTE)gb.BitRead(4)<<4;
pClut->Palette[entry_id].Cb = (BYTE)gb.BitRead(4)<<4;
pClut->Palette[entry_id].T = 255-((BYTE)gb.BitRead(2)<<6);
}
pClut->Size = max (pClut->Size, entry_id);
}
}
return hr;
}
示例13: ParsePage
HRESULT CDVBSub::ParsePage(CGolombBuffer& gb, WORD wSegLength, CAutoPtr<DVB_PAGE>& pPage)
{
size_t nExpectedSize = 2;
size_t nEnd = gb.GetPos() + wSegLength;
pPage = CAutoPtr<DVB_PAGE>(DEBUG_NEW DVB_PAGE());
pPage->pageTimeOut = gb.ReadByte();
pPage->pageVersionNumber = (BYTE)gb.BitRead(4);
pPage->pageState = (BYTE)gb.BitRead(2);
gb.BitRead(2); // Reserved
while (gb.GetPos() < nEnd) {
nExpectedSize += 6;
DVB_REGION_POS regionPos;
regionPos.id = gb.ReadByte();
gb.ReadByte(); // Reserved
regionPos.horizAddr = gb.ReadShort();
regionPos.vertAddr = gb.ReadShort();
pPage->regionsPos.AddTail(regionPos);
}
return (wSegLength == nExpectedSize) ? S_OK : E_UNEXPECTED;
}
示例14: for
HRESULT CMpeg2DataParser::ParsePMT(CDVBChannel& Channel)
{
HRESULT hr;
CComPtr<ISectionList> pSectionList;
DWORD dwLength;
PSECTION data;
WORD wTSID;
WORD wSectionLength;
CheckNoLog (m_pData->GetSection (Channel.GetPMT(), SI_PMT, &m_Filter, 5000, &pSectionList));
CheckNoLog (pSectionList->GetSectionData (0, &dwLength, &data));
CGolombBuffer gb ((BYTE*)data, dwLength);
// TS_program_map_section()
CheckNoLog (ParseSIHeader (gb, SI_PMT, wSectionLength, wTSID));
gb.BitRead(3); // reserved
Channel.SetPCR (gb.BitRead(13)); // PCR_PID
gb.BitRead(4); // reserved
BeginEnumDescriptors(gb, nType, nLength) { // for (i=0;i<N;i++) {
SkipDescriptor (gb, nType, nLength); // descriptor()
}
示例15: ParseObject
HRESULT CDVBSub::ParseObject(CGolombBuffer& gb, WORD wSegLength)
{
HRESULT hr = E_POINTER;
if (m_pCurrentPage) {
size_t nExpectedSize = 3;
size_t nEnd = gb.GetPos() + wSegLength;
short id = gb.ReadShort();
POSITION posObject = FindObject(m_pCurrentPage, id);
if (!posObject) {
posObject = m_pCurrentPage->objects.AddTail(CAutoPtr<CompositionObject>(DEBUG_NEW CompositionObject()));
}
const auto& pObject = m_pCurrentPage->objects.GetAt(posObject);
pObject->m_object_id_ref = id;
pObject->m_version_number = (BYTE)gb.BitRead(4);
BYTE object_coding_method = (BYTE)gb.BitRead(2); // object_coding_method
gb.BitRead(1); // non_modifying_colour_flag
gb.BitRead(1); // reserved
if (object_coding_method == 0x00) {
pObject->SetRLEData(gb.GetBufferPos(), wSegLength - nExpectedSize, wSegLength - nExpectedSize);
gb.SkipBytes(wSegLength - 3);
hr = (wSegLength >= nExpectedSize) ? S_OK : E_UNEXPECTED;
} else {
TRACE_DVB(_T("DVB - Text subtitles are currently not supported\n"));
m_pCurrentPage->objects.RemoveTail();
hr = E_NOTIMPL;
}
}
return hr;
}