OpenJPEG 2.5.4

Data Structures | Typedefs
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_t * | opj_tgt_create (OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv, opj_event_mgr_t *p_manager)
| Create a tag-tree.
opj_tgt_tree_t * | opj_tgt_init (opj_tgt_tree_t *p_tree, OPJ_UINT32 p_num_leafs_h, OPJ_UINT32 p_num_leafs_v, opj_event_mgr_t *p_manager)
| Reinitialises a tag-tree from an exixting one.
void | opj_tgt_destroy (opj_tgt_tree_t *tree)
| Destroy a tag-tree, liberating memory.
void | opj_tgt_reset (opj_tgt_tree_t *tree)
| Reset a tag-tree (set all leaves to 0).
void | opj_tgt_setvalue (opj_tgt_tree_t *tree, OPJ_UINT32 leafno, OPJ_INT32 value)
| Set the value of a leaf of a tag-tree.
void | opj_tgt_encode (opj_bio_t *bio, opj_tgt_tree_t *tree, OPJ_UINT32 leafno, OPJ_INT32 threshold)
| Encode the value of a leaf of the tag-tree up to a given threshold.
OPJ_UINT32 | opj_tgt_decode (opj_bio_t *bio, opj_tgt_tree_t *tree, OPJ_UINT32 leafno, OPJ_INT32 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

## ◆ opj_tgt_create()

opj_tgt_tree_t * opj_tgt_create | ( | OPJ_UINT32 | numleafsh,
|  | OPJ_UINT32 | numleafsv,
|  | opj_event_mgr_t * | p_manager )

Create a tag-tree.

Parameters

  numleafsh | Width of the array of leafs of the tree
  numleafsv | Height of the array of leafs of the tree
  p_manager | the event manager

Returns
  Returns a new tag-tree if successful, returns NULL otherwise

References EVT_ERROR, opj_tgt_tree::nodes, opj_tgt_tree::nodes_size, opj_tgt_tree::numleafsh, opj_tgt_tree::numleafsv, opj_tgt_tree::numnodes, opj_calloc(), opj_event_msg(), opj_free(), opj_tgt_reset(), and opj_tgt_node::parent.

Referenced by opj_tcd_init_tile().

## ◆ opj_tgt_decode()

OPJ_UINT32 opj_tgt_decode | ( | opj_bio_t * | bio,
|  | opj_tgt_tree_t * | tree,
|  | OPJ_UINT32 | leafno,
|  | OPJ_INT32 | threshold )

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

Parameters

  bio | Pointer to a BIO handle
  tree | Tag-tree to decode
  leafno | Number that identifies the leaf to decode
  threshold | Threshold to use when decoding value of the leaf

Returns
  Returns 1 if the node's value < threshold, returns 0 otherwise

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

Referenced by opj_t2_read_packet_header().

## ◆ opj_tgt_destroy()

void opj_tgt_destroy | ( | opj_tgt_tree_t * | tree | ) |

Destroy a tag-tree, liberating memory.

Parameters

  tree | Tag-tree to destroy

References opj_tgt_tree::nodes, and opj_free().

Referenced by opj_tcd_free_tile(), and opj_tgt_init().

## ◆ opj_tgt_encode()

void opj_tgt_encode | ( | opj_bio_t * | bio,
|  | opj_tgt_tree_t * | tree,
|  | OPJ_UINT32 | leafno,
|  | OPJ_INT32 | threshold )

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

Parameters

  bio | Pointer to a BIO handle
  tree | Tag-tree to modify
  leafno | Number that identifies the leaf to encode
  threshold | Threshold to use when encoding value of the leaf

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

Referenced by opj_t2_encode_packet().

## ◆ opj_tgt_init()

opj_tgt_tree_t * opj_tgt_init | ( | opj_tgt_tree_t * | p_tree,
|  | OPJ_UINT32 | p_num_leafs_h,
|  | OPJ_UINT32 | p_num_leafs_v,
|  | opj_event_mgr_t * | p_manager )

Reinitialises a tag-tree from an exixting one.

Parameters

  p_tree | the tree to reinitialize.
  p_num_leafs_h | the width of the array of leafs of the tree
  p_num_leafs_v | the height of the array of leafs of the tree
  p_manager | the event manager

Returns
  a new tag-tree if successful, NULL otherwise

Reinitialises a tag-tree from an exixting one.

Parameters

  p_tree | the tree to reinitialize.
  p_num_leafs_h | the width of the array of leafs of the tree
  p_num_leafs_v | the height of the array of leafs of the tree

Returns
  a new tag-tree if successful, NULL otherwise

References EVT_ERROR, opj_tgt_tree::nodes, opj_tgt_tree::nodes_size, opj_tgt_tree::numleafsh, opj_tgt_tree::numleafsv, opj_tgt_tree::numnodes, opj_event_msg(), opj_realloc(), opj_tgt_destroy(), opj_tgt_reset(), and opj_tgt_node::parent.

Referenced by opj_tcd_init_tile().

## ◆ opj_tgt_reset()

void opj_tgt_reset | ( | opj_tgt_tree_t * | tree | ) |

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

Parameters

  tree | Tag-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 opj_t2_encode_packet(), opj_t2_read_packet_header(), opj_tgt_create(), and opj_tgt_init().

## ◆ opj_tgt_setvalue()

void opj_tgt_setvalue | ( | opj_tgt_tree_t * | tree,
|  | OPJ_UINT32 | leafno,
|  | OPJ_INT32 | value )

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

Parameters

  tree | Tag-tree to modify
  leafno | Number that identifies the leaf to modify
  value | New value of the leaf

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

Referenced by opj_t2_encode_packet().