OpenJPEG 1.5.1
tcd.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 __TCD_H
32#define __TCD_H
43
47typedef struct opj_tcd_seg {
48 unsigned char** data;
51 int len;
54 int newlen;
56
60typedef struct opj_tcd_pass {
61 int rate;
63 int term, len;
65
69typedef struct opj_tcd_layer {
70 int numpasses; /* Number of passes in the layer */
71 int len; /* len of information */
72 double disto; /* add for index (Cfr. Marcela) */
73 unsigned char *data; /* data */
75
79typedef struct opj_tcd_cblk_enc {
80 unsigned char* data; /* Data */
81 opj_tcd_layer_t* layers; /* layer information */
82 opj_tcd_pass_t* passes; /* information about the passes */
83 int x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
84 int numbps;
86 int numpasses; /* number of pass already done for the code-blocks */
87 int numpassesinlayers; /* number of passes in the layer */
88 int totalpasses; /* total number of passes */
90
91typedef struct opj_tcd_cblk_dec {
92 unsigned char* data; /* Data */
93 opj_tcd_seg_t* segs; /* segments informations */
94 int x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
95 int numbps;
97 int len; /* length */
98 int numnewpasses; /* number of pass added to the code-blocks */
99 int numsegs; /* number of segments */
101
105typedef struct opj_tcd_precinct {
106 int x0, y0, x1, y1; /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */
107 int cw, ch; /* number of precinct in width and heigth */
108 union{ /* code-blocks informations */
112 opj_tgt_tree_t *incltree; /* inclusion tree */
113 opj_tgt_tree_t *imsbtree; /* IMSB tree */
115
119typedef struct opj_tcd_band {
120 int x0, y0, x1, y1; /* dimension of the subband : left upper corner (x0, y0) right low corner (x1,y1) */
122 opj_tcd_precinct_t *precincts; /* precinct information */
124 float stepsize;
126
130typedef struct opj_tcd_resolution {
131 int x0, y0, x1, y1; /* dimension of the resolution level : left upper corner (x0, y0) right low corner (x1,y1) */
132 int pw, ph;
133 int numbands; /* number sub-band for the resolution level */
134 opj_tcd_band_t bands[3]; /* subband information */
136
140typedef struct opj_tcd_tilecomp {
141 int x0, y0, x1, y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */
142 int numresolutions; /* number of resolutions level */
143 opj_tcd_resolution_t *resolutions; /* resolutions information */
144 int *data; /* data of the component */
145 int numpix; /* add fixed_quality */
147
151typedef struct opj_tcd_tile {
152 int x0, y0, x1, y1; /* dimension of the tile : left upper corner (x0, y0) right low corner (x1,y1) */
153 int numcomps; /* number of components in tile */
154 opj_tcd_tilecomp_t *comps; /* Components information */
155 int numpix; /* add fixed_quality */
156 double distotile; /* add fixed_quality */
157 double distolayer[100]; /* add fixed_quality */
161
165typedef struct opj_tcd_image {
166 int tw, th; /* number of tiles in width and heigth */
167 opj_tcd_tile_t *tiles; /* Tiles information */
169
173typedef struct opj_tcd {
186
202
205/* ----------------------------------------------------------------------- */
206
210void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t *img);
221void tcd_destroy(opj_tcd_t *tcd);
229void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int curtileno);
234void tcd_free_encode(opj_tcd_t *tcd);
242void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int curtileno);
249void tcd_malloc_decode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp);
250void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int tileno, opj_codestream_info_t *cstr_info);
251void tcd_makelayer_fixed(opj_tcd_t *tcd, int layno, int final);
253void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final);
254opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info);
264int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_codestream_info_t *cstr_info);
273opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info);
278void tcd_free_decode(opj_tcd_t *tcd);
279void tcd_free_decode_tile(opj_tcd_t *tcd, int tileno);
280
281/* ----------------------------------------------------------------------- */
285
286#endif /* __TCD_H */
int opj_bool
Definition: openjpeg.h:63
Index structure of the codestream.
Definition: openjpeg.h:672
Definition: openjpeg.h:430
Coding parameters.
Definition: j2k.h:204
Defines image data and characteristics.
Definition: openjpeg.h:533
FIXME: documentation.
Definition: tcd.h:119
float stepsize
Definition: tcd.h:124
opj_tcd_precinct_t * precincts
Definition: tcd.h:122
int y1
Definition: tcd.h:120
int bandno
Definition: tcd.h:121
int numbps
Definition: tcd.h:123
int x0
Definition: tcd.h:120
int y0
Definition: tcd.h:120
int x1
Definition: tcd.h:120
Definition: tcd.h:91
unsigned char * data
Definition: tcd.h:92
int numsegs
Definition: tcd.h:99
int y1
Definition: tcd.h:94
opj_tcd_seg_t * segs
Definition: tcd.h:93
int x1
Definition: tcd.h:94
int numnewpasses
Definition: tcd.h:98
int len
Definition: tcd.h:97
int numlenbits
Definition: tcd.h:96
int y0
Definition: tcd.h:94
int numbps
Definition: tcd.h:95
int x0
Definition: tcd.h:94
FIXME: documentation.
Definition: tcd.h:79
unsigned char * data
Definition: tcd.h:80
int numlenbits
Definition: tcd.h:85
opj_tcd_layer_t * layers
Definition: tcd.h:81
opj_tcd_pass_t * passes
Definition: tcd.h:82
int x1
Definition: tcd.h:83
int numbps
Definition: tcd.h:84
int y1
Definition: tcd.h:83
int y0
Definition: tcd.h:83
int numpassesinlayers
Definition: tcd.h:87
int totalpasses
Definition: tcd.h:88
int x0
Definition: tcd.h:83
int numpasses
Definition: tcd.h:86
FIXME: documentation.
Definition: tcd.h:165
opj_tcd_tile_t * tiles
Definition: tcd.h:167
int tw
Definition: tcd.h:166
int th
Definition: tcd.h:166
FIXME: documentation.
Definition: tcd.h:69
double disto
Definition: tcd.h:72
unsigned char * data
Definition: tcd.h:73
int len
Definition: tcd.h:71
int numpasses
Definition: tcd.h:70
FIXME: documentation.
Definition: tcd.h:60
int len
Definition: tcd.h:63
double distortiondec
Definition: tcd.h:62
int rate
Definition: tcd.h:61
int term
Definition: tcd.h:63
FIXME: documentation.
Definition: tcd.h:105
int x0
Definition: tcd.h:106
int y0
Definition: tcd.h:106
opj_tgt_tree_t * incltree
Definition: tcd.h:112
int y1
Definition: tcd.h:106
int x1
Definition: tcd.h:106
int cw
Definition: tcd.h:107
opj_tgt_tree_t * imsbtree
Definition: tcd.h:113
union opj_tcd_precinct::@0 cblks
opj_tcd_cblk_dec_t * dec
Definition: tcd.h:110
opj_tcd_cblk_enc_t * enc
Definition: tcd.h:109
int ch
Definition: tcd.h:107
FIXME: documentation.
Definition: tcd.h:130
opj_tcd_band_t bands[3]
Definition: tcd.h:134
int pw
Definition: tcd.h:132
int numbands
Definition: tcd.h:133
int ph
Definition: tcd.h:132
int x0
Definition: tcd.h:131
int y0
Definition: tcd.h:131
int x1
Definition: tcd.h:131
int y1
Definition: tcd.h:131
FIXME: documentation.
Definition: tcd.h:47
int newlen
Definition: tcd.h:54
int numpasses
Definition: tcd.h:50
int len
Definition: tcd.h:51
int numnewpasses
Definition: tcd.h:53
int dataindex
Definition: tcd.h:49
unsigned char ** data
Definition: tcd.h:48
int maxpasses
Definition: tcd.h:52
FIXME: documentation.
Definition: tcd.h:151
int x1
Definition: tcd.h:152
int y0
Definition: tcd.h:152
int numpix
Definition: tcd.h:155
int x0
Definition: tcd.h:152
double distolayer[100]
Definition: tcd.h:157
int packno
packet number
Definition: tcd.h:159
double distotile
Definition: tcd.h:156
int numcomps
Definition: tcd.h:153
int y1
Definition: tcd.h:152
opj_tcd_tilecomp_t * comps
Definition: tcd.h:154
FIXME: documentation.
Definition: tcd.h:140
int x0
Definition: tcd.h:141
int y1
Definition: tcd.h:141
int y0
Definition: tcd.h:141
int x1
Definition: tcd.h:141
int numpix
Definition: tcd.h:145
opj_tcd_resolution_t * resolutions
Definition: tcd.h:143
int numresolutions
Definition: tcd.h:142
int * data
Definition: tcd.h:144
Tile coder/decoder.
Definition: tcd.h:173
opj_tcp_t * tcp
coding/decoding parameters common to all tiles
Definition: tcd.h:196
int tp_pos
Position of the tilepart flag in Progression order.
Definition: tcd.h:175
double encoding_time
Time taken to encode a tile.
Definition: tcd.h:200
int tp_num
Tile part number.
Definition: tcd.h:177
opj_common_ptr cinfo
codec context
Definition: tcd.h:185
opj_image_t * image
image
Definition: tcd.h:190
int tcd_tileno
current encoded/decoded tile
Definition: tcd.h:198
int cur_pino
Current Packet iterator number.
Definition: tcd.h:183
opj_tcd_image_t * tcd_image
info on each image tile
Definition: tcd.h:188
int cur_tp_num
Current tile part number.
Definition: tcd.h:179
opj_tcd_tile_t * tcd_tile
pointer to the current encoded/decoded tile
Definition: tcd.h:194
opj_cp_t * cp
coding parameters
Definition: tcd.h:192
int cur_totnum_tp
Total number of tileparts of the current tile.
Definition: tcd.h:181
Tile coding parameters : this structure is used to store coding/decoding parameters common to all til...
Definition: j2k.h:166
Tag tree.
Definition: tgt.h:58
void tcd_malloc_decode(opj_tcd_t *tcd, opj_image_t *image, opj_cp_t *cp)
Initialize the tile decoder.
Definition: tcd.c:616
void tcd_destroy(opj_tcd_t *tcd)
Destroy a previously created TCD handle.
Definition: tcd.c:118
struct opj_tcd_cblk_dec opj_tcd_cblk_dec_t
void tcd_free_decode_tile(opj_tcd_t *tcd, int tileno)
Definition: tcd.c:1560
struct opj_tcd_layer opj_tcd_layer_t
FIXME: documentation.
void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t *image, opj_cp_t *cp, int tileno, opj_codestream_info_t *cstr_info)
Definition: tcd.c:681
void tcd_free_encode(opj_tcd_t *tcd)
Free the memory allocated for encoding.
Definition: tcd.c:355
struct opj_tcd opj_tcd_t
Tile coder/decoder.
void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t *img)
Dump the content of a tcd structure.
Definition: tcd.c:37
struct opj_tcd_band opj_tcd_band_t
FIXME: documentation.
struct opj_tcd_tile opj_tcd_tile_t
FIXME: documentation.
void tcd_init_encode(opj_tcd_t *tcd, opj_image_t *image, opj_cp_t *cp, int curtileno)
Initialize the tile coder (reuses the memory allocated by tcd_malloc_encode)
Definition: tcd.c:402
int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_codestream_info_t *cstr_info)
Encode a tile from the raw image into a buffer.
Definition: tcd.c:1182
opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info)
Definition: tcd.c:1015
void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final)
Definition: tcd.c:945
struct opj_tcd_precinct opj_tcd_precinct_t
FIXME: documentation.
opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info)
Decode a tile from a buffer into a raw image.
Definition: tcd.c:1331
opj_tcd_t * tcd_create(opj_common_ptr cinfo)
Create a new TCD handle.
Definition: tcd.c:101
struct opj_tcd_cblk_enc opj_tcd_cblk_enc_t
FIXME: documentation.
void tcd_makelayer_fixed(opj_tcd_t *tcd, int layno, int final)
Definition: tcd.c:849
struct opj_tcd_resolution opj_tcd_resolution_t
FIXME: documentation.
void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t *image, opj_cp_t *cp, int curtileno)
Initialize the tile coder (allocate the memory)
Definition: tcd.c:127
struct opj_tcd_pass opj_tcd_pass_t
FIXME: documentation.
void tcd_rateallocate_fixed(opj_tcd_t *tcd)
Definition: tcd.c:938
struct opj_tcd_seg opj_tcd_seg_t
FIXME: documentation.
struct opj_tcd_image opj_tcd_image_t
FIXME: documentation.
void tcd_free_decode(opj_tcd_t *tcd)
Free the memory allocated for decoding.
Definition: tcd.c:1549
struct opj_tcd_tilecomp opj_tcd_tilecomp_t
FIXME: documentation.