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 #ifndef __JP2_H
00030 #define __JP2_H
00031
00039
00040 #define JPIP_JPIP 0x6a706970
00041
00042 #define JP2_JP 0x6a502020
00043 #define JP2_FTYP 0x66747970
00044 #define JP2_JP2H 0x6a703268
00045 #define JP2_IHDR 0x69686472
00046 #define JP2_COLR 0x636f6c72
00047 #define JP2_JP2C 0x6a703263
00048 #define JP2_URL 0x75726c20
00049 #define JP2_DTBL 0x6474626c
00050 #define JP2_BPCC 0x62706363
00051 #define JP2_JP2 0x6a703220
00052 #define JP2_PCLR 0x70636c72
00053 #define JP2_CMAP 0x636d6170
00054 #define JP2_CDEF 0x63646566
00056
00057
00060 typedef struct opj_jp2_cdef_info
00061 {
00062 unsigned short cn, typ, asoc;
00063 } opj_jp2_cdef_info_t;
00064
00068 typedef struct opj_jp2_cdef
00069 {
00070 opj_jp2_cdef_info_t *info;
00071 unsigned short n;
00072 } opj_jp2_cdef_t;
00073
00077 typedef struct opj_jp2_cmap_comp
00078 {
00079 unsigned short cmp;
00080 unsigned char mtyp, pcol;
00081 } opj_jp2_cmap_comp_t;
00082
00086 typedef struct opj_jp2_pclr
00087 {
00088 unsigned int *entries;
00089 unsigned char *channel_sign;
00090 unsigned char *channel_size;
00091 opj_jp2_cmap_comp_t *cmap;
00092 unsigned short nr_entries, nr_channels;
00093 } opj_jp2_pclr_t;
00094
00098 typedef struct opj_jp2_color
00099 {
00100 unsigned char *icc_profile_buf;
00101 int icc_profile_len;
00102
00103 opj_jp2_cdef_t *jp2_cdef;
00104 opj_jp2_pclr_t *jp2_pclr;
00105 unsigned char jp2_has_colr;
00106 } opj_jp2_color_t;
00107
00111 typedef struct opj_jp2_comps {
00112 int depth;
00113 int sgnd;
00114 int bpcc;
00115 } opj_jp2_comps_t;
00116
00120 typedef struct opj_jp2 {
00122 opj_common_ptr cinfo;
00124 opj_j2k_t *j2k;
00125 unsigned int w;
00126 unsigned int h;
00127 unsigned int numcomps;
00128 unsigned int bpc;
00129 unsigned int C;
00130 unsigned int UnkC;
00131 unsigned int IPR;
00132 unsigned int meth;
00133 unsigned int approx;
00134 unsigned int enumcs;
00135 unsigned int precedence;
00136 unsigned int brand;
00137 unsigned int minversion;
00138 unsigned int numcl;
00139 unsigned int *cl;
00140 opj_jp2_comps_t *comps;
00141 unsigned int j2k_codestream_offset;
00142 unsigned int j2k_codestream_length;
00143 opj_bool jpip_on;
00144 opj_bool ignore_pclr_cmap_cdef;
00145 } opj_jp2_t;
00146
00150 typedef struct opj_jp2_box {
00151 int length;
00152 int type;
00153 int init_pos;
00154 } opj_jp2_box_t;
00155
00158
00164 void jp2_write_jp2h(opj_jp2_t *jp2, opj_cio_t *cio);
00172 opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color);
00178 opj_jp2_t* jp2_create_decompress(opj_common_ptr cinfo);
00183 void jp2_destroy_decompress(opj_jp2_t *jp2);
00190 void jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters);
00198 opj_image_t* opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info);
00204 opj_jp2_t* jp2_create_compress(opj_common_ptr cinfo);
00209 void jp2_destroy_compress(opj_jp2_t *jp2);
00217 void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image);
00226 opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
00227
00228
00232
00233 #endif
00234