"L. Spiro Engine"
|
00001 00016 #ifndef __LSI_JPEGCOMMONSTRUCTS_H__ 00017 #define __LSI_JPEGCOMMONSTRUCTS_H__ 00018 00019 #include "../LSIImageLib.h" 00020 00021 00022 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00023 // MACROS 00024 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00025 #define OPJ_PATH_LEN 4096 00027 #define J2K_MAXRLVLS 33 00028 #define J2K_MAXBANDS (3*J2K_MAXRLVLS-2 ) 00030 #define JPWL_MAX_NO_TILESPECS 16 00031 #define JPWL_MAX_NO_PACKSPECS 16 00032 #define JPWL_MAX_NO_MARKERS 512 00033 #define JPWL_PRIVATEINDEX_NAME "jpwl_index_privatefilename" 00034 #define JPWL_EXPECTED_COMPONENTS 3 00035 #define JPWL_MAXIMUM_TILES 8192 00036 #define JPWL_MAXIMUM_HAMMING 2 00037 #define JPWL_MAXIMUM_EPB_ROOM 65450 00039 /* 00040 * Stream open flags. 00041 */ 00042 00043 #define OPJ_STREAM_READ 0x0001 00044 00045 #define OPJ_STREAM_WRITE 0x0002 00046 00048 #define opj_common_fields \ 00049 opj_event_mgr_t * event_mgr; \ 00050 LSVOID * client_data; \ 00051 LSBOOL is_decompressor; \ 00052 OPJ_CODEC_FORMAT codec_format; \ 00053 LSVOID * j2k_handle; \ 00054 LSVOID * jp2_handle; \ 00055 LSVOID * mj2_handle 00057 namespace lsi { 00058 00059 // == Enumerations. 00063 typedef enum RSIZ_CAPABILITIES { 00064 STD_RSIZ = 0, 00065 CINEMA2K = 3, 00066 CINEMA4K = 4 00067 } OPJ_RSIZ_CAPABILITIES; 00068 00072 typedef enum CINEMA_MODE { 00073 OFF = 0, 00074 CINEMA2K_24 = 1, 00075 CINEMA2K_48 = 2, 00076 CINEMA4K_24 = 3 00077 }OPJ_CINEMA_MODE; 00078 00082 typedef enum PROG_ORDER { 00083 PROG_UNKNOWN = -1, 00084 LRCP = 0, 00085 RLCP = 1, 00086 RPCL = 2, 00087 PCRL = 3, 00088 CPRL = 4 00089 } OPJ_PROG_ORDER; 00090 00094 typedef enum CODEC_FORMAT { 00095 CODEC_UNKNOWN = -1, 00096 CODEC_J2K = 0, 00097 CODEC_JPT = 1, 00098 CODEC_JP2 = 2 00099 } OPJ_CODEC_FORMAT; 00100 00104 typedef enum LIMIT_DECODING { 00105 NO_LIMITATION = 0, 00106 LIMIT_TO_MAIN_HEADER = 1, 00107 DECODE_ALL_BUT_PACKETS = 2 00108 } OPJ_LIMIT_DECODING; 00109 00116 class CJpegCommonStructs { 00117 public : 00118 // == Types. 00125 typedef LSVOID (LSE_CALL * opj_msg_callback)( const LSCHAR * msg, LSVOID * client_data ); 00126 00135 typedef struct opj_event_mgr { 00137 opj_msg_callback error_handler; 00139 opj_msg_callback warning_handler; 00141 opj_msg_callback info_handler; 00142 } opj_event_mgr_t; 00143 00147 typedef struct opj_poc { 00149 LSINT32 resno0, compno0; 00151 LSINT32 layno1, resno1, compno1; 00153 LSINT32 layno0, precno0, precno1; 00155 OPJ_PROG_ORDER prg1, prg; 00157 LSCHAR progorder[5]; 00159 LSINT32 tile; 00161 LSINT32 tx0, tx1, ty0, ty1; 00163 LSINT32 layS, resS, compS, prcS; 00165 LSINT32 layE, resE, compE, prcE; 00167 LSINT32 txS, txE, tyS, tyE, dx, dy; 00169 LSINT32 lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t; 00170 } opj_poc_t; 00171 00175 typedef struct opj_cparameters { 00177 LSBOOL tile_size_on; 00179 LSINT32 cp_tx0; 00181 LSINT32 cp_ty0; 00183 LSINT32 cp_tdx; 00185 LSINT32 cp_tdy; 00187 LSINT32 cp_disto_alloc; 00189 LSINT32 cp_fixed_alloc; 00191 LSINT32 cp_fixed_quality; 00193 LSINT32 * cp_matrice; 00195 LSCHAR * cp_comment; 00197 LSINT32 csty; 00199 OPJ_PROG_ORDER prog_order; 00201 opj_poc_t POC[32]; 00203 LSINT32 numpocs; 00205 LSINT32 tcp_numlayers; 00207 LSFLOAT tcp_rates[100]; 00209 LSFLOAT tcp_distoratio[100]; 00211 LSINT32 numresolution; 00213 LSINT32 cblockw_init; 00215 LSINT32 cblockh_init; 00217 LSINT32 mode; 00219 LSINT32 irreversible; 00221 LSINT32 roi_compno; 00223 LSINT32 roi_shift; 00225 LSINT32 res_spec; 00227 LSINT32 prcw_init[J2K_MAXRLVLS]; 00229 LSINT32 prch_init[J2K_MAXRLVLS]; 00230 00232 LSCHAR infile[OPJ_PATH_LEN]; 00234 LSCHAR outfile[OPJ_PATH_LEN]; 00236 LSINT32 index_on; 00238 LSCHAR index[OPJ_PATH_LEN]; 00240 LSINT32 image_offset_x0; 00242 LSINT32 image_offset_y0; 00244 LSINT32 subsampling_dx; 00246 LSINT32 subsampling_dy; 00248 LSINT32 decod_format; 00250 LSINT32 cod_format; 00251 00252 00254 LSBOOL jpwl_epc_on; 00256 LSINT32 jpwl_hprot_MH; 00258 LSINT32 jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; 00260 LSINT32 jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS]; 00262 LSINT32 jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS]; 00264 LSINT32 jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS]; 00266 LSINT32 jpwl_pprot[JPWL_MAX_NO_PACKSPECS]; 00268 LSINT32 jpwl_sens_size; 00270 LSINT32 jpwl_sens_addr; 00272 LSINT32 jpwl_sens_range; 00274 LSINT32 jpwl_sens_MH; 00276 LSINT32 jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; 00278 LSINT32 jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS]; 00279 00281 OPJ_CINEMA_MODE cp_cinema; 00283 LSINT32 max_comp_size; 00285 OPJ_RSIZ_CAPABILITIES cp_rsiz; 00287 LSCHAR tp_on; 00289 LSCHAR tp_flag; 00291 LSCHAR tcp_mct; 00292 } opj_cparameters_t; 00293 00297 typedef struct opj_dparameters { 00305 LSINT32 cp_reduce; 00312 LSINT32 cp_layer; 00313 00315 LSCHAR infile[OPJ_PATH_LEN]; 00317 LSCHAR outfile[OPJ_PATH_LEN]; 00319 LSINT32 decod_format; 00321 LSINT32 cod_format; 00322 00324 LSBOOL jpwl_correct; 00326 LSINT32 jpwl_exp_comps; 00328 LSINT32 jpwl_max_tiles; 00329 00336 OPJ_LIMIT_DECODING cp_limit_decoding; 00337 00338 } opj_dparameters_t; 00339 00345 typedef struct opj_common_struct { 00346 /* Fields common to both master struct types. */ 00347 opj_common_fields; 00348 /* Additional fields follow in an actual opj_cinfo_t or 00349 * opj_dinfo_t. All three structs must agree on these 00350 * initial fields! (This would be a lot cleaner in C++.) 00351 */ 00352 } opj_common_struct_t; 00353 00354 typedef opj_common_struct_t * opj_common_ptr; 00355 00359 typedef struct opj_cinfo { 00361 opj_common_fields; 00362 /* Other specific fields go here. */ 00363 } opj_cinfo_t; 00364 00368 typedef struct opj_dinfo { 00370 opj_common_fields; 00371 /* Other specific fields go here. */ 00372 } opj_dinfo_t; 00373 00377 typedef struct opj_packet_info { 00379 LSINT32 start_pos; 00381 LSINT32 end_ph_pos; 00383 LSINT32 end_pos; 00385 LSDOUBLE disto; 00386 } opj_packet_info_t; 00387 00391 typedef struct opj_tp_info { 00393 LSINT32 tp_start_pos; 00395 LSINT32 tp_end_header; 00397 LSINT32 tp_end_pos; 00399 LSINT32 tp_start_pack; 00401 LSINT32 tp_numpacks; 00402 } opj_tp_info_t; 00403 00407 typedef struct opj_tile_info { 00409 LSDOUBLE * thresh; 00411 LSINT32 tileno; 00413 LSINT32 start_pos; 00415 LSINT32 end_header; 00417 LSINT32 end_pos; 00419 LSINT32 pw[33]; 00421 LSINT32 ph[33]; 00423 LSINT32 pdx[33]; 00425 LSINT32 pdy[33]; 00427 opj_packet_info_t * packet; 00429 LSINT32 numpix; 00431 LSDOUBLE distotile; 00433 LSINT32 num_tps; 00435 opj_tp_info_t * tp; 00436 } opj_tile_info_t; 00437 00441 typedef struct opj_marker_info_t { 00443 LSUINT16 type; 00445 LSINT32 pos; 00447 LSINT32 len; 00448 } opj_marker_info_t; 00449 00453 typedef struct opj_codestream_info { 00455 LSDOUBLE D_max; 00457 LSINT32 packno; 00459 LSINT32 index_write; 00461 LSINT32 image_w; 00463 LSINT32 image_h; 00465 OPJ_PROG_ORDER prog; 00467 LSINT32 tile_x; 00469 LSINT32 tile_y; 00470 LSINT32 tile_Ox; 00471 LSINT32 tile_Oy; 00473 LSINT32 tw; 00475 LSINT32 th; 00477 LSINT32 numcomps; 00479 LSINT32 numlayers; 00481 LSINT32 * numdecompos; 00483 LSINT32 marknum; 00485 opj_marker_info_t * marker; 00487 LSINT32 maxmarknum; 00489 LSINT32 main_head_start; 00491 LSINT32 main_head_end; 00493 LSINT32 codestream_size; 00495 opj_tile_info_t * tile; 00496 } opj_codestream_info_t; 00497 }; 00498 00499 } // namespace lsi 00500 00501 #endif // __LSI_JPEGCOMMONSTRUCTS_H__