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...

Defines

#define JPWL_ASSUME   true
 Assume a basic codestream structure, so you can resort better from uncorrected errors.
#define jpwl_updateCRC16(CRC, DATA)   updateCRC16(CRC, DATA)
 Macro functions for CRC computation.
#define jpwl_updateCRC32(CRC, DATA)   updateCRC32(CRC, DATA)
 Computes the CRC-32, as stated in JPWL specs.
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 Computes the minimum between two integers.

Typedefs

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_red_ms jpwl_red_ms_t
 RED (Residual Error Descriptor) Marker segment.
typedef struct jpwl_marker jpwl_marker_t
 Structure used to store JPWL markers temporary position and readyness.

Functions

void jpwl_encode (opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image)
 Encode according to JPWL specs.
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).
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.
void j2k_read_epc (opj_j2k_t *j2k)
 Read the EPC marker (Error Protection Capability).
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.
void j2k_read_epb (opj_j2k_t *j2k)
 Read the EPB marker (Error Protection Block).
void j2k_write_epb (opj_j2k_t *j2k)
 Write the EPB marker (Error Protection Block).
void j2k_read_esd (opj_j2k_t *j2k)
 Read the ESD marker (Error Sensitivity Descriptor).
void j2k_read_red (opj_j2k_t *j2k)
 Read the RED marker (Residual Error Descriptor).
jpwl_epb_ms_tjpwl_epb_create (opj_j2k_t *j2k, bool latest, bool packed, int tileno, int idx, int hprot, unsigned long int pre_len, unsigned long int post_len)
 create an EPB marker segment
int jpwl_epbs_add (opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, bool latest, bool packed, 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
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
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
bool jpwl_esd_fill (opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf)
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)
bool jpwl_correct (opj_j2k_t *j2k)
 corrects the data in the JPWL codestream
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
bool jpwl_check_tile (opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno)
 check that a tile and its children have valid data

Local static variables



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

Define Documentation

#define JPWL_ASSUME   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:
CRC two bytes containing the CRC value (must be initialized with 0x0000)
Parameters:
DATA byte 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:
CRC four bytes containing the CRC value (must be initialized with 0x00000000)
Parameters:
DATA byte 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().

#define min ( a,
 )     (((a) < (b)) ? (a) : (b))

Computes the minimum between two integers.

Parameters:
a first integer to compare
Parameters:
b second integer to compare
Returns:
returns the minimum integer between a and b

Referenced by eras_dec_rs(), jpwl_epbs_add(), tcd_decode_tile(), and tcd_rateallocate().


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:
j2k J2K 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:
j2k J2K 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:
j2k J2K 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:
j2k J2K 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:
j2k J2K 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.

bool jpwl_check_tile ( opj_j2k_t j2k,
opj_tcd_t tcd,
int  tileno 
)
bool jpwl_correct ( opj_j2k_t j2k  ) 

corrects the data in the JPWL codestream

Parameters:
j2k J2K compressor handle
Returns:
true if correction is performed correctly

References opj_cio::bp, opj_j2k::cio, cio_read(), cio_seek(), cio_skip(), cio_tell(), opj_j2k::cp, opj_cio::end, opj_cp::exp_comps, J2K_MS_EOC, J2K_MS_EPB, J2K_MS_SIZ, J2K_MS_SOC, J2K_MS_SOD, J2K_MS_SOT, J2K_STATE_MH, J2K_STATE_MHSIZ, J2K_STATE_MHSOC, J2K_STATE_MT, J2K_STATE_TPH, jpwl_epb_correct(), opj_cio::length, and opj_j2k::state.

Referenced by j2k_decode().

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:
j2k J2K handle
Parameters:
cio codestream handle
Parameters:
image image 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, and opj_j2k::pos_correction.

Referenced by j2k_encode().

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:
j2k J2K compressor handle
Parameters:
buffer pointer to the EPB position
Parameters:
type type of EPB: 0=MH, 1=TPH, 2=other, 3=auto
Parameters:
pre_len length of pre-data
Parameters:
post_len length of post_data
Parameters:
conn is a pointer to the length of all connected (packed) EPBs
Parameters:
L4_bufp is 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, and opj_event_msg().

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

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

create an EPB marker segment

Parameters:
j2k J2K compressor handle
Parameters:
latest it is the latest EPB in the header
Parameters:
packed EPB is in packed style
Parameters:
tileno tile number where the marker has been placed (-1 means MH)
Parameters:
idx current EPB running index
Parameters:
hprot applied protection type (-1/0,1,16,32,37-128)
Parameters:
pre_len length of pre-protected data
Parameters:
post_len length 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().

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,
bool  latest,
bool  packed,
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:
j2k J2K compressor handle
Parameters:
jwmarker pointer to the JPWL markers list
Parameters:
jwmarker_num pointer to the number of JPWL markers (gets updated)
Parameters:
latest it is the latest group of EPBs in the header
Parameters:
packed EPBs are in packed style
Parameters:
insideMH it is in the MH
Parameters:
idx pointer to the starting EPB running index (gets updated)
Parameters:
hprot applied protection type (-1/0,1,16,32,37-128)
Parameters:
place_pos place in original codestream where EPBs should go
Parameters:
tileno tile number of these EPBs
Parameters:
pre_len length of pre-protected data
Parameters:
post_len length 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::epbmark, EVT_ERROR, jpwl_marker::id, J2K_MS_EPB, jpwl_epb_create(), JPWL_MAX_NO_MARKERS, JPWL_MAXIMUM_EPB_ROOM, jpwl_marker::len, jpwl_marker::len_ready, jpwl_epb_ms::Lepb, min, opj_event_msg(), jpwl_marker::parms_ready, jpwl_marker::pos, and jpwl_marker::pos_ready.

Referenced by jpwl_prepare_marks().

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:
j2k J2K compressor handle
Parameters:
jwmarker pointer to the JPWL markers list
Parameters:
jwmarker_num pointer to the number of JPWL markers (gets updated)
Parameters:
comps considered component (-1=average, 0/1/2/...=component no.)
Parameters:
addrm addressing mode (0=packet, 1=byte range, 2=packet range, 3=reserved)
Parameters:
ad_size size of addresses (2/4 bytes)
Parameters:
senst sensitivity type
Parameters:
se_size sensitivity values size (1/2 bytes)
Parameters:
place_pos place in original codestream where EPBs should go
Parameters:
tileno tile 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:
j2k J2K handle
Parameters:
cio codestream handle
Parameters:
image image 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::epbmark, jpwl_marker::epcmark, opj_cp::esd_on, jpwl_marker::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, opj_codestream_info::main_head_end, opj_codestream_info::main_head_start, opj_tile_info::num_tps, opj_event_msg(), 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().

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

Variable Documentation

jpwl_marker_t jwmarker[JPWL_MAX_NO_MARKERS] [static]

properties of JPWL markers to insert

int jwmarker_num [static]

number of JPWL prepared markers

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

Generated on Sat Jan 22 13:23:00 2011 for OpenJPEG by  doxygen 1.6.3