1*3ac0a46fSAndroid Build Coastguard Worker /* 2*3ac0a46fSAndroid Build Coastguard Worker * The copyright in this software is being made available under the 2-clauses 3*3ac0a46fSAndroid Build Coastguard Worker * BSD License, included below. This software may be subject to other third 4*3ac0a46fSAndroid Build Coastguard Worker * party and contributor rights, including patent rights, and no such rights 5*3ac0a46fSAndroid Build Coastguard Worker * are granted under this license. 6*3ac0a46fSAndroid Build Coastguard Worker * 7*3ac0a46fSAndroid Build Coastguard Worker * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 8*3ac0a46fSAndroid Build Coastguard Worker * Copyright (c) 2002-2014, Professor Benoit Macq 9*3ac0a46fSAndroid Build Coastguard Worker * All rights reserved. 10*3ac0a46fSAndroid Build Coastguard Worker * 11*3ac0a46fSAndroid Build Coastguard Worker * Redistribution and use in source and binary forms, with or without 12*3ac0a46fSAndroid Build Coastguard Worker * modification, are permitted provided that the following conditions 13*3ac0a46fSAndroid Build Coastguard Worker * are met: 14*3ac0a46fSAndroid Build Coastguard Worker * 1. Redistributions of source code must retain the above copyright 15*3ac0a46fSAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer. 16*3ac0a46fSAndroid Build Coastguard Worker * 2. Redistributions in binary form must reproduce the above copyright 17*3ac0a46fSAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer in the 18*3ac0a46fSAndroid Build Coastguard Worker * documentation and/or other materials provided with the distribution. 19*3ac0a46fSAndroid Build Coastguard Worker * 20*3ac0a46fSAndroid Build Coastguard Worker * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 21*3ac0a46fSAndroid Build Coastguard Worker * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22*3ac0a46fSAndroid Build Coastguard Worker * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23*3ac0a46fSAndroid Build Coastguard Worker * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24*3ac0a46fSAndroid Build Coastguard Worker * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25*3ac0a46fSAndroid Build Coastguard Worker * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26*3ac0a46fSAndroid Build Coastguard Worker * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27*3ac0a46fSAndroid Build Coastguard Worker * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28*3ac0a46fSAndroid Build Coastguard Worker * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29*3ac0a46fSAndroid Build Coastguard Worker * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30*3ac0a46fSAndroid Build Coastguard Worker * POSSIBILITY OF SUCH DAMAGE. 31*3ac0a46fSAndroid Build Coastguard Worker */ 32*3ac0a46fSAndroid Build Coastguard Worker #ifndef OPJ_CODEC_H 33*3ac0a46fSAndroid Build Coastguard Worker #define OPJ_CODEC_H 34*3ac0a46fSAndroid Build Coastguard Worker /** 35*3ac0a46fSAndroid Build Coastguard Worker @file opj_codec.h 36*3ac0a46fSAndroid Build Coastguard Worker */ 37*3ac0a46fSAndroid Build Coastguard Worker 38*3ac0a46fSAndroid Build Coastguard Worker 39*3ac0a46fSAndroid Build Coastguard Worker /** 40*3ac0a46fSAndroid Build Coastguard Worker * Main codec handler used for compression or decompression. 41*3ac0a46fSAndroid Build Coastguard Worker */ 42*3ac0a46fSAndroid Build Coastguard Worker typedef struct opj_codec_private { 43*3ac0a46fSAndroid Build Coastguard Worker /** FIXME DOC */ 44*3ac0a46fSAndroid Build Coastguard Worker union { 45*3ac0a46fSAndroid Build Coastguard Worker /** 46*3ac0a46fSAndroid Build Coastguard Worker * Decompression handler. 47*3ac0a46fSAndroid Build Coastguard Worker */ 48*3ac0a46fSAndroid Build Coastguard Worker struct opj_decompression { 49*3ac0a46fSAndroid Build Coastguard Worker /** Main header reading function handler */ 50*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(*opj_read_header)(struct opj_stream_private * cio, 51*3ac0a46fSAndroid Build Coastguard Worker void * p_codec, 52*3ac0a46fSAndroid Build Coastguard Worker opj_image_t **p_image, 53*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 54*3ac0a46fSAndroid Build Coastguard Worker 55*3ac0a46fSAndroid Build Coastguard Worker /** Decoding function */ 56*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(*opj_decode)(void * p_codec, 57*3ac0a46fSAndroid Build Coastguard Worker struct opj_stream_private * p_cio, 58*3ac0a46fSAndroid Build Coastguard Worker opj_image_t * p_image, 59*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 60*3ac0a46fSAndroid Build Coastguard Worker 61*3ac0a46fSAndroid Build Coastguard Worker /** FIXME DOC */ 62*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(*opj_read_tile_header)(void * p_codec, 63*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 * p_tile_index, 64*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 * p_data_size, 65*3ac0a46fSAndroid Build Coastguard Worker OPJ_INT32 * p_tile_x0, 66*3ac0a46fSAndroid Build Coastguard Worker OPJ_INT32 * p_tile_y0, 67*3ac0a46fSAndroid Build Coastguard Worker OPJ_INT32 * p_tile_x1, 68*3ac0a46fSAndroid Build Coastguard Worker OPJ_INT32 * p_tile_y1, 69*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 * p_nb_comps, 70*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL * p_should_go_on, 71*3ac0a46fSAndroid Build Coastguard Worker struct opj_stream_private * p_cio, 72*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 73*3ac0a46fSAndroid Build Coastguard Worker 74*3ac0a46fSAndroid Build Coastguard Worker /** FIXME DOC */ 75*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(*opj_decode_tile_data)(void * p_codec, 76*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 p_tile_index, 77*3ac0a46fSAndroid Build Coastguard Worker OPJ_BYTE * p_data, 78*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 p_data_size, 79*3ac0a46fSAndroid Build Coastguard Worker struct opj_stream_private * p_cio, 80*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 81*3ac0a46fSAndroid Build Coastguard Worker 82*3ac0a46fSAndroid Build Coastguard Worker /** Reading function used after codestream if necessary */ 83*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(* opj_end_decompress)(void *p_codec, 84*3ac0a46fSAndroid Build Coastguard Worker struct opj_stream_private * cio, 85*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 86*3ac0a46fSAndroid Build Coastguard Worker 87*3ac0a46fSAndroid Build Coastguard Worker /** Codec destroy function handler */ 88*3ac0a46fSAndroid Build Coastguard Worker void (*opj_destroy)(void * p_codec); 89*3ac0a46fSAndroid Build Coastguard Worker 90*3ac0a46fSAndroid Build Coastguard Worker /** Setup decoder function handler */ 91*3ac0a46fSAndroid Build Coastguard Worker void (*opj_setup_decoder)(void * p_codec, opj_dparameters_t * p_param); 92*3ac0a46fSAndroid Build Coastguard Worker 93*3ac0a46fSAndroid Build Coastguard Worker /** Strict mode function handler */ 94*3ac0a46fSAndroid Build Coastguard Worker void (*opj_decoder_set_strict_mode)(void * p_codec, OPJ_BOOL strict); 95*3ac0a46fSAndroid Build Coastguard Worker 96*3ac0a46fSAndroid Build Coastguard Worker /** Set decode area function handler */ 97*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(*opj_set_decode_area)(void * p_codec, 98*3ac0a46fSAndroid Build Coastguard Worker opj_image_t * p_image, 99*3ac0a46fSAndroid Build Coastguard Worker OPJ_INT32 p_start_x, 100*3ac0a46fSAndroid Build Coastguard Worker OPJ_INT32 p_end_x, 101*3ac0a46fSAndroid Build Coastguard Worker OPJ_INT32 p_start_y, 102*3ac0a46fSAndroid Build Coastguard Worker OPJ_INT32 p_end_y, 103*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 104*3ac0a46fSAndroid Build Coastguard Worker 105*3ac0a46fSAndroid Build Coastguard Worker /** Get tile function */ 106*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(*opj_get_decoded_tile)(void *p_codec, 107*3ac0a46fSAndroid Build Coastguard Worker opj_stream_private_t * p_cio, 108*3ac0a46fSAndroid Build Coastguard Worker opj_image_t *p_image, 109*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager, 110*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 tile_index); 111*3ac0a46fSAndroid Build Coastguard Worker 112*3ac0a46fSAndroid Build Coastguard Worker /** Set the decoded resolution factor */ 113*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(*opj_set_decoded_resolution_factor)(void * p_codec, 114*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 res_factor, 115*3ac0a46fSAndroid Build Coastguard Worker opj_event_mgr_t * p_manager); 116*3ac0a46fSAndroid Build Coastguard Worker 117*3ac0a46fSAndroid Build Coastguard Worker /** Set the decoded components */ 118*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(*opj_set_decoded_components)(void * p_codec, 119*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 num_comps, 120*3ac0a46fSAndroid Build Coastguard Worker const OPJ_UINT32* comps_indices, 121*3ac0a46fSAndroid Build Coastguard Worker opj_event_mgr_t * p_manager); 122*3ac0a46fSAndroid Build Coastguard Worker } m_decompression; 123*3ac0a46fSAndroid Build Coastguard Worker 124*3ac0a46fSAndroid Build Coastguard Worker /** 125*3ac0a46fSAndroid Build Coastguard Worker * Compression handler. FIXME DOC 126*3ac0a46fSAndroid Build Coastguard Worker */ 127*3ac0a46fSAndroid Build Coastguard Worker struct opj_compression { 128*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(* opj_start_compress)(void *p_codec, 129*3ac0a46fSAndroid Build Coastguard Worker struct opj_stream_private * cio, 130*3ac0a46fSAndroid Build Coastguard Worker struct opj_image * p_image, 131*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 132*3ac0a46fSAndroid Build Coastguard Worker 133*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(* opj_encode)(void * p_codec, 134*3ac0a46fSAndroid Build Coastguard Worker struct opj_stream_private *p_cio, 135*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 136*3ac0a46fSAndroid Build Coastguard Worker 137*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(* opj_write_tile)(void * p_codec, 138*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 p_tile_index, 139*3ac0a46fSAndroid Build Coastguard Worker OPJ_BYTE * p_data, 140*3ac0a46fSAndroid Build Coastguard Worker OPJ_UINT32 p_data_size, 141*3ac0a46fSAndroid Build Coastguard Worker struct opj_stream_private * p_cio, 142*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 143*3ac0a46fSAndroid Build Coastguard Worker 144*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(* opj_end_compress)(void * p_codec, 145*3ac0a46fSAndroid Build Coastguard Worker struct opj_stream_private * p_cio, 146*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 147*3ac0a46fSAndroid Build Coastguard Worker 148*3ac0a46fSAndroid Build Coastguard Worker void (* opj_destroy)(void * p_codec); 149*3ac0a46fSAndroid Build Coastguard Worker 150*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(* opj_setup_encoder)(void * p_codec, 151*3ac0a46fSAndroid Build Coastguard Worker opj_cparameters_t * p_param, 152*3ac0a46fSAndroid Build Coastguard Worker struct opj_image * p_image, 153*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 154*3ac0a46fSAndroid Build Coastguard Worker 155*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(* opj_encoder_set_extra_options)(void * p_codec, 156*3ac0a46fSAndroid Build Coastguard Worker const char* const* p_options, 157*3ac0a46fSAndroid Build Coastguard Worker struct opj_event_mgr * p_manager); 158*3ac0a46fSAndroid Build Coastguard Worker 159*3ac0a46fSAndroid Build Coastguard Worker } m_compression; 160*3ac0a46fSAndroid Build Coastguard Worker } m_codec_data; 161*3ac0a46fSAndroid Build Coastguard Worker /** FIXME DOC*/ 162*3ac0a46fSAndroid Build Coastguard Worker void * m_codec; 163*3ac0a46fSAndroid Build Coastguard Worker /** Event handler */ 164*3ac0a46fSAndroid Build Coastguard Worker opj_event_mgr_t m_event_mgr; 165*3ac0a46fSAndroid Build Coastguard Worker /** Flag to indicate if the codec is used to decode or encode*/ 166*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL is_decompressor; 167*3ac0a46fSAndroid Build Coastguard Worker void (*opj_dump_codec)(void * p_codec, OPJ_INT32 info_flag, 168*3ac0a46fSAndroid Build Coastguard Worker FILE* output_stream); 169*3ac0a46fSAndroid Build Coastguard Worker opj_codestream_info_v2_t* (*opj_get_codec_info)(void* p_codec); 170*3ac0a46fSAndroid Build Coastguard Worker opj_codestream_index_t* (*opj_get_codec_index)(void* p_codec); 171*3ac0a46fSAndroid Build Coastguard Worker 172*3ac0a46fSAndroid Build Coastguard Worker /** Set number of threads */ 173*3ac0a46fSAndroid Build Coastguard Worker OPJ_BOOL(*opj_set_threads)(void * p_codec, OPJ_UINT32 num_threads); 174*3ac0a46fSAndroid Build Coastguard Worker } 175*3ac0a46fSAndroid Build Coastguard Worker opj_codec_private_t; 176*3ac0a46fSAndroid Build Coastguard Worker 177*3ac0a46fSAndroid Build Coastguard Worker 178*3ac0a46fSAndroid Build Coastguard Worker #endif /* OPJ_CODEC_H */ 179*3ac0a46fSAndroid Build Coastguard Worker 180