Go to the documentation of this file.
52 #define JPWL_ASSUME OPJ_TRUE
117 unsigned long int DL;
284 unsigned long int pre_len,
unsigned long int post_len);
303 double place_pos,
int tileno,
304 unsigned long int pre_len,
unsigned long int post_len);
320 int comps,
unsigned char addrm,
unsigned char ad_size,
321 unsigned char senst,
unsigned char se_size,
322 double place_pos,
int tileno);
356 unsigned char **L4_bufp);
373 #define jpwl_updateCRC16(CRC, DATA) updateCRC16(CRC, DATA)
381 #define jpwl_updateCRC32(CRC, DATA) updateCRC32(CRC, DATA)
390 #define min(a,b) (((a) < (b)) ? (a) : (b))
unsigned short int Lesd
two bytes for the length of ESD MS, exluding the marker itself (4 to 65535 bytes)
Definition: jpwl.h:142
int pre_len
length of pre-data
Definition: jpwl.h:75
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 ful...
Definition: jpwl.c:183
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 simplif...
Definition: jpwl.c:958
opj_packet_info_t * packet
information concerning packets inside tile
Definition: openjpeg.h:652
unsigned char * data
EPB data, variable size.
Definition: jpwl.h:94
int tw
number of tiles in X
Definition: openjpeg.h:694
unsigned short int Lred
two bytes for the length of RED MS, exluding the marker itself (3 to 65535 bytes)
Definition: jpwl.h:168
#define jpwl_updateCRC16(CRC, DATA)
Macro functions for CRC computation.
Definition: jpwl.h:373
int hprot_MH
error protection method for MH (0,1,16,32,37-128)
Definition: j2k.h:278
void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len)
Definition: jpwl.c:164
unsigned long int svalnum
number of sensitivity values
Definition: jpwl.h:157
unsigned long int Pepb
four bytes, next error management method
Definition: jpwl.h:92
#define opj_free(m)
Deallocates or frees a memory block.
Definition: opj_malloc.h:152
#define opj_malloc(size)
Allocate an uninitialized memory block.
Definition: opj_malloc.h:51
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
Definition: jpwl_lib.c:744
static jpwl_marker_t jwmarker[JPWL_MAX_NO_MARKERS]
properties of JPWL markers to insert
Definition: jpwl.c:45
struct jpwl_epb_ms jpwl_epb_ms_t
EPB (Error Protection Block) Marker segment.
void j2k_read_epb(opj_j2k_t *j2k)
Read the EPB marker (Error Protection Block)
Definition: jpwl.c:1019
unsigned long int LDPepb
four bytes, from 0 to 2^31-1
Definition: jpwl.h:90
unsigned short int type
marker type
Definition: openjpeg.h:605
unsigned char * data
EPC data, variable length.
Definition: jpwl.h:121
#define J2K_MS_ESD
ESD marker value (Part 11: JPEG 2000 for Wireless)
Definition: j2k.h:84
unsigned char se_size
size of sensitivity data (1/2 bytes)
Definition: jpwl.h:138
unsigned char Pesd
one byte, signals JPWL techniques adoption
Definition: jpwl.h:146
int pw
Definition: tcd.h:132
JPEG-2000 codestream reader/writer.
Definition: j2k.h:314
opj_bool parms_ready
the marker parameters are ready or not?
Definition: jpwl.h:203
int post_len
length of post-data
Definition: jpwl.h:81
int tp_end_header
end position of tile part header
Definition: openjpeg.h:620
static int jwmarker_num
number of JPWL prepared markers
Definition: jpwl.c:43
int len
length, marker val included
Definition: openjpeg.h:609
Marker structure.
Definition: openjpeg.h:603
double opj_clock(void)
Difference in successive opj_clock() calls tells you the elapsed time.
Definition: j2k_lib.c:36
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 ful...
Definition: jpwl.c:183
void j2k_read_esd(opj_j2k_t *j2k)
Read the ESD marker (Error Sensitivity Descriptor)
Definition: jpwl.c:1170
unsigned short int Pcrc
two bytes, CRC for the EPC, excluding Pcrc itself
Definition: jpwl.h:115
int numbands
Definition: tcd.h:133
int tileno
tile where this marker has been placed (-1 means MH)
Definition: jpwl.h:155
opj_tcd_band_t bands[3]
Definition: tcd.h:134
int pprot_tileno[JPWL_MAX_NO_PACKSPECS]
tile number of packet protection specification (>=0)
Definition: j2k.h:284
opj_cio_t * cio
pointer to the byte i/o stream
Definition: j2k.h:368
int hprot
error protection method [-1=absent 0=none 1=predefined 16=CRC-16 32=CRC-32 37-128=RS]
Definition: jpwl.h:69
int maxmarknum
actual size of markers array
Definition: openjpeg.h:709
void j2k_write_sec(opj_j2k_t *j2k)
Write the SEC marker (SEcured Codestream)
Definition: jpwl.c:1327
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
Definition: jpwl_lib.c:1203
int length
buffer size in bytes
Definition: openjpeg.h:484
EPC (Error Protection Capability) Marker segment.
Definition: jpwl.h:101
int end_pos
packet end position
Definition: openjpeg.h:593
void j2k_write_epb(opj_j2k_t *j2k)
Write the EPB marker (Error Protection Block)
Definition: jpwl.c:1134
unsigned char * data
ESD data, variable length.
Definition: jpwl.h:148
int sens_MH
sensitivity method for MH (-1,0-7)
Definition: j2k.h:296
opj_bool esd_on
enables writing of ESD, in case of activated JPWL
Definition: j2k.h:272
Functions used to compute the 16- and 32-bit CRC of byte arrays.
#define J2K_MS_SEC
SEC marker value (Part 8: Secure JPEG 2000)
Definition: j2k.h:88
unsigned short int Lepb
two bytes for the length of EPB MS, exluding the marker itself (11 to 65535 bytes)
Definition: jpwl.h:86
opj_image_t * image
pointer to the encoded / decoded image
Definition: j2k.h:362
int exp_comps
expected number of components at the decoder
Definition: j2k.h:304
int main_head_start
main header position
Definition: openjpeg.h:712
opj_bool red_on
is RED active?
Definition: jpwl.h:105
int pos_correction
as the J2K-file is written in several parts during encoding, it enables to make the right correction ...
Definition: j2k.h:351
opj_bool epb_on
is EPB active?
Definition: jpwl.h:107
int sens_TPH[JPWL_MAX_NO_TILESPECS]
sensitivity methods for TPHs (-1,0-7)
Definition: j2k.h:300
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
Definition: jpwl_lib.c:1685
int start_pos
packet start position (including SOP marker if it exists)
Definition: openjpeg.h:589
void j2k_read_epb(opj_j2k_t *j2k)
Read the EPB marker (Error Protection Block)
Definition: jpwl.c:1019
unsigned char * data
RED data, variable length.
Definition: jpwl.h:172
Structure used to store JPWL markers temporary position and readyness.
Definition: jpwl.h:178
#define J2K_MS_EPC
EPC marker value (Part 11: JPEG 2000 for Wireless)
Definition: j2k.h:82
opj_tcd_resolution_t * resolutions
Definition: tcd.h:143
int pprot_packno[JPWL_MAX_NO_PACKSPECS]
packet number of packet protection specification (>=0)
Definition: j2k.h:286
int n_pre
code word length of pre-data
Definition: jpwl.h:73
opj_bool len_ready
the marker length is ready or not?
Definition: jpwl.h:199
@ J2K_STATE_MH
the decoding process is in the main header
Definition: j2k.h:103
unsigned char Depb
single byte for the style
Definition: jpwl.h:88
unsigned int cio_read(opj_cio_t *cio, int n)
Read some bytes.
Definition: cio.c:183
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.
Definition: jpwl.c:712
ESD (Error Sensitivity Descriptor) Marker segment.
Definition: jpwl.h:128
opj_common_ptr cinfo
codec context
Definition: j2k.h:316
int hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]
tile number of header protection specification (>=0)
Definition: j2k.h:280
#define EVT_WARNING
Warning event type.
Definition: event.h:36
int x1
Definition: tcd.h:106
#define opj_realloc(m, s)
Reallocate memory blocks.
Definition: opj_malloc.h:142
#define J2K_MS_RED
RED marker value (Part 11: JPEG 2000 for Wireless)
Definition: j2k.h:85
opj_bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf, unsigned char *post_buf)
Definition: jpwl_lib.c:359
int sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]
tile number of sensitivity specification (>=0)
Definition: j2k.h:298
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
Definition: jpwl.c:1223
int cw
Definition: tcd.h:107
void jpwl_esd_write(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf)
write an ESD MS to a buffer
Definition: jpwl_lib.c:1584
int id
marker value (J2K_MS_EPC, etc.)
Definition: jpwl.h:180
unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n)
Write some bytes.
Definition: cio.c:167
int openmode
open mode (read/write) either OPJ_STREAM_READ or OPJ_STREAM_WRITE
Definition: openjpeg.h:480
FIXME: documentation.
Definition: tcd.h:105
void jpwl_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image)
Encode according to JPWL specs.
Definition: jpwl.c:114
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 simplif...
Definition: jpwl.c:958
unsigned short int Lepc
two bytes for the length of EPC MS, exluding the marker itself (9 to 65535 bytes)
Definition: jpwl.h:113
Byte input-output stream (CIO)
Definition: openjpeg.h:475
int tp_start_pos
start position of tile part
Definition: openjpeg.h:618
opj_marker_info_t * marker
list of markers
Definition: openjpeg.h:707
jpwl_esd_ms_t * esdmark
pointer to ESD marker
Definition: jpwl.h:188
unsigned char Pepc
one byte, signals JPWL techniques adoption
Definition: jpwl.h:119
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
Definition: jpwl_lib.c:76
FIXME: documentation.
Definition: tcd.h:130
opj_tcd_tile_t * tiles
Definition: tcd.h:167
FIXME: documentation.
Definition: tcd.h:140
unsigned short int Cesd
two bytes, component of error sensitivity
Definition: jpwl.h:144
FIXME: documentation.
Definition: tcd.h:119
opj_bool correct
enables JPWL correction at the decoder
Definition: j2k.h:302
void j2k_read_red(opj_j2k_t *j2k)
Read the RED marker (Residual Error Descriptor)
Definition: jpwl.c:1200
@ J2K_STATE_TPH
the decoding process is in a tile part header
Definition: j2k.h:105
union opj_tcd_precinct::@0 cblks
size_t sensval_size
size of a single sensitivity pair (address+value)
Definition: jpwl.h:159
unsigned char * end
pointer to the end of the stream
Definition: openjpeg.h:489
int numresolutions
Definition: tcd.h:142
unsigned long int DL
four bytes, the codestream length from SOC to EOC
Definition: jpwl.h:117
struct jpwl_epc_ms jpwl_epc_ms_t
EPC (Error Protection Capability) Marker segment.
void jpwl_epb_write(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf)
write an EPB MS to a buffer
Definition: jpwl_lib.c:298
int OPJ_CALLCONV cio_tell(opj_cio_t *cio)
Get position in byte stream.
Definition: cio.c:100
int num_tps
number of tile parts
Definition: openjpeg.h:664
void jpwl_epc_write(opj_j2k_t *j2k, jpwl_epc_ms_t *epcmark, unsigned char *buf)
write an EPC MS to a buffer
Definition: jpwl_lib.c:1163
int pprot[JPWL_MAX_NO_PACKSPECS]
error protection methods for packets (0,1,16,32,37-128)
Definition: j2k.h:288
opj_bool data_ready
are the written data ready or not
Definition: jpwl.h:205
opj_bool info_on
are informative techniques active?
Definition: jpwl.h:109
void j2k_read_insec(opj_j2k_t *j2k)
Read the INSEC marker (SEcured Codestream)
Definition: jpwl.c:1341
int packno
packet number
Definition: openjpeg.h:676
int k_pre
message word length of pre-data
Definition: jpwl.h:71
opj_tcd_precinct_t * precincts
Definition: tcd.h:122
struct jpwl_marker jpwl_marker_t
Structure used to store JPWL markers temporary position and readyness.
#define OPJ_TRUE
Definition: openjpeg.h:64
void j2k_write_sec(opj_j2k_t *j2k)
Write the SEC marker (SEcured Codestream)
Definition: jpwl.c:1327
unsigned char index
index in current header (0-63)
Definition: jpwl.h:67
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
Definition: jpwl_lib.c:1195
jpwl_red_ms_t * redmark
pointer to RED marker
Definition: jpwl.h:190
opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt,...)
Write formatted data to a string and send the string to a user callback.
Definition: event.c:76
void cio_skip(opj_cio_t *cio, int n)
Skip some bytes.
Definition: cio.c:198
union keeping the pointer to the real marker struct
Definition: jpwl.h:182
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
Definition: jpwl.c:1223
struct jpwl_esd_ms jpwl_esd_ms_t
ESD (Error Sensitivity Descriptor) Marker segment.
jpwl_epb_ms_t * epbmark
pointer to EPB marker
Definition: jpwl.h:184
unsigned char * bp
pointer to the current position
Definition: openjpeg.h:491
unsigned short int len
length of the marker segment (marker excluded)
Definition: jpwl.h:197
opj_bool pos_ready
the marker position is ready or not?
Definition: jpwl.h:201
#define JPWL_ASSUME
Assume a basic codestream structure, so you can resort better from uncorrected errors.
Definition: jpwl.h:52
EPB (Error Protection Block) Marker segment.
Definition: jpwl.h:57
int main_head_end
main header position
Definition: openjpeg.h:714
unsigned char * start
pointer to the start of the stream
Definition: openjpeg.h:487
int x0
Definition: tcd.h:106
void j2k_read_sec(opj_j2k_t *j2k)
Read the SEC marker (SEcured Codestream)
Definition: jpwl.c:1310
#define EVT_INFO
Debug event type.
Definition: event.h:37
int opj_bool
Definition: openjpeg.h:63
int numcomps
number of components in the image
Definition: jpwl.h:153
int numcomps
Definition: tcd.h:153
opj_tcd_image_t * tcd_image
info on each image tile
Definition: tcd.h:188
void j2k_read_red(opj_j2k_t *j2k)
Read the RED marker (Residual Error Descriptor)
Definition: jpwl.c:1200
int jpwl_markcomp(const void *arg1, const void *arg2)
this function is used to compare two JPWL markers based on their relevant wishlist position
Definition: jpwl_lib.c:63
opj_common_ptr cinfo
codec context
Definition: openjpeg.h:477
opj_bool esd_on
is ESD active?
Definition: jpwl.h:103
int sens_size
enables writing of ESD, (0/2/4 bytes)
Definition: j2k.h:290
void j2k_read_esd(opj_j2k_t *j2k)
Read the ESD marker (Error Sensitivity Descriptor)
Definition: jpwl.c:1170
int pos
position in codestream
Definition: openjpeg.h:607
union jpwl_marker::jpwl_marks m
FIXME: documentation.
Definition: tcd.h:151
int hprot_TPH[JPWL_MAX_NO_TILESPECS]
error protection methods for TPHs (0,1,16,32,37-128)
Definition: j2k.h:282
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
Definition: jpwl_lib.c:199
void j2k_read_epc(opj_j2k_t *j2k)
Read the EPC marker (Error Protection Capability)
Definition: jpwl.c:907
void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos)
Set position in byte stream.
Definition: cio.c:109
unsigned char ad_size
size of codestream addresses [2/4 bytes]
Definition: jpwl.h:132
RED (Residual Error Descriptor) Marker segment.
Definition: jpwl.h:166
opj_tile_info_t * tile
information regarding tiles inside image
Definition: openjpeg.h:718
unsigned char Pred
one byte, signals JPWL techniques adoption
Definition: jpwl.h:170
#define JPWL_MAX_NO_PACKSPECS
Maximum number of packet parts expected by JPWL: increase at your will.
Definition: openjpeg.h:82
Functions used to compute Reed-Solomon parity and check of byte arrays.
#define JPWL_MAX_NO_TILESPECS
Maximum number of tile parts expected by JPWL: increase at your will.
Definition: openjpeg.h:81
Index structure of the codestream.
Definition: openjpeg.h:672
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
Definition: jpwl_lib.c:333
#define EVT_ERROR
Error event type.
Definition: event.h:35
void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len)
Definition: jpwl.c:164
unsigned char addrm
codestream addressing mode [0=packet, 1=byte range, 2=packet range, 3=reserved]
Definition: jpwl.h:130
unsigned char senst
type of sensitivity [0=relative error, 1=MSE, 2=MSE reduction, 3=PSNR, 4=PSNR increment,...
Definition: jpwl.h:136
opj_tp_info_t * tp
information concerning tile parts
Definition: openjpeg.h:666
void jpwl_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image)
Encode according to JPWL specs.
Definition: jpwl.c:114
int k_post
message word length of post-data
Definition: jpwl.h:77
opj_bool packed
is it in packed mode?
Definition: jpwl.h:63
int tileno
TH where this marker has been placed (-1 means MH)
Definition: jpwl.h:65
unsigned char * cio_getbp(opj_cio_t *cio)
Get pointer to the current position in the stream.
Definition: cio.c:129
double dpos
same as before, only written as a double, so we can sort it better
Definition: jpwl.h:195
#define OPJ_FALSE
Definition: openjpeg.h:65
opj_bool red_on
enables writing of RED, in case of activated JPWL
Definition: j2k.h:276
struct jpwl_red_ms jpwl_red_ms_t
RED (Residual Error Descriptor) Marker segment.
opj_bool latest
is the latest in header?
Definition: jpwl.h:61
opj_cp_t * cp
pointer to the coding parameters
Definition: j2k.h:364
opj_codestream_info_t * cstr_info
helper used to write the index file
Definition: j2k.h:366
void j2k_read_epc(opj_j2k_t *j2k)
Read the EPC marker (Error Protection Capability)
Definition: jpwl.c:907
opj_bool jpwl_correct(opj_j2k_t *j2k)
corrects the data in the JPWL codestream
Definition: jpwl_lib.c:546
int state
locate in which part of the codestream the decoder is (main header, tile header, end)
Definition: j2k.h:319
int n_post
code word length of post-data
Definition: jpwl.h:79
opj_bool epb_on
enables writing of EPB, in case of activated JPWL
Definition: j2k.h:270
unsigned long int pos
position where the marker should go, in the pre-JPWL codestream
Definition: jpwl.h:193
void j2k_read_sec(opj_j2k_t *j2k)
Read the SEC marker (SEcured Codestream)
Definition: jpwl.c:1310
int th
number of tiles in Y
Definition: openjpeg.h:696
Defines image data and characteristics.
Definition: openjpeg.h:533
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.
Definition: jpwl.c:712
int ch
Definition: tcd.h:107
opj_tcd_tilecomp_t * comps
Definition: tcd.h:154
int tp_numpacks
number of packets of tile part
Definition: openjpeg.h:626
void j2k_write_epb(opj_j2k_t *j2k)
Write the EPB marker (Error Protection Block)
Definition: jpwl.c:1134
opj_bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf)
Definition: jpwl_lib.c:1336
int sens_addr
sensitivity addressing size (0=auto/2/4 bytes)
Definition: j2k.h:292
jpwl_epc_ms_t * epcmark
pointer to EPC marker
Definition: jpwl.h:186
int numcomps
number of components in the image
Definition: openjpeg.h:543
int marknum
number of markers
Definition: openjpeg.h:705
void j2k_read_insec(opj_j2k_t *j2k)
Read the INSEC marker (SEcured Codestream)
Definition: jpwl.c:1341
#define JPWL_MAX_NO_MARKERS
Maximum number of JPWL markers: increase at your will.
Definition: openjpeg.h:83
Tile coder/decoder.
Definition: tcd.h:173
unsigned char * buffer
pointer to the start of the buffer
Definition: openjpeg.h:482
#define J2K_MS_EPB
EPB marker value (Part 11: JPEG 2000 for Wireless)
Definition: j2k.h:83
int sens_range
sensitivity range (0-3)
Definition: j2k.h:294
int ph
Definition: tcd.h:132
int tp_start_pack
start packet of tile part
Definition: openjpeg.h:624
int codestream_size
codestream's size
Definition: openjpeg.h:716