pi.h File Reference

Implementation of a packet iterator (PI) More...

Go to the source code of this file.

## Data Structures

struct | opj_pi_resolution
| FIXME DOC. More...
struct | opj_pi_comp
| FIXME DOC. More...
struct | opj_pi_iterator
| Packet iterator. More...

## Typedefs

typedef struct opj_pi_resolution | opj_pi_resolution_t
| FIXME DOC.
typedef struct opj_pi_comp | opj_pi_comp_t
| FIXME DOC.
typedef struct opj_pi_iterator | opj_pi_iterator_t
| Packet iterator.

## Functions

Exported functions
opj_pi_iterator_t * | opj_pi_initialise_encode (const opj_image_t *image, opj_cp_t *cp, OPJ_UINT32 tileno, J2K_T2_MODE t2_mode, opj_event_mgr_t *manager)
| Creates a packet iterator for encoding.
void | opj_pi_update_encoding_parameters (const opj_image_t *p_image, opj_cp_t *p_cp, OPJ_UINT32 p_tile_no)
| Updates the encoding parameters of the codec.
void | opj_pi_create_encode (opj_pi_iterator_t *pi, opj_cp_t *cp, OPJ_UINT32 tileno, OPJ_UINT32 pino, OPJ_UINT32 tpnum, OPJ_INT32 tppos, J2K_T2_MODE t2_mode)
| Modify the packet iterator for enabling tile part generation.
opj_pi_iterator_t * | opj_pi_create_decode (opj_image_t *image, opj_cp_t *cp, OPJ_UINT32 tileno, opj_event_mgr_t *manager)
| Create a packet iterator for Decoder.
void | opj_pi_destroy (opj_pi_iterator_t *p_pi, OPJ_UINT32 p_nb_elements)
| Destroys a packet iterator array.
OPJ_BOOL | opj_pi_next (opj_pi_iterator_t *pi)
| Modify the packet iterator to point to the next packet.
OPJ_UINT32 | opj_get_encoding_packet_count (const opj_image_t *p_image, const opj_cp_t *p_cp, OPJ_UINT32 p_tile_no)
| Return the number of packets in the tile.

## Detailed Description

Implementation of a packet iterator (PI)

The functions in PI.C have for goal to realize a packet iterator that permits to get the next packet following the progression order and change of it. The functions in PI.C are used by some function in T2.C.

## Typedef Documentation

## opj_pi_comp_t

typedef struct opj_pi_comp opj_pi_comp_t

FIXME DOC.

## opj_pi_iterator_t

typedef struct opj_pi_iterator opj_pi_iterator_t

Packet iterator.

## opj_pi_resolution_t

typedef struct opj_pi_resolution opj_pi_resolution_t

FIXME DOC.

## Function Documentation

## opj_get_encoding_packet_count()

OPJ_UINT32 opj_get_encoding_packet_count | ( | const opj_image_t * | p_image,
|  | const opj_cp_t * | p_cp,
|  | OPJ_UINT32 | p_tile_no
| ) |  |

Return the number of packets in the tile.

Parameters

  image | the image being encoded.
  cp | Coding parameters
  tileno | Number that identifies the tile.

References opj_image::numcomps, opj_tcp::numlayers, opj_get_all_encoding_parameters(), opj_cp::tcps, and opj_cp::th.

Referenced by opj_j2k_get_specific_header_sizes(), and opj_t2_encode_packets().

## opj_pi_create_decode()

opj_pi_iterator_t * opj_pi_create_decode | ( | opj_image_t * | image,
|  | opj_cp_t * | cp,
|  | OPJ_UINT32 | tileno,
|  | opj_event_mgr_t * | manager
| ) |  |

Create a packet iterator for Decoder.

Parameters

  image | Raw image for which the packets will be listed
  cp | Coding parameters
  tileno | Number that identifies the tile for which to list the packets
  manager | Event manager

Returns
  Returns a packet iterator that points to the first packet of the tile

See also
  opj_pi_destroy

References opj_image::comps, opj_pi_iterator::comps, opj_image_comp::dx, opj_pi_comp::dx, opj_image_comp::dy, opj_pi_comp::dy, opj_pi_iterator::include, opj_pi_iterator::include_size, opj_image::numcomps, opj_tcp::numlayers, opj_tcp::numpocs, opj_pi_comp::numresolutions, opj_calloc(), opj_free(), opj_get_all_encoding_parameters(), OPJ_J2K_MAXRLVLS, opj_malloc(), opj_pi_create(), opj_pi_destroy(), opj_pi_update_decode_not_poc(), opj_pi_update_decode_poc(), opj_pi_resolution::pdx, opj_pi_resolution::pdy, opj_pi_resolution::ph, opj_tcp::POC, opj_pi_resolution::pw, opj_pi_comp::resolutions, opj_pi_iterator::step_c, opj_pi_iterator::step_l, opj_pi_iterator::step_p, opj_pi_iterator::step_r, opj_tcp::tccps, opj_cp::tcps, opj_cp::th, opj_pi_iterator::tx0, opj_pi_iterator::tx1, opj_pi_iterator::ty0, and opj_pi_iterator::ty1.

Referenced by opj_t2_decode_packets().

## opj_pi_create_encode()

void opj_pi_create_encode | ( | opj_pi_iterator_t * | pi,
|  | opj_cp_t * | cp,
|  | OPJ_UINT32 | tileno,
|  | OPJ_UINT32 | pino,
|  | OPJ_UINT32 | tpnum,
|  | OPJ_INT32 | tppos,
|  | J2K_T2_MODE | t2_mode
| ) |  |

Modify the packet iterator for enabling tile part generation.

Parameters

  pi | Handle to the packet iterator generated in pi_initialise_encode
  cp | Coding parameters
  tileno | Number that identifies the tile for which to list the packets
  pino | FIXME DOC
  tpnum | Tile part number of the current tile
  tppos | The position of the tile part flag in the progression order
  t2_mode | FIXME DOC

References opj_poc::compno0, opj_poc::compno1, FINAL_PASS, opj_pi_iterator::first, opj_poc::layno0, opj_poc::layno1, opj_cp::m_enc, opj_cp::m_specific_param, opj_encoding_param::m_tp_on, OPJ_IS_CINEMA, OPJ_IS_IMF, opj_j2k_convert_progression_order(), OPJ_LRCP, opj_pi_check_next_level(), OPJ_RLCP, opj_pi_iterator::poc, opj_tcp::pocs, opj_poc::precno0, opj_poc::precno1, opj_poc::prg, opj_poc::resno0, opj_poc::resno1, opj_cp::rsiz, tcp, opj_cp::tcps, opj_poc::tx0, opj_poc::tx1, opj_pi_iterator::tx1, opj_poc::ty0, opj_poc::ty1, and opj_pi_iterator::ty1.

Referenced by opj_t2_encode_packets().

## opj_pi_destroy()

void opj_pi_destroy | ( | opj_pi_iterator_t * | p_pi,
|  | OPJ_UINT32 | p_nb_elements
| ) |  |

Destroys a packet iterator array.

Parameters

  p_pi | the packet iterator array to destroy.
  p_nb_elements | the number of elements in the array.

References opj_pi_iterator::comps, opj_pi_iterator::include, opj_pi_iterator::numcomps, opj_free(), and opj_pi_comp::resolutions.

Referenced by opj_pi_create(), opj_pi_create_decode(), opj_pi_initialise_encode(), opj_t2_decode_packets(), and opj_t2_encode_packets().

## opj_pi_initialise_encode()

opj_pi_iterator_t * opj_pi_initialise_encode | ( | const opj_image_t * | image,
|  | opj_cp_t * | cp,
|  | OPJ_UINT32 | tileno,
|  | J2K_T2_MODE | t2_mode,
|  | opj_event_mgr_t * | manager
| ) |  |

Creates a packet iterator for encoding.

Parameters

  image | the image being encoded.
  cp | the coding parameters.
  tileno | index of the tile being encoded.
  t2_mode | the type of pass for generating the packet iterator
  manager | Event manager

Returns
  a list of packet iterator that points to the first packet of the tile (not true).

References opj_image::comps, opj_pi_iterator::comps, opj_image_comp::dx, opj_pi_comp::dx, opj_pi_iterator::dx, opj_image_comp::dy, opj_pi_comp::dy, opj_pi_iterator::dy, FINAL_PASS, opj_pi_iterator::include, opj_pi_iterator::include_size, opj_cp::m_enc, opj_cp::m_specific_param, opj_encoding_param::m_tp_on, opj_image::numcomps, opj_tcp::numlayers, opj_tcp::numpocs, opj_pi_comp::numresolutions, opj_calloc(), opj_free(), opj_get_all_encoding_parameters(), OPJ_IS_CINEMA, OPJ_J2K_MAXRLVLS, opj_malloc(), opj_pi_create(), opj_pi_destroy(), opj_pi_update_encode_not_poc(), opj_pi_update_encode_poc_and_final(), opj_pi_resolution::pdx, opj_pi_resolution::pdy, opj_pi_resolution::ph, opj_tcp::POC, opj_pi_resolution::pw, opj_pi_comp::resolutions, opj_cp::rsiz, opj_pi_iterator::step_c, opj_pi_iterator::step_l, opj_pi_iterator::step_p, opj_pi_iterator::step_r, opj_tcp::tccps, opj_cp::tcps, opj_cp::th, opj_pi_iterator::tp_on, opj_pi_iterator::tx0, opj_pi_iterator::tx1, opj_pi_iterator::ty0, and opj_pi_iterator::ty1.

Referenced by opj_t2_encode_packets().

## opj_pi_next()

OPJ_BOOL opj_pi_next | ( | opj_pi_iterator_t * | pi | ) |

Modify the packet iterator to point to the next packet.

Parameters

  pi | Packet iterator to modify

Returns
  Returns false if pi pointed to the last packet or else returns true

References OPJ_CPRL, OPJ_FALSE, OPJ_LRCP, OPJ_PCRL, opj_pi_next_cprl(), opj_pi_next_lrcp(), opj_pi_next_pcrl(), opj_pi_next_rlcp(), opj_pi_next_rpcl(), OPJ_PROG_UNKNOWN, OPJ_RLCP, OPJ_RPCL, opj_pi_iterator::poc, and opj_poc::prg.

Referenced by opj_t2_decode_packets(), and opj_t2_encode_packets().

## opj_pi_update_encoding_parameters()

void opj_pi_update_encoding_parameters | ( | const opj_image_t * | p_image,
|  | opj_cp_t * | p_cp,
|  | OPJ_UINT32 | p_tile_no
| ) |  |

Updates the encoding parameters of the codec.

Parameters

  p_image | the image being encoded.
  p_cp | the coding parameters.
  p_tile_no | index of the tile being encoded.

References opj_image::numcomps, opj_get_encoding_parameters(), opj_pi_update_encode_not_poc(), opj_pi_update_encode_poc_and_final(), opj_tcp::POC, opj_cp::tcps, and opj_cp::th.

Referenced by opj_j2k_calculate_tp().