OpenJPEG  1.5.1
t2.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 #ifndef __T2_H
32 #define __T2_H
33 
41 
45 typedef struct opj_t2 {
48 
54 
57 /* ----------------------------------------------------------------------- */
58 
74 int t2_encode_packets(opj_t2_t* t2,int tileno, opj_tcd_tile_t *tile, int maxlayers, unsigned char *dest, int len, opj_codestream_info_t *cstr_info,int tpnum, int tppos,int pino,J2K_T2_MODE t2_mode,int cur_totnum_tp);
84 int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info);
85 
98 void t2_destroy(opj_t2_t *t2);
99 
100 /* ----------------------------------------------------------------------- */
104 
105 #endif /* __T2_H */
opj_tile_info::packet
opj_packet_info_t * packet
information concerning packets inside tile
Definition: openjpeg.h:652
t2_encode_packets
int t2_encode_packets(opj_t2_t *t2, int tileno, opj_tcd_tile_t *tile, int maxlayers, unsigned char *dest, int len, opj_codestream_info_t *cstr_info, int tpnum, int tppos, int pino, J2K_T2_MODE t2_mode, int cur_totnum_tp)
Encode the packets of a tile to a destination buffer.
Definition: t2.c:625
opj_pi_iterator
Packet iterator.
Definition: pi.h:67
opj_tcd_cblk_dec::numnewpasses
int numnewpasses
Definition: tcd.h:98
opj_free
#define opj_free(m)
Deallocates or frees a memory block.
Definition: opj_malloc.h:152
opj_tcd_cblk_enc
FIXME: documentation.
Definition: tcd.h:79
opj_malloc
#define opj_malloc(size)
Allocate an uninitialized memory block.
Definition: opj_malloc.h:51
opj_tcd_layer::data
unsigned char * data
Definition: tcd.h:73
int_max
static INLINE int int_max(int a, int b)
Get the maximum of two integers.
Definition: int.h:57
bio_inalign
int bio_inalign(opj_bio_t *bio)
Passes the ending bits (coming from flushing)
Definition: bio.c:178
opj_tcd_seg
FIXME: documentation.
Definition: tcd.h:47
opj_tcd_seg_t
struct opj_tcd_seg opj_tcd_seg_t
FIXME: documentation.
opj_tcd_pass::len
int len
Definition: tcd.h:63
pi_next
opj_bool pi_next(opj_pi_iterator_t *pi)
Modify the packet iterator to point to the next packet.
Definition: pi.c:710
opj_codestream_info::index_write
int index_write
writing the packet in the index with t2_encode_packets
Definition: openjpeg.h:678
opj_tcp::csty
int csty
coding style
Definition: j2k.h:170
opj_codestream_info::D_max
double D_max
maximum distortion reduction on the whole image (add for Marcela)
Definition: openjpeg.h:674
opj_tcd_seg::len
int len
Definition: tcd.h:51
opj_tcd_cblk_dec::numbps
int numbps
Definition: tcd.h:95
opj_t2::image
opj_image_t * image
Encoding: pointer to the src image.
Definition: t2.h:50
opj_tp_info::tp_end_header
int tp_end_header
end position of tile part header
Definition: openjpeg.h:620
opj_tcd_cblk_enc::passes
opj_tcd_pass_t * passes
Definition: tcd.h:82
opj_cp::max_comp_size
int max_comp_size
Maximum rate for each component.
Definition: j2k.h:208
t2_getnumpasses
static int t2_getnumpasses(opj_bio_t *bio)
Definition: t2.c:119
opj_tcd_cblk_enc::layers
opj_tcd_layer_t * layers
Definition: tcd.h:81
opj_tcd_resolution::numbands
int numbands
Definition: tcd.h:133
opj_t2
Tier-2 coding.
Definition: t2.h:45
opj_tcd_cblk_dec::numlenbits
int numlenbits
Definition: tcd.h:96
opj_tcd_resolution::bands
opj_tcd_band_t bands[3]
Definition: tcd.h:134
THRESH_CALC
@ THRESH_CALC
Definition: j2k.h:117
J2K_CCP_CBLKSTY_LAZY
#define J2K_CCP_CBLKSTY_LAZY
Selective arithmetic coding bypass.
Definition: j2k.h:48
t2_init_seg
static opj_bool t2_init_seg(opj_tcd_cblk_dec_t *cblk, int index, int cblksty, int first)
Definition: t2.c:299
tgt_reset
void tgt_reset(opj_tgt_tree_t *tree)
Reset a tag-tree (set all leaves to 0)
Definition: tgt.c:116
t2_putcommacode
static void t2_putcommacode(opj_bio_t *bio, int n)
Definition: t2.c:90
opj_packet_info::end_pos
int end_pos
packet end position
Definition: openjpeg.h:593
opj_tcp::ppt_len
int ppt_len
ppmbug1
Definition: j2k.h:194
opj_packet_info::disto
double disto
packet distorsion
Definition: openjpeg.h:595
opj_tcp::ppt_data
unsigned char * ppt_data
packet header store there for futur use in t2_decode_packet
Definition: j2k.h:186
opj_tcd_tile::packno
int packno
packet number
Definition: tcd.h:159
opj_tcd_layer::disto
double disto
Definition: tcd.h:72
opj_tcd_seg::maxpasses
int maxpasses
Definition: tcd.h:52
opj_packet_info::start_pos
int start_pos
packet start position (including SOP marker if it exists)
Definition: openjpeg.h:589
opj_pi_iterator::precno
int precno
precinct that identify the packet
Definition: pi.h:85
opj_tcd_seg::numpasses
int numpasses
Definition: tcd.h:50
opj_tcd_tilecomp::resolutions
opj_tcd_resolution_t * resolutions
Definition: tcd.h:143
pi_create_decode
opj_pi_iterator_t * pi_create_decode(opj_image_t *image, opj_cp_t *cp, int tileno)
Create a packet iterator for Decoder.
Definition: pi.c:410
opj_tcd_band::y0
int y0
Definition: tcd.h:120
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
opj_cp
Coding parameters.
Definition: j2k.h:204
t2_destroy
void t2_destroy(opj_t2_t *t2)
Destroy a T2 handle.
Definition: t2.c:818
opj_tcp::ppt
int ppt
If ppt == 1 --> there was a PPT marker for the present tile.
Definition: j2k.h:190
opj_tcd_seg::numnewpasses
int numnewpasses
Definition: tcd.h:53
bio_destroy
void bio_destroy(opj_bio_t *bio)
Destroy a previously created BIO handle.
Definition: bio.c:122
EVT_WARNING
#define EVT_WARNING
Warning event type.
Definition: event.h:36
opj_pi_iterator::layno
int layno
layer that identify the packet
Definition: pi.h:87
opj_realloc
#define opj_realloc(m, s)
Reallocate memory blocks.
Definition: opj_malloc.h:142
t2_getcommacode
static int t2_getcommacode(opj_bio_t *bio)
Definition: t2.c:97
opj_t2::cinfo
opj_common_ptr cinfo
codec context
Definition: t2.h:47
opj_tcd_layer
FIXME: documentation.
Definition: tcd.h:69
opj_cp::ppm
int ppm
if ppm == 1 --> there was a PPM marker for the present tile
Definition: j2k.h:254
opj_tile_info::end_header
int end_header
end position of the header
Definition: openjpeg.h:640
opj_t2_t
struct opj_t2 opj_t2_t
Tier-2 coding.
opj_tcd_precinct::enc
opj_tcd_cblk_enc_t * enc
Definition: tcd.h:109
opj_tcd_precinct::cw
int cw
Definition: tcd.h:107
opj_cp::tcps
opj_tcp_t * tcps
tile coding parameters
Definition: j2k.h:262
opj_tcd_precinct::imsbtree
opj_tgt_tree_t * imsbtree
Definition: tcd.h:113
opj_tcd_precinct
FIXME: documentation.
Definition: tcd.h:105
bio_create
opj_bio_t * bio_create(void)
Create a new BIO handle.
Definition: bio.c:117
pi_destroy
void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno)
Destroy a packet iterator.
Definition: pi.c:688
opj_includes.h
opj_bio
Individual bit input-output stream (BIO)
Definition: bio.h:47
t2_encode_packets
int t2_encode_packets(opj_t2_t *t2, int tileno, opj_tcd_tile_t *tile, int maxlayers, unsigned char *dest, int len, opj_codestream_info_t *cstr_info, int tpnum, int tppos, int pino, J2K_T2_MODE t2_mode, int cur_totnum_tp)
Encode the packets of a tile to a destination buffer.
Definition: t2.c:625
t2_create
opj_t2_t * t2_create(opj_common_ptr cinfo, opj_image_t *image, opj_cp_t *cp)
Create a T2 handle.
Definition: t2.c:807
opj_tcd_precinct::incltree
opj_tgt_tree_t * incltree
Definition: tcd.h:112
opj_tcd_pass
FIXME: documentation.
Definition: tcd.h:60
t2_decode_packets
int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info)
Decode the packets of a tile from a source buffer.
Definition: t2.c:716
opj_tcd_resolution
FIXME: documentation.
Definition: tcd.h:130
opj_tcd_tilecomp
FIXME: documentation.
Definition: tcd.h:140
J2K_T2_MODE
enum T2_MODE J2K_T2_MODE
T2 encoding mode.
opj_tcd_cblk_dec::numsegs
int numsegs
Definition: tcd.h:99
pi_create_encode
opj_bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno, int pino, int tpnum, int tppos, J2K_T2_MODE t2_mode, int cur_totnum_tp)
Modify the packet iterator for enabling tile part generation.
Definition: pi.c:729
opj_tcd_band
FIXME: documentation.
Definition: tcd.h:119
opj_tcd_cblk_enc::numpasses
int numpasses
Definition: tcd.h:86
opj_tcd_seg::newlen
int newlen
Definition: tcd.h:54
bio_write
void bio_write(opj_bio_t *bio, int v, int n)
Write bits.
Definition: bio.c:148
opj_tcd_precinct::cblks
union opj_tcd_precinct::@0 cblks
int_floorlog2
static INLINE int int_floorlog2(int a)
Get logarithm of an integer and round downwards.
Definition: int.h:107
int_min
static INLINE int int_min(int a, int b)
Get the minimum of two integers.
Definition: int.h:50
bio_init_enc
void bio_init_enc(opj_bio_t *bio, unsigned char *bp, int len)
Init encoder.
Definition: bio.c:132
tgt_setvalue
void tgt_setvalue(opj_tgt_tree_t *tree, int leafno, int value)
Set the value of a leaf of a tag-tree.
Definition: tgt.c:129
t2_destroy
void t2_destroy(opj_t2_t *t2)
Destroy a T2 handle.
Definition: t2.c:818
opj_codestream_info::packno
int packno
packet number
Definition: openjpeg.h:676
opj_tcd_band::precincts
opj_tcd_precinct_t * precincts
Definition: tcd.h:122
OPJ_TRUE
#define OPJ_TRUE
Definition: openjpeg.h:64
opj_tcd_cblk_dec::len
int len
Definition: tcd.h:97
opj_tcd_cblk_enc::numlenbits
int numlenbits
Definition: tcd.h:85
bio_numbytes
int bio_numbytes(opj_bio_t *bio)
Number of bytes written.
Definition: bio.c:128
opj_tcp::numpocs
int numpocs
number of progression order changes
Definition: j2k.h:180
opj_tcd_cblk_dec::data
unsigned char * data
Definition: tcd.h:92
J2K_CP_CSTY_SOP
#define J2K_CP_CSTY_SOP
Definition: j2k.h:45
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
opj_common_struct
Definition: openjpeg.h:430
J2K_CP_CSTY_EPH
#define J2K_CP_CSTY_EPH
Definition: j2k.h:46
opj_tcd_cblk_enc::numbps
int numbps
Definition: tcd.h:84
opj_packet_info
Index structure : Information concerning a packet inside tile.
Definition: openjpeg.h:587
opj_tcp
Tile coding parameters : this structure is used to store coding/decoding parameters common to all til...
Definition: j2k.h:166
opj_tcp::tccps
opj_tccp_t * tccps
tile-component coding parameters
Definition: j2k.h:198
opj_cp::tp_on
char tp_on
Enabling Tile part generation.
Definition: j2k.h:214
opj_tcd_band::y1
int y1
Definition: tcd.h:120
bio_init_dec
void bio_init_dec(opj_bio_t *bio, unsigned char *bp, int len)
Init decoder.
Definition: bio.c:140
JPWL_ASSUME
#define JPWL_ASSUME
Assume a basic codestream structure, so you can resort better from uncorrected errors.
Definition: jpwl.h:52
CINEMA4K_24
@ CINEMA4K_24
2K Digital Cinema at 48 fps
Definition: openjpeg.h:112
opj_cp::ppm_data
unsigned char * ppm_data
packet header store there for futur use in t2_decode_packet
Definition: j2k.h:250
opj_tcd_cblk_dec
Definition: tcd.h:91
opj_tcd_band::x0
int x0
Definition: tcd.h:120
opj_bool
int opj_bool
Definition: openjpeg.h:63
opj_tcd_seg::data
unsigned char ** data
Definition: tcd.h:48
opj_image_comp::resno_decoded
int resno_decoded
number of decoded resolution
Definition: openjpeg.h:523
opj_pi_iterator::resno
int resno
resolution that identify the packet
Definition: pi.h:83
opj_tcd_tile
FIXME: documentation.
Definition: tcd.h:151
opj_image::comps
opj_image_comp_t * comps
image components
Definition: openjpeg.h:547
opj_tcd_seg::dataindex
int dataindex
Definition: tcd.h:49
opj_codestream_info::tile
opj_tile_info_t * tile
information regarding tiles inside image
Definition: openjpeg.h:718
opj_t2::cp
opj_cp_t * cp
pointer to the image coding parameters
Definition: t2.h:52
opj_tccp::cblksty
int cblksty
code-block coding style
Definition: j2k.h:144
opj_cp::cinema
OPJ_CINEMA_MODE cinema
Digital cinema profile.
Definition: j2k.h:206
bio_read
int bio_read(opj_bio_t *bio, int n)
Read bits.
Definition: bio.c:155
opj_codestream_info
Index structure of the codestream.
Definition: openjpeg.h:672
opj_tcd_layer::numpasses
int numpasses
Definition: tcd.h:70
EVT_ERROR
#define EVT_ERROR
Error event type.
Definition: event.h:35
t2_decode_packet
static int t2_decode_packet(opj_t2_t *t2, unsigned char *src, int len, opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi, opj_packet_info_t *pack_info)
Decode a packet of a tile from a source buffer.
Definition: t2.c:331
opj_tcd_pass::term
int term
Definition: tcd.h:63
opj_tile_info::tp
opj_tp_info_t * tp
information concerning tile parts
Definition: openjpeg.h:666
opj_tile_info
Index structure : information regarding tiles.
Definition: openjpeg.h:632
t2_create
opj_t2_t * t2_create(opj_common_ptr cinfo, opj_image_t *image, opj_cp_t *cp)
Create a T2 handle.
Definition: t2.c:807
opj_tcd_cblk_dec::segs
opj_tcd_seg_t * segs
Definition: tcd.h:93
OPJ_FALSE
#define OPJ_FALSE
Definition: openjpeg.h:65
t2_decode_packets
int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info)
Decode the packets of a tile from a source buffer.
Definition: t2.c:716
t2_putnumpasses
static void t2_putnumpasses(opj_bio_t *bio, int n)
Variable length code for signalling delta Zil (truncation point)
Definition: t2.c:105
opj_tcd_band::numbps
int numbps
Definition: tcd.h:123
pi_initialise_encode
opj_pi_iterator_t * pi_initialise_encode(opj_image_t *image, opj_cp_t *cp, int tileno, J2K_T2_MODE t2_mode)
Create a packet iterator for Encoder.
Definition: pi.c:543
opj_tcp::POC
int POC
indicates if a POC marker has been used O:NO, 1:YES
Definition: j2k.h:182
J2K_CCP_CBLKSTY_TERMALL
#define J2K_CCP_CBLKSTY_TERMALL
Termination on each coding pass.
Definition: j2k.h:50
opj_pi_iterator::compno
int compno
component that identify the packet
Definition: pi.h:81
tgt_decode
int tgt_decode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold)
Decode the value of a leaf of the tag-tree up to a given threshold.
Definition: tgt.c:178
opj_tcd_band::x1
int x1
Definition: tcd.h:120
opj_tcd_precinct::dec
opj_tcd_cblk_dec_t * dec
Definition: tcd.h:110
tgt_encode
void tgt_encode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold)
Encode the value of a leaf of the tag-tree up to a given threshold.
Definition: tgt.c:138
opj_cp::ppm_len
int ppm_len
ppmbug1
Definition: j2k.h:260
t2_encode_packet
static int t2_encode_packet(opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi, unsigned char *dest, int len, opj_codestream_info_t *cstr_info, int tileno)
Encode a packet of a tile to a destination buffer.
Definition: t2.c:132
opj_tp_info::tp_end_pos
int tp_end_pos
end position of tile part
Definition: openjpeg.h:622
opj_image
Defines image data and characteristics.
Definition: openjpeg.h:533
opj_tcd_precinct::ch
int ch
Definition: tcd.h:107
opj_tcd_tile::comps
opj_tcd_tilecomp_t * comps
Definition: tcd.h:154
opj_cp::layer
int layer
if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers ...
Definition: j2k.h:228
opj_tcd_layer::len
int len
Definition: tcd.h:71
opj_tp_info::tp_numpacks
int tp_numpacks
number of packets of tile part
Definition: openjpeg.h:626
bio_flush
int bio_flush(opj_bio_t *bio)
Flush bits.
Definition: bio.c:164
opj_image::numcomps
int numcomps
number of components in the image
Definition: openjpeg.h:543
opj_tp_info::tp_start_pack
int tp_start_pack
start packet of tile part
Definition: openjpeg.h:624