这篇教程C++ GetBits函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetBits函数的典型用法代码示例。如果您正苦于以下问题:C++ GetBits函数的具体用法?C++ GetBits怎么用?C++ GetBits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetBits函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DecodeFillElement/************************************************************************************** * Function: DecodeFillElement * * Description: decode one fill element * * Inputs: BitStreamInfo struct pointing to start of fill element * (14496-3, table 4.4.11) * * Outputs: updated element instance tag * unpacked extension payload * * Return: 0 if successful, -1 if error **************************************************************************************/static int DecodeFillElement(AACDecInfo *aacDecInfo, BitStreamInfo *bsi){ unsigned int fillCount; unsigned char *fillBuf; PSInfoBase *psi; /* validate pointers */ if (!aacDecInfo || !aacDecInfo->psInfoBase) return -1; psi = (PSInfoBase *)(aacDecInfo->psInfoBase); fillCount = GetBits(bsi, 4); if (fillCount == 15) fillCount += (GetBits(bsi, 8) - 1); psi->fillCount = fillCount; fillBuf = psi->fillBuf; while (fillCount--) *fillBuf++ = GetBits(bsi, 8); aacDecInfo->currInstTag = -1; /* fill elements don't have instance tag */ aacDecInfo->fillExtType = 0;#ifdef AAC_ENABLE_SBR /* check for SBR * aacDecInfo->sbrEnabled is sticky (reset each raw_data_block), so for multichannel * need to verify that all SCE/CPE/ICCE have valid SBR fill element following, and * must upsample by 2 for LFE */ if (psi->fillCount > 0) { aacDecInfo->fillExtType = (int)((psi->fillBuf[0] >> 4) & 0x0f); if (aacDecInfo->fillExtType == EXT_SBR_DATA || aacDecInfo->fillExtType == EXT_SBR_DATA_CRC) aacDecInfo->sbrEnabled = 1; }
开发者ID:carlocaione,项目名称:buildroot-ved-2014-05-27,代码行数:47,
示例2: QVariantvoid AVRStudioXMLParser::Parse(QString configDirPath, Part *pPart){ QXmlQuery query; QString result; query.bindVariable("partName", QVariant(configDirPath)); query.setQuery(GetXQuery()); query.evaluateTo(&result); // for future use QString errorMsg; int line; int col; QDomDocument doc; if(!doc.setContent(result, &errorMsg, &line, &col)) return; QDomNode root = doc.firstChild(); QDomNode fuses = root.firstChild(); QDomNode locks = fuses.nextSibling(); QDomNode interfaces = locks.nextSibling(); pPart->SetFuseBits(GetBits(fuses.firstChild())); pPart->SetLockBits(GetBits(locks.firstChild())); pPart->SetProgrammingInterfaces(GetInterfaces(interfaces.firstChild()));}
开发者ID:ttomek32,项目名称:tmfavrcalculator,代码行数:26,
示例3: CPulseData_Read/* The function reads the elements for pulse data from the bitstream.*/void CPulseData_Read(HANDLE_BIT_BUF bs, /*!< pointer to bitstream */ CPulseData *PulseData) /*!< pointer to pulse data side info */{ int i; FLC_sub_start("CPulseData_Read"); FUNC(2); INDIRECT(1); STORE(1); BRANCH(1); if ((PulseData->PulseDataPresent = (char) GetBits(bs,1))) { FUNC(2); INDIRECT(2); STORE(1); PulseData->NumberPulse = (char) GetBits(bs,2); FUNC(2); INDIRECT(2); STORE(1); PulseData->PulseStartBand = (char) GetBits(bs,6); PTR_INIT(2); /* PulseData->PulseOffset[i] PulseData->PulseAmp[i] */ LOOP(1); for (i=0; i<=PulseData->NumberPulse; i++) { FUNC(2); STORE(1); PulseData->PulseOffset[i] = (char) GetBits(bs,5); FUNC(2); STORE(1); PulseData->PulseAmp[i] = (char) GetBits(bs,4); } } FLC_sub_end();}
开发者ID:wonktnodi,项目名称:webrtc_port,代码行数:36,
示例4: DecodeDataStreamElement/************************************************************************************** * Function: DecodeDataStreamElement * * Description: decode one DSE * * Inputs: BitStreamInfo struct pointing to start of DSE (14496-3, table 4.4.10) * * Outputs: updated element instance tag * filled in data stream buffer * * Return: 0 if successful, -1 if error **************************************************************************************/static int DecodeDataStreamElement(AACDecInfo *aacDecInfo, BitStreamInfo *bsi){ unsigned int byteAlign, dataCount; unsigned char *dataBuf; PSInfoBase *psi; /* validate pointers */ if (!aacDecInfo || !aacDecInfo->psInfoBase) return -1; psi = (PSInfoBase *)(aacDecInfo->psInfoBase); aacDecInfo->currInstTag = GetBits(bsi, NUM_INST_TAG_BITS); byteAlign = GetBits(bsi, 1); dataCount = GetBits(bsi, 8); if (dataCount == 255) dataCount += GetBits(bsi, 8); if (byteAlign) ByteAlignBitstream(bsi); psi->dataCount = dataCount; dataBuf = psi->dataBuf; while (dataCount--) *dataBuf++ = GetBits(bsi, 8); return 0;}
开发者ID:carlocaione,项目名称:buildroot-ved-2014-05-27,代码行数:39,
示例5: rfx_rlgr_get_gr_codestatic uint32rfx_rlgr_get_gr_code(RFX_BITSTREAM * bs, int * krp, int * kr){ int vk; uint32 mag; /* chew up/count leading 1s and escape 0 */ for (vk = 0; GetBits(1) == 1;) vk++; /* get next *kr bits, and combine with leading 1s */ mag = (vk << *kr) | GetBits(*kr); /* adjust krp and kr based on vk */ if (!vk) { UpdateParam(*krp, -2, *kr); } else if (vk != 1) { /* at 1, no change! */ UpdateParam(*krp, vk, *kr); } return mag;}
开发者ID:mfleisz,项目名称:FreeRDP-old,代码行数:26,
示例6: CodeToFile//把出现过的字符编码表经过压缩写进文件short CodeToFile(FILE *fp,char **hc,short n,SeqQueue *Q,MyType *length){ int i; char *p; MyType j,bits; short count=0; for(i = 0;i < n;i++)// 将n个叶子压缩并写入文件 { for(p = hc[i]; '/0' != *p; p++) In_seqQueue( Q,*p ); while(Q->length > 8) { bits = GetBits(Q);//出队8个元素 fputc(bits,fp); count++; } } *length = Q->length; i = 8 - *length; bits = GetBits(Q);//取8个如果队不空 for(j = 0;j < i;j++) bits = bits << 1; fputc(bits,fp); count++; InitQueue(Q); return count;}
开发者ID:Gaoyuan0710,项目名称:Huffman,代码行数:32,
示例7: ntohsbool CxImageSKA::Decode(CxFile *hFile){ if (hFile==NULL) return false; // read the header SKAHEADER ska_header; hFile->Read(&ska_header,sizeof(SKAHEADER),1); ska_header.Width = ntohs(ska_header.Width); ska_header.Height = ntohs(ska_header.Height); ska_header.dwUnknown = ntohl(ska_header.dwUnknown); // check header if (ska_header.dwUnknown != 0x01000000 || ska_header.Width > 0x7FFF || ska_header.Height > 0x7FFF || ska_header.BppExp != 3) return false; if (info.nEscape == -1){ head.biWidth = ska_header.Width ; head.biHeight= ska_header.Height; info.dwType = CXIMAGE_FORMAT_SKA; return true; } int bpp = 1<<ska_header.BppExp; Create(ska_header.Width,ska_header.Height,bpp,CXIMAGE_FORMAT_SKA); if (!IsValid()) return false; // read the palette int nColors = 1<<bpp; rgb_color* ppal = (rgb_color*)malloc(nColors*sizeof(rgb_color)); if (!ppal) return false; hFile->Read(ppal,nColors*sizeof(rgb_color),1); SetPalette(ppal,nColors); free(ppal); //read the image hFile->Read(GetBits(),ska_header.Width*ska_header.Height,1); //reorder rows if (GetEffWidth() != ska_header.Width){ BYTE *src,*dst; src = GetBits() + ska_header.Width*(ska_header.Height-1); dst = GetBits(ska_header.Height-1); for(int y=0;y<ska_header.Height;y++){ memcpy(dst,src,ska_header.Width); src -= ska_header.Width; dst -= GetEffWidth(); } } Flip(); return true;}
开发者ID:Aliceljm1,项目名称:CxImageVS2010,代码行数:59,
示例8: UninstDbgBreakfromThrdDWORDUninstDbgBreakfromThrd( DWORD dwThreadId, DWORD dwLineAddr, DWORD dwAccessType){ HANDLE hThread; hThread = OpenThread( THREAD_SET_CONTEXT|THREAD_GET_CONTEXT|THREAD_SUSPEND_RESUME, FALSE, dwThreadId ); if ( hThread == NULL ) return GetLastError(); if ( -1 == SuspendThread( hThread )) return GetLastError(); CONTEXT cxt = {0}; cxt.ContextFlags = CONTEXT_DEBUG_REGISTERS|CONTEXT_FULL; if (!GetThreadContext( hThread, &cxt )) return GetLastError(); if (cxt.Dr0 == dwLineAddr) { if (dwAccessType == GetBits(cxt.Dr7, 16, 2)) { SetBits(cxt.Dr7, DR7_L0, 1, 0); } } if (cxt.Dr1 == dwLineAddr) { if (dwAccessType == GetBits(cxt.Dr7, 20, 2)) { SetBits(cxt.Dr7, DR7_L1, 1, 0); } } if (cxt.Dr2 == dwLineAddr) { if (dwAccessType == GetBits(cxt.Dr7, 24, 2)) { SetBits(cxt.Dr7, DR7_L2, 1, 0); } } if (cxt.Dr3 == dwLineAddr) { if (dwAccessType == GetBits(cxt.Dr7, 28, 2)) { SetBits(cxt.Dr7, DR7_L3, 1, 0); } } cxt.ContextFlags = CONTEXT_DEBUG_REGISTERS; if(!SetThreadContext( hThread, &cxt )) return GetLastError(); if(-1 == ResumeThread( hThread )) return GetLastError(); return 0;}
开发者ID:danieljiang0415,项目名称:gh,代码行数:53,
示例9: GetDCFCounter/* * GetDCFCounter * * Description: * This function will read a counter from a specified * position in a dynamic count filter. * * Parameters: * dcf: [in] * The dynamic count filter whose counter is to be read. * index: [in] * The index of the counter to be read. * * Returns: * The counter in the specified position. * * Comments: * */unsigned GetDCFCounter(DynamicCountFilter *dcf, unsigned index){ unsigned ofvCounter; unsigned cbfvCounter = GetBits((unsigned *)dcf->CBFV, index * dcf->CBFV_Counter_Size, dcf->CBFV_Counter_Size); if (dcf->OFV == NULL) return cbfvCounter; ofvCounter = GetBits((unsigned *)dcf->OFV, index * dcf->OFV_Counter_Size, dcf->OFV_Counter_Size); return (ofvCounter << dcf->CBFV_Counter_Size) | cbfvCounter;}
开发者ID:axxapp,项目名称:winxgui,代码行数:33,
示例10: DecodeChannelPairElement/************************************************************************************** * Function: DecodeChannelPairElement * * Description: decode one CPE * * Inputs: BitStreamInfo struct pointing to start of CPE (14496-3, table 4.4.5) * * Outputs: updated element instance tag * updated commonWin * updated ICS info, if commonWin == 1 * updated mid-side stereo info, if commonWin == 1 * * Return: 0 if successful, -1 if error * * Notes: doesn't decode individual channel stream (part of DecodeNoiselessData) **************************************************************************************/static int DecodeChannelPairElement(AACDecInfo *aacDecInfo, BitStreamInfo *bsi){ int sfb, gp, maskOffset; unsigned char currBit, *maskPtr; PSInfoBase *psi; ICSInfo *icsInfo; /* validate pointers */ if (!aacDecInfo || !aacDecInfo->psInfoBase) return -1; psi = (PSInfoBase *)(aacDecInfo->psInfoBase); icsInfo = psi->icsInfo; /* read instance tag */ aacDecInfo->currInstTag = GetBits(bsi, NUM_INST_TAG_BITS); /* read common window flag and mid-side info (if present) * store msMask bits in psi->msMaskBits[] as follows: * long blocks - pack bits for each SFB in range [0, maxSFB) starting with lsb of msMaskBits[0] * short blocks - pack bits for each SFB in range [0, maxSFB), for each group [0, 7] * msMaskPresent = 0 means no M/S coding * = 1 means psi->msMaskBits contains 1 bit per SFB to toggle M/S coding * = 2 means all SFB's are M/S coded (so psi->msMaskBits is not needed) */ psi->commonWin = GetBits(bsi, 1); if (psi->commonWin) { DecodeICSInfo(bsi, icsInfo, psi->sampRateIdx); psi->msMaskPresent = GetBits(bsi, 2); if (psi->msMaskPresent == 1) { maskPtr = psi->msMaskBits; *maskPtr = 0; maskOffset = 0; for (gp = 0; gp < icsInfo->numWinGroup; gp++) { for (sfb = 0; sfb < icsInfo->maxSFB; sfb++) { currBit = (unsigned char)GetBits(bsi, 1); *maskPtr |= currBit << maskOffset; if (++maskOffset == 8) { maskPtr++; *maskPtr = 0; maskOffset = 0; } } } } } return 0;}
开发者ID:carlocaione,项目名称:buildroot-ved-2014-05-27,代码行数:64,
示例11: GetWidthbool CImageEx::SetGray(){ int nWidth = GetWidth(); int nHeight = GetHeight(); BYTE* pArray = (BYTE*)GetBits(); int nPitch = GetPitch(); int nBitCount = GetBPP() / 8; for (int i = 0; i < nHeight; i++) { for (int j = 0; j < nWidth; j++) { int grayVal = (BYTE)(((*(pArray + nPitch * i + j * nBitCount) * 306) + (*(pArray + nPitch * i + j * nBitCount + 1) * 601) + (*(pArray + nPitch * i + j * nBitCount + 2) * 117) + 512 ) >> 10); // C++ GetBlobSize函数代码示例 C++ GetBitmap函数代码示例
|