[trunk] rename opj_tcd_truct_v2 to opj_tcd_struct

This commit is contained in:
Mickael Savinaud 2012-10-25 14:49:10 +00:00
parent 94a69c2b31
commit 06615a556d
11 changed files with 281 additions and 279 deletions

View File

@ -118,12 +118,12 @@ static void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_st
/**
Inverse wavelet transform in 2-D.
*/
static opj_bool opj_dwt_decode_tile(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 i, DWT1DFN fn);
static opj_bool opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 i, DWT1DFN fn);
static opj_bool opj_dwt_encode_procedure( opj_tcd_tilecomp_v2_t * tilec,
static opj_bool opj_dwt_encode_procedure( opj_tcd_tilecomp_t * tilec,
void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) );
static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_v2_t* restrict r, OPJ_UINT32 i);
static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i);
/* <summary> */
/* Inverse 9-7 wavelet transform in 1-D. */
@ -379,7 +379,7 @@ void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_
/* <summary> */
/* Forward 5-3 wavelet transform in 2-D. */
/* </summary> */
INLINE opj_bool opj_dwt_encode_procedure(opj_tcd_tilecomp_v2_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) )
INLINE opj_bool opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) )
{
OPJ_INT32 i, j, k;
OPJ_INT32 *a = 00;
@ -391,8 +391,8 @@ INLINE opj_bool opj_dwt_encode_procedure(opj_tcd_tilecomp_v2_t * tilec,void (*p_
OPJ_INT32 rh; /* height of the resolution level computed */
OPJ_INT32 l_data_size;
opj_tcd_resolution_v2_t * l_cur_res = 0;
opj_tcd_resolution_v2_t * l_last_res = 0;
opj_tcd_resolution_t * l_cur_res = 0;
opj_tcd_resolution_t * l_last_res = 0;
w = tilec->x1-tilec->x0;
l = tilec->numresolutions-1;
@ -460,7 +460,7 @@ INLINE opj_bool opj_dwt_encode_procedure(opj_tcd_tilecomp_v2_t * tilec,void (*p_
/* Forward 5-3 wavelet transform in 2-D. */
/* </summary> */
opj_bool opj_dwt_encode(opj_tcd_tilecomp_v2_t * tilec)
opj_bool opj_dwt_encode(opj_tcd_tilecomp_t * tilec)
{
return opj_dwt_encode_procedure(tilec,opj_dwt_encode_1);
}
@ -468,7 +468,7 @@ opj_bool opj_dwt_encode(opj_tcd_tilecomp_v2_t * tilec)
/* <summary> */
/* Inverse 5-3 wavelet transform in 2-D. */
/* </summary> */
opj_bool opj_dwt_decode(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres) {
opj_bool opj_dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres) {
return opj_dwt_decode_tile(tilec, numres, &opj_dwt_decode_1);
}
@ -494,7 +494,7 @@ OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient) {
/* <summary> */
/* Forward 9-7 wavelet transform in 2-D. */
/* </summary> */
opj_bool opj_dwt_encode_real(opj_tcd_tilecomp_v2_t * tilec)
opj_bool opj_dwt_encode_real(opj_tcd_tilecomp_t * tilec)
{
return opj_dwt_encode_procedure(tilec,opj_dwt_encode_1_real);
}
@ -538,7 +538,7 @@ void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec) {
/* <summary> */
/* Determine maximum computed resolution level for inverse wavelet transform */
/* </summary> */
OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_v2_t* restrict r, OPJ_UINT32 i) {
OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i) {
OPJ_UINT32 mr = 0;
OPJ_UINT32 w;
while( --i ) {
@ -554,11 +554,11 @@ OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_v2_t* restrict r, OPJ_UINT3
/* <summary> */
/* Inverse wavelet transform in 2-D. */
/* </summary> */
opj_bool opj_dwt_decode_tile(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) {
opj_bool opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) {
dwt_t h;
dwt_t v;
opj_tcd_resolution_v2_t* tr = tilec->resolutions;
opj_tcd_resolution_t* tr = tilec->resolutions;
OPJ_UINT32 rw = tr->x1 - tr->x0; /* width of the resolution level computed */
OPJ_UINT32 rh = tr->y1 - tr->y0; /* height of the resolution level computed */
@ -826,12 +826,12 @@ void opj_v4dwt_decode(v4dwt_t* restrict dwt)
/* <summary> */
/* Inverse 9-7 wavelet transform in 2-D. */
/* </summary> */
opj_bool opj_dwt_decode_real(opj_tcd_tilecomp_v2_t* restrict tilec, OPJ_UINT32 numres)
opj_bool opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numres)
{
v4dwt_t h;
v4dwt_t v;
opj_tcd_resolution_v2_t* res = tilec->resolutions;
opj_tcd_resolution_t* res = tilec->resolutions;
OPJ_UINT32 rw = res->x1 - res->x0; /* width of the resolution level computed */
OPJ_UINT32 rh = res->y1 - res->y0; /* height of the resolution level computed */

View File

@ -52,7 +52,7 @@ Forward 5-3 wavelet tranform in 2-D.
Apply a reversible DWT transform to a component of an image.
@param tilec Tile component information (current tile)
*/
opj_bool opj_dwt_encode(opj_tcd_tilecomp_v2_t * tilec);
opj_bool opj_dwt_encode(opj_tcd_tilecomp_t * tilec);
/**
Inverse 5-3 wavelet tranform in 2-D.
@ -60,7 +60,7 @@ Apply a reversible inverse DWT transform to a component of an image.
@param tilec Tile component information (current tile)
@param numres Number of resolution levels to decode
*/
opj_bool opj_dwt_decode(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres);
opj_bool opj_dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres);
/**
Get the gain of a subband for the reversible 5-3 DWT.
@ -80,14 +80,14 @@ Forward 9-7 wavelet transform in 2-D.
Apply an irreversible DWT transform to a component of an image.
@param tilec Tile component information (current tile)
*/
opj_bool opj_dwt_encode_real(opj_tcd_tilecomp_v2_t * tilec);
opj_bool opj_dwt_encode_real(opj_tcd_tilecomp_t * tilec);
/**
Inverse 9-7 wavelet transform in 2-D.
Apply an irreversible inverse DWT transform to a component of an image.
@param tilec Tile component information (current tile)
@param numres Number of resolution levels to decode
*/
opj_bool opj_dwt_decode_real(opj_tcd_tilecomp_v2_t* restrict tilec, OPJ_UINT32 numres);
opj_bool opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numres);
/**
Get the gain of a subband for the irreversible 9-7 DWT.

View File

@ -329,9 +329,9 @@ static opj_bool opj_j2k_pre_write_tile ( opj_j2k_t * p_j2k,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager );
static opj_bool opj_j2k_update_image_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data, opj_image_t* p_output_image);
static opj_bool opj_j2k_update_image_data (opj_tcd_t * p_tcd, OPJ_BYTE * p_data, opj_image_t* p_output_image);
static void opj_j2k_get_tile_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data);
static void opj_j2k_get_tile_data (opj_tcd_t * p_tcd, OPJ_BYTE * p_data);
static opj_bool opj_j2k_post_write_tile (opj_j2k_t * p_j2k,
OPJ_BYTE * p_data,
@ -777,7 +777,7 @@ static opj_bool opj_j2k_read_sot ( opj_j2k_t *p_j2k,
* @param p_manager the user event manager.
*/
static opj_bool opj_j2k_write_sod( opj_j2k_t *p_j2k,
opj_tcd_v2_t * p_tile_coder,
opj_tcd_t * p_tile_coder,
OPJ_BYTE * p_data,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 p_total_data_size,
@ -4073,7 +4073,7 @@ opj_bool opj_j2k_read_sot ( opj_j2k_t *p_j2k,
}
opj_bool opj_j2k_write_sod( opj_j2k_t *p_j2k,
opj_tcd_v2_t * p_tile_coder,
opj_tcd_t * p_tile_coder,
OPJ_BYTE * p_data,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 p_total_data_size,
@ -4590,7 +4590,7 @@ opj_bool opj_j2k_read_eoc ( opj_j2k_t *p_j2k,
opj_event_mgr_t * p_manager )
{
OPJ_UINT32 i;
opj_tcd_v2_t * l_tcd = 00;
opj_tcd_t * l_tcd = 00;
OPJ_UINT32 l_nb_tiles;
opj_tcp_v2_t * l_tcp = 00;
opj_bool l_success;
@ -6735,7 +6735,7 @@ static opj_bool opj_j2k_copy_default_tcp_and_create_tcd ( opj_j2k_t * p_j2
}
/* Create the current tile decoder*/
p_j2k->m_tcd = (opj_tcd_v2_t*)opj_tcd_create(OPJ_TRUE); /* FIXME why a cast ? */
p_j2k->m_tcd = (opj_tcd_t*)opj_tcd_create(OPJ_TRUE); /* FIXME why a cast ? */
if (! p_j2k->m_tcd ) {
return OPJ_FALSE;
}
@ -7250,7 +7250,7 @@ opj_bool opj_j2k_decode_tile ( opj_j2k_t * p_j2k,
return OPJ_TRUE;
}
opj_bool opj_j2k_update_image_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data, opj_image_t* p_output_image)
opj_bool opj_j2k_update_image_data (opj_tcd_t * p_tcd, OPJ_BYTE * p_data, opj_image_t* p_output_image)
{
OPJ_UINT32 i,j,k = 0;
OPJ_UINT32 l_width_src,l_height_src;
@ -7264,11 +7264,11 @@ opj_bool opj_j2k_update_image_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data, opj
opj_image_comp_t * l_img_comp_src = 00;
opj_image_comp_t * l_img_comp_dest = 00;
opj_tcd_tilecomp_v2_t * l_tilec = 00;
opj_tcd_tilecomp_t * l_tilec = 00;
opj_image_t * l_image_src = 00;
OPJ_UINT32 l_size_comp, l_remaining;
OPJ_INT32 * l_dest_ptr;
opj_tcd_resolution_v2_t* l_res= 00;
opj_tcd_resolution_t* l_res= 00;
l_tilec = p_tcd->tcd_image->tiles->comps;
l_image_src = p_tcd->image;
@ -9140,12 +9140,12 @@ opj_bool opj_j2k_pre_write_tile ( opj_j2k_t * p_j2k,
return OPJ_TRUE;
}
void opj_j2k_get_tile_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data)
void opj_j2k_get_tile_data (opj_tcd_t * p_tcd, OPJ_BYTE * p_data)
{
OPJ_UINT32 i,j,k = 0;
OPJ_UINT32 l_width,l_height,l_stride, l_offset_x,l_offset_y, l_image_width;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tilecomp_v2_t * l_tilec = 00;
opj_tcd_tilecomp_t * l_tilec = 00;
opj_image_t * l_image = 00;
OPJ_UINT32 l_size_comp, l_remaining;
OPJ_INT32 * l_src_ptr;
@ -9249,7 +9249,7 @@ opj_bool opj_j2k_post_write_tile ( opj_j2k_t * p_j2k,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager )
{
opj_tcd_v2_t * l_tcd = 00;
opj_tcd_t * l_tcd = 00;
opj_cp_v2_t * l_cp = 00;
opj_tcp_v2_t * l_tcp = 00;
OPJ_UINT32 l_nb_bytes_written;
@ -9381,7 +9381,7 @@ opj_bool opj_j2k_write_first_tile_part (opj_j2k_t *p_j2k,
OPJ_BYTE * l_begin_data = 00;
opj_tcp_v2_t *l_tcp = 00;
opj_tcd_v2_t * l_tcd = 00;
opj_tcd_t * l_tcd = 00;
opj_cp_v2_t * l_cp = 00;
l_tcd = p_j2k->m_tcd;
@ -9466,7 +9466,7 @@ opj_bool opj_j2k_write_all_tile_parts( opj_j2k_t *p_j2k,
OPJ_BYTE * l_begin_data;
opj_tcp_v2_t *l_tcp = 00;
opj_tcd_v2_t * l_tcd = 00;
opj_tcd_t * l_tcd = 00;
opj_cp_v2_t * l_cp = 00;
l_tcd = p_j2k->m_tcd;

View File

@ -670,7 +670,7 @@ typedef struct opj_j2k_enc
struct opj_tcd_v2;
struct opj_tcd;
/**
JPEG-2000 codestream reader/writer
*/
@ -697,10 +697,10 @@ typedef struct opj_j2k
opj_cp_v2_t m_cp;
/** the list of procedures to exec **/
struct opj_procedure_list * m_procedure_list;
opj_procedure_list_t * m_procedure_list;
/** the list of validation procedures to follow to make sure the code is valid **/
struct opj_procedure_list * m_validation_list;
opj_procedure_list_t * m_validation_list;
/** helper used to write the index file */
opj_codestream_index_t *cstr_index;
@ -709,7 +709,7 @@ typedef struct opj_j2k
OPJ_UINT32 m_current_tile_number;
/** the current tile coder/decoder **/
struct opj_tcd_v2 * m_tcd;
struct opj_tcd * m_tcd;
}
opj_j2k_t;

View File

@ -148,6 +148,7 @@ static INLINE long lrintf(float f){
#include "opj_inttypes.h"
#include "opj_clock.h"
#include "opj_malloc.h"
#include "function_list.h"
#include "event.h"
#include "bio.h"
#include "cio.h"
@ -160,8 +161,9 @@ static INLINE long lrintf(float f){
#include "mqc.h"
#include "raw.h"
#include "bio.h"
#include "tgt.h"
#include "pi.h"
#include "tgt.h"
#include "tcd.h"
#include "t1.h"
#include "dwt.h"
@ -181,6 +183,6 @@ static INLINE long lrintf(float f){
/* <<JPWL */
/* V2 */
#include "function_list.h"
#endif /* OPJ_INCLUDES_H */

View File

@ -207,7 +207,7 @@ static OPJ_FLOAT64 t1_getwmsedec_v2(
const OPJ_FLOAT64 * mct_norms);
static void opj_t1_encode_cblk( opj_t1_t *t1,
opj_tcd_cblk_enc_v2_t* cblk,
opj_tcd_cblk_enc_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 compno,
OPJ_UINT32 level,
@ -215,7 +215,7 @@ static void opj_t1_encode_cblk( opj_t1_t *t1,
OPJ_FLOAT64 stepsize,
OPJ_UINT32 cblksty,
OPJ_UINT32 numcomps,
opj_tcd_tile_v2_t * tile,
opj_tcd_tile_t * tile,
const OPJ_FLOAT64 * mct_norms);
/**
@ -227,7 +227,7 @@ Decode 1 code-block
@param cblksty Code-block style
*/
static opj_bool opj_t1_decode_cblk( opj_t1_t *t1,
opj_tcd_cblk_dec_v2_t* cblk,
opj_tcd_cblk_dec_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 roishift,
OPJ_UINT32 cblksty);
@ -892,7 +892,7 @@ void opj_t1_destroy(opj_t1_t *p_t1)
}
opj_bool opj_t1_decode_cblks( opj_t1_t* t1,
opj_tcd_tilecomp_v2_t* tilec,
opj_tcd_tilecomp_t* tilec,
opj_tccp_t* tccp
)
{
@ -900,16 +900,16 @@ opj_bool opj_t1_decode_cblks( opj_t1_t* t1,
OPJ_UINT32 tile_w = tilec->x1 - tilec->x0;
for (resno = 0; resno < tilec->minimum_num_resolutions; ++resno) {
opj_tcd_resolution_v2_t* res = &tilec->resolutions[resno];
opj_tcd_resolution_t* res = &tilec->resolutions[resno];
for (bandno = 0; bandno < res->numbands; ++bandno) {
opj_tcd_band_v2_t* restrict band = &res->bands[bandno];
opj_tcd_band_t* restrict band = &res->bands[bandno];
for (precno = 0; precno < res->pw * res->ph; ++precno) {
opj_tcd_precinct_v2_t* precinct = &band->precincts[precno];
opj_tcd_precinct_t* precinct = &band->precincts[precno];
for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) {
opj_tcd_cblk_dec_v2_t* cblk = &precinct->cblks.dec[cblkno];
opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno];
OPJ_INT32* restrict datap;
void* restrict tiledp;
OPJ_UINT32 cblk_w, cblk_h;
@ -928,11 +928,11 @@ opj_bool opj_t1_decode_cblks( opj_t1_t* t1,
x = cblk->x0 - band->x0;
y = cblk->y0 - band->y0;
if (band->bandno & 1) {
opj_tcd_resolution_v2_t* pres = &tilec->resolutions[resno - 1];
opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
x += pres->x1 - pres->x0;
}
if (band->bandno & 2) {
opj_tcd_resolution_v2_t* pres = &tilec->resolutions[resno - 1];
opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1];
y += pres->y1 - pres->y0;
}
@ -981,7 +981,7 @@ opj_bool opj_t1_decode_cblks( opj_t1_t* t1,
opj_bool opj_t1_decode_cblk(opj_t1_t *t1,
opj_tcd_cblk_dec_v2_t* cblk,
opj_tcd_cblk_dec_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 roishift,
OPJ_UINT32 cblksty)
@ -1056,7 +1056,7 @@ opj_bool opj_t1_decode_cblk(opj_t1_t *t1,
}
opj_bool opj_t1_encode_cblks( opj_t1_t *t1,
opj_tcd_tile_v2_t *tile,
opj_tcd_tile_t *tile,
opj_tcp_v2_t *tcp,
const OPJ_FLOAT64 * mct_norms
)
@ -1066,22 +1066,22 @@ opj_bool opj_t1_encode_cblks( opj_t1_t *t1,
tile->distotile = 0; /* fixed_quality */
for (compno = 0; compno < tile->numcomps; ++compno) {
opj_tcd_tilecomp_v2_t* tilec = &tile->comps[compno];
opj_tcd_tilecomp_t* tilec = &tile->comps[compno];
opj_tccp_t* tccp = &tcp->tccps[compno];
OPJ_UINT32 tile_w = tilec->x1 - tilec->x0;
for (resno = 0; resno < tilec->numresolutions; ++resno) {
opj_tcd_resolution_v2_t *res = &tilec->resolutions[resno];
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
for (bandno = 0; bandno < res->numbands; ++bandno) {
opj_tcd_band_v2_t* restrict band = &res->bands[bandno];
opj_tcd_band_t* restrict band = &res->bands[bandno];
OPJ_INT32 bandconst = 8192 * 8192 / ((OPJ_INT32) floor(band->stepsize * 8192));
for (precno = 0; precno < res->pw * res->ph; ++precno) {
opj_tcd_precinct_v2_t *prc = &band->precincts[precno];
opj_tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; ++cblkno) {
opj_tcd_cblk_enc_v2_t* cblk = &prc->cblks.enc[cblkno];
opj_tcd_cblk_enc_t* cblk = &prc->cblks.enc[cblkno];
OPJ_INT32 * restrict datap;
OPJ_INT32* restrict tiledp;
OPJ_UINT32 cblk_w;
@ -1091,11 +1091,11 @@ opj_bool opj_t1_encode_cblks( opj_t1_t *t1,
OPJ_INT32 x = cblk->x0 - band->x0;
OPJ_INT32 y = cblk->y0 - band->y0;
if (band->bandno & 1) {
opj_tcd_resolution_v2_t *pres = &tilec->resolutions[resno - 1];
opj_tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
x += pres->x1 - pres->x0;
}
if (band->bandno & 2) {
opj_tcd_resolution_v2_t *pres = &tilec->resolutions[resno - 1];
opj_tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
y += pres->y1 - pres->y0;
}
@ -1154,7 +1154,7 @@ opj_bool opj_t1_encode_cblks( opj_t1_t *t1,
/** mod fixed_quality */
void opj_t1_encode_cblk(opj_t1_t *t1,
opj_tcd_cblk_enc_v2_t* cblk,
opj_tcd_cblk_enc_t* cblk,
OPJ_UINT32 orient,
OPJ_UINT32 compno,
OPJ_UINT32 level,
@ -1162,7 +1162,7 @@ void opj_t1_encode_cblk(opj_t1_t *t1,
OPJ_FLOAT64 stepsize,
OPJ_UINT32 cblksty,
OPJ_UINT32 numcomps,
opj_tcd_tile_v2_t * tile,
opj_tcd_tile_t * tile,
const OPJ_FLOAT64 * mct_norms)
{
OPJ_FLOAT64 cumwmsedec = 0.0;
@ -1196,7 +1196,7 @@ void opj_t1_encode_cblk(opj_t1_t *t1,
opj_mqc_init_enc(mqc, cblk->data);
for (passno = 0; bpno >= 0; ++passno) {
opj_tcd_pass_v2_t *pass = &cblk->passes[passno];
opj_tcd_pass_t *pass = &cblk->passes[passno];
OPJ_UINT32 correction = 3;
type = ((bpno < ((OPJ_INT32) (cblk->numbps) - 4)) && (passtype < 2) && (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
@ -1278,7 +1278,7 @@ void opj_t1_encode_cblk(opj_t1_t *t1,
cblk->totalpasses = passno;
for (passno = 0; passno<cblk->totalpasses; passno++) {
opj_tcd_pass_v2_t *pass = &cblk->passes[passno];
opj_tcd_pass_t *pass = &cblk->passes[passno];
if (pass->rate > opj_mqc_numbytes(mqc))
pass->rate = opj_mqc_numbytes(mqc);
/*Preventing generation of FF as last data byte of a pass*/

View File

@ -122,7 +122,7 @@ Encode the code-blocks of a tile
@param mct_norms FIXME DOC
*/
opj_bool opj_t1_encode_cblks( opj_t1_t *t1,
opj_tcd_tile_v2_t *tile,
opj_tcd_tile_t *tile,
opj_tcp_v2_t *tcp,
const OPJ_FLOAT64 * mct_norms);
@ -133,7 +133,7 @@ Decode the code-blocks of a tile
@param tccp Tile coding parameters
*/
opj_bool opj_t1_decode_cblks( opj_t1_t* t1,
opj_tcd_tilecomp_v2_t* tilec,
opj_tcd_tilecomp_t* tilec,
opj_tccp_t* tccp);

View File

@ -61,7 +61,7 @@ Encode a packet of a tile to a destination buffer
@return
*/
static opj_bool opj_t2_encode_packet( OPJ_UINT32 tileno,
opj_tcd_tile_v2_t *tile,
opj_tcd_tile_t *tile,
opj_tcp_v2_t *tcp,
opj_pi_iterator_t *pi,
OPJ_BYTE *dest,
@ -83,7 +83,7 @@ Decode a packet of a tile from a source buffer
@return FIXME DOC
*/
static opj_bool opj_t2_decode_packet( opj_t2_v2_t* t2,
opj_tcd_tile_v2_t *tile,
opj_tcd_tile_t *tile,
opj_tcp_v2_t *tcp,
opj_pi_iterator_t *pi,
OPJ_BYTE *src,
@ -92,7 +92,7 @@ static opj_bool opj_t2_decode_packet( opj_t2_v2_t* t2,
opj_packet_info_t *pack_info);
static opj_bool opj_t2_skip_packet( opj_t2_v2_t* p_t2,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
opj_tcp_v2_t *p_tcp,
opj_pi_iterator_t *p_pi,
OPJ_BYTE *p_src,
@ -101,7 +101,7 @@ static opj_bool opj_t2_skip_packet( opj_t2_v2_t* p_t2,
opj_packet_info_t *p_pack_info);
static opj_bool opj_t2_read_packet_header( opj_t2_v2_t* p_t2,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
opj_tcp_v2_t *p_tcp,
opj_pi_iterator_t *p_pi,
opj_bool * p_is_data_present,
@ -111,7 +111,7 @@ static opj_bool opj_t2_read_packet_header( opj_t2_v2_t* p_t2,
opj_packet_info_t *p_pack_info);
static opj_bool opj_t2_read_packet_data(opj_t2_v2_t* p_t2,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
opj_pi_iterator_t *p_pi,
OPJ_BYTE *p_src_data,
OPJ_UINT32 * p_data_read,
@ -119,7 +119,7 @@ static opj_bool opj_t2_read_packet_data(opj_t2_v2_t* p_t2,
opj_packet_info_t *pack_info);
static opj_bool opj_t2_skip_packet_data(opj_t2_v2_t* p_t2,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
opj_pi_iterator_t *p_pi,
OPJ_UINT32 * p_data_read,
OPJ_UINT32 p_max_length,
@ -131,7 +131,7 @@ static opj_bool opj_t2_skip_packet_data(opj_t2_v2_t* p_t2,
@param cblksty
@param first
*/
static opj_bool opj_t2_init_seg( opj_tcd_cblk_dec_v2_t* cblk,
static opj_bool opj_t2_init_seg( opj_tcd_cblk_dec_t* cblk,
OPJ_UINT32 index,
OPJ_UINT32 cblksty,
OPJ_UINT32 first);
@ -191,7 +191,7 @@ OPJ_UINT32 opj_t2_getnumpasses(opj_bio_t *bio) {
opj_bool opj_t2_encode_packets( opj_t2_v2_t* p_t2,
OPJ_UINT32 p_tile_no,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
OPJ_UINT32 p_maxlayers,
OPJ_BYTE *p_dest,
OPJ_UINT32 * p_data_written,
@ -312,7 +312,7 @@ opj_bool opj_t2_encode_packets( opj_t2_v2_t* p_t2,
opj_bool opj_t2_decode_packets( opj_t2_v2_t *p_t2,
OPJ_UINT32 p_tile_no,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
OPJ_BYTE *p_src,
OPJ_UINT32 * p_data_read,
OPJ_UINT32 p_max_len,
@ -464,7 +464,7 @@ void opj_t2_destroy(opj_t2_v2_t *t2) {
}
opj_bool opj_t2_decode_packet( opj_t2_v2_t* p_t2,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
opj_tcp_v2_t *p_tcp,
opj_pi_iterator_t *p_pi,
OPJ_BYTE *p_src,
@ -503,7 +503,7 @@ opj_bool opj_t2_decode_packet( opj_t2_v2_t* p_t2,
}
opj_bool opj_t2_encode_packet( OPJ_UINT32 tileno,
opj_tcd_tile_v2_t * tile,
opj_tcd_tile_t * tile,
opj_tcp_v2_t * tcp,
opj_pi_iterator_t *pi,
OPJ_BYTE *dest,
@ -519,12 +519,12 @@ opj_bool opj_t2_encode_packet( OPJ_UINT32 tileno,
OPJ_UINT32 precno = pi->precno; /* precinct value */
OPJ_UINT32 layno = pi->layno; /* quality layer value */
OPJ_UINT32 l_nb_blocks;
opj_tcd_band_v2_t *band = 00;
opj_tcd_cblk_enc_v2_t* cblk = 00;
opj_tcd_pass_v2_t *pass = 00;
opj_tcd_band_t *band = 00;
opj_tcd_cblk_enc_t* cblk = 00;
opj_tcd_pass_t *pass = 00;
opj_tcd_tilecomp_v2_t *tilec = &tile->comps[compno];
opj_tcd_resolution_v2_t *res = &tilec->resolutions[resno];
opj_tcd_tilecomp_t *tilec = &tile->comps[compno];
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
opj_bio_t *bio = 00; /* BIO component */
@ -545,14 +545,14 @@ opj_bool opj_t2_encode_packet( OPJ_UINT32 tileno,
band = res->bands;
for(bandno = 0; bandno < res->numbands; ++bandno) {
opj_tcd_precinct_v2_t *prc = &band->precincts[precno];
opj_tcd_precinct_t *prc = &band->precincts[precno];
opj_tgt_reset(prc->incltree);
opj_tgt_reset(prc->imsbtree);
l_nb_blocks = prc->cw * prc->ch;
for (cblkno = 0; cblkno < l_nb_blocks; ++cblkno) {
opj_tcd_cblk_enc_v2_t* cblk = &prc->cblks.enc[cblkno];
opj_tcd_cblk_enc_t* cblk = &prc->cblks.enc[cblkno];
cblk->numpasses = 0;
opj_tgt_setvalue(prc->imsbtree, cblkno, band->numbps - cblk->numbps);
@ -568,7 +568,7 @@ opj_bool opj_t2_encode_packet( OPJ_UINT32 tileno,
/* Writing Packet header */
band = res->bands;
for (bandno = 0; bandno < res->numbands; ++bandno) {
opj_tcd_precinct_v2_t *prc = &band->precincts[precno];
opj_tcd_precinct_t *prc = &band->precincts[precno];
l_nb_blocks = prc->cw * prc->ch;
cblk = prc->cblks.enc;
@ -685,7 +685,7 @@ opj_bool opj_t2_encode_packet( OPJ_UINT32 tileno,
/* Writing the packet body */
band = res->bands;
for (bandno = 0; bandno < res->numbands; bandno++) {
opj_tcd_precinct_v2_t *prc = &band->precincts[precno];
opj_tcd_precinct_t *prc = &band->precincts[precno];
l_nb_blocks = prc->cw * prc->ch;
cblk = prc->cblks.enc;
@ -728,7 +728,7 @@ opj_bool opj_t2_encode_packet( OPJ_UINT32 tileno,
}
static opj_bool opj_t2_skip_packet( opj_t2_v2_t* p_t2,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
opj_tcp_v2_t *p_tcp,
opj_pi_iterator_t *p_pi,
OPJ_BYTE *p_src,
@ -768,7 +768,7 @@ static opj_bool opj_t2_skip_packet( opj_t2_v2_t* p_t2,
opj_bool opj_t2_read_packet_header( opj_t2_v2_t* p_t2,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
opj_tcp_v2_t *p_tcp,
opj_pi_iterator_t *p_pi,
opj_bool * p_is_data_present,
@ -787,9 +787,9 @@ opj_bool opj_t2_read_packet_header( opj_t2_v2_t* p_t2,
OPJ_BYTE *l_current_data = p_src_data;
opj_cp_v2_t *l_cp = p_t2->cp;
opj_bio_t *l_bio = 00; /* BIO component */
opj_tcd_band_v2_t *l_band = 00;
opj_tcd_cblk_dec_v2_t* l_cblk = 00;
opj_tcd_resolution_v2_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
opj_tcd_band_t *l_band = 00;
opj_tcd_cblk_dec_t* l_cblk = 00;
opj_tcd_resolution_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
OPJ_BYTE *l_header_data = 00;
OPJ_BYTE **l_header_data_start = 00;
@ -801,7 +801,7 @@ opj_bool opj_t2_read_packet_header( opj_t2_v2_t* p_t2,
/* reset tagtrees */
for (bandno = 0; bandno < l_res->numbands; ++bandno) {
opj_tcd_precinct_v2_t *l_prc = &l_band->precincts[p_pi->precno];
opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
if ( ! ((l_band->x1-l_band->x0 == 0)||(l_band->y1-l_band->y0 == 0)) ) {
opj_tgt_reset(l_prc->incltree);
@ -899,7 +899,7 @@ opj_bool opj_t2_read_packet_header( opj_t2_v2_t* p_t2,
l_band = l_res->bands;
for (bandno = 0; bandno < l_res->numbands; ++bandno) {
opj_tcd_precinct_v2_t *l_prc = &(l_band->precincts[p_pi->precno]);
opj_tcd_precinct_t *l_prc = &(l_band->precincts[p_pi->precno]);
if ((l_band->x1-l_band->x0 == 0)||(l_band->y1-l_band->y0 == 0)) {
++l_band;
@ -1023,7 +1023,7 @@ opj_bool opj_t2_read_packet_header( opj_t2_v2_t* p_t2,
}
opj_bool opj_t2_read_packet_data( opj_t2_v2_t* p_t2,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
opj_pi_iterator_t *p_pi,
OPJ_BYTE *p_src_data,
OPJ_UINT32 * p_data_read,
@ -1033,13 +1033,13 @@ opj_bool opj_t2_read_packet_data( opj_t2_v2_t* p_t2,
OPJ_UINT32 bandno, cblkno;
OPJ_UINT32 l_nb_code_blocks;
OPJ_BYTE *l_current_data = p_src_data;
opj_tcd_band_v2_t *l_band = 00;
opj_tcd_cblk_dec_v2_t* l_cblk = 00;
opj_tcd_resolution_v2_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
opj_tcd_band_t *l_band = 00;
opj_tcd_cblk_dec_t* l_cblk = 00;
opj_tcd_resolution_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
l_band = l_res->bands;
for (bandno = 0; bandno < l_res->numbands; ++bandno) {
opj_tcd_precinct_v2_t *l_prc = &l_band->precincts[p_pi->precno];
opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
if ((l_band->x1-l_band->x0 == 0)||(l_band->y1-l_band->y0 == 0)) {
++l_band;
@ -1135,7 +1135,7 @@ opj_bool opj_t2_read_packet_data( opj_t2_v2_t* p_t2,
}
opj_bool opj_t2_skip_packet_data( opj_t2_v2_t* p_t2,
opj_tcd_tile_v2_t *p_tile,
opj_tcd_tile_t *p_tile,
opj_pi_iterator_t *p_pi,
OPJ_UINT32 * p_data_read,
OPJ_UINT32 p_max_length,
@ -1143,15 +1143,15 @@ opj_bool opj_t2_skip_packet_data( opj_t2_v2_t* p_t2,
{
OPJ_UINT32 bandno, cblkno;
OPJ_UINT32 l_nb_code_blocks;
opj_tcd_band_v2_t *l_band = 00;
opj_tcd_cblk_dec_v2_t* l_cblk = 00;
opj_tcd_resolution_v2_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
opj_tcd_band_t *l_band = 00;
opj_tcd_cblk_dec_t* l_cblk = 00;
opj_tcd_resolution_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
*p_data_read = 0;
l_band = l_res->bands;
for (bandno = 0; bandno < l_res->numbands; ++bandno) {
opj_tcd_precinct_v2_t *l_prc = &l_band->precincts[p_pi->precno];
opj_tcd_precinct_t *l_prc = &l_band->precincts[p_pi->precno];
if ((l_band->x1-l_band->x0 == 0)||(l_band->y1-l_band->y0 == 0)) {
++l_band;
@ -1229,7 +1229,7 @@ opj_bool opj_t2_skip_packet_data( opj_t2_v2_t* p_t2,
}
opj_bool opj_t2_init_seg( opj_tcd_cblk_dec_v2_t* cblk,
opj_bool opj_t2_init_seg( opj_tcd_cblk_dec_t* cblk,
OPJ_UINT32 index,
OPJ_UINT32 cblksty,
OPJ_UINT32 first)

View File

@ -86,7 +86,7 @@ Encode the packets of a tile to a destination buffer
*/
opj_bool opj_t2_encode_packets( opj_t2_v2_t* t2,
OPJ_UINT32 tileno,
opj_tcd_tile_v2_t *tile,
opj_tcd_tile_t *tile,
OPJ_UINT32 maxlayers,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
@ -111,7 +111,7 @@ Decode the packets of a tile from a source buffer
*/
opj_bool opj_t2_decode_packets( opj_t2_v2_t *t2,
OPJ_UINT32 tileno,
opj_tcd_tile_v2_t *tile,
opj_tcd_tile_t *tile,
OPJ_BYTE *src,
OPJ_UINT32 * p_data_read,
OPJ_UINT32 len,

View File

@ -98,61 +98,61 @@ void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t * img) {
/**
* Allocates memory for a decoding code block.
*/
static opj_bool opj_tcd_code_block_dec_allocate (opj_tcd_cblk_dec_v2_t * p_code_block);
static opj_bool opj_tcd_code_block_dec_allocate (opj_tcd_cblk_dec_t * p_code_block);
/**
* Deallocates the decoding data of the given precinct.
*/
static void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_v2_t * p_precinct);
static void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_t * p_precinct);
/**
* Allocates memory for an encoding code block.
*/
static opj_bool opj_tcd_code_block_enc_allocate (opj_tcd_cblk_enc_v2_t * p_code_block);
static opj_bool opj_tcd_code_block_enc_allocate (opj_tcd_cblk_enc_t * p_code_block);
/**
* Deallocates the encoding data of the given precinct.
*/
static void opj_tcd_code_block_enc_deallocate (opj_tcd_precinct_v2_t * p_precinct);
static void opj_tcd_code_block_enc_deallocate (opj_tcd_precinct_t * p_precinct);
/**
Free the memory allocated for encoding
@param tcd TCD handle
*/
static void opj_tcd_free_tile(opj_tcd_v2_t *tcd);
static void opj_tcd_free_tile(opj_tcd_t *tcd);
static opj_bool opj_tcd_t2_decode ( opj_tcd_v2_t *p_tcd,
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 );
static opj_bool opj_tcd_t1_decode (opj_tcd_v2_t *p_tcd);
static opj_bool opj_tcd_t1_decode (opj_tcd_t *p_tcd);
static opj_bool opj_tcd_dwt_decode (opj_tcd_v2_t *p_tcd);
static opj_bool opj_tcd_dwt_decode (opj_tcd_t *p_tcd);
static opj_bool opj_tcd_mct_decode (opj_tcd_v2_t *p_tcd);
static opj_bool opj_tcd_mct_decode (opj_tcd_t *p_tcd);
static opj_bool opj_tcd_dc_level_shift_decode (opj_tcd_v2_t *p_tcd);
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_v2_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_v2_t *p_tcd );
static opj_bool opj_tcd_mct_encode ( opj_tcd_t *p_tcd );
static opj_bool opj_tcd_dwt_encode ( opj_tcd_v2_t *p_tcd );
static opj_bool opj_tcd_dwt_encode ( opj_tcd_t *p_tcd );
static opj_bool opj_tcd_t1_encode ( opj_tcd_v2_t *p_tcd );
static opj_bool opj_tcd_t1_encode ( opj_tcd_t *p_tcd );
static opj_bool opj_tcd_t2_encode ( opj_tcd_v2_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 );
static opj_bool opj_tcd_rate_allocate_encode( opj_tcd_v2_t *p_tcd,
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 );
@ -162,25 +162,25 @@ static opj_bool opj_tcd_rate_allocate_encode( opj_tcd_v2_t *p_tcd,
/**
Create a new TCD handle
*/
opj_tcd_v2_t* opj_tcd_create(opj_bool p_is_decoder)
opj_tcd_t* opj_tcd_create(opj_bool p_is_decoder)
{
opj_tcd_v2_t *l_tcd = 00;
opj_tcd_t *l_tcd = 00;
/* create the tcd structure */
l_tcd = (opj_tcd_v2_t*) opj_malloc(sizeof(opj_tcd_v2_t));
l_tcd = (opj_tcd_t*) opj_malloc(sizeof(opj_tcd_t));
if (!l_tcd) {
return 00;
}
memset(l_tcd,0,sizeof(opj_tcd_v2_t));
memset(l_tcd,0,sizeof(opj_tcd_t));
l_tcd->m_is_decoder = p_is_decoder ? 1 : 0;
l_tcd->tcd_image = (opj_tcd_image_v2_t*)opj_malloc(sizeof(opj_tcd_image_v2_t));
l_tcd->tcd_image = (opj_tcd_image_t*)opj_malloc(sizeof(opj_tcd_image_t));
if (!l_tcd->tcd_image) {
opj_free(l_tcd);
return 00;
}
memset(l_tcd->tcd_image,0,sizeof(opj_tcd_image_v2_t));
memset(l_tcd->tcd_image,0,sizeof(opj_tcd_image_t));
return l_tcd;
}
@ -188,7 +188,7 @@ opj_tcd_v2_t* opj_tcd_create(opj_bool p_is_decoder)
/* ----------------------------------------------------------------------- */
void opj_tcd_rateallocate_fixed(opj_tcd_v2_t *tcd) {
void opj_tcd_rateallocate_fixed(opj_tcd_t *tcd) {
OPJ_UINT32 layno;
for (layno = 0; layno < tcd->tcp->numlayers; layno++) {
@ -197,7 +197,7 @@ void opj_tcd_rateallocate_fixed(opj_tcd_v2_t *tcd) {
}
void opj_tcd_makelayer( opj_tcd_v2_t *tcd,
void opj_tcd_makelayer( opj_tcd_t *tcd,
OPJ_UINT32 layno,
OPJ_FLOAT64 thresh,
OPJ_UINT32 final)
@ -205,24 +205,24 @@ void opj_tcd_makelayer( opj_tcd_v2_t *tcd,
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
OPJ_UINT32 passno;
opj_tcd_tile_v2_t *tcd_tile = tcd->tcd_image->tiles;
opj_tcd_tile_t *tcd_tile = tcd->tcd_image->tiles;
tcd_tile->distolayer[layno] = 0; /* fixed_quality */
for (compno = 0; compno < tcd_tile->numcomps; compno++) {
opj_tcd_tilecomp_v2_t *tilec = &tcd_tile->comps[compno];
opj_tcd_tilecomp_t *tilec = &tcd_tile->comps[compno];
for (resno = 0; resno < tilec->numresolutions; resno++) {
opj_tcd_resolution_v2_t *res = &tilec->resolutions[resno];
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
for (bandno = 0; bandno < res->numbands; bandno++) {
opj_tcd_band_v2_t *band = &res->bands[bandno];
opj_tcd_band_t *band = &res->bands[bandno];
for (precno = 0; precno < res->pw * res->ph; precno++) {
opj_tcd_precinct_v2_t *prc = &band->precincts[precno];
opj_tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
opj_tcd_cblk_enc_v2_t *cblk = &prc->cblks.enc[cblkno];
opj_tcd_cblk_enc_t *cblk = &prc->cblks.enc[cblkno];
opj_tcd_layer_t *layer = &cblk->layers[layno];
OPJ_UINT32 n;
@ -235,7 +235,7 @@ void opj_tcd_makelayer( opj_tcd_v2_t *tcd,
for (passno = cblk->numpassesinlayers; passno < cblk->totalpasses; passno++) {
OPJ_UINT32 dr;
OPJ_FLOAT64 dd;
opj_tcd_pass_v2_t *pass = &cblk->passes[passno];
opj_tcd_pass_t *pass = &cblk->passes[passno];
if (n == 0) {
dr = pass->rate;
@ -282,18 +282,18 @@ void opj_tcd_makelayer( opj_tcd_v2_t *tcd,
}
}
void opj_tcd_makelayer_fixed(opj_tcd_v2_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 final) {
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 final) {
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
OPJ_INT32 value; /*, matrice[tcd_tcp->numlayers][tcd_tile->comps[0].numresolutions][3]; */
OPJ_INT32 matrice[10][10][3];
OPJ_UINT32 i, j, k;
opj_cp_v2_t *cp = tcd->cp;
opj_tcd_tile_v2_t *tcd_tile = tcd->tcd_image->tiles;
opj_tcd_tile_t *tcd_tile = tcd->tcd_image->tiles;
opj_tcp_v2_t *tcd_tcp = tcd->tcp;
for (compno = 0; compno < tcd_tile->numcomps; compno++) {
opj_tcd_tilecomp_v2_t *tilec = &tcd_tile->comps[compno];
opj_tcd_tilecomp_t *tilec = &tcd_tile->comps[compno];
for (i = 0; i < tcd_tcp->numlayers; i++) {
for (j = 0; j < tilec->numresolutions; j++) {
@ -306,16 +306,16 @@ void opj_tcd_makelayer_fixed(opj_tcd_v2_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 fin
}
for (resno = 0; resno < tilec->numresolutions; resno++) {
opj_tcd_resolution_v2_t *res = &tilec->resolutions[resno];
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
for (bandno = 0; bandno < res->numbands; bandno++) {
opj_tcd_band_v2_t *band = &res->bands[bandno];
opj_tcd_band_t *band = &res->bands[bandno];
for (precno = 0; precno < res->pw * res->ph; precno++) {
opj_tcd_precinct_v2_t *prc = &band->precincts[precno];
opj_tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
opj_tcd_cblk_enc_v2_t *cblk = &prc->cblks.enc[cblkno];
opj_tcd_cblk_enc_t *cblk = &prc->cblks.enc[cblkno];
opj_tcd_layer_t *layer = &cblk->layers[layno];
OPJ_UINT32 n;
OPJ_INT32 imsb = tcd->image->comps[compno].prec - cblk->numbps; /* number of bit-plan equal to zero */
@ -375,7 +375,7 @@ void opj_tcd_makelayer_fixed(opj_tcd_v2_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 fin
}
}
opj_bool opj_tcd_rateallocate( opj_tcd_v2_t *tcd,
opj_bool opj_tcd_rateallocate( opj_tcd_t *tcd,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 len,
@ -389,7 +389,7 @@ opj_bool opj_tcd_rateallocate( opj_tcd_v2_t *tcd,
OPJ_FLOAT64 maxSE = 0;
opj_cp_v2_t *cp = tcd->cp;
opj_tcd_tile_v2_t *tcd_tile = tcd->tcd_image->tiles;
opj_tcd_tile_t *tcd_tile = tcd->tcd_image->tiles;
opj_tcp_v2_t *tcd_tcp = tcd->tcp;
min = DBL_MAX;
@ -398,23 +398,23 @@ opj_bool opj_tcd_rateallocate( opj_tcd_v2_t *tcd,
tcd_tile->numpix = 0; /* fixed_quality */
for (compno = 0; compno < tcd_tile->numcomps; compno++) {
opj_tcd_tilecomp_v2_t *tilec = &tcd_tile->comps[compno];
opj_tcd_tilecomp_t *tilec = &tcd_tile->comps[compno];
tilec->numpix = 0;
for (resno = 0; resno < tilec->numresolutions; resno++) {
opj_tcd_resolution_v2_t *res = &tilec->resolutions[resno];
opj_tcd_resolution_t *res = &tilec->resolutions[resno];
for (bandno = 0; bandno < res->numbands; bandno++) {
opj_tcd_band_v2_t *band = &res->bands[bandno];
opj_tcd_band_t *band = &res->bands[bandno];
for (precno = 0; precno < res->pw * res->ph; precno++) {
opj_tcd_precinct_v2_t *prc = &band->precincts[precno];
opj_tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
opj_tcd_cblk_enc_v2_t *cblk = &prc->cblks.enc[cblkno];
opj_tcd_cblk_enc_t *cblk = &prc->cblks.enc[cblkno];
for (passno = 0; passno < cblk->totalpasses; passno++) {
opj_tcd_pass_v2_t *pass = &cblk->passes[passno];
opj_tcd_pass_t *pass = &cblk->passes[passno];
OPJ_INT32 dr;
OPJ_FLOAT64 dd, rdslope;
@ -563,7 +563,7 @@ opj_bool opj_tcd_rateallocate( opj_tcd_v2_t *tcd,
return OPJ_TRUE;
}
opj_bool opj_tcd_init( opj_tcd_v2_t *p_tcd,
opj_bool opj_tcd_init( opj_tcd_t *p_tcd,
opj_image_t * p_image,
opj_cp_v2_t * p_cp )
{
@ -572,14 +572,14 @@ opj_bool opj_tcd_init( opj_tcd_v2_t *p_tcd,
p_tcd->image = p_image;
p_tcd->cp = p_cp;
p_tcd->tcd_image->tiles = (opj_tcd_tile_v2_t *) opj_malloc(sizeof(opj_tcd_tile_v2_t));
p_tcd->tcd_image->tiles = (opj_tcd_tile_t *) opj_malloc(sizeof(opj_tcd_tile_t));
if (! p_tcd->tcd_image->tiles) {
return OPJ_FALSE;
}
memset(p_tcd->tcd_image->tiles,0, sizeof(opj_tcd_tile_v2_t));
memset(p_tcd->tcd_image->tiles,0, sizeof(opj_tcd_tile_t));
l_tile_comp_size = p_image->numcomps * sizeof(opj_tcd_tilecomp_v2_t);
p_tcd->tcd_image->tiles->comps = (opj_tcd_tilecomp_v2_t *) opj_malloc(l_tile_comp_size);
l_tile_comp_size = p_image->numcomps * sizeof(opj_tcd_tilecomp_t);
p_tcd->tcd_image->tiles->comps = (opj_tcd_tilecomp_t *) opj_malloc(l_tile_comp_size);
if (! p_tcd->tcd_image->tiles->comps ) {
return OPJ_FALSE;
}
@ -594,7 +594,7 @@ opj_bool opj_tcd_init( opj_tcd_v2_t *p_tcd,
/**
Destroy a previously created TCD handle
*/
void opj_tcd_destroy(opj_tcd_v2_t *tcd) {
void opj_tcd_destroy(opj_tcd_t *tcd) {
if (tcd) {
opj_tcd_free_tile(tcd);
@ -608,7 +608,7 @@ void opj_tcd_destroy(opj_tcd_v2_t *tcd) {
/* ----------------------------------------------------------------------- */
#define MACRO_TCD_ALLOCATE(FUNCTION,TYPE,FRACTION,ELEMENT,FUNCTION_ELEMENT) \
opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
opj_bool FUNCTION ( opj_tcd_t *p_tcd, \
OPJ_UINT32 p_tile_no \
) \
{ \
@ -616,14 +616,14 @@ opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
OPJ_UINT32 compno, resno, bandno, precno, cblkno; \
opj_tcp_v2_t * l_tcp = 00; \
opj_cp_v2_t * l_cp = 00; \
opj_tcd_tile_v2_t * l_tile = 00; \
opj_tcd_tile_t * l_tile = 00; \
opj_tccp_t *l_tccp = 00; \
opj_tcd_tilecomp_v2_t *l_tilec = 00; \
opj_tcd_tilecomp_t *l_tilec = 00; \
opj_image_comp_t * l_image_comp = 00; \
opj_tcd_resolution_v2_t *l_res = 00; \
opj_tcd_band_v2_t *l_band = 00; \
opj_tcd_resolution_t *l_res = 00; \
opj_tcd_band_t *l_band = 00; \
opj_stepsize_t * l_step_size = 00; \
opj_tcd_precinct_v2_t *l_current_precinct = 00; \
opj_tcd_precinct_t *l_current_precinct = 00; \
TYPE* l_code_block = 00; \
opj_image_t *l_image = 00; \
OPJ_UINT32 p,q; \
@ -709,19 +709,19 @@ opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
l_tilec->data_size = l_data_size; \
} \
\
l_data_size = l_tilec->numresolutions * sizeof(opj_tcd_resolution_v2_t); \
l_data_size = l_tilec->numresolutions * sizeof(opj_tcd_resolution_t); \
\
if (l_tilec->resolutions == 00) { \
l_tilec->resolutions = (opj_tcd_resolution_v2_t *) opj_malloc(l_data_size); \
l_tilec->resolutions = (opj_tcd_resolution_t *) opj_malloc(l_data_size); \
if (! l_tilec->resolutions ) { \
return OPJ_FALSE; \
} \
/*fprintf(stderr, "\tAllocate resolutions of tilec (opj_tcd_resolution_v2_t): %d\n",l_data_size);*/ \
/*fprintf(stderr, "\tAllocate resolutions of tilec (opj_tcd_resolution_t): %d\n",l_data_size);*/ \
l_tilec->resolutions_size = l_data_size; \
memset(l_tilec->resolutions,0,l_data_size); \
} \
else if (l_data_size > l_tilec->resolutions_size) { \
opj_tcd_resolution_v2_t* new_resolutions = (opj_tcd_resolution_v2_t *) opj_realloc(l_tilec->resolutions, l_data_size); \
opj_tcd_resolution_t* new_resolutions = (opj_tcd_resolution_t *) opj_realloc(l_tilec->resolutions, l_data_size); \
if (! new_resolutions) { \
/* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to tile resolutions\n"); */ \
fprintf(stderr, "Not enough memory to tile resolutions\n"); \
@ -775,7 +775,7 @@ opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
/*fprintf(stderr, "\t\t\tres_pw=%d, res_ph=%d\n", l_res->pw, l_res->ph );*/ \
\
l_nb_precincts = l_res->pw * l_res->ph; \
l_nb_precinct_size = l_nb_precincts * sizeof(opj_tcd_precinct_v2_t); \
l_nb_precinct_size = l_nb_precincts * sizeof(opj_tcd_precinct_t); \
if (resno == 0) { \
tlcbgxstart = l_tl_prc_x_start; \
tlcbgystart = l_tl_prc_y_start; \
@ -830,17 +830,17 @@ opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
l_band->numbps = l_step_size->expn + l_tccp->numgbits - 1; /* WHY -1 ? */ \
\
if (! l_band->precincts) { \
l_band->precincts = (opj_tcd_precinct_v2_t *) opj_malloc( /*3 * */ l_nb_precinct_size); \
l_band->precincts = (opj_tcd_precinct_t *) opj_malloc( /*3 * */ l_nb_precinct_size); \
if (! l_band->precincts) { \
return OPJ_FALSE; \
} \
/*fprintf(stderr, "\t\t\t\tAllocate precincts of a band (opj_tcd_precinct_v2_t): %d\n",l_nb_precinct_size); */ \
/*fprintf(stderr, "\t\t\t\tAllocate precincts of a band (opj_tcd_precinct_t): %d\n",l_nb_precinct_size); */ \
memset(l_band->precincts,0,l_nb_precinct_size); \
l_band->precincts_data_size = l_nb_precinct_size; \
} \
else if (l_band->precincts_data_size < l_nb_precinct_size) { \
\
opj_tcd_precinct_v2_t * new_precincts = (opj_tcd_precinct_v2_t *) opj_realloc(l_band->precincts,/*3 * */ l_nb_precinct_size); \
opj_tcd_precinct_t * new_precincts = (opj_tcd_precinct_t *) opj_realloc(l_band->precincts,/*3 * */ l_nb_precinct_size); \
if (! new_precincts) { \
/* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to handle band precints\n"); */ \
fprintf(stderr, "Not enough memory to handle band precints\n"); \
@ -850,7 +850,7 @@ opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
return OPJ_FALSE; \
} \
l_band->precincts = new_precincts; \
/*fprintf(stderr, "\t\t\t\tReallocate precincts of a band (opj_tcd_precinct_v2_t): from %d to %d\n",l_band->precincts_data_size, l_nb_precinct_size);*/ \
/*fprintf(stderr, "\t\t\t\tReallocate precincts of a band (opj_tcd_precinct_t): from %d to %d\n",l_band->precincts_data_size, l_nb_precinct_size);*/ \
memset(((OPJ_BYTE *) l_band->precincts) + l_band->precincts_data_size,0,l_nb_precinct_size - l_band->precincts_data_size); \
l_band->precincts_data_size = l_nb_precinct_size; \
} \
@ -894,7 +894,7 @@ opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
if (! l_current_precinct->cblks.ELEMENT ) { \
return OPJ_FALSE; \
} \
/*fprintf(stderr, "\t\t\t\tAllocate cblks of a precinct (opj_tcd_cblk_dec_v2_t): %d\n",l_nb_code_blocks_size);*/ \
/*fprintf(stderr, "\t\t\t\tAllocate cblks of a precinct (opj_tcd_cblk_dec_t): %d\n",l_nb_code_blocks_size);*/ \
\
memset(l_current_precinct->cblks.ELEMENT,0,l_nb_code_blocks_size); \
\
@ -911,7 +911,7 @@ opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
return OPJ_FALSE; \
} \
l_current_precinct->cblks.ELEMENT = new_ELEMENT; \
/*fprintf(stderr, "\t\t\t\tReallocate cblks of a precinct (opj_tcd_cblk_dec_v2_t): from %d to %d\n",l_current_precinct->block_size, l_nb_code_blocks_size); */\
/*fprintf(stderr, "\t\t\t\tReallocate cblks of a precinct (opj_tcd_cblk_dec_t): from %d to %d\n",l_current_precinct->block_size, l_nb_code_blocks_size); */\
\
memset(((OPJ_BYTE *) l_current_precinct->cblks.ELEMENT) + l_current_precinct->block_size \
,0 \
@ -987,15 +987,15 @@ opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
} \
MACRO_TCD_ALLOCATE(opj_tcd_init_encode_tile, opj_tcd_cblk_enc_v2_t, 1.f, enc, opj_tcd_code_block_enc_allocate)
MACRO_TCD_ALLOCATE(opj_tcd_init_decode_tile, opj_tcd_cblk_dec_v2_t, 0.5f, dec, opj_tcd_code_block_dec_allocate)
MACRO_TCD_ALLOCATE(opj_tcd_init_encode_tile, opj_tcd_cblk_enc_t, 1.f, enc, opj_tcd_code_block_enc_allocate)
MACRO_TCD_ALLOCATE(opj_tcd_init_decode_tile, opj_tcd_cblk_dec_t, 0.5f, dec, opj_tcd_code_block_dec_allocate)
#undef MACRO_TCD_ALLOCATE
/**
* Allocates memory for an encoding code block.
*/
opj_bool opj_tcd_code_block_enc_allocate (opj_tcd_cblk_enc_v2_t * p_code_block)
opj_bool opj_tcd_code_block_enc_allocate (opj_tcd_cblk_enc_t * p_code_block)
{
if (! p_code_block->data) {
@ -1013,14 +1013,14 @@ opj_bool opj_tcd_code_block_enc_allocate (opj_tcd_cblk_enc_v2_t * p_code_block)
return OPJ_FALSE;
}
p_code_block->passes = (opj_tcd_pass_v2_t*) opj_malloc(100 * sizeof(opj_tcd_pass_v2_t));
p_code_block->passes = (opj_tcd_pass_t*) opj_malloc(100 * sizeof(opj_tcd_pass_t));
if (! p_code_block->passes) {
return OPJ_FALSE;
}
}
memset(p_code_block->layers,0,100 * sizeof(opj_tcd_layer_t));
memset(p_code_block->passes,0,100 * sizeof(opj_tcd_pass_v2_t));
memset(p_code_block->passes,0,100 * sizeof(opj_tcd_pass_t));
return OPJ_TRUE;
}
@ -1028,7 +1028,7 @@ opj_bool opj_tcd_code_block_enc_allocate (opj_tcd_cblk_enc_v2_t * p_code_block)
/**
* Allocates memory for a decoding code block.
*/
opj_bool opj_tcd_code_block_dec_allocate (opj_tcd_cblk_dec_v2_t * p_code_block)
opj_bool opj_tcd_code_block_dec_allocate (opj_tcd_cblk_dec_t * p_code_block)
{
OPJ_UINT32 l_seg_size;
@ -1057,13 +1057,13 @@ opj_bool opj_tcd_code_block_dec_allocate (opj_tcd_cblk_dec_v2_t * p_code_block)
return OPJ_TRUE;
}
OPJ_UINT32 opj_tcd_get_decoded_tile_size ( opj_tcd_v2_t *p_tcd )
OPJ_UINT32 opj_tcd_get_decoded_tile_size ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 i;
OPJ_UINT32 l_data_size = 0;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tilecomp_v2_t * l_tile_comp = 00;
opj_tcd_resolution_v2_t * l_res = 00;
opj_tcd_tilecomp_t * l_tile_comp = 00;
opj_tcd_resolution_t * l_res = 00;
OPJ_UINT32 l_size_comp, l_remaining;
l_tile_comp = p_tcd->tcd_image->tiles->comps;
@ -1090,7 +1090,7 @@ OPJ_UINT32 opj_tcd_get_decoded_tile_size ( opj_tcd_v2_t *p_tcd )
return l_data_size;
}
opj_bool opj_tcd_encode_tile( opj_tcd_v2_t *p_tcd,
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,
@ -1107,11 +1107,11 @@ opj_bool opj_tcd_encode_tile( opj_tcd_v2_t *p_tcd,
if(p_cstr_info) {
OPJ_UINT32 l_num_packs = 0;
OPJ_UINT32 i;
opj_tcd_tilecomp_v2_t *l_tilec_idx = &p_tcd->tcd_image->tiles->comps[0]; /* based on component 0 */
opj_tcd_tilecomp_t *l_tilec_idx = &p_tcd->tcd_image->tiles->comps[0]; /* based on component 0 */
opj_tccp_t *l_tccp = p_tcd->tcp->tccps; /* based on component 0 */
for (i = 0; i < l_tilec_idx->numresolutions; i++) {
opj_tcd_resolution_v2_t *l_res_idx = &l_tilec_idx->resolutions[i];
opj_tcd_resolution_t *l_res_idx = &l_tilec_idx->resolutions[i];
p_cstr_info->tile[p_tile_no].pw[i] = l_res_idx->pw;
p_cstr_info->tile[p_tile_no].ph[i] = l_res_idx->ph;
@ -1174,7 +1174,7 @@ opj_bool opj_tcd_encode_tile( opj_tcd_v2_t *p_tcd,
return OPJ_TRUE;
}
opj_bool opj_tcd_decode_tile( opj_tcd_v2_t *p_tcd,
opj_bool opj_tcd_decode_tile( opj_tcd_t *p_tcd,
OPJ_BYTE *p_src,
OPJ_UINT32 p_max_length,
OPJ_UINT32 p_tile_no,
@ -1192,9 +1192,9 @@ opj_bool opj_tcd_decode_tile( opj_tcd_v2_t *p_tcd,
for (compno = 0; compno < (OPJ_UINT32) p_cstr_info->numcomps; compno++) {
opj_tcp_v2_t *tcp = &p_tcd->cp->tcps[0];
opj_tccp_t *tccp = &tcp->tccps[compno];
opj_tcd_tilecomp_v2_t *tilec_idx = &p_tcd->tcd_image->tiles->comps[compno];
opj_tcd_tilecomp_t *tilec_idx = &p_tcd->tcd_image->tiles->comps[compno];
for (resno = 0; resno < tilec_idx->numresolutions; resno++) {
opj_tcd_resolution_v2_t *res_idx = &tilec_idx->resolutions[resno];
opj_tcd_resolution_t *res_idx = &tilec_idx->resolutions[resno];
p_cstr_info->tile[p_tile_no].pw[resno] = res_idx->pw;
p_cstr_info->tile[p_tile_no].ph[resno] = res_idx->ph;
numprec += res_idx->pw * res_idx->ph;
@ -1260,15 +1260,15 @@ opj_bool opj_tcd_decode_tile( opj_tcd_v2_t *p_tcd,
return OPJ_TRUE;
}
opj_bool opj_tcd_update_tile_data ( opj_tcd_v2_t *p_tcd,
opj_bool opj_tcd_update_tile_data ( opj_tcd_t *p_tcd,
OPJ_BYTE * p_dest,
OPJ_UINT32 p_dest_length
)
{
OPJ_UINT32 i,j,k,l_data_size = 0;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tilecomp_v2_t * l_tilec = 00;
opj_tcd_resolution_v2_t * l_res;
opj_tcd_tilecomp_t * l_tilec = 00;
opj_tcd_resolution_t * l_res;
OPJ_UINT32 l_size_comp, l_remaining;
OPJ_UINT32 l_stride, l_width,l_height;
@ -1375,16 +1375,16 @@ opj_bool opj_tcd_update_tile_data ( opj_tcd_v2_t *p_tcd,
void opj_tcd_free_tile(opj_tcd_v2_t *p_tcd)
void opj_tcd_free_tile(opj_tcd_t *p_tcd)
{
OPJ_UINT32 compno, resno, bandno, precno;
opj_tcd_tile_v2_t *l_tile = 00;
opj_tcd_tilecomp_v2_t *l_tile_comp = 00;
opj_tcd_resolution_v2_t *l_res = 00;
opj_tcd_band_v2_t *l_band = 00;
opj_tcd_precinct_v2_t *l_precinct = 00;
opj_tcd_tile_t *l_tile = 00;
opj_tcd_tilecomp_t *l_tile_comp = 00;
opj_tcd_resolution_t *l_res = 00;
opj_tcd_band_t *l_band = 00;
opj_tcd_precinct_t *l_precinct = 00;
OPJ_UINT32 l_nb_resolutions, l_nb_precincts;
void (* l_tcd_code_block_deallocate) (opj_tcd_precinct_v2_t *) = 00;
void (* l_tcd_code_block_deallocate) (opj_tcd_precinct_t *) = 00;
if (! p_tcd) {
return;
@ -1412,14 +1412,14 @@ void opj_tcd_free_tile(opj_tcd_v2_t *p_tcd)
l_res = l_tile_comp->resolutions;
if (l_res) {
l_nb_resolutions = l_tile_comp->resolutions_size / sizeof(opj_tcd_resolution_v2_t);
l_nb_resolutions = l_tile_comp->resolutions_size / sizeof(opj_tcd_resolution_t);
for (resno = 0; resno < l_nb_resolutions; ++resno) {
l_band = l_res->bands;
for (bandno = 0; bandno < 3; ++bandno) {
l_precinct = l_band->precincts;
if (l_precinct) {
l_nb_precincts = l_band->precincts_data_size / sizeof(opj_tcd_precinct_v2_t);
l_nb_precincts = l_band->precincts_data_size / sizeof(opj_tcd_precinct_t);
for (precno = 0; precno < l_nb_precincts; ++precno) {
opj_tgt_destroy(l_precinct->incltree);
l_precinct->incltree = 00;
@ -1455,7 +1455,7 @@ void opj_tcd_free_tile(opj_tcd_v2_t *p_tcd)
}
opj_bool opj_tcd_t2_decode (opj_tcd_v2_t *p_tcd,
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,
@ -1487,12 +1487,12 @@ opj_bool opj_tcd_t2_decode (opj_tcd_v2_t *p_tcd,
return OPJ_TRUE;
}
opj_bool opj_tcd_t1_decode ( opj_tcd_v2_t *p_tcd )
opj_bool opj_tcd_t1_decode ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 compno;
opj_t1_t * l_t1;
opj_tcd_tile_v2_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_v2_t* l_tile_comp = l_tile->comps;
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_t* l_tile_comp = l_tile->comps;
opj_tccp_t * l_tccp = p_tcd->tcp->tccps;
@ -1517,11 +1517,11 @@ opj_bool opj_tcd_t1_decode ( opj_tcd_v2_t *p_tcd )
}
opj_bool opj_tcd_dwt_decode ( opj_tcd_v2_t *p_tcd )
opj_bool opj_tcd_dwt_decode ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 compno;
opj_tcd_tile_v2_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_v2_t * l_tile_comp = l_tile->comps;
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_t * l_tile_comp = l_tile->comps;
opj_tccp_t * l_tccp = p_tcd->tcp->tccps;
opj_image_comp_t * l_img_comp = p_tcd->image->comps;
@ -1557,11 +1557,11 @@ opj_bool opj_tcd_dwt_decode ( opj_tcd_v2_t *p_tcd )
return OPJ_TRUE;
}
opj_bool opj_tcd_mct_decode ( opj_tcd_v2_t *p_tcd )
opj_bool opj_tcd_mct_decode ( opj_tcd_t *p_tcd )
{
opj_tcd_tile_v2_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcp_v2_t * l_tcp = p_tcd->tcp;
opj_tcd_tilecomp_v2_t * l_tile_comp = l_tile->comps;
opj_tcd_tilecomp_t * l_tile_comp = l_tile->comps;
OPJ_UINT32 l_samples,i;
if (! l_tcp->mct) {
@ -1628,15 +1628,15 @@ opj_bool opj_tcd_mct_decode ( opj_tcd_v2_t *p_tcd )
}
opj_bool opj_tcd_dc_level_shift_decode ( opj_tcd_v2_t *p_tcd )
opj_bool opj_tcd_dc_level_shift_decode ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 compno;
opj_tcd_tilecomp_v2_t * l_tile_comp = 00;
opj_tcd_tilecomp_t * l_tile_comp = 00;
opj_tccp_t * l_tccp = 00;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_resolution_v2_t* l_res = 00;
opj_tcd_resolution_t* l_res = 00;
opj_tcp_v2_t * l_tcp = 00;
opj_tcd_tile_v2_t * l_tile;
opj_tcd_tile_t * l_tile;
OPJ_UINT32 l_width,l_height,i,j;
OPJ_INT32 * l_current_ptr;
OPJ_INT32 l_min, l_max;
@ -1698,11 +1698,11 @@ opj_bool opj_tcd_dc_level_shift_decode ( opj_tcd_v2_t *p_tcd )
/**
* Deallocates the encoding data of the given precinct.
*/
void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_v2_t * p_precinct)
void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_t * p_precinct)
{
OPJ_UINT32 cblkno , l_nb_code_blocks;
opj_tcd_cblk_dec_v2_t * l_code_block = p_precinct->cblks.dec;
opj_tcd_cblk_dec_t * l_code_block = p_precinct->cblks.dec;
if (l_code_block) {
/*fprintf(stderr,"deallocate codeblock:{\n");*/
/*fprintf(stderr,"\t x0=%d, y0=%d, x1=%d, y1=%d\n",l_code_block->x0, l_code_block->y0, l_code_block->x1, l_code_block->y1);*/
@ -1710,7 +1710,7 @@ void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_v2_t * p_precinct)
l_code_block->numbps, l_code_block->numlenbits, l_code_block->len, l_code_block->numnewpasses, l_code_block->real_num_segs, l_code_block->m_current_max_segs );*/
l_nb_code_blocks = p_precinct->block_size / sizeof(opj_tcd_cblk_dec_v2_t);
l_nb_code_blocks = p_precinct->block_size / sizeof(opj_tcd_cblk_dec_t);
/*fprintf(stderr,"nb_code_blocks =%d\t}\n", l_nb_code_blocks);*/
for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
@ -1736,13 +1736,13 @@ void opj_tcd_code_block_dec_deallocate (opj_tcd_precinct_v2_t * p_precinct)
/**
* Deallocates the encoding data of the given precinct.
*/
void opj_tcd_code_block_enc_deallocate (opj_tcd_precinct_v2_t * p_precinct)
void opj_tcd_code_block_enc_deallocate (opj_tcd_precinct_t * p_precinct)
{
OPJ_UINT32 cblkno , l_nb_code_blocks;
opj_tcd_cblk_enc_v2_t * l_code_block = p_precinct->cblks.enc;
opj_tcd_cblk_enc_t * l_code_block = p_precinct->cblks.enc;
if (l_code_block) {
l_nb_code_blocks = p_precinct->block_size / sizeof(opj_tcd_cblk_enc_v2_t);
l_nb_code_blocks = p_precinct->block_size / sizeof(opj_tcd_cblk_enc_t);
for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
if (l_code_block->data) {
@ -1768,11 +1768,11 @@ void opj_tcd_code_block_enc_deallocate (opj_tcd_precinct_v2_t * p_precinct)
}
}
OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_v2_t *p_tcd )
OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 i,l_data_size = 0;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tilecomp_v2_t * l_tilec = 00;
opj_tcd_tilecomp_t * l_tilec = 00;
OPJ_UINT32 l_size_comp, l_remaining;
l_tilec = p_tcd->tcd_image->tiles->comps;
@ -1797,14 +1797,14 @@ OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_v2_t *p_tcd )
return l_data_size;
}
opj_bool opj_tcd_dc_level_shift_encode ( opj_tcd_v2_t *p_tcd )
opj_bool opj_tcd_dc_level_shift_encode ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 compno;
opj_tcd_tilecomp_v2_t * l_tile_comp = 00;
opj_tcd_tilecomp_t * l_tile_comp = 00;
opj_tccp_t * l_tccp = 00;
opj_image_comp_t * l_img_comp = 00;
opj_tcp_v2_t * l_tcp = 00;
opj_tcd_tile_v2_t * l_tile;
opj_tcd_tile_t * l_tile;
OPJ_UINT32 l_nb_elem,i;
OPJ_INT32 * l_current_ptr;
@ -1839,10 +1839,10 @@ opj_bool opj_tcd_dc_level_shift_encode ( opj_tcd_v2_t *p_tcd )
return OPJ_TRUE;
}
opj_bool opj_tcd_mct_encode ( opj_tcd_v2_t *p_tcd )
opj_bool opj_tcd_mct_encode ( opj_tcd_t *p_tcd )
{
opj_tcd_tile_v2_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_v2_t * l_tile_comp = p_tcd->tcd_image->tiles->comps;
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_t * l_tile_comp = p_tcd->tcd_image->tiles->comps;
OPJ_UINT32 samples = (l_tile_comp->x1 - l_tile_comp->x0) * (l_tile_comp->y1 - l_tile_comp->y0);
OPJ_UINT32 i;
OPJ_BYTE ** l_data = 00;
@ -1894,10 +1894,10 @@ opj_bool opj_tcd_mct_encode ( opj_tcd_v2_t *p_tcd )
return OPJ_TRUE;
}
opj_bool opj_tcd_dwt_encode ( opj_tcd_v2_t *p_tcd )
opj_bool opj_tcd_dwt_encode ( opj_tcd_t *p_tcd )
{
opj_tcd_tile_v2_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_v2_t * l_tile_comp = p_tcd->tcd_image->tiles->comps;
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcd_tilecomp_t * l_tile_comp = p_tcd->tcd_image->tiles->comps;
opj_tccp_t * l_tccp = p_tcd->tcp->tccps;
OPJ_UINT32 compno;
@ -1920,7 +1920,7 @@ opj_bool opj_tcd_dwt_encode ( opj_tcd_v2_t *p_tcd )
return OPJ_TRUE;
}
opj_bool opj_tcd_t1_encode ( opj_tcd_v2_t *p_tcd )
opj_bool opj_tcd_t1_encode ( opj_tcd_t *p_tcd )
{
opj_t1_t * l_t1;
const OPJ_FLOAT64 * l_mct_norms;
@ -1954,7 +1954,7 @@ opj_bool opj_tcd_t1_encode ( opj_tcd_v2_t *p_tcd )
return OPJ_TRUE;
}
opj_bool opj_tcd_t2_encode (opj_tcd_v2_t *p_tcd,
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,
@ -1992,7 +1992,7 @@ opj_bool opj_tcd_t2_encode (opj_tcd_v2_t *p_tcd,
}
opj_bool opj_tcd_rate_allocate_encode( opj_tcd_v2_t *p_tcd,
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 )
@ -2020,13 +2020,13 @@ opj_bool opj_tcd_rate_allocate_encode( opj_tcd_v2_t *p_tcd,
}
opj_bool opj_tcd_copy_tile_data ( opj_tcd_v2_t *p_tcd,
opj_bool opj_tcd_copy_tile_data ( opj_tcd_t *p_tcd,
OPJ_BYTE * p_src,
OPJ_UINT32 p_src_length )
{
OPJ_UINT32 i,j,l_data_size = 0;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tilecomp_v2_t * l_tilec = 00;
opj_tcd_tilecomp_t * l_tilec = 00;
OPJ_UINT32 l_size_comp, l_remaining;
OPJ_UINT32 l_nb_elem;

View File

@ -58,12 +58,12 @@ typedef struct opj_tcd_seg {
/**
FIXME DOC
*/
typedef struct opj_tcd_pass_v2 {
typedef struct opj_tcd_pass {
OPJ_UINT32 rate;
OPJ_FLOAT64 distortiondec;
OPJ_UINT32 len;
OPJ_UINT32 term : 1;
} opj_tcd_pass_v2_t;
} opj_tcd_pass_t;
/**
FIXME DOC
@ -78,20 +78,20 @@ typedef struct opj_tcd_layer {
/**
FIXME DOC
*/
typedef struct opj_tcd_cblk_enc_v2 {
typedef struct opj_tcd_cblk_enc {
OPJ_BYTE* data; /* Data */
opj_tcd_layer_t* layers; /* layer information */
opj_tcd_pass_v2_t* passes; /* information about the passes */
opj_tcd_pass_t* passes; /* information about the passes */
OPJ_INT32 x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numbps;
OPJ_UINT32 numlenbits;
OPJ_UINT32 numpasses; /* number of pass already done for the code-blocks */
OPJ_UINT32 numpassesinlayers; /* number of passes in the layer */
OPJ_UINT32 totalpasses; /* total number of passes */
} opj_tcd_cblk_enc_v2_t;
} opj_tcd_cblk_enc_t;
typedef struct opj_tcd_cblk_dec_v2 {
typedef struct opj_tcd_cblk_dec {
OPJ_BYTE * data; /* Data */
opj_tcd_seg_t* segs; /* segments information */
OPJ_INT32 x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
@ -102,88 +102,88 @@ typedef struct opj_tcd_cblk_dec_v2 {
OPJ_UINT32 numsegs; /* number of segments */
OPJ_UINT32 real_num_segs;
OPJ_UINT32 m_current_max_segs;
} opj_tcd_cblk_dec_v2_t;
} opj_tcd_cblk_dec_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_precinct_v2 {
typedef struct opj_tcd_precinct {
OPJ_INT32 x0, y0, x1, y1; /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 cw, ch; /* number of precinct in width and height */
union{ /* code-blocks information */
opj_tcd_cblk_enc_v2_t* enc;
opj_tcd_cblk_dec_v2_t* dec;
opj_tcd_cblk_enc_t* enc;
opj_tcd_cblk_dec_t* dec;
} cblks;
OPJ_UINT32 block_size; /* size taken by cblks (in bytes) */
opj_tgt_tree_t *incltree; /* inclusion tree */
opj_tgt_tree_t *imsbtree; /* IMSB tree */
} opj_tcd_precinct_v2_t;
} opj_tcd_precinct_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_band_v2 {
typedef struct opj_tcd_band {
OPJ_INT32 x0, y0, x1, y1; /* dimension of the subband : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 bandno;
opj_tcd_precinct_v2_t *precincts; /* precinct information */
opj_tcd_precinct_t *precincts; /* precinct information */
OPJ_UINT32 precincts_data_size; /* size of data taken by precincts */
OPJ_INT32 numbps;
OPJ_FLOAT32 stepsize;
} opj_tcd_band_v2_t;
} opj_tcd_band_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_resolution_v2 {
typedef struct opj_tcd_resolution {
OPJ_INT32 x0, y0, x1, y1; /* dimension of the resolution level : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 pw, ph;
OPJ_UINT32 numbands; /* number sub-band for the resolution level */
opj_tcd_band_v2_t bands[3]; /* subband information */
} opj_tcd_resolution_v2_t;
opj_tcd_band_t bands[3]; /* subband information */
} opj_tcd_resolution_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_tilecomp_v2
typedef struct opj_tcd_tilecomp
{
OPJ_INT32 x0, y0, x1, y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numresolutions; /* number of resolutions level */
OPJ_UINT32 minimum_num_resolutions; /* number of resolutions level to decode (at max)*/
opj_tcd_resolution_v2_t *resolutions; /* resolutions information */
opj_tcd_resolution_t *resolutions; /* resolutions information */
OPJ_UINT32 resolutions_size; /* size of data for resolutions (in bytes) */
OPJ_INT32 *data; /* data of the component */
OPJ_UINT32 data_size; /* size of the data of the component */
OPJ_INT32 numpix; /* add fixed_quality */
} opj_tcd_tilecomp_v2_t;
} opj_tcd_tilecomp_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_tile_v2 {
typedef struct opj_tcd_tile {
OPJ_INT32 x0, y0, x1, y1; /* dimension of the tile : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numcomps; /* number of components in tile */
opj_tcd_tilecomp_v2_t *comps; /* Components information */
opj_tcd_tilecomp_t *comps; /* Components information */
OPJ_INT32 numpix; /* add fixed_quality */
OPJ_FLOAT64 distotile; /* add fixed_quality */
OPJ_FLOAT64 distolayer[100]; /* add fixed_quality */
OPJ_UINT32 packno; /* packet number */
} opj_tcd_tile_v2_t;
} opj_tcd_tile_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_image_v2
typedef struct opj_tcd_image
{
opj_tcd_tile_v2_t *tiles; /* Tiles information */
opj_tcd_tile_t *tiles; /* Tiles information */
}
opj_tcd_image_v2_t;
opj_tcd_image_t;
/**
Tile coder/decoder
*/
typedef struct opj_tcd_v2
typedef struct opj_tcd
{
/** Position of the tilepart flag in Progression order*/
OPJ_INT32 tp_pos;
@ -196,7 +196,7 @@ typedef struct opj_tcd_v2
/** Current Packet iterator number */
OPJ_UINT32 cur_pino;
/** info on each image tile */
opj_tcd_image_v2_t *tcd_image;
opj_tcd_image_t *tcd_image;
/** image header */
opj_image_t *image;
/** coding parameters */
@ -207,7 +207,7 @@ typedef struct opj_tcd_v2
OPJ_UINT32 tcd_tileno;
/** tell if the tcd is a decoder. */
OPJ_UINT32 m_is_decoder : 1;
} opj_tcd_v2_t;
} opj_tcd_t;
/** @name Exported functions */
/*@{*/
@ -223,13 +223,13 @@ Create a new TCD handle
@param p_is_decoder FIXME DOC
@return Returns a new TCD handle if successful returns NULL otherwise
*/
opj_tcd_v2_t* opj_tcd_create(opj_bool p_is_decoder);
opj_tcd_t* opj_tcd_create(opj_bool p_is_decoder);
/**
Destroy a previously created TCD handle
@param tcd TCD handle to destroy
*/
void opj_tcd_destroy(opj_tcd_v2_t *tcd);
void opj_tcd_destroy(opj_tcd_t *tcd);
/**
* Initialize the tile coder and may reuse some memory.
@ -239,7 +239,7 @@ void opj_tcd_destroy(opj_tcd_v2_t *tcd);
*
* @return true if the encoding values could be set (false otherwise).
*/
opj_bool opj_tcd_init( opj_tcd_v2_t *p_tcd,
opj_bool opj_tcd_init( opj_tcd_t *p_tcd,
opj_image_t * p_image,
opj_cp_v2_t * p_cp );
@ -252,18 +252,18 @@ opj_bool opj_tcd_init( opj_tcd_v2_t *p_tcd,
*
* @return true if the remaining data is sufficient.
*/
opj_bool opj_tcd_init_decode_tile(opj_tcd_v2_t *p_tcd, OPJ_UINT32 p_tile_no);
opj_bool opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no);
void opj_tcd_makelayer_fixed(opj_tcd_v2_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 final);
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 final);
void opj_tcd_rateallocate_fixed(opj_tcd_v2_t *tcd);
void opj_tcd_rateallocate_fixed(opj_tcd_t *tcd);
void opj_tcd_makelayer( opj_tcd_v2_t *tcd,
void opj_tcd_makelayer( opj_tcd_t *tcd,
OPJ_UINT32 layno,
OPJ_FLOAT64 thresh,
OPJ_UINT32 final);
opj_bool opj_tcd_rateallocate( opj_tcd_v2_t *tcd,
opj_bool opj_tcd_rateallocate( opj_tcd_t *tcd,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 len,
@ -272,7 +272,7 @@ opj_bool opj_tcd_rateallocate( opj_tcd_v2_t *tcd,
/**
* Gets the maximum tile size that will be taken by the tile once decoded.
*/
OPJ_UINT32 opj_tcd_get_decoded_tile_size (opj_tcd_v2_t *p_tcd );
OPJ_UINT32 opj_tcd_get_decoded_tile_size (opj_tcd_t *p_tcd );
/**
* Encodes a tile from the raw image into the given buffer.
@ -284,7 +284,7 @@ OPJ_UINT32 opj_tcd_get_decoded_tile_size (opj_tcd_v2_t *p_tcd );
* @param p_cstr_info Codestream information structure
* @return true if the coding is successfull.
*/
opj_bool opj_tcd_encode_tile( opj_tcd_v2_t *p_tcd,
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,
@ -300,7 +300,7 @@ Decode a tile from a buffer into a raw image
@param tileno Number that identifies one of the tiles to be decoded
@param cstr_info FIXME DOC
*/
opj_bool opj_tcd_decode_tile( opj_tcd_v2_t *tcd,
opj_bool opj_tcd_decode_tile( opj_tcd_t *tcd,
OPJ_BYTE *src,
OPJ_UINT32 len,
OPJ_UINT32 tileno,
@ -310,14 +310,14 @@ opj_bool opj_tcd_decode_tile( opj_tcd_v2_t *tcd,
/**
* Copies tile data from the system onto the given memory block.
*/
opj_bool opj_tcd_update_tile_data ( opj_tcd_v2_t *p_tcd,
opj_bool opj_tcd_update_tile_data ( opj_tcd_t *p_tcd,
OPJ_BYTE * p_dest,
OPJ_UINT32 p_dest_length );
/**
*
*/
OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_v2_t *p_tcd );
OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_t *p_tcd );
/**
* Initialize the tile coder and may reuse some meory.
@ -327,13 +327,13 @@ OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_v2_t *p_tcd );
*
* @return true if the encoding values could be set (false otherwise).
*/
opj_bool opj_tcd_init_encode_tile ( opj_tcd_v2_t *p_tcd,
opj_bool opj_tcd_init_encode_tile ( opj_tcd_t *p_tcd,
OPJ_UINT32 p_tile_no );
/**
* Copies tile data from the given memory block onto the system.
*/
opj_bool opj_tcd_copy_tile_data (opj_tcd_v2_t *p_tcd,
opj_bool opj_tcd_copy_tile_data (opj_tcd_t *p_tcd,
OPJ_BYTE * p_src,
OPJ_UINT32 p_src_length );