OpenJPEG 2.1.0
|
00001 /* 00002 * The copyright in this software is being made available under the 2-clauses 00003 * BSD License, included below. This software may be subject to other third 00004 * party and contributor rights, including patent rights, and no such rights 00005 * are granted under this license. 00006 * 00007 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 00008 * Copyright (c) 2002-2014, Professor Benoit Macq 00009 * Copyright (c) 2001-2003, David Janssens 00010 * Copyright (c) 2002-2003, Yannick Verschueren 00011 * Copyright (c) 2003-2007, Francois-Olivier Devaux 00012 * Copyright (c) 2003-2014, Antonin Descampe 00013 * Copyright (c) 2005, Herve Drolon, FreeImage Team 00014 * Copyright (c) 2006-2007, Parvatha Elangovan 00015 * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr> 00016 * Copyright (c) 2010-2011, Kaori Hagihara 00017 * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France 00018 * Copyright (c) 2012, CS Systemes d'Information, France 00019 * All rights reserved. 00020 * 00021 * Redistribution and use in source and binary forms, with or without 00022 * modification, are permitted provided that the following conditions 00023 * are met: 00024 * 1. Redistributions of source code must retain the above copyright 00025 * notice, this list of conditions and the following disclaimer. 00026 * 2. Redistributions in binary form must reproduce the above copyright 00027 * notice, this list of conditions and the following disclaimer in the 00028 * documentation and/or other materials provided with the distribution. 00029 * 00030 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 00031 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00032 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00033 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00034 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00035 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00036 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00037 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00038 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00039 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00040 * POSSIBILITY OF SUCH DAMAGE. 00041 */ 00042 #ifndef OPENJPEG_H 00043 #define OPENJPEG_H 00044 00045 00046 /* 00047 ========================================================== 00048 Compiler directives 00049 ========================================================== 00050 */ 00051 00052 /* 00053 The inline keyword is supported by C99 but not by C90. 00054 Most compilers implement their own version of this keyword ... 00055 */ 00056 #ifndef INLINE 00057 #if defined(_MSC_VER) 00058 #define INLINE __forceinline 00059 #elif defined(__GNUC__) 00060 #define INLINE __inline__ 00061 #elif defined(__MWERKS__) 00062 #define INLINE inline 00063 #else 00064 /* add other compilers here ... */ 00065 #define INLINE 00066 #endif /* defined(<Compiler>) */ 00067 #endif /* INLINE */ 00068 00069 /* deprecated attribute */ 00070 #ifdef __GNUC__ 00071 #define OPJ_DEPRECATED(func) func __attribute__ ((deprecated)) 00072 #elif defined(_MSC_VER) 00073 #define OPJ_DEPRECATED(func) __declspec(deprecated) func 00074 #else 00075 #pragma message("WARNING: You need to implement DEPRECATED for this compiler") 00076 #define OPJ_DEPRECATED(func) func 00077 #endif 00078 00079 #if defined(OPJ_STATIC) || !defined(_WIN32) 00080 /* http://gcc.gnu.org/wiki/Visibility */ 00081 #if __GNUC__ >= 4 00082 #define OPJ_API __attribute__ ((visibility ("default"))) 00083 #define OPJ_LOCAL __attribute__ ((visibility ("hidden"))) 00084 #else 00085 #define OPJ_API 00086 #define OPJ_LOCAL 00087 #endif 00088 #define OPJ_CALLCONV 00089 #else 00090 #define OPJ_CALLCONV __stdcall 00091 /* 00092 The following ifdef block is the standard way of creating macros which make exporting 00093 from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS 00094 symbol defined on the command line. this symbol should not be defined on any project 00095 that uses this DLL. This way any other project whose source files include this file see 00096 OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols 00097 defined with this macro as being exported. 00098 */ 00099 #if defined(OPJ_EXPORTS) || defined(DLL_EXPORT) 00100 #define OPJ_API __declspec(dllexport) 00101 #else 00102 #define OPJ_API __declspec(dllimport) 00103 #endif /* OPJ_EXPORTS */ 00104 #endif /* !OPJ_STATIC || !_WIN32 */ 00105 00106 typedef int OPJ_BOOL; 00107 #define OPJ_TRUE 1 00108 #define OPJ_FALSE 0 00109 00110 typedef char OPJ_CHAR; 00111 typedef float OPJ_FLOAT32; 00112 typedef double OPJ_FLOAT64; 00113 typedef unsigned char OPJ_BYTE; 00114 00115 #include "opj_stdint.h" 00116 00117 typedef int8_t OPJ_INT8; 00118 typedef uint8_t OPJ_UINT8; 00119 typedef int16_t OPJ_INT16; 00120 typedef uint16_t OPJ_UINT16; 00121 typedef int32_t OPJ_INT32; 00122 typedef uint32_t OPJ_UINT32; 00123 typedef int64_t OPJ_INT64; 00124 typedef uint64_t OPJ_UINT64; 00125 00126 typedef int64_t OPJ_OFF_T; /* 64-bit file offset type */ 00127 00128 #include <stdio.h> 00129 typedef size_t OPJ_SIZE_T; 00130 00131 /* Avoid compile-time warning because parameter is not used */ 00132 #define OPJ_ARG_NOT_USED(x) (void)(x) 00133 00134 /* 00135 ========================================================== 00136 Useful constant definitions 00137 ========================================================== 00138 */ 00139 00140 #define OPJ_PATH_LEN 4096 00142 #define OPJ_J2K_MAXRLVLS 33 00143 #define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) 00145 #define OPJ_J2K_DEFAULT_NB_SEGS 10 00146 #define OPJ_J2K_STREAM_CHUNK_SIZE 0x100000 00147 #define OPJ_J2K_DEFAULT_HEADER_SIZE 1000 00148 #define OPJ_J2K_MCC_DEFAULT_NB_RECORDS 10 00149 #define OPJ_J2K_MCT_DEFAULT_NB_RECORDS 10 00150 00151 /* UniPG>> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */ 00152 #define JPWL_MAX_NO_TILESPECS 16 00153 #define JPWL_MAX_NO_PACKSPECS 16 00154 #define JPWL_MAX_NO_MARKERS 512 00155 #define JPWL_PRIVATEINDEX_NAME "jpwl_index_privatefilename" 00156 #define JPWL_EXPECTED_COMPONENTS 3 00157 #define JPWL_MAXIMUM_TILES 8192 00158 #define JPWL_MAXIMUM_HAMMING 2 00159 #define JPWL_MAXIMUM_EPB_ROOM 65450 00160 /* <<UniPG */ 00161 00166 #define OPJ_IMG_INFO 1 00167 #define OPJ_J2K_MH_INFO 2 00168 #define OPJ_J2K_TH_INFO 4 00169 #define OPJ_J2K_TCH_INFO 8 00170 #define OPJ_J2K_MH_IND 16 00171 #define OPJ_J2K_TH_IND 32 00172 /*FIXME #define OPJ_J2K_CSTR_IND 48*/ 00173 #define OPJ_JP2_INFO 128 00174 #define OPJ_JP2_IND 256 00190 #define OPJ_PROFILE_NONE 0x0000 00191 #define OPJ_PROFILE_0 0x0001 00192 #define OPJ_PROFILE_1 0x0002 00193 #define OPJ_PROFILE_PART2 0x8000 00194 #define OPJ_PROFILE_CINEMA_2K 0x0003 00195 #define OPJ_PROFILE_CINEMA_4K 0x0004 00196 #define OPJ_PROFILE_CINEMA_S2K 0x0005 00197 #define OPJ_PROFILE_CINEMA_S4K 0x0006 00198 #define OPJ_PROFILE_CINEMA_LTS 0x0007 00199 #define OPJ_PROFILE_BC_SINGLE 0x0100 00200 #define OPJ_PROFILE_BC_MULTI 0x0200 00201 #define OPJ_PROFILE_BC_MULTI_R 0x0300 00202 #define OPJ_PROFILE_IMF_2K 0x0400 00203 #define OPJ_PROFILE_IMF_4K 0x0401 00204 #define OPJ_PROFILE_IMF_8K 0x0402 00205 #define OPJ_PROFILE_IMF_2K_R 0x0403 00206 #define OPJ_PROFILE_IMF_4K_R 0x0800 00207 #define OPJ_PROFILE_IMF_8K_R 0x0801 00212 #define OPJ_EXTENSION_NONE 0x0000 00213 #define OPJ_EXTENSION_MCT 0x0100 00218 #define OPJ_IS_CINEMA(v) (((v) >= OPJ_PROFILE_CINEMA_2K)&&((v) <= OPJ_PROFILE_CINEMA_S4K)) 00219 #define OPJ_IS_STORAGE(v) ((v) == OPJ_PROFILE_CINEMA_LTS) 00220 #define OPJ_IS_BROADCAST(v) (((v) >= OPJ_PROFILE_BC_SINGLE)&&((v) <= ((OPJ_PROFILE_BC_MULTI_R) | (0x000b)))) 00221 #define OPJ_IS_IMF(v) (((v) >= OPJ_PROFILE_IMF_2K)&&((v) <= ((OPJ_PROFILE_IMF_8K_R) | (0x009b)))) 00222 #define OPJ_IS_PART2(v) ((v) & OPJ_PROFILE_PART2) 00223 00227 #define OPJ_CINEMA_24_CS 1302083 00228 #define OPJ_CINEMA_48_CS 651041 00229 #define OPJ_CINEMA_24_COMP 1041666 00230 #define OPJ_CINEMA_48_COMP 520833 00232 /* 00233 ========================================================== 00234 enum definitions 00235 ========================================================== 00236 */ 00237 00242 typedef enum RSIZ_CAPABILITIES { 00243 OPJ_STD_RSIZ = 0, 00244 OPJ_CINEMA2K = 3, 00245 OPJ_CINEMA4K = 4, 00246 OPJ_MCT = 0x8100 00247 } OPJ_RSIZ_CAPABILITIES; 00248 00253 typedef enum CINEMA_MODE { 00254 OPJ_OFF = 0, 00255 OPJ_CINEMA2K_24 = 1, 00256 OPJ_CINEMA2K_48 = 2, 00257 OPJ_CINEMA4K_24 = 3 00258 }OPJ_CINEMA_MODE; 00259 00263 typedef enum PROG_ORDER { 00264 OPJ_PROG_UNKNOWN = -1, 00265 OPJ_LRCP = 0, 00266 OPJ_RLCP = 1, 00267 OPJ_RPCL = 2, 00268 OPJ_PCRL = 3, 00269 OPJ_CPRL = 4 00270 } OPJ_PROG_ORDER; 00271 00275 typedef enum COLOR_SPACE { 00276 OPJ_CLRSPC_UNKNOWN = -1, 00277 OPJ_CLRSPC_UNSPECIFIED = 0, 00278 OPJ_CLRSPC_SRGB = 1, 00279 OPJ_CLRSPC_GRAY = 2, 00280 OPJ_CLRSPC_SYCC = 3, 00281 OPJ_CLRSPC_EYCC = 4, 00282 OPJ_CLRSPC_CMYK = 5 00283 } OPJ_COLOR_SPACE; 00284 00288 typedef enum CODEC_FORMAT { 00289 OPJ_CODEC_UNKNOWN = -1, 00290 OPJ_CODEC_J2K = 0, 00291 OPJ_CODEC_JPT = 1, 00292 OPJ_CODEC_JP2 = 2, 00293 OPJ_CODEC_JPP = 3, 00294 OPJ_CODEC_JPX = 4 00295 } OPJ_CODEC_FORMAT; 00296 00297 00298 /* 00299 ========================================================== 00300 event manager typedef definitions 00301 ========================================================== 00302 */ 00303 00309 typedef void (*opj_msg_callback) (const char *msg, void *client_data); 00310 00311 /* 00312 ========================================================== 00313 codec typedef definitions 00314 ========================================================== 00315 */ 00316 00321 typedef struct opj_poc { 00323 OPJ_UINT32 resno0, compno0; 00325 OPJ_UINT32 layno1, resno1, compno1; 00327 OPJ_UINT32 layno0, precno0, precno1; 00329 OPJ_PROG_ORDER prg1,prg; 00331 OPJ_CHAR progorder[5]; 00333 OPJ_UINT32 tile; 00335 OPJ_INT32 tx0,tx1,ty0,ty1; 00337 OPJ_UINT32 layS, resS, compS, prcS; 00339 OPJ_UINT32 layE, resE, compE, prcE; 00341 OPJ_UINT32 txS,txE,tyS,tyE,dx,dy; 00343 OPJ_UINT32 lay_t, res_t, comp_t, prc_t,tx0_t,ty0_t; 00344 } opj_poc_t; 00345 00349 typedef struct opj_cparameters { 00351 OPJ_BOOL tile_size_on; 00353 int cp_tx0; 00355 int cp_ty0; 00357 int cp_tdx; 00359 int cp_tdy; 00361 int cp_disto_alloc; 00363 int cp_fixed_alloc; 00365 int cp_fixed_quality; 00367 int *cp_matrice; 00369 char *cp_comment; 00371 int csty; 00373 OPJ_PROG_ORDER prog_order; 00375 opj_poc_t POC[32]; 00377 OPJ_UINT32 numpocs; 00379 int tcp_numlayers; 00381 float tcp_rates[100]; 00383 float tcp_distoratio[100]; 00385 int numresolution; 00387 int cblockw_init; 00389 int cblockh_init; 00391 int mode; 00393 int irreversible; 00395 int roi_compno; 00397 int roi_shift; 00398 /* number of precinct size specifications */ 00399 int res_spec; 00401 int prcw_init[OPJ_J2K_MAXRLVLS]; 00403 int prch_init[OPJ_J2K_MAXRLVLS]; 00404 00408 char infile[OPJ_PATH_LEN]; 00410 char outfile[OPJ_PATH_LEN]; 00412 int index_on; 00414 char index[OPJ_PATH_LEN]; 00416 int image_offset_x0; 00418 int image_offset_y0; 00420 int subsampling_dx; 00422 int subsampling_dy; 00424 int decod_format; 00426 int cod_format; 00429 /* UniPG>> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */ 00433 OPJ_BOOL jpwl_epc_on; 00435 int jpwl_hprot_MH; 00437 int jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; 00439 int jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS]; 00441 int jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS]; 00443 int jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS]; 00445 int jpwl_pprot[JPWL_MAX_NO_PACKSPECS]; 00447 int jpwl_sens_size; 00449 int jpwl_sens_addr; 00451 int jpwl_sens_range; 00453 int jpwl_sens_MH; 00455 int jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; 00457 int jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS]; 00459 /* <<UniPG */ 00460 00465 OPJ_CINEMA_MODE cp_cinema; 00470 int max_comp_size; 00475 OPJ_RSIZ_CAPABILITIES cp_rsiz; 00477 char tp_on; 00479 char tp_flag; 00481 char tcp_mct; 00483 OPJ_BOOL jpip_on; 00486 void * mct_data; 00493 int max_cs_size; 00496 OPJ_UINT16 rsiz; 00497 } opj_cparameters_t; 00498 00499 #define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001 00500 00504 typedef struct opj_dparameters { 00512 OPJ_UINT32 cp_reduce; 00519 OPJ_UINT32 cp_layer; 00520 00524 char infile[OPJ_PATH_LEN]; 00526 char outfile[OPJ_PATH_LEN]; 00528 int decod_format; 00530 int cod_format; 00531 00533 OPJ_UINT32 DA_x0; 00535 OPJ_UINT32 DA_x1; 00537 OPJ_UINT32 DA_y0; 00539 OPJ_UINT32 DA_y1; 00541 OPJ_BOOL m_verbose; 00542 00544 OPJ_UINT32 tile_index; 00546 OPJ_UINT32 nb_tile_to_decode; 00547 00550 /* UniPG>> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */ 00554 OPJ_BOOL jpwl_correct; 00556 int jpwl_exp_comps; 00558 int jpwl_max_tiles; 00560 /* <<UniPG */ 00561 00562 unsigned int flags; 00563 00564 } opj_dparameters_t; 00565 00566 00570 typedef void * opj_codec_t; 00571 00572 /* 00573 ========================================================== 00574 I/O stream typedef definitions 00575 ========================================================== 00576 */ 00577 00582 #define OPJ_STREAM_READ OPJ_TRUE 00583 00584 #define OPJ_STREAM_WRITE OPJ_FALSE 00585 00586 /* 00587 * Callback function prototype for read function 00588 */ 00589 typedef OPJ_SIZE_T (* opj_stream_read_fn) (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data) ; 00590 00591 /* 00592 * Callback function prototype for write function 00593 */ 00594 typedef OPJ_SIZE_T (* opj_stream_write_fn) (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data) ; 00595 00596 /* 00597 * Callback function prototype for skip function 00598 */ 00599 typedef OPJ_OFF_T (* opj_stream_skip_fn) (OPJ_OFF_T p_nb_bytes, void * p_user_data) ; 00600 00601 /* 00602 * Callback function prototype for seek function 00603 */ 00604 typedef OPJ_BOOL (* opj_stream_seek_fn) (OPJ_OFF_T p_nb_bytes, void * p_user_data) ; 00605 00606 /* 00607 * Callback function prototype for free user data function 00608 */ 00609 typedef void (* opj_stream_free_user_data_fn) (void * p_user_data) ; 00610 00611 /* 00612 * JPEG2000 Stream. 00613 */ 00614 typedef void * opj_stream_t; 00615 00616 /* 00617 ========================================================== 00618 image typedef definitions 00619 ========================================================== 00620 */ 00621 00625 typedef struct opj_image_comp { 00627 OPJ_UINT32 dx; 00629 OPJ_UINT32 dy; 00631 OPJ_UINT32 w; 00633 OPJ_UINT32 h; 00635 OPJ_UINT32 x0; 00637 OPJ_UINT32 y0; 00639 OPJ_UINT32 prec; 00641 OPJ_UINT32 bpp; 00643 OPJ_UINT32 sgnd; 00645 OPJ_UINT32 resno_decoded; 00647 OPJ_UINT32 factor; 00649 OPJ_INT32 *data; 00651 OPJ_UINT16 alpha; 00652 } opj_image_comp_t; 00653 00657 typedef struct opj_image { 00659 OPJ_UINT32 x0; 00661 OPJ_UINT32 y0; 00663 OPJ_UINT32 x1; 00665 OPJ_UINT32 y1; 00667 OPJ_UINT32 numcomps; 00669 OPJ_COLOR_SPACE color_space; 00671 opj_image_comp_t *comps; 00673 OPJ_BYTE *icc_profile_buf; 00675 OPJ_UINT32 icc_profile_len; 00676 } opj_image_t; 00677 00678 00682 typedef struct opj_image_comptparm { 00684 OPJ_UINT32 dx; 00686 OPJ_UINT32 dy; 00688 OPJ_UINT32 w; 00690 OPJ_UINT32 h; 00692 OPJ_UINT32 x0; 00694 OPJ_UINT32 y0; 00696 OPJ_UINT32 prec; 00698 OPJ_UINT32 bpp; 00700 OPJ_UINT32 sgnd; 00701 } opj_image_cmptparm_t; 00702 00703 00704 /* 00705 ========================================================== 00706 Information on the JPEG 2000 codestream 00707 ========================================================== 00708 */ 00709 /* QUITE EXPERIMENTAL FOR THE MOMENT */ 00710 00714 typedef struct opj_packet_info { 00716 OPJ_OFF_T start_pos; 00718 OPJ_OFF_T end_ph_pos; 00720 OPJ_OFF_T end_pos; 00722 double disto; 00723 } opj_packet_info_t; 00724 00725 00726 /* UniPG>> */ 00730 typedef struct opj_marker_info { 00732 unsigned short int type; 00734 OPJ_OFF_T pos; 00736 int len; 00737 } opj_marker_info_t; 00738 /* <<UniPG */ 00739 00743 typedef struct opj_tp_info { 00745 int tp_start_pos; 00747 int tp_end_header; 00749 int tp_end_pos; 00751 int tp_start_pack; 00753 int tp_numpacks; 00754 } opj_tp_info_t; 00755 00759 typedef struct opj_tile_info { 00761 double *thresh; 00763 int tileno; 00765 int start_pos; 00767 int end_header; 00769 int end_pos; 00771 int pw[33]; 00773 int ph[33]; 00775 int pdx[33]; 00777 int pdy[33]; 00779 opj_packet_info_t *packet; 00781 int numpix; 00783 double distotile; 00785 int marknum; 00787 opj_marker_info_t *marker; 00789 int maxmarknum; 00791 int num_tps; 00793 opj_tp_info_t *tp; 00794 } opj_tile_info_t; 00795 00799 typedef struct opj_codestream_info { 00801 double D_max; 00803 int packno; 00805 int index_write; 00807 int image_w; 00809 int image_h; 00811 OPJ_PROG_ORDER prog; 00813 int tile_x; 00815 int tile_y; 00817 int tile_Ox; 00819 int tile_Oy; 00821 int tw; 00823 int th; 00825 int numcomps; 00827 int numlayers; 00829 int *numdecompos; 00830 /* UniPG>> */ 00832 int marknum; 00834 opj_marker_info_t *marker; 00836 int maxmarknum; 00837 /* <<UniPG */ 00839 int main_head_start; 00841 int main_head_end; 00843 int codestream_size; 00845 opj_tile_info_t *tile; 00846 } opj_codestream_info_t; 00847 00848 /* <----------------------------------------------------------- */ 00849 /* new output managment of the codestream information and index */ 00850 00854 typedef struct opj_tccp_info 00855 { 00857 OPJ_UINT32 compno; 00859 OPJ_UINT32 csty; 00861 OPJ_UINT32 numresolutions; 00863 OPJ_UINT32 cblkw; 00865 OPJ_UINT32 cblkh; 00867 OPJ_UINT32 cblksty; 00869 OPJ_UINT32 qmfbid; 00871 OPJ_UINT32 qntsty; 00873 OPJ_UINT32 stepsizes_mant[OPJ_J2K_MAXBANDS]; 00875 OPJ_UINT32 stepsizes_expn[OPJ_J2K_MAXBANDS]; 00877 OPJ_UINT32 numgbits; 00879 OPJ_INT32 roishift; 00881 OPJ_UINT32 prcw[OPJ_J2K_MAXRLVLS]; 00883 OPJ_UINT32 prch[OPJ_J2K_MAXRLVLS]; 00884 } 00885 opj_tccp_info_t; 00886 00890 typedef struct opj_tile_v2_info { 00891 00893 int tileno; 00895 OPJ_UINT32 csty; 00897 OPJ_PROG_ORDER prg; 00899 OPJ_UINT32 numlayers; 00901 OPJ_UINT32 mct; 00902 00904 opj_tccp_info_t *tccp_info; 00905 00906 } opj_tile_info_v2_t; 00907 00911 typedef struct opj_codestream_info_v2 { 00912 /* Tile info */ 00914 OPJ_UINT32 tx0; 00916 OPJ_UINT32 ty0; 00918 OPJ_UINT32 tdx; 00920 OPJ_UINT32 tdy; 00922 OPJ_UINT32 tw; 00924 OPJ_UINT32 th; 00925 00927 OPJ_UINT32 nbcomps; 00928 00930 opj_tile_info_v2_t m_default_tile_info; 00931 00933 opj_tile_info_v2_t *tile_info; /* FIXME not used for the moment */ 00934 00935 } opj_codestream_info_v2_t; 00936 00937 00941 typedef struct opj_tp_index { 00943 OPJ_OFF_T start_pos; 00945 OPJ_OFF_T end_header; 00947 OPJ_OFF_T end_pos; 00948 00949 } opj_tp_index_t; 00950 00954 typedef struct opj_tile_index { 00956 OPJ_UINT32 tileno; 00957 00959 OPJ_UINT32 nb_tps; 00961 OPJ_UINT32 current_nb_tps; 00963 OPJ_UINT32 current_tpsno; 00965 opj_tp_index_t *tp_index; 00966 00967 /* UniPG>> */ /* NOT USED FOR THE MOMENT IN THE V2 VERSION */ 00969 OPJ_UINT32 marknum; 00971 opj_marker_info_t *marker; 00973 OPJ_UINT32 maxmarknum; 00974 /* <<UniPG */ 00975 00977 OPJ_UINT32 nb_packet; 00979 opj_packet_info_t *packet_index; 00980 00981 } opj_tile_index_t; 00982 00986 typedef struct opj_codestream_index { 00988 OPJ_OFF_T main_head_start; 00990 OPJ_OFF_T main_head_end; 00991 00993 OPJ_UINT64 codestream_size; 00994 00995 /* UniPG>> */ /* NOT USED FOR THE MOMENT IN THE V2 VERSION */ 00997 OPJ_UINT32 marknum; 00999 opj_marker_info_t *marker; 01001 OPJ_UINT32 maxmarknum; 01002 /* <<UniPG */ 01003 01005 OPJ_UINT32 nb_of_tiles; 01007 opj_tile_index_t *tile_index; /* FIXME not used for the moment */ 01008 01009 }opj_codestream_index_t; 01010 /* -----------------------------------------------------------> */ 01011 01012 /* 01013 ========================================================== 01014 Metadata from the JP2file 01015 ========================================================== 01016 */ 01017 01022 typedef struct opj_jp2_metadata { 01024 OPJ_INT32 not_used; 01025 01026 } opj_jp2_metadata_t; 01027 01032 typedef struct opj_jp2_index { 01034 OPJ_INT32 not_used; 01035 01036 } opj_jp2_index_t; 01037 01038 01039 #ifdef __cplusplus 01040 extern "C" { 01041 #endif 01042 01043 01044 /* 01045 ========================================================== 01046 openjpeg version 01047 ========================================================== 01048 */ 01049 01050 /* Get the version of the openjpeg library*/ 01051 OPJ_API const char * OPJ_CALLCONV opj_version(void); 01052 01053 /* 01054 ========================================================== 01055 image functions definitions 01056 ========================================================== 01057 */ 01058 01067 OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc); 01068 01074 OPJ_API void OPJ_CALLCONV opj_image_destroy(opj_image_t *image); 01075 01085 OPJ_API opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc); 01086 01087 /* 01088 ========================================================== 01089 stream functions definitions 01090 ========================================================== 01091 */ 01092 01100 OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_default_create(OPJ_BOOL p_is_input); 01101 01110 OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size, OPJ_BOOL p_is_input); 01111 01118 OPJ_API void OPJ_CALLCONV opj_stream_destroy(opj_stream_t* p_stream); 01119 01125 OPJ_API void OPJ_CALLCONV opj_stream_set_read_function(opj_stream_t* p_stream, opj_stream_read_fn p_function); 01126 01132 OPJ_API void OPJ_CALLCONV opj_stream_set_write_function(opj_stream_t* p_stream, opj_stream_write_fn p_function); 01133 01139 OPJ_API void OPJ_CALLCONV opj_stream_set_skip_function(opj_stream_t* p_stream, opj_stream_skip_fn p_function); 01140 01146 OPJ_API void OPJ_CALLCONV opj_stream_set_seek_function(opj_stream_t* p_stream, opj_stream_seek_fn p_function); 01147 01154 OPJ_API void OPJ_CALLCONV opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data, opj_stream_free_user_data_fn p_function); 01155 01162 OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream, OPJ_UINT64 data_length); 01163 01169 OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream (const char *fname, OPJ_BOOL p_is_read_stream); 01170 01176 OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (const char *fname, 01177 OPJ_SIZE_T p_buffer_size, 01178 OPJ_BOOL p_is_read_stream); 01179 01180 /* 01181 ========================================================== 01182 event manager functions definitions 01183 ========================================================== 01184 */ 01191 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_info_handler(opj_codec_t * p_codec, 01192 opj_msg_callback p_callback, 01193 void * p_user_data); 01200 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_warning_handler(opj_codec_t * p_codec, 01201 opj_msg_callback p_callback, 01202 void * p_user_data); 01209 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_error_handler(opj_codec_t * p_codec, 01210 opj_msg_callback p_callback, 01211 void * p_user_data); 01212 01213 /* 01214 ========================================================== 01215 codec functions definitions 01216 ========================================================== 01217 */ 01218 01225 OPJ_API opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format); 01226 01232 OPJ_API void OPJ_CALLCONV opj_destroy_codec(opj_codec_t * p_codec); 01233 01239 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_end_decompress ( opj_codec_t *p_codec, 01240 opj_stream_t *p_stream); 01241 01242 01247 OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *parameters); 01248 01258 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, 01259 opj_dparameters_t *parameters ); 01260 01270 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_read_header ( opj_stream_t *p_stream, 01271 opj_codec_t *p_codec, 01272 opj_image_t **p_image); 01273 01286 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_decode_area( opj_codec_t *p_codec, 01287 opj_image_t* p_image, 01288 OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, 01289 OPJ_INT32 p_end_x, OPJ_INT32 p_end_y ); 01290 01299 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decode( opj_codec_t *p_decompressor, 01300 opj_stream_t *p_stream, 01301 opj_image_t *p_image); 01302 01313 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_get_decoded_tile( opj_codec_t *p_codec, 01314 opj_stream_t *p_stream, 01315 opj_image_t *p_image, 01316 OPJ_UINT32 tile_index); 01317 01325 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_decoded_resolution_factor(opj_codec_t *p_codec, OPJ_UINT32 res_factor); 01326 01339 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_write_tile ( opj_codec_t *p_codec, 01340 OPJ_UINT32 p_tile_index, 01341 OPJ_BYTE * p_data, 01342 OPJ_UINT32 p_data_size, 01343 opj_stream_t *p_stream ); 01344 01366 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_read_tile_header( opj_codec_t *p_codec, 01367 opj_stream_t * p_stream, 01368 OPJ_UINT32 * p_tile_index, 01369 OPJ_UINT32 * p_data_size, 01370 OPJ_INT32 * p_tile_x0, OPJ_INT32 * p_tile_y0, 01371 OPJ_INT32 * p_tile_x1, OPJ_INT32 * p_tile_y1, 01372 OPJ_UINT32 * p_nb_comps, 01373 OPJ_BOOL * p_should_go_on ); 01374 01387 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decode_tile_data( opj_codec_t *p_codec, 01388 OPJ_UINT32 p_tile_index, 01389 OPJ_BYTE * p_data, 01390 OPJ_UINT32 p_data_size, 01391 opj_stream_t *p_stream ); 01392 01393 /* COMPRESSION FUNCTIONS*/ 01394 01400 OPJ_API opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format); 01401 01423 OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters); 01424 01431 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_encoder(opj_codec_t *p_codec, 01432 opj_cparameters_t *parameters, 01433 opj_image_t *image); 01434 01441 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_start_compress ( opj_codec_t *p_codec, 01442 opj_image_t * p_image, 01443 opj_stream_t *p_stream); 01444 01450 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_end_compress (opj_codec_t *p_codec, 01451 opj_stream_t *p_stream); 01452 01460 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_encode(opj_codec_t *p_codec, 01461 opj_stream_t *p_stream); 01462 /* 01463 ========================================================== 01464 codec output functions definitions 01465 ========================================================== 01466 */ 01467 /* EXPERIMENTAL FUNCTIONS FOR NOW, USED ONLY IN J2K_DUMP*/ 01468 01473 OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_v2_t **cstr_info); 01474 01475 01484 OPJ_API void OPJ_CALLCONV opj_dump_codec( opj_codec_t *p_codec, 01485 OPJ_INT32 info_flag, 01486 FILE* output_stream); 01487 01496 OPJ_API opj_codestream_info_v2_t* OPJ_CALLCONV opj_get_cstr_info(opj_codec_t *p_codec); 01497 01506 OPJ_API opj_codestream_index_t * OPJ_CALLCONV opj_get_cstr_index(opj_codec_t *p_codec); 01507 01508 OPJ_API void OPJ_CALLCONV opj_destroy_cstr_index(opj_codestream_index_t **p_cstr_index); 01509 01510 01519 OPJ_API opj_jp2_metadata_t* OPJ_CALLCONV opj_get_jp2_metadata(opj_codec_t *p_codec); 01520 01529 OPJ_API opj_jp2_index_t* OPJ_CALLCONV opj_get_jp2_index(opj_codec_t *p_codec); 01530 01531 01532 /* 01533 ========================================================== 01534 MCT functions 01535 ========================================================== 01536 */ 01537 01548 OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_MCT( opj_cparameters_t *parameters, 01549 OPJ_FLOAT32 * pEncodingMatrix, 01550 OPJ_INT32 * p_dc_shift, 01551 OPJ_UINT32 pNbComp); 01552 01553 01554 01555 #ifdef __cplusplus 01556 } 01557 #endif 01558 01559 #endif /* OPENJPEG_H */