OpenJPEG  2.5.0
Macros
pi.c File Reference
#include "opj_includes.h"

Macros

#define OPJ_UINT32_SEMANTICALLY_BUT_INT32   OPJ_UINT32
 

Functions

Local static functions
static OPJ_BOOL opj_pi_next_lrcp (opj_pi_iterator_t *pi)
 Get next packet in layer-resolution-component-precinct order. More...
 
static OPJ_BOOL opj_pi_next_rlcp (opj_pi_iterator_t *pi)
 Get next packet in resolution-layer-component-precinct order. More...
 
static OPJ_BOOL opj_pi_next_rpcl (opj_pi_iterator_t *pi)
 Get next packet in resolution-precinct-component-layer order. More...
 
static OPJ_BOOL opj_pi_next_pcrl (opj_pi_iterator_t *pi)
 Get next packet in precinct-component-resolution-layer order. More...
 
static OPJ_BOOL opj_pi_next_cprl (opj_pi_iterator_t *pi)
 Get next packet in component-precinct-resolution-layer order. More...
 
static void opj_pi_update_encode_poc_and_final (opj_cp_t *p_cp, OPJ_UINT32 p_tileno, OPJ_UINT32 p_tx0, OPJ_UINT32 p_tx1, OPJ_UINT32 p_ty0, OPJ_UINT32 p_ty1, OPJ_UINT32 p_max_prec, OPJ_UINT32 p_max_res, OPJ_UINT32 p_dx_min, OPJ_UINT32 p_dy_min)
 Updates the coding parameters if the encoding is used with Progression order changes and final (or cinema parameters are used). More...
 
static void opj_pi_update_encode_not_poc (opj_cp_t *p_cp, OPJ_UINT32 p_num_comps, OPJ_UINT32 p_tileno, OPJ_UINT32 p_tx0, OPJ_UINT32 p_tx1, OPJ_UINT32 p_ty0, OPJ_UINT32 p_ty1, OPJ_UINT32 p_max_prec, OPJ_UINT32 p_max_res, OPJ_UINT32 p_dx_min, OPJ_UINT32 p_dy_min)
 Updates the coding parameters if the encoding is not used with Progression order changes and final (and cinema parameters are used). More...
 
static void opj_get_encoding_parameters (const opj_image_t *p_image, const opj_cp_t *p_cp, OPJ_UINT32 tileno, OPJ_UINT32 *p_tx0, OPJ_UINT32 *p_tx1, OPJ_UINT32 *p_ty0, OPJ_UINT32 *p_ty1, OPJ_UINT32 *p_dx_min, OPJ_UINT32 *p_dy_min, OPJ_UINT32 *p_max_prec, OPJ_UINT32 *p_max_res)
 Gets the encoding parameters needed to update the coding parameters and all the pocs. More...
 
static void opj_get_all_encoding_parameters (const opj_image_t *p_image, const opj_cp_t *p_cp, OPJ_UINT32 tileno, OPJ_UINT32 *p_tx0, OPJ_UINT32 *p_tx1, OPJ_UINT32 *p_ty0, OPJ_UINT32 *p_ty1, OPJ_UINT32 *p_dx_min, OPJ_UINT32 *p_dy_min, OPJ_UINT32 *p_max_prec, OPJ_UINT32 *p_max_res, OPJ_UINT32 **p_resolutions)
 Gets the encoding parameters needed to update the coding parameters and all the pocs. More...
 
static opj_pi_iterator_topj_pi_create (const opj_image_t *p_image, const opj_cp_t *p_cp, OPJ_UINT32 tileno, opj_event_mgr_t *manager)
 Allocates memory for a packet iterator. More...
 
static void opj_pi_update_decode_not_poc (opj_pi_iterator_t *p_pi, opj_tcp_t *p_tcp, OPJ_UINT32 p_max_precision, OPJ_UINT32 p_max_res)
 FIXME DOC. More...
 
static void opj_pi_update_decode_poc (opj_pi_iterator_t *p_pi, opj_tcp_t *p_tcp, OPJ_UINT32 p_max_precision, OPJ_UINT32 p_max_res)
 FIXME DOC. More...
 
static OPJ_BOOL opj_pi_check_next_level (OPJ_INT32 pos, opj_cp_t *cp, OPJ_UINT32 tileno, OPJ_UINT32 pino, const OPJ_CHAR *prog)
 FIXME DOC. More...
 
opj_pi_iterator_topj_pi_create_decode (opj_image_t *p_image, opj_cp_t *p_cp, OPJ_UINT32 p_tile_no, opj_event_mgr_t *manager)
 Create a packet iterator for Decoder. More...
 
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. More...
 
opj_pi_iterator_topj_pi_initialise_encode (const opj_image_t *p_image, opj_cp_t *p_cp, OPJ_UINT32 p_tile_no, J2K_T2_MODE p_t2_mode, opj_event_mgr_t *manager)
 Creates a packet iterator for encoding. More...
 
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. More...
 
void opj_pi_destroy (opj_pi_iterator_t *p_pi, OPJ_UINT32 p_nb_elements)
 Destroys a packet iterator array. More...
 
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. More...
 
OPJ_BOOL opj_pi_next (opj_pi_iterator_t *pi)
 Modify the packet iterator to point to the next packet. More...
 

Macro Definition Documentation

◆ OPJ_UINT32_SEMANTICALLY_BUT_INT32

#define OPJ_UINT32_SEMANTICALLY_BUT_INT32   OPJ_UINT32

Function Documentation

◆ opj_get_all_encoding_parameters()

static void opj_get_all_encoding_parameters ( const opj_image_t p_image,
const opj_cp_t p_cp,
OPJ_UINT32  tileno,
OPJ_UINT32 p_tx0,
OPJ_UINT32 p_tx1,
OPJ_UINT32 p_ty0,
OPJ_UINT32 p_ty1,
OPJ_UINT32 p_dx_min,
OPJ_UINT32 p_dy_min,
OPJ_UINT32 p_max_prec,
OPJ_UINT32 p_max_res,
OPJ_UINT32 **  p_resolutions 
)
static

Gets the encoding parameters needed to update the coding parameters and all the pocs.

The precinct widths, heights, dx and dy for each component at each resolution will be stored as well. the last parameter of the function should be an array of pointers of size nb components, each pointer leading to an area of size 4 * max_res. The data is stored inside this area with the following pattern : dx_compi_res0 , dy_compi_res0 , w_compi_res0, h_compi_res0 , dx_compi_res1 , dy_compi_res1 , w_compi_res1, h_compi_res1 , ...

Parameters
p_imagethe image being encoded.
p_cpthe coding parameters.
tilenothe tile index of the tile being encoded.
p_tx0pointer that will hold the X0 parameter for the tile
p_tx1pointer that will hold the X1 parameter for the tile
p_ty0pointer that will hold the Y0 parameter for the tile
p_ty1pointer that will hold the Y1 parameter for the tile
p_max_precpointer that will hold the maximum precision for all the bands of the tile
p_max_respointer that will hold the maximum number of resolutions for all the poc inside the tile.
p_dx_minpointer that will hold the minimum dx of all the components of all the resolutions for the tile.
p_dy_minpointer that will hold the minimum dy of all the components of all the resolutions for the tile.
p_resolutionspointer to an area corresponding to the one described above.

References opj_image::comps, opj_image_comp::dx, opj_image_comp::dy, opj_image::numcomps, opj_tccp::numresolutions, opj_uint_adds(), opj_uint_ceildiv(), opj_uint_ceildivpow2(), opj_uint_floordivpow2(), opj_uint_max(), opj_uint_min(), opj_tccp::prch, opj_tccp::prcw, tcp, opj_cp::tcps, opj_cp::tdx, opj_cp::tdy, opj_cp::th, opj_cp::tw, opj_cp::tx0, opj_cp::ty0, opj_image::x0, opj_image::x1, opj_image::y0, and opj_image::y1.

Referenced by opj_get_encoding_packet_count(), opj_pi_create_decode(), and opj_pi_initialise_encode().

◆ 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
imagethe image being encoded.
cpCoding parameters
tilenoNumber 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_get_encoding_parameters()

static void opj_get_encoding_parameters ( const opj_image_t p_image,
const opj_cp_t p_cp,
OPJ_UINT32  tileno,
OPJ_UINT32 p_tx0,
OPJ_UINT32 p_tx1,
OPJ_UINT32 p_ty0,
OPJ_UINT32 p_ty1,
OPJ_UINT32 p_dx_min,
OPJ_UINT32 p_dy_min,
OPJ_UINT32 p_max_prec,
OPJ_UINT32 p_max_res 
)
static

Gets the encoding parameters needed to update the coding parameters and all the pocs.

Parameters
p_imagethe image being encoded.
p_cpthe coding parameters.
tilenothe tile index of the tile being encoded.
p_tx0pointer that will hold the X0 parameter for the tile
p_tx1pointer that will hold the X1 parameter for the tile
p_ty0pointer that will hold the Y0 parameter for the tile
p_ty1pointer that will hold the Y1 parameter for the tile
p_max_precpointer that will hold the maximum precision for all the bands of the tile
p_max_respointer that will hold the maximum number of resolutions for all the poc inside the tile.
p_dx_minpointer that will hold the minimum dx of all the components of all the resolutions for the tile.
p_dy_minpointer that will hold the minimum dy of all the components of all the resolutions for the tile.

References opj_image::comps, opj_image_comp::dx, opj_image_comp::dy, opj_image::numcomps, opj_tccp::numresolutions, opj_uint_adds(), opj_uint_ceildiv(), opj_uint_ceildivpow2(), opj_uint_floordivpow2(), opj_uint_max(), opj_uint_min(), opj_tccp::prch, opj_tccp::prcw, opj_tcp::tccps, opj_cp::tcps, opj_cp::tdx, opj_cp::tdy, opj_cp::th, opj_cp::tw, opj_cp::tx0, opj_cp::ty0, opj_image::x0, opj_image::x1, opj_image::y0, and opj_image::y1.

Referenced by opj_pi_update_encoding_parameters().

◆ opj_pi_check_next_level()

static OPJ_BOOL opj_pi_check_next_level ( OPJ_INT32  pos,
opj_cp_t cp,
OPJ_UINT32  tileno,
OPJ_UINT32  pino,
const OPJ_CHAR prog 
)
static

FIXME DOC.

References OPJ_FALSE, OPJ_LRCP, OPJ_RLCP, OPJ_TRUE, opj_tcp::pocs, tcp, and opj_cp::tcps.

Referenced by opj_pi_create_encode().

◆ opj_pi_create()

static opj_pi_iterator_t * opj_pi_create ( const opj_image_t p_image,
const opj_cp_t p_cp,
OPJ_UINT32  tileno,
opj_event_mgr_t manager 
)
static

Allocates memory for a packet iterator.

Data and data sizes are set by this operation. No other data is set. The include section of the packet iterator is not allocated.

Parameters
p_imagethe image used to initialize the packet iterator (in fact only the number of components is relevant.
p_cpthe coding parameters.
tilenothe index of the tile from which creating the packet iterator.
managerEvent manager

References opj_pi_iterator::comps, opj_pi_iterator::manager, opj_pi_iterator::numcomps, opj_image::numcomps, opj_pi_comp::numresolutions, opj_tccp::numresolutions, opj_calloc(), opj_pi_destroy(), opj_pi_comp::resolutions, tcp, opj_cp::tcps, and opj_cp::th.

Referenced by opj_pi_create_decode(), and opj_pi_initialise_encode().

◆ 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 
)

◆ 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
piHandle to the packet iterator generated in pi_initialise_encode
cpCoding parameters
tilenoNumber that identifies the tile for which to list the packets
pinoFIXME DOC
tpnumTile part number of the current tile
tpposThe position of the tile part flag in the progression order
t2_modeFIXME 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_pi_iterator::tx1, opj_poc::tx1, opj_poc::ty0, opj_pi_iterator::ty1, and opj_poc::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_pithe packet iterator array to destroy.
p_nb_elementsthe 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 
)

◆ opj_pi_next()

OPJ_BOOL opj_pi_next ( opj_pi_iterator_t pi)

Modify the packet iterator to point to the next packet.

Parameters
piPacket 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_next_cprl()

static OPJ_BOOL opj_pi_next_cprl ( opj_pi_iterator_t pi)
static

◆ opj_pi_next_lrcp()

static OPJ_BOOL opj_pi_next_lrcp ( opj_pi_iterator_t pi)
static

◆ opj_pi_next_pcrl()

static OPJ_BOOL opj_pi_next_pcrl ( opj_pi_iterator_t pi)
static

◆ opj_pi_next_rlcp()

static OPJ_BOOL opj_pi_next_rlcp ( opj_pi_iterator_t pi)
static

◆ opj_pi_next_rpcl()

static OPJ_BOOL opj_pi_next_rpcl ( opj_pi_iterator_t pi)
static

◆ opj_pi_update_decode_not_poc()

static void opj_pi_update_decode_not_poc ( opj_pi_iterator_t p_pi,
opj_tcp_t p_tcp,
OPJ_UINT32  p_max_precision,
OPJ_UINT32  p_max_res 
)
static

◆ opj_pi_update_decode_poc()

static void opj_pi_update_decode_poc ( opj_pi_iterator_t p_pi,
opj_tcp_t p_tcp,
OPJ_UINT32  p_max_precision,
OPJ_UINT32  p_max_res 
)
static

◆ opj_pi_update_encode_not_poc()

static void opj_pi_update_encode_not_poc ( opj_cp_t p_cp,
OPJ_UINT32  p_num_comps,
OPJ_UINT32  p_tileno,
OPJ_UINT32  p_tx0,
OPJ_UINT32  p_tx1,
OPJ_UINT32  p_ty0,
OPJ_UINT32  p_ty1,
OPJ_UINT32  p_max_prec,
OPJ_UINT32  p_max_res,
OPJ_UINT32  p_dx_min,
OPJ_UINT32  p_dy_min 
)
static

Updates the coding parameters if the encoding is not used with Progression order changes and final (and cinema parameters are used).

Parameters
p_cpthe coding parameters to modify
p_num_compsthe number of components
p_tilenothe tile index being concerned.
p_tx0X0 parameter for the tile
p_tx1X1 parameter for the tile
p_ty0Y0 parameter for the tile
p_ty1Y1 parameter for the tile
p_max_precthe maximum precision for all the bands of the tile
p_max_resthe maximum number of resolutions for all the poc inside the tile.
p_dx_minthe minimum dx of all the components of all the resolutions for the tile.
p_dy_minthe minimum dy of all the components of all the resolutions for the tile.

References opj_poc::compE, opj_poc::compS, opj_poc::dx, opj_poc::dy, opj_poc::layE, opj_poc::layS, opj_tcp::numlayers, opj_tcp::numpocs, opj_tcp::pocs, opj_poc::prcE, opj_poc::prcS, opj_tcp::prg, opj_poc::prg, opj_poc::resE, opj_poc::resS, opj_cp::tcps, opj_cp::th, opj_poc::txE, opj_poc::txS, opj_poc::tyE, and opj_poc::tyS.

Referenced by opj_pi_initialise_encode(), and opj_pi_update_encoding_parameters().

◆ opj_pi_update_encode_poc_and_final()

static void opj_pi_update_encode_poc_and_final ( opj_cp_t p_cp,
OPJ_UINT32  p_tileno,
OPJ_UINT32  p_tx0,
OPJ_UINT32  p_tx1,
OPJ_UINT32  p_ty0,
OPJ_UINT32  p_ty1,
OPJ_UINT32  p_max_prec,
OPJ_UINT32  p_max_res,
OPJ_UINT32  p_dx_min,
OPJ_UINT32  p_dy_min 
)
static

Updates the coding parameters if the encoding is used with Progression order changes and final (or cinema parameters are used).

Parameters
p_cpthe coding parameters to modify
p_tilenothe tile index being concerned.
p_tx0X0 parameter for the tile
p_tx1X1 parameter for the tile
p_ty0Y0 parameter for the tile
p_ty1Y1 parameter for the tile
p_max_precthe maximum precision for all the bands of the tile
p_max_resthe maximum number of resolutions for all the poc inside the tile.
p_dx_minthe minimum dx of all the components of all the resolutions for the tile.
p_dy_minthe minimum dy of all the components of all the resolutions for the tile.

References opj_poc::compE, opj_poc::compno0, opj_poc::compno1, opj_poc::compS, opj_poc::dx, opj_poc::dy, opj_poc::layE, opj_poc::layno1, opj_poc::layS, opj_tcp::numpocs, OPJ_ARG_NOT_USED, opj_tcp::pocs, opj_poc::prcE, opj_poc::prcS, opj_poc::prg, opj_poc::prg1, opj_poc::resE, opj_poc::resno0, opj_poc::resno1, opj_poc::resS, opj_cp::tcps, opj_cp::th, opj_poc::txE, opj_poc::txS, opj_poc::tyE, and opj_poc::tyS.

Referenced by opj_pi_initialise_encode(), and opj_pi_update_encoding_parameters().

◆ 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_imagethe image being encoded.
p_cpthe coding parameters.
p_tile_noindex 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().