当前位置: 首页>>代码示例>>C++>>正文


C++ GetBits函数代码示例

本文整理汇总了C++中GetBits函数的典型用法代码示例。如果您正苦于以下问题:C++ GetBits函数的具体用法?C++ GetBits怎么用?C++ GetBits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetBits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:decelmnt.c

示例2: QVariant

void 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,代码来源:AVRStudioXMLParser.cpp

示例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,代码来源:pulsedata.cpp

示例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,代码来源:decelmnt.c

示例5: rfx_rlgr_get_gr_code

static uint32
rfx_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,代码来源:rfx_rlgr.c

示例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,代码来源:Huffman.c

示例7: ntohs

bool 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,代码来源:ximaska.cpp

示例8: UninstDbgBreakfromThrd

DWORD
UninstDbgBreakfromThrd( 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,代码来源:dbghook.cpp

示例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,代码来源:DynamicCountFilter.c

示例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,代码来源:decelmnt.c

示例11: GetWidth

bool 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);	// ¼ÆËã»Ò¶ÈÖµ

			*(pArray + nPitch * i + j * nBitCount) = grayVal;							// ¸³»Ò¶ÈÖµ
			*(pArray + nPitch * i + j * nBitCount + 1) = grayVal;
			*(pArray + nPitch * i + j * nBitCount + 2) = grayVal;
		}
	}

	return true;
}
开发者ID:9crk,项目名称:EasyClient,代码行数:25,代码来源:ImageEx.cpp

示例12: GetImageSize

oexINT CImage::GetBits( oexPVOID x_buf, oexINT x_nSize )
{
#if !defined( OEX_ENABLE_XIMAGE )
	return 0;
#else

	// Sanity checks
	if ( !x_buf || !x_nSize )
		return 0;

	// Get image size
	oexINT nSize = GetImageSize();
	if ( nSize > x_nSize )
		nSize = x_nSize;

	// Get destination buffer
	oexPVOID pBits = GetBits();
	if ( !pBits )
		return 0;

	// Copy the data
	memcpy( x_buf, pBits, nSize );

	return nSize;
#endif
}
开发者ID:MangoCats,项目名称:winglib,代码行数:26,代码来源:image.cpp

示例13: GetBits

BYTE CxDib::GetPixelIndex(long x,long y)
{
	if ((hDib==NULL)||(m_nColors==0)||
		(x<0)||(y<0)||(x>=m_bi.biWidth)||(y>=m_bi.biHeight)) return 0;
	BYTE* iDst = GetBits();
	return iDst[(m_bi.biHeight - y)*m_LineWidth + x];
}
开发者ID:F5000,项目名称:spree,代码行数:7,代码来源:xShadeButton.cpp

示例14: DecodeEnvelope

/**************************************************************************************
 * Function:    DecodeEnvelope
 *
 * Description: decode the power envelope
 *
 * Inputs:      pointer to initialized Gecko2Info struct
 *              number of bits remaining in bitstream for this frame
 *              index of current channel
 *
 * Outputs:     rmsIndex[0, ..., cregsions-1] has power index for each region
 *              updated rmsMax with largest value of rmsImdex for this channel
 *
 * Return:      number of bits remaining in bitstream, -1 if out-of-bits
 **************************************************************************************/
int DecodeEnvelope(Gecko2Info *gi, int availbits, int ch)
{
	int r, code, nbits, rprime, cache, rmsMax;
	int *rmsIndex = gi->db.rmsIndex;
	BitStreamInfo *bsi = &(gi->bsi);

	if (availbits < RMS0BITS)
		return -1;

	/* unpack first index */
	code = GetBits(bsi, RMS0BITS, 1); 
	availbits -= RMS0BITS;
	rmsIndex[0] = CODE2RMS(code);

	/* check for escape code */
	/* ASSERT(rmsIndex[0] != 0); */

	rmsMax = rmsIndex[0];
	for (r = 1; r < gi->cRegions; r++) {

		/* for interleaved regions, choose a reasonable table */
		if (r < 2 * gi->cplStart) {
			rprime = r >> 1;
			if (rprime < 1) 
				rprime = 1;
		} else {
开发者ID:knone1,项目名称:hardware-ingenic-xb4780,代码行数:40,代码来源:envelope.c

示例15: GetWidth

void
Dib::Render (/*[in]*/ HDC	hdc,
	     /*[in]*/ int	x,
	     /*[in]*/ int	y,
	     /*[in]*/ int	cx,
	     /*[in]*/ int	cy)
{
  if (cx < 0)
  {
    cx = GetWidth();
  }
  if (cy < 0)
  {
    cy = GetHeight();
  }
  SetStretchBltMode (hdc, COLORONCOLOR);
  if (StretchDIBits(hdc,
    x,
    y,
    cx,
    cy,
    0,
    0,
    GetWidth(),
    GetHeight(),
    GetBits(),
    GetBitmapInfo(),
    DIB_RGB_COLORS,
    SRCCOPY)
      == GDI_ERROR)
  {
    FATAL_WINDOWS_ERROR ("StretchDIBits", 0);
  }
}
开发者ID:bngabonziza,项目名称:miktex,代码行数:34,代码来源:Dib.cpp


注:本文中的GetBits函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。