Grok
7.6.2
|
Tag tree. More...
#include <TagTree.h>
Public Member Functions | |
TagTree (uint64_t numleafsh, uint64_t numleafsv) | |
Create a tag tree. More... | |
~TagTree () | |
bool | init (uint64_t num_leafs_h, uint64_t num_leafs_v) |
Reinitialises a tag tree. More... | |
void | reset () |
Reset a tag tree (set all leaves to 0) More... | |
void | setvalue (uint64_t leafno, int64_t value) |
Set the value of a leaf of a tag tree. More... | |
bool | compress (BitIO *bio, uint64_t leafno, int64_t threshold) |
Encode the value of a leaf of the tag tree up to a given threshold. More... | |
void | decompress (BitIO *bio, uint64_t leafno, int64_t threshold, uint8_t *decompressed) |
Decompress the value of a leaf of the tag tree up to a given threshold. More... | |
void | decodeValue (BitIO *bio, uint64_t leafno, int64_t threshold, uint64_t *value) |
Decompress the value of a leaf of the tag tree up to a given threshold. More... | |
Private Attributes | |
uint64_t | numleafsh |
uint64_t | numleafsv |
uint64_t | numnodes |
TagTreeNode * | nodes |
uint64_t | nodes_size |
Tag tree.
grk::TagTree::TagTree | ( | uint64_t | numleafsh, |
uint64_t | numleafsv | ||
) |
Create a tag tree.
numleafsh | Width of the array of leafs of the tree |
numleafsv | Height of the array of leafs of the tree |
References grk::GRK_WARN(), nodes, nodes_size, numleafsh, numleafsv, numnodes, grk::TagTreeNode::parent, and reset().
grk::TagTree::~TagTree | ( | ) |
References nodes.
bool grk::TagTree::compress | ( | BitIO * | bio, |
uint64_t | leafno, | ||
int64_t | threshold | ||
) |
Encode the value of a leaf of the tag tree up to a given threshold.
bio | Pointer to a BIO handle |
leafno | Number that identifies the leaf to compress |
threshold | Threshold to use when compressing value of the leaf |
References grk::TagTreeNode::low, nodes, grk::TagTreeNode::parent, and grk::BitIO::write().
void grk::TagTree::decodeValue | ( | BitIO * | bio, |
uint64_t | leafno, | ||
int64_t | threshold, | ||
uint64_t * | value | ||
) |
Decompress the value of a leaf of the tag tree up to a given threshold.
bio | Pointer to a BIO handle |
leafno | Number that identifies the leaf to decompress |
threshold | Threshold to use when decoding value of the leaf |
value | the node's value |
References grk::TagTreeNode::low, nodes, grk::TagTreeNode::parent, grk::BitIO::read(), grk::tag_tree_uninitialized_node_value, and grk::TagTreeNode::value.
Referenced by decompress().
void grk::TagTree::decompress | ( | BitIO * | bio, |
uint64_t | leafno, | ||
int64_t | threshold, | ||
uint8_t * | decompressed | ||
) |
Decompress the value of a leaf of the tag tree up to a given threshold.
bio | Pointer to a BIO handle |
leafno | Number that identifies the leaf to decompress |
threshold | Threshold to use when decoding value of the leaf |
decompressed | 1 if the node's value < threshold, 0 otherwise |
References decodeValue().
bool grk::TagTree::init | ( | uint64_t | num_leafs_h, |
uint64_t | num_leafs_v | ||
) |
Reinitialises a tag tree.
Reinitialise a tag tree from an existing one.
num_leafs_h | the width of the array of leafs of the tree |
num_leafs_v | the height of the array of leafs of the tree |
num_leafs_h | the width of the array of leafs of the tree |
num_leafs_v | the height of the array of leafs of the tree |
References nodes, nodes_size, numleafsh, numleafsv, numnodes, grk::TagTreeNode::parent, and reset().
Referenced by grk::PrecinctImpl::initTagTrees().
void grk::TagTree::reset | ( | ) |
Reset a tag tree (set all leaves to 0)
References nodes, numnodes, grk::tag_tree_uninitialized_node_value, and grk::TagTreeNode::value.
void grk::TagTree::setvalue | ( | uint64_t | leafno, |
int64_t | value | ||
) |
Set the value of a leaf of a tag tree.
leafno | Number that identifies the leaf to modify |
value | New value of the leaf |
References nodes, and grk::TagTreeNode::value.
|
private |
Referenced by compress(), decodeValue(), init(), reset(), setvalue(), TagTree(), and ~TagTree().