# gdcm_jp2.h

Go to the documentation of this file.

    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_DBTL 0x6474626c
    00050 #define JP2_BPCC 0x62706363
    00051 #define JP2_JP2  0x6a703220
    00053 /* ----------------------------------------------------------------------- */
    00054
    00058 typedef struct opj_jp2_comps {
    00059   int depth;
    00060   int sgnd;
    00061   int bpcc;
    00062 } opj_jp2_comps_t;
    00063
    00067 typedef struct opj_jp2 {
    00069   opj_common_ptr cinfo;
    00071   opj_j2k_t *j2k;
    00072   unsigned int w;
    00073   unsigned int h;
    00074   unsigned int numcomps;
    00075   unsigned int bpc;
    00076   unsigned int C;
    00077   unsigned int UnkC;
    00078   unsigned int IPR;
    00079   unsigned int meth;
    00080   unsigned int approx;
    00081   unsigned int enumcs;
    00082   unsigned int precedence;
    00083   unsigned int brand;
    00084   unsigned int minversion;
    00085   unsigned int numcl;
    00086   unsigned int *cl;
    00087   opj_jp2_comps_t *comps;
    00088   unsigned int j2k_codestream_offset;
    00089   unsigned int j2k_codestream_length;
    00090 } opj_jp2_t;
    00091
    00095 typedef struct opj_jp2_box {
    00096   int length;
    00097   int type;
    00098   int init_pos;
    00099 } opj_jp2_box_t;
    00100
    00103 /* ----------------------------------------------------------------------- */
    00109 void jp2_write_jp2h(opj_jp2_t *jp2, opj_cio_t *cio);
    00116 bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio);
    00122 opj_jp2_t* jp2_create_decompress(opj_common_ptr cinfo);
    00127 void jp2_destroy_decompress(opj_jp2_t *jp2);
    00134 void jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters);
    00142 opj_image_t* jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info);
    00148 opj_jp2_t* jp2_create_compress(opj_common_ptr cinfo);
    00153 void jp2_destroy_compress(opj_jp2_t *jp2);
    00161 void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image);
    00170 bool jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info);
    00171 /* ----------------------------------------------------------------------- */
    00175
    00176 #endif /* __JP2_H */
    00177