|
OpenJPEG
1.5.1
|
00001 /* 00002 * Copyright (c) 2001-2003, David Janssens 00003 * Copyright (c) 2002-2003, Yannick Verschueren 00004 * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe 00005 * Copyright (c) 2005, Herve Drolon, FreeImage Team 00006 * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium 00007 * Copyright (c) 2005-2006, Dept. of Electronic and Information Engineering, Universita' degli Studi di Perugia, Italy 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 __JPWL_H 00032 #define __JPWL_H 00033 00034 #ifdef USE_JPWL 00035 00036 #include "crc.h" 00037 #include "rs.h" 00038 00048 00052 #define JPWL_ASSUME OPJ_TRUE 00053 00057 typedef struct jpwl_epb_ms { 00061 opj_bool latest; 00063 opj_bool packed; 00065 int tileno; 00067 unsigned char index; 00069 int hprot; 00071 int k_pre; 00073 int n_pre; 00075 int pre_len; 00077 int k_post; 00079 int n_post; 00081 int post_len; 00086 unsigned short int Lepb; 00088 unsigned char Depb; 00090 unsigned long int LDPepb; 00092 unsigned long int Pepb; 00094 unsigned char *data; 00096 } jpwl_epb_ms_t; 00097 00101 typedef struct jpwl_epc_ms { 00103 opj_bool esd_on; 00105 opj_bool red_on; 00107 opj_bool epb_on; 00109 opj_bool info_on; 00113 unsigned short int Lepc; 00115 unsigned short int Pcrc; 00117 unsigned long int DL; 00119 unsigned char Pepc; 00121 unsigned char *data; 00123 } jpwl_epc_ms_t; 00124 00128 typedef struct jpwl_esd_ms { 00130 unsigned char addrm; 00132 unsigned char ad_size; 00136 unsigned char senst; 00138 unsigned char se_size; 00142 unsigned short int Lesd; 00144 unsigned short int Cesd; 00146 unsigned char Pesd; 00148 unsigned char *data; 00153 int numcomps; 00155 int tileno; 00157 unsigned long int svalnum; 00159 size_t sensval_size; 00161 } jpwl_esd_ms_t; 00162 00166 typedef struct jpwl_red_ms { 00168 unsigned short int Lred; 00170 unsigned char Pred; 00172 unsigned char *data; 00173 } jpwl_red_ms_t; 00174 00178 typedef struct jpwl_marker { 00180 int id; 00182 union jpwl_marks { 00184 jpwl_epb_ms_t *epbmark; 00186 jpwl_epc_ms_t *epcmark; 00188 jpwl_esd_ms_t *esdmark; 00190 jpwl_red_ms_t *redmark; 00191 } m; 00193 unsigned long int pos; 00195 double dpos; 00197 unsigned short int len; 00199 opj_bool len_ready; 00201 opj_bool pos_ready; 00203 opj_bool parms_ready; 00205 opj_bool data_ready; 00206 } jpwl_marker_t; 00207 00214 void jpwl_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image); 00215 00223 void jpwl_prepare_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image); 00224 00231 void jpwl_dump_marks(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image); 00232 00237 void j2k_read_epc(opj_j2k_t *j2k); 00238 00246 void j2k_write_epc(opj_j2k_t *j2k); 00247 00252 void j2k_read_epb(opj_j2k_t *j2k); 00253 00258 void j2k_write_epb(opj_j2k_t *j2k); 00259 00264 void j2k_read_esd(opj_j2k_t *j2k); 00265 00270 void j2k_read_red(opj_j2k_t *j2k); 00271 00283 jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, opj_bool latest, opj_bool packed, int tileno, int idx, int hprot, 00284 unsigned long int pre_len, unsigned long int post_len); 00285 00301 int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, 00302 opj_bool latest, opj_bool packed, opj_bool insideMH, int *idx, int hprot, 00303 double place_pos, int tileno, 00304 unsigned long int pre_len, unsigned long int post_len); 00305 00319 int jpwl_esds_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, 00320 int comps, unsigned char addrm, unsigned char ad_size, 00321 unsigned char senst, unsigned char se_size, 00322 double place_pos, int tileno); 00323 00330 opj_bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num); 00331 00332 00333 opj_bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf); 00334 00335 opj_bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf, unsigned char *post_buf); 00336 00337 void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len); 00338 00343 opj_bool jpwl_correct(opj_j2k_t *j2k); 00344 00355 opj_bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_len, int post_len, int *conn, 00356 unsigned char **L4_bufp); 00357 00363 opj_bool jpwl_check_tile(opj_j2k_t *j2k, opj_tcd_t *tcd, int tileno); 00364 00373 #define jpwl_updateCRC16(CRC, DATA) updateCRC16(CRC, DATA) 00374 00381 #define jpwl_updateCRC32(CRC, DATA) updateCRC32(CRC, DATA) 00382 00389 #ifndef min 00390 #define min(a,b) (((a) < (b)) ? (a) : (b)) 00391 #endif /* min */ 00392 00395 #endif /* USE_JPWL */ 00396 00397 #ifdef USE_JPSEC 00398 00401 00406 void j2k_read_sec(opj_j2k_t *j2k); 00407 00412 void j2k_write_sec(opj_j2k_t *j2k); 00413 00418 void j2k_read_insec(opj_j2k_t *j2k); 00419 00422 #endif /* USE_JPSEC */ 00423 00424 #endif /* __JPWL_H */ 00425
1.7.5.1