[]
        
(Showing Draft Content)

CSJ2K.j2k.codestream.writer.TagTreeEncoder

TagTreeEncoder Class

This class implements the tag tree encoder. A tag tree codes a 2D matrix of integer elements in an efficient way. The encoding procedure 'encode()' codes information about a value of the matrix, given a threshold. The procedure encodes the sufficient information to identify whether or not the value is greater than or equal to the threshold.

       <p>The tag tree saves encoded information to a BitOutputBuffer.</p><p>A particular and useful property of tag trees is that it is possible to
       change a value of the matrix, provided both new and old values of the
       element are both greater than or equal to the largest threshold which has
       yet been supplied to the coding procedure 'encode()'. This property can be
       exploited through the 'setValue()' method.</p><p>This class allows saving the state of the tree at any point and
       restoring it at a later time, by calling save() and restore().</p><p>A tag tree can also be reused, or restarted, if one of the reset()
       methods is called.</p><p>The TagTreeDecoder class implements the tag tree decoder.</p><p>Tag trees that have one dimension, or both, as 0 are allowed for
       convenience. Of course no values can be set or coded in such cases.</p>
Inheritance
TagTreeEncoder
Namespace: CSJ2K.j2k.codestream.writer
Assembly: C1.WPF.PdfViewer.4.6.2.dll
Syntax
public class TagTreeEncoder

Constructors

Name Description
TagTreeEncoder(int, int)

Creates a tag tree encoder with 'w' elements along the horizontal dimension and 'h' elements along the vertical direction. The total number of elements is thus 'vdim' x 'hdim'.

       <p>The values of all elements are initialized to Integer.MAX_VALUE.</p>
TagTreeEncoder(int, int, int[])

Creates a tag tree encoder with 'w' elements along the horizontal dimension and 'h' elements along the vertical direction. The total number of elements is thus 'vdim' x 'hdim'. The values of the leafs in the tag tree are initialized to the values of the 'val' array.

       <p>The values in the 'val' array are supposed to appear in
       lexicographical order, starting at index 0.</p>

Fields

Name Description
h

The vertical dimensions of the base level

lvls

The number of levels in the tag tree

saved

The saved state. If true the values and states of the tree have been saved since the creation or last reset.

treeS

The tag tree state. The first index is the level, starting at level 0 (leafs). The second index is the element within the level, in lexicographical order.

treeSbak

The saved tag tree state. The first index is the level, starting at level 0 (leafs). The second index is the element within the level, in lexicographical order.

treeV

The tag tree values. The first index is the level, starting at level 0 (leafs). The second index is the element within the level, in lexicographical order.

treeVbak

The saved tag tree values. The first index is the level, starting at level 0 (leafs). The second index is the element within the level, in lexicographical order.

w

The horizontal dimension of the base level

Properties

Name Description
Height

Returns the number of leafs along the vertical direction.

Values

Sets the values of the leafs to the new set of values and updates the tag tree accordingly. No leaf can change its value if either the new or old value is smaller than largest threshold which has yet been supplied to 'encode()'. However such a leaf can keep its old value (i.e. new and old value must be identical.

       <p>This method is more efficient than the setValue() method if a large
       proportion of the leafs change their value. Note that for leafs which
       don't have their value defined yet the value should be
       Integer.MAX_VALUE (which is the default initialization value).</p>
Width

Returns the number of leafs along the horizontal direction.

Methods

Name Description
encode(int, int, int, BitOutputBuffer)

Encodes information for the specified element of the tree, given the threshold and sends it to the 'out' stream. The information that is coded is whether or not the value of the element is greater than or equal to the value of the threshold.

reset()

Resets the tree values and state. All the values are set to Integer.MAX_VALUE and the states to 0.

reset(int[])

Resets the tree values and state. The values are set to the values in 'val'. The states are all set to 0.

restore()

Restores the saved values and state of the tree. An IllegalArgumentException is thrown if the tree values and state have not been saved yet.

save()

Saves the current values and state of the tree. Calling restore() restores the tag tree the saved state.

setValue(int, int, int)

Changes the value of a leaf in the tag tree. The new and old values of the element must be not smaller than the largest threshold which has yet been supplied to 'encode()'.

See Also