Basic Package


Package Name

DvmBasic

Description

The Dalí Basic package provides several basic primitives and abstractions.  It is generally required by other packages. The abstractions defined in DvmBasic are ByteImage, BitImage, ScImage, VectorImage, AudioBuffer, BitStream, BitParser and BitStreamFilter.  The Basic package provides functions to allocate, free, and perform simple manipulations of these abstractions.  More sophisticated operations are supported by other packages, as noted below.

Image Types

The four Dalí image types (ByteImage, BitImage, ScImage, and VectorImage) always have five basic operations defined: new, free, copy, clip, and reclipNew allocates an image, free deallocates it, copy copies data from one image to another, clip allocates a new image that shares part of another image (i.e., it creates a virtual image), and reclip overwrites an image header so that  it shares part of another image (i.e., it creates a virtual image using an image that is already allocated).   The rest of the abstractions are described below.

ByteImage

A ByteImage is a 2D array of pixels, which are represented as 8-bit unsigned integers (i.e., the range 0 - 255). A ByteImage can be physical (with memory allocated for it) or virtual (borrows its memory from another ByteImage). See the Dali Overview for a description of physical and virtual images. The Basic package provides functions to create, destroy, copy, extend, and initialize ByteImages, and to convert from ScImages and BitImages to ByteImages.

Related packages

The C documentation for the ByteImage package describes this data type in more detail.

BitImage

A BitImage is similar to ByteImage, but each pixel is a one-bit value (0 or 1). BitImages can be byte-aligned (i.e., first bit and last bit in every row are at byte boundary) or not.   BitImages that are byte-aligned are considerable more efficient to work with, since the images can be manipulated 8 pixels (or more) at a time.  The Basic package contains routines to allocate, free, copy, and clip BitImages(C, Tcl), to perform union and intersection operations on BitImages(C, Tcl), and to determine whether a BitImage is byte aligned or not (C, Tcl). BitImages can also be use as masks for copying and setting ByteImages (C, Tcl).  In this use, BitImages act to define arbitrary shaped regions of an image (whereas clipping always defines rectangular regions of an image).

Related packages

The C documentation for the BitImage package describes this data type in more detail.

VectorImage

VectorImages provide an representation for motion vector data in MPEG video streams. The structure of vector image is similar to ByteImage: it is a 2-dimensional array of vectors and can be physical or virtual. Each vector contains three components, right, down and exists.  The latter property indicates whether the vector contains valid right and down components.  The Basic package contains routines to allocate, free, copy, and clip VectorImages (C, Tcl).

Related packages

The C documentation for the VectorImage package describes this data type in more detail.

ScImage

The ScImage (Semi-Compressed Image) provides an abstraction for DCT data blocks decoded from JPEG and MPEG. The structure of an ScImage is similar to a ByteImage: an ScImage is a 2-dimensional array of SCBlocks. Like ByteImages, ScImage can be physical or virtual. Each SCBlock contains a DC value and a sequence of AC values in (index, value) pair format. In addition, SCBlocks contain flags to indicate whether a block is skipped or intracoded. The Basic package contains routines to allocate, free, copy, and clip ScImages

The coefficients in the blocks are integers, and can be in either scaled or unscaled.  

Scaled coefficients are scaled using a quantization table (an array of 64 coefficients). That is, each coefficient is divided by the corresponding integer in the quantization table, and the result is rounded.  Dali provides constants for the recommended quantization tables from the JPEG and MPEG standards. Unscaled coefficients are independent of quantization tables.  The advantage of working with unscaled ScImages is that two unscaled ScImage can always be combined (e.g., blocks can be copied or mixed).

Care must be taken when applying an operator to ensure than an ScImage with scaled coefficients is not used with an operator that expects unscaled coefficients.

Whether or not the coefficients are scaled, no dependencies exist between the blocks.   This representation allows virtual ScImage to be copied.

Related packages

We plan to support compressed-domain processing on ScImages (someday...).

The C documentation for the ScImage package describes this data type in more detail.

Audio

The Dalí provides an AudioBuffer structure for audio data. AudioBuffers can be used to store many types of audio data, stereo or mono, 8-bit or 16-bit. An AudioBuffers can be either physical or virtual. A physical AudioBuffers has a memory chunk allocated to it, while a virtual AudioBuffers points to a region in a physical audio buffer. AudioBuffers are very similar to ByteImages, except that AudioBuffers are one dimensional, and they are more generic in that they can store 8-bit or 16-bit mono or stereo data.

The C documentation for the Audio package describes this data type in more detail.

Streams

A BitStream is just a chunk of memory. We can initialize a BitStream in several ways : we can read bits into it from a file, from a network or simply memory-map a whole file into a BitStream. BitStream maintains a end pointer which indicates the end of valid data in it's buffer. The BitStream can also be create by casting a ByteImage, BitImage, or AudioBuffer into a BitStream, in this case the BitStream object created is said to be virtual (since it does not have it's own memory but borrowed the memory from other objects).

A BitParser is an interface to BitStream that provide bit-level and byte-level access to the content of BitStream. Note that BitParser will not perform any I/O. It will however signal an underflow (if there aren't enough data in the BitStream) or overflow (if there aren't enough space in the BitStream) so that the users can know when perform I/O.

A BitParser is responsible of keeping track of the cursor position in the BitStream by a variable byte offset. There is no way to tell which bits the cursor is at, or seek to a particular bit in the BitStream. See the BitParser API for details on the operation on BitStream.

A BitStreamFilter is a filter on the input (could be file, network etc.) consists of a sequence of (offset, length) entries. By applying a filter when we read into the BitStream, we read in only the regions that we are interested in. Filters can be created and entries can be added by using the add_entry primitives.

The C documentation for the Streams package describes this data type in more detail.

Detailed Specification

ByteImage

Tcl specification
C API specification

BitImage

Tcl specification
C API specification

ScImage

Tcl specification
C API specification

VectorImage

Tcl specification
C API specification

Audio

Tcl specification
C API specification

Streams

Tcl specification
C API specification

Dependencies

None. But every other package needs DvmBasic.


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.