|
OpenJPEG
1.5.1
|
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) 2002-2003, Yannick Verschueren 00005 * Copyright (c) 2005, Herve Drolon, FreeImage Team 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 2. Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the distribution. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 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 /* __JP2_H */ 00234
1.7.5.1