2 * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
3 * Copyright (c) 2002-2007, Professor Benoit Macq
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
35 * Main codec handler used for compression or decompression.
37 typedef struct opj_codec_private
43 * Decompression handler.
45 struct opj_decompression
47 /** Main header reading function handler */
48 OPJ_BOOL (*opj_read_header) ( struct opj_stream_private * cio,
50 opj_image_t **p_image,
51 struct opj_event_mgr * p_manager);
53 /** Decoding function */
54 OPJ_BOOL (*opj_decode) ( void * p_codec,
55 struct opj_stream_private * p_cio,
56 opj_image_t * p_image,
57 struct opj_event_mgr * p_manager);
60 OPJ_BOOL (*opj_read_tile_header)( void * p_codec,
61 OPJ_UINT32 * p_tile_index,
62 OPJ_UINT32 * p_data_size,
63 OPJ_INT32 * p_tile_x0,
64 OPJ_INT32 * p_tile_y0,
65 OPJ_INT32 * p_tile_x1,
66 OPJ_INT32 * p_tile_y1,
67 OPJ_UINT32 * p_nb_comps,
68 OPJ_BOOL * p_should_go_on,
69 struct opj_stream_private * p_cio,
70 struct opj_event_mgr * p_manager);
73 OPJ_BOOL (*opj_decode_tile_data)( void * p_codec,
74 OPJ_UINT32 p_tile_index,
76 OPJ_UINT32 p_data_size,
77 struct opj_stream_private * p_cio,
78 struct opj_event_mgr * p_manager);
80 /** Reading function used after codestream if necessary */
81 OPJ_BOOL (* opj_end_decompress) ( void *p_codec,
82 struct opj_stream_private * cio,
83 struct opj_event_mgr * p_manager);
85 /** Codec destroy function handler */
86 void (*opj_destroy) (void * p_codec);
88 /** Setup decoder function handler */
89 void (*opj_setup_decoder) ( void * p_codec, opj_dparameters_t * p_param);
91 /** Set decode area function handler */
92 OPJ_BOOL (*opj_set_decode_area) ( void * p_codec,
93 opj_image_t * p_image,
98 struct opj_event_mgr * p_manager);
100 /** Get tile function */
101 OPJ_BOOL (*opj_get_decoded_tile) ( void *p_codec,
102 opj_stream_private_t * p_cio,
103 opj_image_t *p_image,
104 struct opj_event_mgr * p_manager,
105 OPJ_UINT32 tile_index);
107 /** Set the decoded resolution factor */
108 OPJ_BOOL (*opj_set_decoded_resolution_factor) ( void * p_codec,
109 OPJ_UINT32 res_factor,
110 opj_event_mgr_t * p_manager);
114 * Compression handler. FIXME DOC
116 struct opj_compression
118 OPJ_BOOL (* opj_start_compress) ( void *p_codec,
119 struct opj_stream_private * cio,
120 struct opj_image * p_image,
121 struct opj_event_mgr * p_manager);
123 OPJ_BOOL (* opj_encode) ( void * p_codec,
124 struct opj_stream_private *p_cio,
125 struct opj_event_mgr * p_manager);
127 OPJ_BOOL (* opj_write_tile) ( void * p_codec,
128 OPJ_UINT32 p_tile_index,
130 OPJ_UINT32 p_data_size,
131 struct opj_stream_private * p_cio,
132 struct opj_event_mgr * p_manager);
134 OPJ_BOOL (* opj_end_compress) ( void * p_codec,
135 struct opj_stream_private * p_cio,
136 struct opj_event_mgr * p_manager);
138 void (* opj_destroy) (void * p_codec);
140 void (* opj_setup_encoder) ( void * p_codec,
141 opj_cparameters_t * p_param,
142 struct opj_image * p_image,
143 struct opj_event_mgr * p_manager);
149 opj_event_mgr_t m_event_mgr;
150 /** Flag to indicate if the codec is used to decode or encode*/
151 OPJ_BOOL is_decompressor;
152 void (*opj_dump_codec) (void * p_codec, OPJ_INT32 info_flag, FILE* output_stream);
153 opj_codestream_info_v2_t* (*opj_get_codec_info)(void* p_codec);
154 opj_codestream_index_t* (*opj_get_codec_index)(void* p_codec);
159 #endif /* __OPJ_CODEC_H */