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


C++ LLBitPack::bitUnpack方法代码示例

本文整理汇总了C++中LLBitPack::bitUnpack方法的典型用法代码示例。如果您正苦于以下问题:C++ LLBitPack::bitUnpack方法的具体用法?C++ LLBitPack::bitUnpack怎么用?C++ LLBitPack::bitUnpack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLBitPack的用法示例。


在下文中一共展示了LLBitPack::bitUnpack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void	decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph)
{
	U8 retvalu8;

	retvalu8 = 0;
	bitpack.bitUnpack(&retvalu8, 8);
	ph->quant_wbits = retvalu8;

	if (END_OF_PATCHES == ph->quant_wbits)
	{
		// End of data, blitz the rest.
		ph->dc_offset = 0;
		ph->range = 0;
		ph->patchids = 0;
		return;
	}

	U32 retvalu32 = 0;
#ifdef LL_BIG_ENDIAN
	U8 *ret = (U8 *)&retvalu32;
	bitpack.bitUnpack(&(ret[3]), 8);
	bitpack.bitUnpack(&(ret[2]), 8);
	bitpack.bitUnpack(&(ret[1]), 8);
	bitpack.bitUnpack(&(ret[0]), 8);
#else
	bitpack.bitUnpack((U8 *)&retvalu32, 32);
#endif
	ph->dc_offset = *(F32 *)&retvalu32;

	U16 retvalu16 = 0;
#ifdef LL_BIG_ENDIAN
	ret = (U8 *)&retvalu16;
	bitpack.bitUnpack(&(ret[1]), 8);
	bitpack.bitUnpack(&(ret[0]), 8);
#else
	bitpack.bitUnpack((U8 *)&retvalu16, 16);
#endif
	ph->range = retvalu16;

	retvalu16 = 0;
#ifdef LL_BIG_ENDIAN
	ret = (U8 *)&retvalu16;
	bitpack.bitUnpack(&(ret[1]), 8);
	bitpack.bitUnpack(&(ret[0]), 2);
#else
	bitpack.bitUnpack((U8 *)&retvalu16, 10);
#endif
	ph->patchids = retvalu16;

	gWordBits = (ph->quant_wbits & 0xf) + 2;
}
开发者ID:HizWylder,项目名称:GIS,代码行数:51,代码来源:patch_code.cpp

示例2: if

void	decode_patch(LLBitPack &bitpack, S32 *patches)
{
#ifdef LL_BIG_ENDIAN
	S32		i, j, patch_size = gPatchSize, wbits = gWordBits;
	U8		tempu8;
	U16		tempu16;
	U32		tempu32;
	for (i = 0; i < patch_size*patch_size; i++)
	{
		bitpack.bitUnpack((U8 *)&tempu8, 1);
		if (tempu8)
		{
			// either 0 EOB or Value
			bitpack.bitUnpack((U8 *)&tempu8, 1);
			if (tempu8)
			{
				// value
				bitpack.bitUnpack((U8 *)&tempu8, 1);
				if (tempu8)
				{
					// negative
					patches[i] = -1;
				}
				else
				{
					// positive
					patches[i] = 1;
				}
				if (wbits <= 8)
				{
					bitpack.bitUnpack((U8 *)&tempu8, wbits);
					patches[i] *= tempu8;
				}
				else if (wbits <= 16)
				{
					tempu16 = 0;
					U8 *ret = (U8 *)&tempu16;
					bitpack.bitUnpack(&(ret[1]), 8);
					bitpack.bitUnpack(&(ret[0]), wbits - 8);
					patches[i] *= tempu16;
				}
				else if (wbits <= 24)
				{
					tempu32 = 0;
					U8 *ret = (U8 *)&tempu32;
					bitpack.bitUnpack(&(ret[2]), 8);
					bitpack.bitUnpack(&(ret[1]), 8);
					bitpack.bitUnpack(&(ret[0]), wbits - 16);
					patches[i] *= tempu32;
				}
				else if (wbits <= 32)
				{
					tempu32 = 0;
					U8 *ret = (U8 *)&tempu32;
					bitpack.bitUnpack(&(ret[3]), 8);
					bitpack.bitUnpack(&(ret[2]), 8);
					bitpack.bitUnpack(&(ret[1]), 8);
					bitpack.bitUnpack(&(ret[0]), wbits - 24);
					patches[i] *= tempu32;
				}
			}
			else
			{
				for (j = i; j < patch_size*patch_size; j++)
				{
					patches[j] = 0;
				}
				return;
			}
		}
		else
		{
			patches[i] = 0;
		}
	}
#else
	S32		i, j, patch_size = gPatchSize, wbits = gWordBits;
	U32		temp;
	for (i = 0; i < patch_size*patch_size; i++)
	{
		temp = 0;
		bitpack.bitUnpack((U8 *)&temp, 1);
		if (temp)
		{
			// either 0 EOB or Value
			temp = 0;
			bitpack.bitUnpack((U8 *)&temp, 1);
			if (temp)
			{
				// value
				temp = 0;
				bitpack.bitUnpack((U8 *)&temp, 1);
				if (temp)
				{
					// negative
					temp = 0;
					bitpack.bitUnpack((U8 *)&temp, wbits);
					patches[i] = temp;
					patches[i] *= -1;
				}
//.........这里部分代码省略.........
开发者ID:HizWylder,项目名称:GIS,代码行数:101,代码来源:patch_code.cpp

示例3:

// <FS:CR> Aurora Sim
//void	decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph)
void	decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, bool b_large_patch)
// </FS:CR> Aurora Sim
{
	U8 retvalu8;

	retvalu8 = 0;
	bitpack.bitUnpack(&retvalu8, 8);
	ph->quant_wbits = retvalu8;

	if (END_OF_PATCHES == ph->quant_wbits)
	{
		// End of data, blitz the rest.
		ph->dc_offset = 0;
		ph->range = 0;
		ph->patchids = 0;
		return;
	}

	U32 retvalu32 = 0;
#ifdef LL_BIG_ENDIAN
	U8 *ret = (U8 *)&retvalu32;
	bitpack.bitUnpack(&(ret[3]), 8);
	bitpack.bitUnpack(&(ret[2]), 8);
	bitpack.bitUnpack(&(ret[1]), 8);
	bitpack.bitUnpack(&(ret[0]), 8);
#else
	bitpack.bitUnpack((U8 *)&retvalu32, 32);
#endif
	ph->dc_offset = *(F32 *)&retvalu32;

	U16 retvalu16 = 0;
#ifdef LL_BIG_ENDIAN
	ret = (U8 *)&retvalu16;
	bitpack.bitUnpack(&(ret[1]), 8);
	bitpack.bitUnpack(&(ret[0]), 8);
#else
	bitpack.bitUnpack((U8 *)&retvalu16, 16);
#endif
	ph->range = retvalu16;

// <FS:CR> Aurora Sim
	//retvalu16 = 0;
	retvalu32 = 0;
#ifdef LL_BIG_ENDIAN
	//ret = (U8 *)&retvalu16;
	ret = (U8*)&retvalu32;
// </FS:CR> Aurora Sim
	if (b_large_patch)
	{
		bitpack.bitUnpack(&(ret[3]), 8);
		bitpack.bitUnpack(&(ret[2]), 8);
		bitpack.bitUnpack(&(ret[1]), 8);
		bitpack.bitUnpack(&(ret[0]), 8);
	}
	else
	{
		bitpack.bitUnpack(&(ret[1]), 8);
		bitpack.bitUnpack(&(ret[0]), 2);
	}
#else
// <FS:CR> Aurora Sim
	//bitpack.bitUnpack((U8 *)&retvalu16, 10);
	bitpack.bitUnpack((U8*)&retvalu32, b_large_patch ? 32 : 10);
#endif
	//ph->patchids = retvalu16;
	ph->patchids = retvalu32;
// </FS:CR> Aurora Sim

	gWordBits = (ph->quant_wbits & 0xf) + 2;
}
开发者ID:1234-,项目名称:SingularityViewer,代码行数:72,代码来源:patch_code.cpp


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