OpenJPEG 1.5.2
tgt.h File Reference

Implementation of a tag-tree coder (TGT) More...

Go to the source code of this file.

Data Structures

struct  opj_tgt_node
 Tag node. More...
 
struct  opj_tgt_tree
 Tag tree. More...
 

Typedefs

typedef struct opj_tgt_node opj_tgt_node_t
 Tag node.
 
typedef struct opj_tgt_tree opj_tgt_tree_t
 Tag tree.
 

Functions

Exported functions
opj_tgt_tree_ttgt_create (int numleafsh, int numleafsv)
 Create a tag-tree.
 
void tgt_destroy (opj_tgt_tree_t *tree)
 Destroy a tag-tree, liberating memory.
 
void tgt_reset (opj_tgt_tree_t *tree)
 Reset a tag-tree (set all leaves to 0)
 
void tgt_setvalue (opj_tgt_tree_t *tree, int leafno, int value)
 Set the value of a leaf of a tag-tree.
 
void tgt_encode (opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold)
 Encode the value of a leaf of the tag-tree up to a given threshold.
 
int tgt_decode (opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold)
 Decode the value of a leaf of the tag-tree up to a given threshold.
 

Detailed Description

Implementation of a tag-tree coder (TGT)

The functions in TGT.C have for goal to realize a tag-tree coder. The functions in TGT.C are used by some function in T2.C.

Typedef Documentation

◆ opj_tgt_node_t

typedef struct opj_tgt_node opj_tgt_node_t

Tag node.

◆ opj_tgt_tree_t

typedef struct opj_tgt_tree opj_tgt_tree_t

Tag tree.

Function Documentation

◆ tgt_create()

opj_tgt_tree_t * tgt_create ( int numleafsh,
int numleafsv )

Create a tag-tree.

Parameters
numleafshWidth of the array of leafs of the tree
numleafsvHeight of the array of leafs of the tree
Returns
Returns a new tag-tree if successful, returns NULL otherwise

References opj_tgt_tree::nodes, opj_tgt_tree::numleafsh, opj_tgt_tree::numleafsv, opj_tgt_tree::numnodes, opj_calloc, opj_free, opj_malloc, opj_tgt_node::parent, and tgt_reset().

Referenced by tcd_init_encode(), tcd_malloc_decode_tile(), and tcd_malloc_encode().

◆ tgt_decode()

int tgt_decode ( opj_bio_t * bio,
opj_tgt_tree_t * tree,
int leafno,
int threshold )

Decode the value of a leaf of the tag-tree up to a given threshold.

Parameters
bioPointer to a BIO handle
treeTag-tree to decode
leafnoNumber that identifies the leaf to decode
thresholdThreshold to use when decoding value of the leaf
Returns
Returns 1 if the node's value < threshold, returns 0 otherwise

References bio_read(), opj_tgt_node::low, opj_tgt_tree::nodes, opj_tgt_node::parent, and opj_tgt_node::value.

Referenced by t2_decode_packet().

◆ tgt_destroy()

void tgt_destroy ( opj_tgt_tree_t * tree)

Destroy a tag-tree, liberating memory.

Parameters
treeTag-tree to destroy

References opj_tgt_tree::nodes, and opj_free.

Referenced by tcd_free_decode_tile(), tcd_free_encode(), and tcd_init_encode().

◆ tgt_encode()

void tgt_encode ( opj_bio_t * bio,
opj_tgt_tree_t * tree,
int leafno,
int threshold )

Encode the value of a leaf of the tag-tree up to a given threshold.

Parameters
bioPointer to a BIO handle
treeTag-tree to modify
leafnoNumber that identifies the leaf to encode
thresholdThreshold to use when encoding value of the leaf

References bio_write(), opj_tgt_node::known, opj_tgt_node::low, opj_tgt_tree::nodes, opj_tgt_node::parent, and opj_tgt_node::value.

Referenced by t2_encode_packet().

◆ tgt_reset()

void tgt_reset ( opj_tgt_tree_t * tree)

Reset a tag-tree (set all leaves to 0)

Parameters
treeTag-tree to reset

References opj_tgt_node::known, opj_tgt_node::low, opj_tgt_tree::nodes, opj_tgt_tree::numnodes, and opj_tgt_node::value.

Referenced by t2_decode_packet(), t2_encode_packet(), and tgt_create().

◆ tgt_setvalue()

void tgt_setvalue ( opj_tgt_tree_t * tree,
int leafno,
int value )

Set the value of a leaf of a tag-tree.

Parameters
treeTag-tree to modify
leafnoNumber that identifies the leaf to modify
valueNew value of the leaf

References opj_tgt_tree::nodes, opj_tgt_node::parent, and opj_tgt_node::value.

Referenced by t2_encode_packet().