本文整理汇总了C++中BitStream::writeBits方法的典型用法代码示例。如果您正苦于以下问题:C++ BitStream::writeBits方法的具体用法?C++ BitStream::writeBits怎么用?C++ BitStream::writeBits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitStream
的用法示例。
在下文中一共展示了BitStream::writeBits方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeBox
void CodingConstraintsBox::writeBox(BitStream& bitstr)
{
writeFullBoxHeader(bitstr);
bitstr.writeBits(mAllRefPicsIntra, 1);
bitstr.writeBits(mIntraPredUsed, 1);
bitstr.writeBits(mMaxRefPicUsed, 4);
bitstr.writeBits(0, 26); // reserved int(26)
updateSize(bitstr);
}
示例2: encode
int Golomb::encode(uint m, int value, BitStream& bs){
int q, r, i;
int nbits = (int) floor(log2(m)) + 1;
int err;
if (value < 0 )
{
value = 2*abs(value) - 1;
}
else
{
value *= 2;
}
q = value/m;
r = value%m;
for(i=0; i<q;i++)
{
if ((err = bs.writeBit(1))!= 0)
return err;
}
if ((err = bs.writeBit(0))!= 0)
return err;
if ((err = bs.writeBits(r, nbits))!= 0){
return err;
}
return 0;
}
示例3: rbucEncodeCPUOneLevel
void rbucEncodeCPUOneLevel(BitStream& bitStream, std::vector<Symbol16>& lengths, const std::vector<Symbol16>& symbols, uint branchFactor)
{
rbucEncodeCPUBuildLengthsOneLevel(lengths, symbols, branchFactor);
uint symbolCount = (uint)symbols.size();
for(uint i = 0; i < symbolCount; i++) {
uint length = lengths[i / branchFactor];
bitStream.writeBits(symbols[i], length);
}
}
示例4: huffmanEncodeCPU
bool huffmanEncodeCPU(BitStream& bitStream, const std::vector<Symbol16>& symbolStream, const HuffmanEncodeTableCPU& encodeTable, std::vector<uint>& offsets, uint codingBlockSize)
{
uint offsetBase = bitStream.getBitPosition();
for(uint i = 0; i < symbolStream.size(); i++) {
if(codingBlockSize > 0 && i % codingBlockSize == 0) {
offsets.push_back(bitStream.getBitPosition() - offsetBase);
}
Symbol16 symbol = symbolStream[i];
const HuffmanEntry& entry = encodeTable.m_encodeTable[symbol];
bitStream.writeBits(entry.m_codeword, entry.m_codewordLength);
}
return true;
}
示例5: rbucEncodeCPUWriteTree
void rbucEncodeCPUWriteTree(BitStream& bitStream, std::vector<uint>& offsets, const std::vector<std::vector<Symbol16>>& tree, const std::vector<uint>& branchFactors, uint level, uint index)
{
if(level+2 == tree.size()) {
offsets.push_back(bitStream.getBitPosition());
}
uint bits = (level+1 >= tree.size() ? 8 : tree[level+1][index / branchFactors[level]]);
bitStream.writeBits(tree[level][index], bits);
if(level > 0) {
uint branchFactor = branchFactors[level - 1];
uint childrenCount = std::min(branchFactor, (uint)tree[level - 1].size() - index * branchFactor);
for(uint i = 0; i < childrenCount; i++) {
rbucEncodeCPUWriteTree(bitStream, offsets, tree, branchFactors, level - 1, index * branchFactor + i);
}
}
}