OpenJPEG  1.5.1
Data Structures | Macros | Typedefs | Functions
JPWL - JPEG-2000 Part11 (JPWL) codestream manager

Data Structures

struct  jpwl_epb_ms
 EPB (Error Protection Block) Marker segment. More...
 
struct  jpwl_epc_ms
 EPC (Error Protection Capability) Marker segment. More...
 
struct  jpwl_esd_ms
 ESD (Error Sensitivity Descriptor) Marker segment. More...
 
struct  jpwl_red_ms
 RED (Residual Error Descriptor) Marker segment. More...
 
struct  jpwl_marker
 Structure used to store JPWL markers temporary position and readyness. More...
 

Macros

#define JPWL_ASSUME   OPJ_TRUE
 Assume a basic codestream structure, so you can resort better from uncorrected errors. More...
 
#define jpwl_updateCRC16(CRC, DATA)   updateCRC16(CRC, DATA)
 Macro functions for CRC computation. More...
 
#define jpwl_updateCRC32(CRC, DATA)   updateCRC32(CRC, DATA)
 Computes the CRC-32, as stated in JPWL specs. More...
 

Typedefs

typedef struct jpwl_epb_ms jpwl_epb_ms_t
 EPB (Error Protection Block) Marker segment. More...
 
typedef struct jpwl_epc_ms jpwl_epc_ms_t
 EPC (Error Protection Capability) Marker segment. More...
 
typedef struct jpwl_esd_ms jpwl_esd_ms_t
 ESD (Error Sensitivity Descriptor) Marker segment. More...
 
typedef struct jpwl_red_ms jpwl_red_ms_t
 RED (Residual Error Descriptor) Marker segment. More...
 
typedef struct jpwl_marker jpwl_marker_t
 Structure used to store JPWL markers temporary position and readyness. More...
 

Functions

void jpwl_encode (opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image)
 Encode according to JPWL specs. More...
 
void jpwl_prepare_marks (opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image)
 Prepare the list of JPWL markers, after the Part 1 codestream has been finalized (index struct is full) More...
 
void jpwl_dump_marks (opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image)
 Dump the list of JPWL markers, after it has been prepared. More...
 
void j2k_read_epc (opj_j2k_t *j2k)
 Read the EPC marker (Error Protection Capability) More...
 
void j2k_write_epc (opj_j2k_t *j2k)
 Write the EPC marker (Error Protection Capability), BUT the DL field is always set to 0 (this simplifies the management of EPBs and it is openly stated in the standard as a possible value, mening that the information is not available) and the informative techniques are not yet implemented. More...
 
void j2k_read_epb (opj_j2k_t *j2k)
 Read the EPB marker (Error Protection Block) More...
 
void j2k_write_epb (opj_j2k_t *j2k)
 Write the EPB marker (Error Protection Block) More...
 
void j2k_read_esd (opj_j2k_t *j2k)
 Read the ESD marker (Error Sensitivity Descriptor) More...
 
void j2k_read_red (opj_j2k_t *j2k)
 Read the RED marker (Residual Error Descriptor) More...
 
jpwl_epb_ms_tjpwl_epb_create (opj_j2k_t *j2k, opj_bool latest, opj_bool packed, int tileno, int idx, int hprot, unsigned long int pre_len, unsigned long int post_len)
 create an EPB marker segment More...
 
int jpwl_epbs_add (opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, opj_bool latest, opj_bool packed, opj_bool insideMH, int *idx, int hprot, double place_pos, int tileno, unsigned long int pre_len, unsigned long int post_len)
 add a number of EPB marker segments More...
 
int jpwl_esds_add (opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, int comps, unsigned char addrm, unsigned char ad_size, unsigned char senst, unsigned char se_size, double place_pos, int tileno)
 add a number of ESD marker segments More...
 
opj_bool jpwl_update_info (opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num)
 updates the information structure by modifying the positions and lengths More...
 
opj_bool jpwl_esd_fill (opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf)
 
opj_bool jpwl_epb_fill (opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf, unsigned char *post_buf)
 
void j2k_add_marker (opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len)
 
opj_bool jpwl_correct (opj_j2k_t *j2k)
 corrects the data in the JPWL codestream More...
 
opj_bool jpwl_epb_correct (opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_len, int post_len, int *conn, unsigned char **L4_bufp)
 corrects the data protected by an EPB More...
 
opj_bool jpwl_check_tile (opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno)
 check that a tile and its children have valid data More...
 

Local static variables

static int jwmarker_num
 number of JPWL prepared markers More...
 
static jpwl_marker_t jwmarker [JPWL_MAX_NO_MARKERS]
 properties of JPWL markers to insert More...
 

Detailed Description

Macro Definition Documentation

#define JPWL_ASSUME   OPJ_TRUE

Assume a basic codestream structure, so you can resort better from uncorrected errors.

Referenced by j2k_decode(), j2k_read_ppm(), j2k_read_qcc(), j2k_read_qcx(), j2k_read_rgn(), j2k_read_siz(), j2k_read_sot(), j2k_read_unk(), jpwl_check_tile(), and t2_decode_packet().

#define jpwl_updateCRC16 (   CRC,
  DATA 
)    updateCRC16(CRC, DATA)

Macro functions for CRC computation.

Computes the CRC-16, as stated in JPWL specs

Parameters
CRCtwo bytes containing the CRC value (must be initialized with 0x0000)
DATAbyte for which the CRC is computed; call this on every byte of the sequence and get the CRC at the end

Referenced by j2k_read_epc(), j2k_write_epc(), jpwl_dump_marks(), jpwl_epb_correct(), and jpwl_epb_fill().

#define jpwl_updateCRC32 (   CRC,
  DATA 
)    updateCRC32(CRC, DATA)

Computes the CRC-32, as stated in JPWL specs.

Parameters
CRCfour bytes containing the CRC value (must be initialized with 0x00000000)
DATAbyte for which the CRC is computed; call this on every byte of the sequence and get the CRC at the end

Referenced by jpwl_epb_correct(), and jpwl_epb_fill().

Typedef Documentation

typedef struct jpwl_epb_ms jpwl_epb_ms_t

EPB (Error Protection Block) Marker segment.

typedef struct jpwl_epc_ms jpwl_epc_ms_t

EPC (Error Protection Capability) Marker segment.

typedef struct jpwl_esd_ms jpwl_esd_ms_t

ESD (Error Sensitivity Descriptor) Marker segment.

typedef struct jpwl_marker jpwl_marker_t

Structure used to store JPWL markers temporary position and readyness.

typedef struct jpwl_red_ms jpwl_red_ms_t

RED (Residual Error Descriptor) Marker segment.

Function Documentation

void j2k_add_marker ( opj_codestream_info_t cstr_info,
unsigned short int  type,
int  pos,
int  len 
)
void j2k_read_epb ( opj_j2k_t j2k)
void j2k_read_epc ( opj_j2k_t j2k)

Read the EPC marker (Error Protection Capability)

Parameters
j2kJ2K handle

References opj_j2k::cinfo, opj_j2k::cio, cio_read(), cio_seek(), cio_skip(), cio_tell(), EVT_INFO, jpwl_updateCRC16, and opj_event_msg().

void j2k_read_esd ( opj_j2k_t j2k)

Read the ESD marker (Error Sensitivity Descriptor)

Parameters
j2kJ2K handle

References opj_j2k::cinfo, opj_j2k::cio, cio_read(), cio_skip(), cio_tell(), EVT_INFO, opj_j2k::image, opj_image::numcomps, and opj_event_msg().

void j2k_read_red ( opj_j2k_t j2k)

Read the RED marker (Residual Error Descriptor)

Parameters
j2kJ2K handle

References opj_j2k::cinfo, opj_j2k::cio, cio_read(), cio_skip(), cio_tell(), EVT_INFO, and opj_event_msg().

void j2k_write_epb ( opj_j2k_t j2k)

Write the EPB marker (Error Protection Block)

Parameters
j2kJ2K handle

References opj_j2k::cio, cio_seek(), cio_skip(), cio_tell(), cio_write(), opj_j2k::cstr_info, j2k_add_marker(), and J2K_MS_EPB.

void j2k_write_epc ( opj_j2k_t j2k)

Write the EPC marker (Error Protection Capability), BUT the DL field is always set to 0 (this simplifies the management of EPBs and it is openly stated in the standard as a possible value, mening that the information is not available) and the informative techniques are not yet implemented.

Parameters
j2kJ2K handle

References opj_j2k::cio, cio_read(), cio_seek(), cio_skip(), cio_tell(), cio_write(), opj_j2k::cstr_info, j2k_add_marker(), J2K_MS_EPC, and jpwl_updateCRC16.

opj_bool jpwl_check_tile ( opj_j2k_t j2k,
opj_tcd_t tcd,
int  tileno 
)
opj_bool jpwl_correct ( opj_j2k_t j2k)
void jpwl_dump_marks ( opj_j2k_t j2k,
opj_cio_t cio,
opj_image_t image 
)
void jpwl_encode ( opj_j2k_t j2k,
opj_cio_t cio,
opj_image_t image 
)

Encode according to JPWL specs.

Parameters
j2kJ2K handle
ciocodestream handle
imageimage handle

References J2K_MS_EPB, J2K_MS_EPC, J2K_MS_ESD, J2K_MS_RED, jpwl_dump_marks(), JPWL_MAX_NO_MARKERS, jpwl_prepare_marks(), jwmarker_num, opj_free, and opj_j2k::pos_correction.

Referenced by j2k_encode().

opj_bool jpwl_epb_correct ( opj_j2k_t j2k,
unsigned char *  buffer,
int  type,
int  pre_len,
int  post_len,
int *  conn,
unsigned char **  L4_bufp 
)

corrects the data protected by an EPB

Parameters
j2kJ2K compressor handle
bufferpointer to the EPB position
typetype of EPB: 0=MH, 1=TPH, 2=other, 3=auto
pre_lenlength of pre-data
post_lenlength of post_data
connis a pointer to the length of all connected (packed) EPBs
L4_bufpis a pointer to the buffer pointer of redundancy data
Returns
returns true if correction could be succesfully performed

References opj_cio::bp, opj_j2k::cinfo, opj_j2k::cio, cio_numbytesleft(), cio_read(), cio_seek(), cio_skip(), cio_tell(), eras_dec_rs(), EVT_ERROR, EVT_INFO, EVT_WARNING, init_rs(), jpwl_epb_correct(), jpwl_updateCRC16, jpwl_updateCRC32, NN, opj_event_msg(), OPJ_FALSE, and OPJ_TRUE.

Referenced by j2k_read_epb(), jpwl_correct(), and jpwl_epb_correct().

jpwl_epb_ms_t* jpwl_epb_create ( opj_j2k_t j2k,
opj_bool  latest,
opj_bool  packed,
int  tileno,
int  idx,
int  hprot,
unsigned long int  pre_len,
unsigned long int  post_len 
)

create an EPB marker segment

Parameters
j2kJ2K compressor handle
latestit is the latest EPB in the header
packedEPB is in packed style
tilenotile number where the marker has been placed (-1 means MH)
idxcurrent EPB running index
hprotapplied protection type (-1/0,1,16,32,37-128)
pre_lenlength of pre-protected data
post_lenlength of post-protected data
Returns
returns the freshly created EPB

References opj_j2k::cinfo, jpwl_epb_ms::Depb, EVT_ERROR, jpwl_epb_ms::hprot, jpwl_epb_ms::k_post, jpwl_epb_ms::k_pre, jpwl_epb_ms::LDPepb, jpwl_epb_ms::Lepb, jpwl_epb_ms::n_post, jpwl_epb_ms::n_pre, opj_event_msg(), opj_malloc, jpwl_epb_ms::Pepb, jpwl_epb_ms::post_len, jpwl_epb_ms::pre_len, and jpwl_epb_ms::tileno.

Referenced by jpwl_epbs_add(), and jpwl_prepare_marks().

opj_bool jpwl_epb_fill ( opj_j2k_t j2k,
jpwl_epb_ms_t epbmark,
unsigned char *  buf,
unsigned char *  post_buf 
)
int jpwl_epbs_add ( opj_j2k_t j2k,
jpwl_marker_t jwmarker,
int *  jwmarker_num,
opj_bool  latest,
opj_bool  packed,
opj_bool  insideMH,
int *  idx,
int  hprot,
double  place_pos,
int  tileno,
unsigned long int  pre_len,
unsigned long int  post_len 
)

add a number of EPB marker segments

Parameters
j2kJ2K compressor handle
jwmarkerpointer to the JPWL markers list
jwmarker_numpointer to the number of JPWL markers (gets updated)
latestit is the latest group of EPBs in the header
packedEPBs are in packed style
insideMHit is in the MH
idxpointer to the starting EPB running index (gets updated)
hprotapplied protection type (-1/0,1,16,32,37-128)
place_posplace in original codestream where EPBs should go
tilenotile number of these EPBs
pre_lenlength of pre-protected data
post_lenlength of post-protected data
Returns
returns the length of all added markers

References opj_j2k::cinfo, jpwl_marker::data_ready, jpwl_marker::dpos, jpwl_marker::jpwl_marks::epbmark, EVT_ERROR, jpwl_marker::id, J2K_MS_EPB, jpwl_epb_create(), JPWL_MAX_NO_MARKERS, JPWL_MAXIMUM_EPB_ROOM, jwmarker_num, jpwl_marker::len, jpwl_marker::len_ready, jpwl_epb_ms::Lepb, jpwl_marker::m, min, opj_event_msg(), OPJ_FALSE, OPJ_TRUE, jpwl_marker::parms_ready, jpwl_marker::pos, and jpwl_marker::pos_ready.

Referenced by jpwl_prepare_marks().

opj_bool jpwl_esd_fill ( opj_j2k_t j2k,
jpwl_esd_ms_t esdmark,
unsigned char *  buf 
)
int jpwl_esds_add ( opj_j2k_t j2k,
jpwl_marker_t jwmarker,
int *  jwmarker_num,
int  comps,
unsigned char  addrm,
unsigned char  ad_size,
unsigned char  senst,
unsigned char  se_size,
double  place_pos,
int  tileno 
)

add a number of ESD marker segments

Parameters
j2kJ2K compressor handle
jwmarkerpointer to the JPWL markers list
jwmarker_numpointer to the number of JPWL markers (gets updated)
compsconsidered component (-1=average, 0/1/2/...=component no.)
addrmaddressing mode (0=packet, 1=byte range, 2=packet range, 3=reserved)
ad_sizesize of addresses (2/4 bytes)
senstsensitivity type
se_sizesensitivity values size (1/2 bytes)
place_posplace in original codestream where EPBs should go
tilenotile number of these EPBs
Returns
returns the length of all added markers
void jpwl_prepare_marks ( opj_j2k_t j2k,
opj_cio_t cio,
opj_image_t image 
)

Prepare the list of JPWL markers, after the Part 1 codestream has been finalized (index struct is full)

Parameters
j2kJ2K handle
ciocodestream handle
imageimage handle

References opj_j2k::cinfo, cio_getbp(), cio_read(), cio_seek(), cio_skip(), cio_tell(), cio_write(), opj_j2k::cp, opj_j2k::cstr_info, jpwl_marker::data_ready, jpwl_epb_ms::Depb, jpwl_marker::dpos, opj_packet_info::end_pos, opj_cp::epb_on, jpwl_marker::jpwl_marks::epbmark, jpwl_marker::jpwl_marks::epcmark, opj_cp::esd_on, jpwl_marker::jpwl_marks::esdmark, EVT_ERROR, EVT_INFO, opj_cp::hprot_MH, opj_cp::hprot_TPH, opj_cp::hprot_TPH_tileno, jpwl_marker::id, J2K_MS_EPB, J2K_MS_EPC, J2K_MS_ESD, jpwl_epb_create(), jpwl_epbs_add(), jpwl_epc_create(), jpwl_esd_create(), JPWL_MAX_NO_MARKERS, JPWL_MAX_NO_PACKSPECS, JPWL_MAX_NO_TILESPECS, jwmarker_num, jpwl_marker::len, jpwl_marker::len_ready, jpwl_epb_ms::Lepb, jpwl_epc_ms::Lepc, jpwl_esd_ms::Lesd, jpwl_marker::m, opj_codestream_info::main_head_end, opj_codestream_info::main_head_start, opj_tile_info::num_tps, opj_event_msg(), OPJ_FALSE, OPJ_TRUE, opj_tile_info::packet, opj_codestream_info::packno, jpwl_marker::parms_ready, jpwl_marker::pos, jpwl_marker::pos_ready, opj_cp::pprot, opj_cp::pprot_packno, opj_cp::pprot_tileno, opj_cp::red_on, opj_cp::sens_addr, opj_cp::sens_MH, opj_cp::sens_range, opj_cp::sens_size, opj_cp::sens_TPH, opj_cp::sens_TPH_tileno, opj_packet_info::start_pos, opj_codestream_info::th, opj_codestream_info::tile, opj_tile_info::tp, opj_tp_info::tp_end_header, opj_tp_info::tp_numpacks, opj_tp_info::tp_start_pack, opj_tp_info::tp_start_pos, and opj_codestream_info::tw.

Referenced by jpwl_encode().

opj_bool jpwl_update_info ( opj_j2k_t j2k,
jpwl_marker_t jwmarker,
int  jwmarker_num 
)

Variable Documentation

properties of JPWL markers to insert

int jwmarker_num
static

number of JPWL prepared markers

Referenced by jpwl_dump_marks(), jpwl_encode(), jpwl_epbs_add(), jpwl_prepare_marks(), and jpwl_update_info().