2 * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
\r
3 * Copyright (c) 2002-2007, Professor Benoit Macq
\r
4 * Copyright (c) 2001-2003, David Janssens
\r
5 * Copyright (c) 2002-2003, Yannick Verschueren
\r
6 * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
\r
7 * Copyright (c) 2005, Herve Drolon, FreeImage Team
\r
8 * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
\r
9 * All rights reserved.
\r
11 * Redistribution and use in source and binary forms, with or without
\r
12 * modification, are permitted provided that the following conditions
\r
14 * 1. Redistributions of source code must retain the above copyright
\r
15 * notice, this list of conditions and the following disclaimer.
\r
16 * 2. Redistributions in binary form must reproduce the above copyright
\r
17 * notice, this list of conditions and the following disclaimer in the
\r
18 * documentation and/or other materials provided with the distribution.
\r
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
\r
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
\r
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
\r
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
\r
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
\r
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
\r
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\r
30 * POSSIBILITY OF SUCH DAMAGE.
\r
36 @brief Implementation of a tier-2 coding (packetization of code-block data) (T2)
\r
39 #include "openjpeg.h"
\r
41 struct opj_common_struct;
\r
44 struct opj_tcd_tile;
\r
45 struct opj_codestream_info;
\r
47 /** @defgroup T2 T2 - Implementation of a tier-2 coding */
\r
53 typedef enum T2_MODE
\r
55 THRESH_CALC = 0, /** Function called in Rate allocation process*/
\r
56 FINAL_PASS = 1 /** Function called in Tier 2 process*/
\r
64 typedef struct opj_t2 {
\r
65 /** Encoding: pointer to the src image. Decoding: pointer to the dst image. */
\r
66 struct opj_image *image;
\r
67 /** pointer to the image coding parameters */
\r
71 /** @name Exported functions */
\r
73 /* ----------------------------------------------------------------------- */
\r
76 Encode the packets of a tile to a destination buffer
\r
78 @param tileno number of the tile encoded
\r
79 @param tile the tile for which to write the packets
\r
80 @param maxlayers maximum number of layers
\r
81 @param dest the destination buffer
\r
82 @param len the length of the destination buffer
\r
83 @param cstr_info Codestream information structure
\r
84 @param tpnum Tile part number of the current tile
\r
85 @param tppos The position of the tile part flag in the progression order
\r
86 @param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass
\r
88 bool t2_encode_packets(opj_t2_t* t2,OPJ_UINT32 tileno, struct opj_tcd_tile *tile, OPJ_UINT32 maxlayers, OPJ_BYTE *dest, OPJ_UINT32 * p_data_written, OPJ_UINT32 len, struct opj_codestream_info *cstr_info,OPJ_UINT32 tpnum, OPJ_INT32 tppos,OPJ_UINT32 pino,J2K_T2_MODE t2_mode);
\r
90 Decode the packets of a tile from a source buffer
\r
92 @param src the source buffer
\r
93 @param len length of the source buffer
\r
94 @param tileno number that identifies the tile for which to decode the packets
\r
95 @param tile tile for which to decode the packets
\r
97 bool t2_decode_packets(opj_t2_t *t2, OPJ_UINT32 tileno,struct opj_tcd_tile *tile, OPJ_BYTE *src, OPJ_UINT32 * p_data_read, OPJ_UINT32 len, struct opj_codestream_info *cstr_info);
\r
100 * Creates a Tier 2 handle
\r
102 * @param p_image Source or destination image
\r
103 * @param p_cp Image coding parameters.
\r
104 * @return a new T2 handle if successful, NULL otherwise.
\r
106 opj_t2_t* t2_create(struct opj_image *p_image, struct opj_cp *p_cp);
\r
109 * Destroys a Tier 2 handle.
\r
111 * @param p_t2 the Tier 2 handle to destroy
\r
113 void t2_destroy(opj_t2_t *t2);
\r
115 /* ----------------------------------------------------------------------- */
\r
120 #endif /* __T2_H */
\r