OpenJPEG 1.5.1
jpwl.c File Reference
#include "opj_includes.h"

Functions

Local static functions
jpwl_epc_ms_tjpwl_epc_create (opj_j2k_t *j2k, opj_bool esd_on, opj_bool red_on, opj_bool epb_on, opj_bool info_on)
 create an EPC marker segment
 
jpwl_esd_ms_tjpwl_esd_create (opj_j2k_t *j2k, int comps, unsigned char addrm, unsigned char ad_size, unsigned char senst, int se_size, int tileno, unsigned long int svalnum, void *sensval)
 create an EPC marker segment
 
int jpwl_markcomp (const void *arg1, const void *arg2)
 this function is used to compare two JPWL markers based on their relevant wishlist position
 
void jpwl_epb_write (opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf)
 write an EPB MS to a buffer
 
void jpwl_epc_write (opj_j2k_t *j2k, jpwl_epc_ms_t *epcmark, unsigned char *buf)
 write an EPC MS to a buffer
 
void jpwl_esd_write (opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf)
 write an ESD MS to a buffer
 
void jpwl_encode (opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image)
 Encode according to JPWL specs.
 
void j2k_add_marker (opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len)
 
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)
 
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
 
void j2k_read_sec (opj_j2k_t *j2k)
 Read the SEC marker (SEcured Codestream)
 
void j2k_write_sec (opj_j2k_t *j2k)
 Write the SEC marker (SEcured Codestream)
 
void j2k_read_insec (opj_j2k_t *j2k)
 Read the INSEC marker (SEcured Codestream)
 

Variables

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
 

Function Documentation

◆ j2k_add_marker()

void j2k_add_marker ( opj_codestream_info_t cstr_info,
unsigned short int  type,
int  pos,
int  len 
)

◆ j2k_read_epb()

void j2k_read_epb ( opj_j2k_t j2k)

◆ j2k_read_epc()

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

◆ j2k_read_esd()

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

◆ j2k_read_insec()

void j2k_read_insec ( opj_j2k_t j2k)

Read the INSEC marker (SEcured Codestream)

Parameters
j2kJ2K handle

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

◆ j2k_read_red()

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

◆ j2k_read_sec()

void j2k_read_sec ( opj_j2k_t j2k)

Read the SEC marker (SEcured Codestream)

Parameters
j2kJ2K handle

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

◆ j2k_write_epb()

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.

◆ j2k_write_epc()

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.

◆ j2k_write_sec()

void j2k_write_sec ( opj_j2k_t j2k)

Write the SEC marker (SEcured Codestream)

Parameters
j2kJ2K handle

References opj_j2k::cio, cio_write(), and J2K_MS_SEC.

◆ jpwl_check_tile()

opj_bool jpwl_check_tile ( opj_j2k_t j2k,
opj_tcd_t tcd,
int  tileno 
)

◆ jpwl_dump_marks()

void jpwl_dump_marks ( opj_j2k_t j2k,
opj_cio_t cio,
opj_image_t image 
)

◆ jpwl_encode()

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, jwmarker_num, opj_free, and opj_j2k::pos_correction.

Referenced by j2k_encode().

◆ jpwl_epb_write()

void jpwl_epb_write ( opj_j2k_t j2k,
jpwl_epb_ms_t epbmark,
unsigned char *  buf 
)

write an EPB MS to a buffer

Parameters
j2kJ2K compressor handle
epbmarkpointer to the EPB MS
bufpointer to the memory buffer

References opj_j2k::cstr_info, jpwl_epb_ms::Depb, j2k_add_marker(), J2K_MS_EPB, jpwl_epb_ms::LDPepb, jpwl_epb_ms::Lepb, and jpwl_epb_ms::Pepb.

Referenced by jpwl_dump_marks().

◆ jpwl_epc_create()

jpwl_epc_ms_t * jpwl_epc_create ( opj_j2k_t j2k,
opj_bool  esd_on,
opj_bool  red_on,
opj_bool  epb_on,
opj_bool  info_on 
)

create an EPC marker segment

Parameters
j2kJ2K compressor handle
esd_ontrue if ESD is activated
red_ontrue if RED is activated
epb_ontrue if EPB is activated
info_ontrue if informative techniques are activated
Returns
returns the freshly created EPC

References opj_j2k::cinfo, opj_j2k::cp, jpwl_epc_ms::DL, opj_cp::epb_on, jpwl_epc_ms::epb_on, opj_cp::esd_on, jpwl_epc_ms::esd_on, EVT_ERROR, opj_cp::info_on, jpwl_epc_ms::info_on, jpwl_epc_ms::Lepc, opj_event_msg(), opj_malloc, jpwl_epc_ms::Pcrc, jpwl_epc_ms::Pepc, opj_cp::red_on, and jpwl_epc_ms::red_on.

Referenced by jpwl_prepare_marks().

◆ jpwl_epc_write()

void jpwl_epc_write ( opj_j2k_t j2k,
jpwl_epc_ms_t epcmark,
unsigned char *  buf 
)

write an EPC MS to a buffer

Parameters
j2kJ2K compressor handle
epcmarkpointer to the EPC MS
bufpointer to the memory buffer

References opj_j2k::cstr_info, jpwl_epc_ms::DL, j2k_add_marker(), J2K_MS_EPC, jpwl_epc_ms::Lepc, jpwl_epc_ms::Pcrc, and jpwl_epc_ms::Pepc.

Referenced by jpwl_dump_marks().

◆ jpwl_esd_create()

jpwl_esd_ms_t * jpwl_esd_create ( opj_j2k_t j2k,
int  comps,
unsigned char  addrm,
unsigned char  ad_size,
unsigned char  senst,
int  se_size,
int  tileno,
unsigned long int  svalnum,
void *  sensval 
)

create an EPC marker segment

Parameters
j2kJ2K compressor handle
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)
tilenotile where this ESD lies (-1 means MH)
svalnumnumber of sensitivity values (if 0, they will be automatically filled)
sensvalpointer to an array of sensitivity values (if NULL, they will be automatically filled)
Returns
returns the freshly created ESD

References jpwl_esd_ms::ad_size, jpwl_esd_ms::addrm, jpwl_esd_ms::Cesd, opj_j2k::cinfo, opj_codestream_info::codestream_size, opj_j2k::cstr_info, jpwl_esd_ms::data, EVT_ERROR, opj_j2k::image, jpwl_esd_ms::Lesd, jpwl_esd_ms::numcomps, opj_image::numcomps, opj_event_msg(), opj_malloc, opj_codestream_info::packno, jpwl_esd_ms::Pesd, jpwl_esd_ms::se_size, jpwl_esd_ms::senst, jpwl_esd_ms::sensval_size, jpwl_esd_ms::svalnum, opj_codestream_info::th, jpwl_esd_ms::tileno, and opj_codestream_info::tw.

Referenced by jpwl_prepare_marks().

◆ jpwl_esd_write()

void jpwl_esd_write ( opj_j2k_t j2k,
jpwl_esd_ms_t esdmark,
unsigned char *  buf 
)

write an ESD MS to a buffer

Parameters
j2kJ2K compressor handle
esdmarkpointer to the ESD MS
bufpointer to the memory buffer

References jpwl_esd_ms::Cesd, opj_j2k::cstr_info, j2k_add_marker(), J2K_MS_ESD, jpwl_esd_ms::Lesd, jpwl_esd_ms::numcomps, and jpwl_esd_ms::Pesd.

Referenced by jpwl_dump_marks().

◆ jpwl_markcomp()

int jpwl_markcomp ( const void *  arg1,
const void *  arg2 
)

this function is used to compare two JPWL markers based on their relevant wishlist position

Parameters
arg1pointer to first marker
arg2pointer to second marker
Returns
1 if arg1>arg2, 0 if arg1=arg2, -1 if arg1

Referenced by jpwl_dump_marks().

◆ jpwl_prepare_marks()

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, 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().

Variable Documentation

◆ jwmarker

properties of JPWL markers to insert

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

◆ jwmarker_num

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