OpenJPEG 2.1.0

opj_codec.h

Go to the documentation of this file.
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  * All rights reserved.
00010  *
00011  * Redistribution and use in source and binary forms, with or without
00012  * modification, are permitted provided that the following conditions
00013  * are met:
00014  * 1. Redistributions of source code must retain the above copyright
00015  *    notice, this list of conditions and the following disclaimer.
00016  * 2. Redistributions in binary form must reproduce the above copyright
00017  *    notice, this list of conditions and the following disclaimer in the
00018  *    documentation and/or other materials provided with the distribution.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
00021  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00023  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00024  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00025  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00026  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00027  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00028  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00029  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00030  * POSSIBILITY OF SUCH DAMAGE.
00031  */
00032 #ifndef __OPJ_CODEC_H
00033 #define __OPJ_CODEC_H
00034 
00042 typedef struct opj_codec_private
00043 {
00045     union
00046     {
00050         struct opj_decompression
00051         {
00053             OPJ_BOOL (*opj_read_header) ( struct opj_stream_private * cio,
00054                                           void * p_codec,
00055                                           opj_image_t **p_image,
00056                                           struct opj_event_mgr * p_manager);
00057 
00059             OPJ_BOOL (*opj_decode) ( void * p_codec,
00060                                      struct opj_stream_private * p_cio,
00061                                      opj_image_t * p_image,
00062                                      struct opj_event_mgr * p_manager);
00063 
00065             OPJ_BOOL (*opj_read_tile_header)( void * p_codec,
00066                                               OPJ_UINT32 * p_tile_index,
00067                                               OPJ_UINT32 * p_data_size,
00068                                               OPJ_INT32 * p_tile_x0,
00069                                               OPJ_INT32 * p_tile_y0,
00070                                               OPJ_INT32 * p_tile_x1,
00071                                               OPJ_INT32 * p_tile_y1,
00072                                               OPJ_UINT32 * p_nb_comps,
00073                                               OPJ_BOOL * p_should_go_on,
00074                                               struct opj_stream_private * p_cio,
00075                                               struct opj_event_mgr * p_manager);
00076 
00078             OPJ_BOOL (*opj_decode_tile_data)( void * p_codec,
00079                                               OPJ_UINT32 p_tile_index,
00080                                               OPJ_BYTE * p_data,
00081                                               OPJ_UINT32 p_data_size,
00082                                               struct opj_stream_private * p_cio,
00083                                               struct opj_event_mgr * p_manager);
00084 
00086             OPJ_BOOL (* opj_end_decompress) ( void *p_codec,
00087                                               struct opj_stream_private * cio,
00088                                               struct opj_event_mgr * p_manager);
00089 
00091             void (*opj_destroy) (void * p_codec);
00092 
00094             void (*opj_setup_decoder) ( void * p_codec, opj_dparameters_t * p_param);
00095 
00097             OPJ_BOOL (*opj_set_decode_area) ( void * p_codec,
00098                                               opj_image_t * p_image,
00099                                               OPJ_INT32 p_start_x,
00100                                               OPJ_INT32 p_end_x,
00101                                               OPJ_INT32 p_start_y,
00102                                               OPJ_INT32 p_end_y,
00103                                               struct opj_event_mgr * p_manager);
00104 
00106             OPJ_BOOL (*opj_get_decoded_tile) ( void *p_codec,
00107                                                opj_stream_private_t * p_cio,
00108                                                opj_image_t *p_image,
00109                                                struct opj_event_mgr * p_manager,
00110                                                OPJ_UINT32 tile_index);
00111 
00113             OPJ_BOOL (*opj_set_decoded_resolution_factor) ( void * p_codec,
00114                                                             OPJ_UINT32 res_factor,
00115                                                             opj_event_mgr_t * p_manager);
00116         } m_decompression;
00117 
00121         struct opj_compression
00122         {
00123             OPJ_BOOL (* opj_start_compress) ( void *p_codec,
00124                                               struct opj_stream_private * cio,
00125                                               struct opj_image * p_image,
00126                                               struct opj_event_mgr * p_manager);
00127 
00128             OPJ_BOOL (* opj_encode) ( void * p_codec,
00129                                       struct opj_stream_private *p_cio,
00130                                       struct opj_event_mgr * p_manager);
00131 
00132             OPJ_BOOL (* opj_write_tile) ( void * p_codec,
00133                                           OPJ_UINT32 p_tile_index,
00134                                           OPJ_BYTE * p_data,
00135                                           OPJ_UINT32 p_data_size,
00136                                           struct opj_stream_private * p_cio,
00137                                           struct opj_event_mgr * p_manager);
00138 
00139             OPJ_BOOL (* opj_end_compress) (     void * p_codec,
00140                                             struct opj_stream_private * p_cio,
00141                                             struct opj_event_mgr * p_manager);
00142 
00143             void (* opj_destroy) (void * p_codec);
00144 
00145             void (* opj_setup_encoder) ( void * p_codec,
00146                                          opj_cparameters_t * p_param,
00147                                          struct opj_image * p_image,
00148                                          struct opj_event_mgr * p_manager);
00149         } m_compression;
00150     } m_codec_data;
00152     void * m_codec;
00154     opj_event_mgr_t m_event_mgr;
00156     OPJ_BOOL is_decompressor;
00157     void (*opj_dump_codec) (void * p_codec, OPJ_INT32 info_flag, FILE* output_stream);
00158     opj_codestream_info_v2_t* (*opj_get_codec_info)(void* p_codec);
00159     opj_codestream_index_t* (*opj_get_codec_index)(void* p_codec);
00160 }
00161 opj_codec_private_t;
00162 
00163 
00164 #endif /* __OPJ_CODEC_H */
00165