Dali VM : BitParser API


Header Files

#include <basicInt.h>
#include <bitparser.h>

The API

The BitParser API is a bunch of macros that provides bit-level access interface to the content of the BitStream. A bitparser can be either output BitParser, which writes into the BitStream, or input BitParser, which reads from the BitStream. Both type of BitParser can operates in two modes : bit-modes or byte-modes. Calling byte-mode macros when the bitparser is in bit-mode can produce wrong result.

Switching Mode

We can switch from bit-mode to byte-mode by calling Bp_InByteAlign (also called Bp_ByteAlign) or Bp_OutByteAlign. Switching from byte-mode to bit-mode is implicit whenever we called a bit-mode macros.

General Macro

BitParser macros name takes the format of Bp_ActionUnit, where Action specifies what we are going to do, and Unit tell us how much data we are going to work on. Unit can be either Bits, Byte, Short, Int, Bytes.

Action

Get

Consume data from the bitstream and output the value of the data. Advance the cursor.

Unget (also called Restore)

Move the cursor back.

Peek

Same as Get but does not advance the cursor.

Flush

Same as Get but the value is ignored.

Put

Write data into the bitstream.

Unput

Undo writing of data into the bitstream.

Move

Get from one BitStream and Put into another.

See Also

Streams

Last Updated :

Copyright © 1997-1998 by Cornell University. See the file license.txt for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.