OpenJPEG  1.5.1
mct.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
3  * Copyright (c) 2002-2007, Professor Benoit Macq
4  * Copyright (c) 2001-2003, David Janssens
5  * Copyright (c) 2002-2003, Yannick Verschueren
6  * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
7  * Copyright (c) 2005, Herve Drolon, FreeImage Team
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef __MCT_H
33 #define __MCT_H
34 
44 
47 /* ----------------------------------------------------------------------- */
55 void mct_encode(int *c0, int *c1, int *c2, int n);
63 void mct_decode(int *c0, int *c1, int *c2, int n);
69 double mct_getnorm(int compno);
70 
78 void mct_encode_real(int *c0, int *c1, int *c2, int n);
86 void mct_decode_real(float* c0, float* c1, float* c2, int n);
92 double mct_getnorm_real(int compno);
93 /* ----------------------------------------------------------------------- */
97 
98 #endif /* __MCT_H */
jpwl_esd_ms::Lesd
unsigned short int Lesd
two bytes for the length of ESD MS, exluding the marker itself (4 to 65535 bytes)
Definition: jpwl.h:142
jpwl_epb_ms::pre_len
int pre_len
length of pre-data
Definition: jpwl.h:75
opj_tile_info::packet
opj_packet_info_t * packet
information concerning packets inside tile
Definition: openjpeg.h:652
opj_codestream_info::tw
int tw
number of tiles in X
Definition: openjpeg.h:694
MAX_V2
#define MAX_V2
Definition: jpwl_lib.c:41
jpwl_updateCRC16
#define jpwl_updateCRC16(CRC, DATA)
Macro functions for CRC computation.
Definition: jpwl.h:373
jpwl_esd_ms::svalnum
unsigned long int svalnum
number of sensitivity values
Definition: jpwl.h:157
jpwl_epb_ms::Pepb
unsigned long int Pepb
four bytes, next error management method
Definition: jpwl.h:92
cio_numbytesleft
int cio_numbytesleft(opj_cio_t *cio)
Number of bytes left before the end of the stream.
Definition: cio.c:121
opj_malloc
#define opj_malloc(size)
Allocate an uninitialized memory block.
Definition: opj_malloc.h:51
jpwl_updateCRC32
#define jpwl_updateCRC32(CRC, DATA)
Computes the CRC-32, as stated in JPWL specs.
Definition: jpwl.h:381
jwmarker
static jpwl_marker_t jwmarker[JPWL_MAX_NO_MARKERS]
properties of JPWL markers to insert
Definition: jpwl.c:45
jpwl_epb_ms::LDPepb
unsigned long int LDPepb
four bytes, from 0 to 2^31-1
Definition: jpwl.h:90
J2K_MS_ESD
#define J2K_MS_ESD
ESD marker value (Part 11: JPEG 2000 for Wireless)
Definition: j2k.h:84
opj_tile_info::distotile
double distotile
add fixed_quality
Definition: openjpeg.h:656
jpwl_esd_ms::se_size
unsigned char se_size
size of sensitivity data (1/2 bytes)
Definition: jpwl.h:138
jpwl_esd_ms::Pesd
unsigned char Pesd
one byte, signals JPWL techniques adoption
Definition: jpwl.h:146
opj_j2k
JPEG-2000 codestream reader/writer.
Definition: j2k.h:314
jpwl_marker::parms_ready
opj_bool parms_ready
the marker parameters are ready or not?
Definition: jpwl.h:203
jpwl_epb_ms::post_len
int post_len
length of post-data
Definition: jpwl.h:81
opj_tp_info::tp_end_header
int tp_end_header
end position of tile part header
Definition: openjpeg.h:620
jwmarker_num
static int jwmarker_num
number of JPWL prepared markers
Definition: jpwl.c:43
JPWL_MAXIMUM_EPB_ROOM
#define JPWL_MAXIMUM_EPB_ROOM
Expect this maximum number of bytes for composition of EPBs.
Definition: openjpeg.h:88
jpwl_epc_ms::Pcrc
unsigned short int Pcrc
two bytes, CRC for the EPC, excluding Pcrc itself
Definition: jpwl.h:115
J2K_STATE_MT
@ J2K_STATE_MT
the EOC marker has just been read
Definition: j2k.h:106
jpwl_esd_ms::tileno
int tileno
tile where this marker has been placed (-1 means MH)
Definition: jpwl.h:155
opj_j2k::cio
opj_cio_t * cio
pointer to the byte i/o stream
Definition: j2k.h:368
jpwl_double_to_pfp
unsigned short int jpwl_double_to_pfp(double V, int bytes)
conversion between a double precision floating point number and the corresponding pseudo-floating poi...
Definition: jpwl_lib.c:1615
jpwl_epb_ms::hprot
int hprot
error protection method [-1=absent 0=none 1=predefined 16=CRC-16 32=CRC-32 37-128=RS]
Definition: jpwl.h:69
J2K_STATE_MHSOC
@ J2K_STATE_MHSOC
a SOC marker is expected
Definition: j2k.h:101
jpwl_esds_add
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
opj_cio::length
int length
buffer size in bytes
Definition: openjpeg.h:484
jpwl_epc_ms
EPC (Error Protection Capability) Marker segment.
Definition: jpwl.h:101
jpwl_esd_write
void jpwl_esd_write(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf)
write an ESD MS to a buffer
Definition: jpwl_lib.c:1584
opj_packet_info::end_pos
int end_pos
packet end position
Definition: openjpeg.h:593
jpwl_esd_ms::data
unsigned char * data
ESD data, variable length.
Definition: jpwl.h:148
opj_packet_info::disto
double disto
packet distorsion
Definition: openjpeg.h:595
opj_cp::esd_on
opj_bool esd_on
enables writing of ESD, in case of activated JPWL
Definition: j2k.h:272
mct_norms_real
static const double mct_norms_real[3]
Definition: mct.c:46
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
Definition: jpwl_lib.c:333
jpwl_pfp_to_double
double jpwl_pfp_to_double(unsigned short int em, int bytes)
conversion between a pseudo-floating point used to represent sensitivity values and the corresponding...
Definition: jpwl_lib.c:1660
mct_getnorm
double mct_getnorm(int compno)
Get norm of the basis function used for the reversible multi-component transform.
Definition: mct.c:97
jpwl_epb_ms::Lepb
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_j2k::image
opj_image_t * image
pointer to the encoded / decoded image
Definition: j2k.h:362
opj_cp::exp_comps
int exp_comps
expected number of components at the decoder
Definition: j2k.h:304
jpwl_epc_ms::red_on
opj_bool red_on
is RED active?
Definition: jpwl.h:105
jpwl_epc_ms::epb_on
opj_bool epb_on
is EPB active?
Definition: jpwl.h:107
opj_packet_info::start_pos
int start_pos
packet start position (including SOP marker if it exists)
Definition: openjpeg.h:589
opj_tile_info::start_pos
int start_pos
start position
Definition: openjpeg.h:638
opj_image_comp::sgnd
int sgnd
signed (1) / unsigned (0)
Definition: openjpeg.h:521
jpwl_marker
Structure used to store JPWL markers temporary position and readyness.
Definition: jpwl.h:178
eras_dec_rs
int eras_dec_rs(dtype *data, int *eras_pos, int no_eras)
Definition: rs.c:367
J2K_MS_EPC
#define J2K_MS_EPC
EPC marker value (Part 11: JPEG 2000 for Wireless)
Definition: j2k.h:82
jpwl_epb_ms::n_pre
int n_pre
code word length of pre-data
Definition: jpwl.h:73
jpwl_marker::len_ready
opj_bool len_ready
the marker length is ready or not?
Definition: jpwl.h:199
mct_decode_real
void mct_decode_real(float *c0, float *c1, float *c2, int n)
Apply an irreversible multi-component inverse transform to an image.
opj_packet_info::end_ph_pos
int end_ph_pos
end of packet header position (including EPH marker if it exists)
Definition: openjpeg.h:591
J2K_STATE_MH
@ J2K_STATE_MH
the decoding process is in the main header
Definition: j2k.h:103
jpwl_epb_ms::Depb
unsigned char Depb
single byte for the style
Definition: jpwl.h:88
cio_read
unsigned int cio_read(opj_cio_t *cio, int n)
Read some bytes.
Definition: cio.c:183
encode_rs
int encode_rs(dtype *data, dtype *bb)
Definition: rs.c:324
mct_encode
void mct_encode(int *c0, int *c1, int *c2, int n)
Apply a reversible multi-component transform to an image.
NN
#define NN
Definition: rs.h:61
opj_image_comp::bpp
int bpp
image depth in bits
Definition: openjpeg.h:519
jpwl_esd_ms
ESD (Error Sensitivity Descriptor) Marker segment.
Definition: jpwl.h:128
opj_j2k::cinfo
opj_common_ptr cinfo
codec context
Definition: j2k.h:316
EVT_WARNING
#define EVT_WARNING
Warning event type.
Definition: event.h:36
MIN_V2
#define MIN_V2
Definition: jpwl_lib.c:40
opj_tile_info::end_header
int end_header
end position of the header
Definition: openjpeg.h:640
jpwl_marker::id
int id
marker value (J2K_MS_EPC, etc.)
Definition: jpwl.h:180
J2K_MS_SIZ
#define J2K_MS_SIZ
SIZ marker value.
Definition: j2k.h:64
opj_includes.h
J2K_MS_SOT
#define J2K_MS_SOT
SOT marker value.
Definition: j2k.h:61
mct_encode_real
void mct_encode_real(int *c0, int *c1, int *c2, int n)
Apply an irreversible multi-component transform to an image.
jpwl_epc_ms::Lepc
unsigned short int Lepc
two bytes for the length of EPC MS, exluding the marker itself (9 to 65535 bytes)
Definition: jpwl.h:113
opj_cio
Byte input-output stream (CIO)
Definition: openjpeg.h:475
opj_tp_info::tp_start_pos
int tp_start_pos
start position of tile part
Definition: openjpeg.h:618
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
Definition: jpwl_lib.c:63
jpwl_epb_write
void jpwl_epb_write(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf)
write an EPB MS to a buffer
Definition: jpwl_lib.c:298
jpwl_epc_ms::Pepc
unsigned char Pepc
one byte, signals JPWL techniques adoption
Definition: jpwl.h:119
J2K_MS_SOC
#define J2K_MS_SOC
SOC marker value.
Definition: j2k.h:60
jpwl_esd_ms::Cesd
unsigned short int Cesd
two bytes, component of error sensitivity
Definition: jpwl.h:144
opj_cp::correct
opj_bool correct
enables JPWL correction at the decoder
Definition: j2k.h:302
opj_cp::info_on
opj_bool info_on
enables writing of informative techniques of ESD, in case of activated JPWL
Definition: j2k.h:274
J2K_STATE_TPH
@ J2K_STATE_TPH
the decoding process is in a tile part header
Definition: j2k.h:105
fix_mul
static INLINE int fix_mul(int a, int b)
Multiply two fixed-precision rational numbers.
Definition: fix.h:56
jpwl_esd_ms::sensval_size
size_t sensval_size
size of a single sensitivity pair (address+value)
Definition: jpwl.h:159
opj_cio::end
unsigned char * end
pointer to the end of the stream
Definition: openjpeg.h:489
jpwl_epc_ms::DL
unsigned long int DL
four bytes, the codestream length from SOC to EOC
Definition: jpwl.h:117
cio_tell
int OPJ_CALLCONV cio_tell(opj_cio_t *cio)
Get position in byte stream.
Definition: cio.c:100
J2K_MS_EOC
#define J2K_MS_EOC
EOC marker value.
Definition: j2k.h:63
opj_tile_info::num_tps
int num_tps
number of tile parts
Definition: openjpeg.h:664
jpwl_marker::data_ready
opj_bool data_ready
are the written data ready or not
Definition: jpwl.h:205
jpwl_epc_ms::info_on
opj_bool info_on
are informative techniques active?
Definition: jpwl.h:109
opj_codestream_info::packno
int packno
packet number
Definition: openjpeg.h:676
jpwl_epb_ms::k_pre
int k_pre
message word length of pre-data
Definition: jpwl.h:71
OPJ_TRUE
#define OPJ_TRUE
Definition: openjpeg.h:64
init_rs
void init_rs(int k)
Initialization function.
Definition: rs.c:198
jpwl_update_info
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
opj_event_msg
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
cio_skip
void cio_skip(opj_cio_t *cio, int n)
Skip some bytes.
Definition: cio.c:198
jpwl_epb_fill
opj_bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epb, unsigned char *buf, unsigned char *post_buf)
Definition: jpwl_lib.c:359
jpwl_marker::jpwl_marks::epbmark
jpwl_epb_ms_t * epbmark
pointer to EPB marker
Definition: jpwl.h:184
jpwl_epbs_add
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
mct_getnorm
double mct_getnorm(int compno)
Get norm of the basis function used for the reversible multi-component transform.
Definition: mct.c:97
jpwl_epb_correct
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
opj_tile_info::numpix
int numpix
add fixed_quality
Definition: openjpeg.h:654
opj_cio::bp
unsigned char * bp
pointer to the current position
Definition: openjpeg.h:491
jpwl_marker::len
unsigned short int len
length of the marker segment (marker excluded)
Definition: jpwl.h:197
jpwl_marker::pos_ready
opj_bool pos_ready
the marker position is ready or not?
Definition: jpwl.h:201
MIN_V1
#define MIN_V1
Minimum and maximum values for the double->pfp conversion.
Definition: jpwl_lib.c:38
jpwl_epb_ms
EPB (Error Protection Block) Marker segment.
Definition: jpwl.h:57
opj_codestream_info::main_head_end
int main_head_end
main header position
Definition: openjpeg.h:714
mct_getnorm_real
double mct_getnorm_real(int compno)
Get norm of the basis function used for the irreversible multi-component transform.
Definition: mct.c:188
EVT_INFO
#define EVT_INFO
Debug event type.
Definition: event.h:37
opj_bool
int opj_bool
Definition: openjpeg.h:63
jpwl_esd_ms::numcomps
int numcomps
number of components in the image
Definition: jpwl.h:153
restrict
#define restrict
Definition: opj_includes.h:85
jpwl_epc_ms::esd_on
opj_bool esd_on
is ESD active?
Definition: jpwl.h:103
jpwl_marker::m
union jpwl_marker::jpwl_marks m
cio_seek
void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos)
Set position in byte stream.
Definition: cio.c:109
opj_image::comps
opj_image_comp_t * comps
image components
Definition: openjpeg.h:547
mct_decode
void mct_decode(int *c0, int *c1, int *c2, int n)
Apply a reversible multi-component inverse transform to an image.
jpwl_esd_ms::ad_size
unsigned char ad_size
size of codestream addresses [2/4 bytes]
Definition: jpwl.h:132
opj_codestream_info::tile
opj_tile_info_t * tile
information regarding tiles inside image
Definition: openjpeg.h:718
opj_codestream_info
Index structure of the codestream.
Definition: openjpeg.h:672
EVT_ERROR
#define EVT_ERROR
Error event type.
Definition: event.h:35
j2k_add_marker
void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len)
Definition: jpwl.c:164
jpwl_esd_ms::addrm
unsigned char addrm
codestream addressing mode [0=packet, 1=byte range, 2=packet range, 3=reserved]
Definition: jpwl.h:130
jpwl_epc_write
void jpwl_epc_write(opj_j2k_t *j2k, jpwl_epc_ms_t *epc, unsigned char *buf)
write an EPC MS to a buffer
Definition: jpwl_lib.c:1163
jpwl_esd_ms::senst
unsigned char senst
type of sensitivity [0=relative error, 1=MSE, 2=MSE reduction, 3=PSNR, 4=PSNR increment,...
Definition: jpwl.h:136
opj_tile_info::tp
opj_tp_info_t * tp
information concerning tile parts
Definition: openjpeg.h:666
jpwl_epb_ms::k_post
int k_post
message word length of post-data
Definition: jpwl.h:77
jpwl_epb_ms::tileno
int tileno
TH where this marker has been placed (-1 means MH)
Definition: jpwl.h:65
J2K_STATE_MHSIZ
@ J2K_STATE_MHSIZ
a SIZ marker is expected
Definition: j2k.h:102
jpwl_marker::dpos
double dpos
same as before, only written as a double, so we can sort it better
Definition: jpwl.h:195
jpwl_epb_create
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
jpwl_esd_create
jpwl_esd_ms_t * jpwl_esd_create(opj_j2k_t *j2k, int comp, 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
OPJ_FALSE
#define OPJ_FALSE
Definition: openjpeg.h:65
opj_cp::red_on
opj_bool red_on
enables writing of RED, in case of activated JPWL
Definition: j2k.h:276
opj_j2k::cp
opj_cp_t * cp
pointer to the coding parameters
Definition: j2k.h:364
opj_j2k::cstr_info
opj_codestream_info_t * cstr_info
helper used to write the index file
Definition: j2k.h:366
mct_decode
void mct_decode(int *restrict c0, int *restrict c1, int *restrict c2, int n)
Definition: mct.c:74
min
#define min(a, b)
Computes the minimum between two integers.
Definition: rs.h:102
mct_encode
void mct_encode(int *restrict c0, int *restrict c1, int *restrict c2, int n)
Definition: mct.c:51
opj_j2k::state
int state
locate in which part of the codestream the decoder is (main header, tile header, end)
Definition: j2k.h:319
jpwl_epb_ms::n_post
int n_post
code word length of post-data
Definition: jpwl.h:79
jpwl_esd_fill
opj_bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf)
Definition: jpwl_lib.c:1336
opj_cp::epb_on
opj_bool epb_on
enables writing of EPB, in case of activated JPWL
Definition: j2k.h:270
mct_getnorm_real
double mct_getnorm_real(int compno)
Get norm of the basis function used for the irreversible multi-component transform.
Definition: mct.c:188
jpwl_marker::pos
unsigned long int pos
position where the marker should go, in the pre-JPWL codestream
Definition: jpwl.h:193
opj_codestream_info::th
int th
number of tiles in Y
Definition: openjpeg.h:696
mct_encode_real
void mct_encode_real(int *restrict c0, int *restrict c1, int *restrict c2, int n)
Definition: mct.c:104
opj_tp_info::tp_end_pos
int tp_end_pos
end position of tile part
Definition: openjpeg.h:622
mct_decode_real
void mct_decode_real(float *restrict c0, float *restrict c1, float *restrict c2, int n)
Definition: mct.c:127
opj_image::numcomps
int numcomps
number of components in the image
Definition: openjpeg.h:543
JPWL_MAX_NO_MARKERS
#define JPWL_MAX_NO_MARKERS
Maximum number of JPWL markers: increase at your will.
Definition: openjpeg.h:83
J2K_MS_EPB
#define J2K_MS_EPB
EPB marker value (Part 11: JPEG 2000 for Wireless)
Definition: j2k.h:83
J2K_MS_SOD
#define J2K_MS_SOD
SOD marker value.
Definition: j2k.h:62
MAX_V1
#define MAX_V1
Definition: jpwl_lib.c:39
opj_tile_info::end_pos
int end_pos
end position
Definition: openjpeg.h:642
jpwl_correct
opj_bool jpwl_correct(opj_j2k_t *j2k)
corrects the data in the JPWL codestream
Definition: jpwl_lib.c:546
mct_norms
static const double mct_norms[3]
Definition: mct.c:41
opj_codestream_info::codestream_size
int codestream_size
codestream's size
Definition: openjpeg.h:716