bitstream.h File Reference

Include file for the bitstream and derived classes. More...

#include <stdint.h>
#include <cstdio>
#include "bit_constants.h"

Go to the source code of this file.

Classes

class  bitstream
 Bit stream base class. More...
class  obitstream
 Output bit stream. More...
class  ibitstream
 Input bit stream. More...

Functions

static unsigned int bit_size (int32_t i)
 Find size (on [0,32]) of the smallest # that can hold the integer i.
static unsigned int bit_size (unsigned int u)
 Find size (on [1,32]) of the smallest # that can hold the unsigned int u.


Detailed Description

Include file for the bitstream and derived classes.


Function Documentation

static unsigned int bit_size ( unsigned int  u  )  [inline, static]

Find size (on [1,32]) of the smallest # that can hold the unsigned int u.

By our convention, [0,1] require 1 bit, [2,3] require 2 bits, [4,5, 6,7] require 3 bits, etc.

Parameters:
u The number whose size is being checked.

static unsigned int bit_size ( int32_t  i  )  [inline, static]

Find size (on [0,32]) of the smallest # that can hold the integer i.

By our convention, [-1,0] require 1 bit, [-2,1] require 2 bits, [-4,-3, 2,3] require 3 bits, etc. This was implemented as loops, but we find we save a lot of compute cycles by laying it out as an explicit tree of tests.

Parameters:
i The number whose size is being checked.

Referenced by mexp_golomb_write().


Generated on Mon Jun 15 14:43:52 2009 for Slim numerical data compression by  doxygen 1.5.7.1