Example #1
0
void CodingConstraintsBox::parseBox(BitStream& bitstr)
{
    parseFullBoxHeader(bitstr);
    mAllRefPicsIntra = bitstr.readBits(1);
    mIntraPredUsed = bitstr.readBits(1);
    mMaxRefPicUsed = bitstr.readBits(4);
    bitstr.readBits(26); // discard reserved int(26)
}
Example #2
0
int Golomb::decode(uint m, int *value, BitStream& bs){
	int q = 0, r, v;
	int nbits = (int) floor(log2(m)) + 1;
	int err;
	uint32_t bit;


	do {
		if ((err=bs.readBit(&bit)) != 0)
			return err;

		if (bit == 0)
			break;
		q++;
	} while(true);


	if ((err = bs.readBits(nbits, &bit)) != 0)
		return err;

	r = (int) bit;

	v = q * m + r;
	if (v % 2 == 0)
		*value =  v/2;
	else
		*value = -(v+1)/2;

	return 0;
}
Example #3
0
void rbucDecodeCPUOneLevel(BitStream& bitStream, const std::vector<Symbol16>& lengths, std::vector<Symbol16>& symbols, uint symbolCount, uint branchFactor)
{
    for(uint i = 0; i < symbolCount; i++) {
        uint length = lengths[i / branchFactor];
        uint symbol = 0;
        bitStream.readBits(symbol, length);
        symbols.push_back(symbol);
    }
}