本文整理汇总了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;
}
示例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;
}
//.........这里部分代码省略.........
示例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;
}