|
OpenJPEG
1.5.0
|
00001 /* 00002 * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium 00003 * Copyright (c) 2002-2007, Professor Benoit Macq 00004 * Copyright (c) 2001-2003, David Janssens 00005 * Copyright (c) 2002-2003, Yannick Verschueren 00006 * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe 00007 * Copyright (c) 2005, Herve Drolon, FreeImage Team 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 1. Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in the 00017 * documentation and/or other materials provided with the distribution. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00021 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00022 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00023 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00024 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00025 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00026 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00027 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00028 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00029 * POSSIBILITY OF SUCH DAMAGE. 00030 */ 00031 #ifndef __TCD_H 00032 #define __TCD_H 00033 00043 00047 typedef struct opj_tcd_seg { 00048 unsigned char** data; 00049 int dataindex; 00050 int numpasses; 00051 int len; 00052 int maxpasses; 00053 int numnewpasses; 00054 int newlen; 00055 } opj_tcd_seg_t; 00056 00060 typedef struct opj_tcd_pass { 00061 int rate; 00062 double distortiondec; 00063 int term, len; 00064 } opj_tcd_pass_t; 00065 00069 typedef struct opj_tcd_layer { 00070 int numpasses; /* Number of passes in the layer */ 00071 int len; /* len of information */ 00072 double disto; /* add for index (Cfr. Marcela) */ 00073 unsigned char *data; /* data */ 00074 } opj_tcd_layer_t; 00075 00079 typedef struct opj_tcd_cblk_enc { 00080 unsigned char* data; /* Data */ 00081 opj_tcd_layer_t* layers; /* layer information */ 00082 opj_tcd_pass_t* passes; /* information about the passes */ 00083 int x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */ 00084 int numbps; 00085 int numlenbits; 00086 int numpasses; /* number of pass already done for the code-blocks */ 00087 int numpassesinlayers; /* number of passes in the layer */ 00088 int totalpasses; /* total number of passes */ 00089 } opj_tcd_cblk_enc_t; 00090 00091 typedef struct opj_tcd_cblk_dec { 00092 unsigned char* data; /* Data */ 00093 opj_tcd_seg_t* segs; /* segments informations */ 00094 int x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */ 00095 int numbps; 00096 int numlenbits; 00097 int len; /* length */ 00098 int numnewpasses; /* number of pass added to the code-blocks */ 00099 int numsegs; /* number of segments */ 00100 } opj_tcd_cblk_dec_t; 00101 00105 typedef struct opj_tcd_precinct { 00106 int x0, y0, x1, y1; /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */ 00107 int cw, ch; /* number of precinct in width and heigth */ 00108 union{ /* code-blocks informations */ 00109 opj_tcd_cblk_enc_t* enc; 00110 opj_tcd_cblk_dec_t* dec; 00111 } cblks; 00112 opj_tgt_tree_t *incltree; /* inclusion tree */ 00113 opj_tgt_tree_t *imsbtree; /* IMSB tree */ 00114 } opj_tcd_precinct_t; 00115 00119 typedef struct opj_tcd_band { 00120 int x0, y0, x1, y1; /* dimension of the subband : left upper corner (x0, y0) right low corner (x1,y1) */ 00121 int bandno; 00122 opj_tcd_precinct_t *precincts; /* precinct information */ 00123 int numbps; 00124 float stepsize; 00125 } opj_tcd_band_t; 00126 00130 typedef struct opj_tcd_resolution { 00131 int x0, y0, x1, y1; /* dimension of the resolution level : left upper corner (x0, y0) right low corner (x1,y1) */ 00132 int pw, ph; 00133 int numbands; /* number sub-band for the resolution level */ 00134 opj_tcd_band_t bands[3]; /* subband information */ 00135 } opj_tcd_resolution_t; 00136 00140 typedef struct opj_tcd_tilecomp { 00141 int x0, y0, x1, y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */ 00142 int numresolutions; /* number of resolutions level */ 00143 opj_tcd_resolution_t *resolutions; /* resolutions information */ 00144 int *data; /* data of the component */ 00145 int numpix; /* add fixed_quality */ 00146 } opj_tcd_tilecomp_t; 00147 00151 typedef struct opj_tcd_tile { 00152 int x0, y0, x1, y1; /* dimension of the tile : left upper corner (x0, y0) right low corner (x1,y1) */ 00153 int numcomps; /* number of components in tile */ 00154 opj_tcd_tilecomp_t *comps; /* Components information */ 00155 int numpix; /* add fixed_quality */ 00156 double distotile; /* add fixed_quality */ 00157 double distolayer[100]; /* add fixed_quality */ 00159 int packno; 00160 } opj_tcd_tile_t; 00161 00165 typedef struct opj_tcd_image { 00166 int tw, th; /* number of tiles in width and heigth */ 00167 opj_tcd_tile_t *tiles; /* Tiles information */ 00168 } opj_tcd_image_t; 00169 00173 typedef struct opj_tcd { 00175 int tp_pos; 00177 int tp_num; 00179 int cur_tp_num; 00181 int cur_totnum_tp; 00183 int cur_pino; 00185 opj_common_ptr cinfo; 00186 00188 opj_tcd_image_t *tcd_image; 00190 opj_image_t *image; 00192 opj_cp_t *cp; 00194 opj_tcd_tile_t *tcd_tile; 00196 opj_tcp_t *tcp; 00198 int tcd_tileno; 00200 double encoding_time; 00201 } opj_tcd_t; 00202 00205 /* ----------------------------------------------------------------------- */ 00206 00210 void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t *img); 00216 opj_tcd_t* tcd_create(opj_common_ptr cinfo); 00221 void tcd_destroy(opj_tcd_t *tcd); 00229 void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int curtileno); 00234 void tcd_free_encode(opj_tcd_t *tcd); 00242 void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int curtileno); 00249 void tcd_malloc_decode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp); 00250 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); 00251 void tcd_makelayer_fixed(opj_tcd_t *tcd, int layno, int final); 00252 void tcd_rateallocate_fixed(opj_tcd_t *tcd); 00253 void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final); 00254 opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info); 00264 int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_codestream_info_t *cstr_info); 00273 opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info); 00278 void tcd_free_decode(opj_tcd_t *tcd); 00279 void tcd_free_decode_tile(opj_tcd_t *tcd, int tileno); 00280 00281 /* ----------------------------------------------------------------------- */ 00285 00286 #endif /* __TCD_H */
1.7.5.1