00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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;
00071 int len;
00072 double disto;
00073 unsigned char *data;
00074 } opj_tcd_layer_t;
00075
00079 typedef struct opj_tcd_cblk_enc {
00080 unsigned char* data;
00081 opj_tcd_layer_t* layers;
00082 opj_tcd_pass_t* passes;
00083 int x0, y0, x1, y1;
00084 int numbps;
00085 int numlenbits;
00086 int numpasses;
00087 int numpassesinlayers;
00088 int totalpasses;
00089 } opj_tcd_cblk_enc_t;
00090
00091 typedef struct opj_tcd_cblk_dec {
00092 unsigned char* data;
00093 opj_tcd_seg_t* segs;
00094 int x0, y0, x1, y1;
00095 int numbps;
00096 int numlenbits;
00097 int len;
00098 int numnewpasses;
00099 int numsegs;
00100 } opj_tcd_cblk_dec_t;
00101
00105 typedef struct opj_tcd_precinct {
00106 int x0, y0, x1, y1;
00107 int cw, ch;
00108 union{
00109 opj_tcd_cblk_enc_t* enc;
00110 opj_tcd_cblk_dec_t* dec;
00111 } cblks;
00112 opj_tgt_tree_t *incltree;
00113 opj_tgt_tree_t *imsbtree;
00114 } opj_tcd_precinct_t;
00115
00119 typedef struct opj_tcd_band {
00120 int x0, y0, x1, y1;
00121 int bandno;
00122 opj_tcd_precinct_t *precincts;
00123 int numbps;
00124 float stepsize;
00125 } opj_tcd_band_t;
00126
00130 typedef struct opj_tcd_resolution {
00131 int x0, y0, x1, y1;
00132 int pw, ph;
00133 int numbands;
00134 opj_tcd_band_t bands[3];
00135 } opj_tcd_resolution_t;
00136
00140 typedef struct opj_tcd_tilecomp {
00141 int x0, y0, x1, y1;
00142 int numresolutions;
00143 opj_tcd_resolution_t *resolutions;
00144 int *data;
00145 int numpix;
00146 } opj_tcd_tilecomp_t;
00147
00151 typedef struct opj_tcd_tile {
00152 int x0, y0, x1, y1;
00153 int numcomps;
00154 opj_tcd_tilecomp_t *comps;
00155 int numpix;
00156 double distotile;
00157 double distolayer[100];
00159 int packno;
00160 } opj_tcd_tile_t;
00161
00165 typedef struct opj_tcd_image {
00166 int tw, th;
00167 opj_tcd_tile_t *tiles;
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