OpenJPEG  2.4.0
Functions
tcd.c File Reference
#include "opj_includes.h"
#include "opj_common.h"

Functions

static INLINE OPJ_BOOL opj_tcd_init_tile (opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, OPJ_BOOL isEncoder, OPJ_SIZE_T sizeof_block, opj_event_mgr_t *manager)
 Initializes tile coding/decoding. More...
 
static OPJ_BOOL opj_tcd_code_block_dec_allocate (opj_tcd_cblk_dec_t *p_code_block)
 Allocates memory for a decoding code block. More...
 
static void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_t *p_precinct)
 Deallocates the decoding data of the given precinct. More...
 
static OPJ_BOOL opj_tcd_code_block_enc_allocate (opj_tcd_cblk_enc_t *p_code_block)
 Allocates memory for an encoding code block (but not data). More...
 
static OPJ_BOOL opj_tcd_code_block_enc_allocate_data (opj_tcd_cblk_enc_t *p_code_block)
 Allocates data for an encoding code block. More...
 
static void opj_tcd_code_block_enc_deallocate (opj_tcd_precinct_t *p_precinct)
 Deallocates the encoding data of the given precinct. More...
 
static void opj_tcd_free_tile (opj_tcd_t *tcd)
 Free the memory allocated for encoding. More...
 
static OPJ_BOOL opj_tcd_t2_decode (opj_tcd_t *p_tcd, OPJ_BYTE *p_src_data, OPJ_UINT32 *p_data_read, OPJ_UINT32 p_max_src_size, opj_codestream_index_t *p_cstr_index, opj_event_mgr_t *p_manager)
 
static OPJ_BOOL opj_tcd_t1_decode (opj_tcd_t *p_tcd, opj_event_mgr_t *p_manager)
 
static OPJ_BOOL opj_tcd_dwt_decode (opj_tcd_t *p_tcd)
 
static OPJ_BOOL opj_tcd_mct_decode (opj_tcd_t *p_tcd, opj_event_mgr_t *p_manager)
 
static OPJ_BOOL opj_tcd_dc_level_shift_decode (opj_tcd_t *p_tcd)
 
static OPJ_BOOL opj_tcd_dc_level_shift_encode (opj_tcd_t *p_tcd)
 
static OPJ_BOOL opj_tcd_mct_encode (opj_tcd_t *p_tcd)
 
static OPJ_BOOL opj_tcd_dwt_encode (opj_tcd_t *p_tcd)
 
static OPJ_BOOL opj_tcd_t1_encode (opj_tcd_t *p_tcd)
 
static OPJ_BOOL opj_tcd_t2_encode (opj_tcd_t *p_tcd, OPJ_BYTE *p_dest_data, OPJ_UINT32 *p_data_written, OPJ_UINT32 p_max_dest_size, opj_codestream_info_t *p_cstr_info, opj_tcd_marker_info_t *p_marker_info, opj_event_mgr_t *p_manager)
 
static OPJ_BOOL opj_tcd_rate_allocate_encode (opj_tcd_t *p_tcd, OPJ_BYTE *p_dest_data, OPJ_UINT32 p_max_dest_size, opj_codestream_info_t *p_cstr_info, opj_event_mgr_t *p_manager)
 
static OPJ_BOOL opj_tcd_is_whole_tilecomp_decoding (opj_tcd_t *p_tcd, OPJ_UINT32 compno)
 Returns whether a tile componenent is fully decoded, taking into account p_tcd->win_* members. More...
 
opj_tcd_topj_tcd_create (OPJ_BOOL p_is_decoder)
 Create a new TCD handle. More...
 
void opj_tcd_rateallocate_fixed (opj_tcd_t *tcd)
 
void opj_tcd_makelayer (opj_tcd_t *tcd, OPJ_UINT32 layno, OPJ_FLOAT64 thresh, OPJ_UINT32 final)
 
void opj_tcd_makelayer_fixed (opj_tcd_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 final)
 
OPJ_BOOL opj_tcd_rateallocate (opj_tcd_t *tcd, OPJ_BYTE *dest, OPJ_UINT32 *p_data_written, OPJ_UINT32 len, opj_codestream_info_t *cstr_info, opj_event_mgr_t *p_manager)
 
OPJ_BOOL opj_tcd_init (opj_tcd_t *p_tcd, opj_image_t *p_image, opj_cp_t *p_cp, opj_thread_pool_t *p_tp)
 Initialize the tile coder and may reuse some memory. More...
 
void opj_tcd_destroy (opj_tcd_t *tcd)
 Destroy a previously created TCD handle. More...
 
OPJ_BOOL opj_alloc_tile_component_data (opj_tcd_tilecomp_t *l_tilec)
 Allocates tile component data. More...
 
OPJ_BOOL opj_tcd_init_encode_tile (opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, opj_event_mgr_t *p_manager)
 Initialize the tile coder and may reuse some meory. More...
 
OPJ_BOOL opj_tcd_init_decode_tile (opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, opj_event_mgr_t *p_manager)
 Allocates memory for decoding a specific tile. More...
 
void opj_tcd_reinit_segment (opj_tcd_seg_t *seg)
 Reinitialize a segment. More...
 
OPJ_UINT32 opj_tcd_get_decoded_tile_size (opj_tcd_t *p_tcd, OPJ_BOOL take_into_account_partial_decoding)
 Gets the maximum tile size that will be taken by the tile once decoded. More...
 
OPJ_BOOL opj_tcd_encode_tile (opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, OPJ_BYTE *p_dest, OPJ_UINT32 *p_data_written, OPJ_UINT32 p_max_length, opj_codestream_info_t *p_cstr_info, opj_tcd_marker_info_t *p_marker_info, opj_event_mgr_t *p_manager)
 Encodes a tile from the raw image into the given buffer. More...
 
OPJ_BOOL opj_tcd_decode_tile (opj_tcd_t *p_tcd, OPJ_UINT32 win_x0, OPJ_UINT32 win_y0, OPJ_UINT32 win_x1, OPJ_UINT32 win_y1, OPJ_UINT32 numcomps_to_decode, const OPJ_UINT32 *comps_indices, OPJ_BYTE *p_src, OPJ_UINT32 p_max_length, OPJ_UINT32 p_tile_no, opj_codestream_index_t *p_cstr_index, opj_event_mgr_t *p_manager)
 Decode a tile from a buffer into a raw image. More...
 
OPJ_BOOL opj_tcd_update_tile_data (opj_tcd_t *p_tcd, OPJ_BYTE *p_dest, OPJ_UINT32 p_dest_length)
 Copies tile data from the system onto the given memory block. More...
 
OPJ_SIZE_T opj_tcd_get_encoder_input_buffer_size (opj_tcd_t *p_tcd)
 Get the size in bytes of the input buffer provided before encoded. More...
 
OPJ_BOOL opj_tcd_copy_tile_data (opj_tcd_t *p_tcd, OPJ_BYTE *p_src, OPJ_SIZE_T p_src_length)
 Copies tile data from the given memory block onto the system. More...
 
OPJ_BOOL opj_tcd_is_band_empty (opj_tcd_band_t *band)
 Returns whether a sub-band is empty (i.e. More...
 
OPJ_BOOL opj_tcd_is_subband_area_of_interest (opj_tcd_t *tcd, OPJ_UINT32 compno, OPJ_UINT32 resno, OPJ_UINT32 bandno, OPJ_UINT32 band_x0, OPJ_UINT32 band_y0, OPJ_UINT32 band_x1, OPJ_UINT32 band_y1)
 Returns whether a sub-band region contributes to the area of interest tcd->win_x0,tcd->win_y0,tcd->win_x1,tcd->win_y1. More...
 
opj_tcd_marker_info_topj_tcd_marker_info_create (OPJ_BOOL need_PLT)
 Create a new opj_tcd_marker_info_t* structure. More...
 
void opj_tcd_marker_info_destroy (opj_tcd_marker_info_t *p_tcd_marker_info)
 Destroy a previously created opj_tcd_marker_info_t* structure. More...
 

Function Documentation

static OPJ_BOOL opj_tcd_code_block_dec_allocate ( opj_tcd_cblk_dec_t p_code_block)
static
static void opj_tcd_code_block_dec_deallocate ( opj_tcd_precinct_t p_precinct)
static

Deallocates the decoding data of the given precinct.

Deallocates the encoding data of the given precinct.

References opj_tcd_precinct::block_size, opj_tcd_precinct::cblks, opj_tcd_cblk_dec::chunks, opj_tcd_precinct::dec, opj_tcd_cblk_dec::decoded_data, opj_aligned_free(), opj_free(), and opj_tcd_cblk_dec::segs.

Referenced by opj_tcd_free_tile().

static OPJ_BOOL opj_tcd_code_block_enc_allocate ( opj_tcd_cblk_enc_t p_code_block)
static

Allocates memory for an encoding code block (but not data).

Allocates memory for an encoding code block (but not data memory).

References opj_tcd_cblk_enc::layers, opj_calloc(), OPJ_FALSE, OPJ_TRUE, and opj_tcd_cblk_enc::passes.

Referenced by opj_tcd_init_tile().

static OPJ_BOOL opj_tcd_code_block_enc_allocate_data ( opj_tcd_cblk_enc_t p_code_block)
static

Allocates data for an encoding code block.

Allocates data memory for an encoding code block.

References opj_tcd_cblk_enc::data, opj_tcd_cblk_enc::data_size, OPJ_FALSE, opj_free(), opj_malloc(), OPJ_TRUE, opj_tcd_cblk_enc::x0, opj_tcd_cblk_enc::x1, opj_tcd_cblk_enc::y0, and opj_tcd_cblk_enc::y1.

Referenced by opj_tcd_init_tile().

static void opj_tcd_code_block_enc_deallocate ( opj_tcd_precinct_t p_precinct)
static
static OPJ_BOOL opj_tcd_dc_level_shift_decode ( opj_tcd_t p_tcd)
static
static OPJ_BOOL opj_tcd_dc_level_shift_encode ( opj_tcd_t p_tcd)
static
static OPJ_BOOL opj_tcd_dwt_decode ( opj_tcd_t p_tcd)
static
static OPJ_BOOL opj_tcd_dwt_encode ( opj_tcd_t p_tcd)
static
static void opj_tcd_free_tile ( opj_tcd_t tcd)
static
static INLINE OPJ_BOOL opj_tcd_init_tile ( opj_tcd_t p_tcd,
OPJ_UINT32  p_tile_no,
OPJ_BOOL  isEncoder,
OPJ_SIZE_T  sizeof_block,
opj_event_mgr_t manager 
)
static

Initializes tile coding/decoding.

References opj_tcd_band::bandno, opj_tcd_resolution::bands, opj_tcd_precinct::block_size, opj_tcd_precinct::blocks, opj_tccp::cblkh, opj_tcd_precinct::cblks, opj_tccp::cblkw, opj_tcd_precinct::ch, opj_tcd_tilecomp::compno, opj_tcd_tile::comps, opj_image::comps, opj_tcd::cp, opj_tcd_precinct::cw, opj_tcd_tilecomp::data_size_needed, opj_tcd_tilecomp::data_win, opj_tcd_precinct::dec, opj_image_comp::dx, opj_image_comp::dy, opj_tcd_precinct::enc, EVT_ERROR, opj_stepsize::expn, opj_tcd::image, opj_tcd_precinct::imsbtree, opj_tcd_precinct::incltree, opj_cp::m_dec, opj_decoding_param::m_reduce, opj_cp::m_specific_param, opj_stepsize::mant, opj_tcd_tilecomp::minimum_num_resolutions, opj_tcd_resolution::numbands, opj_tcd_tile::numcomps, opj_tccp::numgbits, opj_tccp::numresolutions, opj_tcd_tilecomp::numresolutions, opj_event_msg(), OPJ_FALSE, opj_free(), opj_image_data_free(), opj_int64_ceildivpow2(), opj_int_ceildiv(), opj_int_ceildivpow2(), opj_int_floordivpow2(), opj_int_max(), opj_int_min(), opj_malloc(), opj_realloc(), opj_tcd_code_block_dec_allocate(), opj_tcd_code_block_enc_allocate(), opj_tcd_code_block_enc_allocate_data(), opj_tcd_is_band_empty(), opj_tgt_create(), opj_tgt_init(), OPJ_TRUE, opj_uint_adds(), opj_uint_max(), opj_uint_min(), opj_tcd_resolution::ph, opj_tccp::prch, opj_tccp::prcw, opj_image_comp::prec, opj_tcd_resolution::pw, opj_tccp::qmfbid, opj_image_comp::resno_decoded, opj_tcd_tilecomp::resolutions, opj_tcd_tilecomp::resolutions_size, SIZE_MAX, opj_tccp::stepsizes, opj_tcp::tccps, opj_tcd::tcd_image, opj_cp::tcps, opj_cp::tdx, opj_cp::tdy, opj_tcd_image::tiles, opj_cp::tw, opj_cp::tx0, opj_cp::ty0, opj_tcd_tilecomp::win_x0, opj_tcd_tilecomp::win_x1, opj_tcd_tilecomp::win_y0, opj_tcd_tilecomp::win_y1, opj_tcd_cblk_enc::x0, opj_tcd_cblk_dec::x0, opj_tcd_precinct::x0, opj_tcd_resolution::x0, opj_tcd_tilecomp::x0, opj_tcd_tile::x0, opj_image::x0, opj_tcd_cblk_enc::x1, opj_tcd_cblk_dec::x1, opj_tcd_precinct::x1, opj_tcd_resolution::x1, opj_tcd_tilecomp::x1, opj_tcd_tile::x1, opj_image::x1, opj_tcd_cblk_enc::y0, opj_tcd_cblk_dec::y0, opj_tcd_precinct::y0, opj_tcd_resolution::y0, opj_tcd_tilecomp::y0, opj_tcd_tile::y0, opj_image::y0, opj_tcd_cblk_enc::y1, opj_tcd_cblk_dec::y1, opj_tcd_precinct::y1, opj_tcd_resolution::y1, opj_tcd_tilecomp::y1, opj_tcd_tile::y1, and opj_image::y1.

Referenced by opj_tcd_init_decode_tile(), and opj_tcd_init_encode_tile().

static OPJ_BOOL opj_tcd_is_whole_tilecomp_decoding ( opj_tcd_t p_tcd,
OPJ_UINT32  compno 
)
static

Returns whether a tile componenent is fully decoded, taking into account p_tcd->win_* members.

Parameters
p_tcdTCD handle.
compnoComponent number
Returns
OPJ_TRUE whether the tile componenent is fully decoded

References opj_tcd_tile::comps, opj_image::comps, opj_image_comp::dx, opj_image_comp::dy, opj_tcd::image, opj_tcd_tilecomp::minimum_num_resolutions, opj_tcd_tilecomp::numresolutions, opj_uint_ceildiv(), opj_uint_max(), opj_uint_min(), opj_tcd::tcd_image, opj_tcd_image::tiles, opj_tcd::win_x0, opj_tcd::win_x1, opj_tcd::win_y0, opj_tcd::win_y1, opj_tcd_tilecomp::x0, opj_tcd_tilecomp::x1, opj_tcd_tilecomp::y0, and opj_tcd_tilecomp::y1.

Referenced by opj_tcd_decode_tile().

static OPJ_BOOL opj_tcd_mct_decode ( opj_tcd_t p_tcd,
opj_event_mgr_t p_manager 
)
static
static OPJ_BOOL opj_tcd_mct_encode ( opj_tcd_t p_tcd)
static
static OPJ_BOOL opj_tcd_rate_allocate_encode ( opj_tcd_t p_tcd,
OPJ_BYTE p_dest_data,
OPJ_UINT32  p_max_dest_size,
opj_codestream_info_t p_cstr_info,
opj_event_mgr_t p_manager 
)
static
static OPJ_BOOL opj_tcd_t1_decode ( opj_tcd_t p_tcd,
opj_event_mgr_t p_manager 
)
static
static OPJ_BOOL opj_tcd_t1_encode ( opj_tcd_t p_tcd)
static
static OPJ_BOOL opj_tcd_t2_decode ( opj_tcd_t p_tcd,
OPJ_BYTE p_src_data,
OPJ_UINT32 p_data_read,
OPJ_UINT32  p_max_src_size,
opj_codestream_index_t p_cstr_index,
opj_event_mgr_t p_manager 
)
static
static OPJ_BOOL opj_tcd_t2_encode ( opj_tcd_t p_tcd,
OPJ_BYTE p_dest_data,
OPJ_UINT32 p_data_written,
OPJ_UINT32  p_max_dest_size,
opj_codestream_info_t p_cstr_info,
opj_tcd_marker_info_t p_marker_info,
opj_event_mgr_t p_manager 
)
static