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


C++ BitStream::writeBits方法代码示例

本文整理汇总了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);
}
开发者ID:axelriet,项目名称:heif,代码行数:11,代码来源:codingconstraintsbox.cpp

示例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;
}
开发者ID:fmanco,项目名称:cavt2,代码行数:34,代码来源:Golomb.cpp

示例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);
    }
}
开发者ID:brookskd,项目名称:cudaCompress,代码行数:11,代码来源:RBUCCPU.cpp

示例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;
}
开发者ID:jebbstewart,项目名称:cudaCompress,代码行数:14,代码来源:HuffmanCPU.cpp

示例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);
        }
    }
}
开发者ID:brookskd,项目名称:cudaCompress,代码行数:16,代码来源:RBUCCPU.cpp


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