OpenJPEG  2.4.0
t1.h
Go to the documentation of this file.
1 /*
2  * The copyright in this software is being made available under the 2-clauses
3  * BSD License, included below. This software may be subject to other third
4  * party and contributor rights, including patent rights, and no such rights
5  * are granted under this license.
6  *
7  * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
8  * Copyright (c) 2002-2014, Professor Benoit Macq
9  * Copyright (c) 2001-2003, David Janssens
10  * Copyright (c) 2002-2003, Yannick Verschueren
11  * Copyright (c) 2003-2007, Francois-Olivier Devaux
12  * Copyright (c) 2003-2014, Antonin Descampe
13  * Copyright (c) 2005, Herve Drolon, FreeImage Team
14  * Copyright (c) 2012, Carl Hetherington
15  * Copyright (c) 2017, IntoPIX SA <support@intopix.com>
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions
20  * are met:
21  * 1. Redistributions of source code must retain the above copyright
22  * notice, this list of conditions and the following disclaimer.
23  * 2. Redistributions in binary form must reproduce the above copyright
24  * notice, this list of conditions and the following disclaimer in the
25  * documentation and/or other materials provided with the distribution.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  * POSSIBILITY OF SUCH DAMAGE.
38  */
39 #ifndef OPJ_T1_H
40 #define OPJ_T1_H
41 
51 
52 /* ----------------------------------------------------------------------- */
53 #define T1_NMSEDEC_BITS 7
54 
55 #define T1_NUMCTXS_ZC 9
56 #define T1_NUMCTXS_SC 5
57 #define T1_NUMCTXS_MAG 3
58 #define T1_NUMCTXS_AGG 1
59 #define T1_NUMCTXS_UNI 1
60 
61 #define T1_CTXNO_ZC 0
62 #define T1_CTXNO_SC (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
63 #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
64 #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
65 #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
66 #define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
67 
68 #define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
69 
70 #define T1_TYPE_MQ 0
71 #define T1_TYPE_RAW 1
73 /* BEGINNING of flags that apply to opj_flag_t */
74 
85 /* SIGMA: significance state (3 cols x 6 rows)
86  * CHI: state for negative sample value (1 col x 6 rows)
87  * MU: state for visited in refinement pass (1 col x 4 rows)
88  * PI: state for visited in significance pass (1 col * 4 rows)
89  */
90 
91 #define T1_SIGMA_0 (1U << 0)
92 #define T1_SIGMA_1 (1U << 1)
93 #define T1_SIGMA_2 (1U << 2)
94 #define T1_SIGMA_3 (1U << 3)
95 #define T1_SIGMA_4 (1U << 4)
96 #define T1_SIGMA_5 (1U << 5)
97 #define T1_SIGMA_6 (1U << 6)
98 #define T1_SIGMA_7 (1U << 7)
99 #define T1_SIGMA_8 (1U << 8)
100 #define T1_SIGMA_9 (1U << 9)
101 #define T1_SIGMA_10 (1U << 10)
102 #define T1_SIGMA_11 (1U << 11)
103 #define T1_SIGMA_12 (1U << 12)
104 #define T1_SIGMA_13 (1U << 13)
105 #define T1_SIGMA_14 (1U << 14)
106 #define T1_SIGMA_15 (1U << 15)
107 #define T1_SIGMA_16 (1U << 16)
108 #define T1_SIGMA_17 (1U << 17)
109 
110 #define T1_CHI_0 (1U << 18)
111 #define T1_CHI_0_I 18
112 #define T1_CHI_1 (1U << 19)
113 #define T1_CHI_1_I 19
114 #define T1_MU_0 (1U << 20)
115 #define T1_PI_0 (1U << 21)
116 #define T1_CHI_2 (1U << 22)
117 #define T1_CHI_2_I 22
118 #define T1_MU_1 (1U << 23)
119 #define T1_PI_1 (1U << 24)
120 #define T1_CHI_3 (1U << 25)
121 #define T1_MU_2 (1U << 26)
122 #define T1_PI_2 (1U << 27)
123 #define T1_CHI_4 (1U << 28)
124 #define T1_MU_3 (1U << 29)
125 #define T1_PI_3 (1U << 30)
126 #define T1_CHI_5 (1U << 31)
127 #define T1_CHI_5_I 31
128 
149 #define T1_SIGMA_NW T1_SIGMA_0
150 #define T1_SIGMA_N T1_SIGMA_1
151 #define T1_SIGMA_NE T1_SIGMA_2
152 #define T1_SIGMA_W T1_SIGMA_3
153 #define T1_SIGMA_THIS T1_SIGMA_4
154 #define T1_SIGMA_E T1_SIGMA_5
155 #define T1_SIGMA_SW T1_SIGMA_6
156 #define T1_SIGMA_S T1_SIGMA_7
157 #define T1_SIGMA_SE T1_SIGMA_8
158 #define T1_SIGMA_NEIGHBOURS (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
159 
160 #define T1_CHI_THIS T1_CHI_1
161 #define T1_CHI_THIS_I T1_CHI_1_I
162 #define T1_MU_THIS T1_MU_0
163 #define T1_PI_THIS T1_PI_0
164 #define T1_CHI_S T1_CHI_2
165 
166 #define T1_LUT_SGN_W (1U << 0)
167 #define T1_LUT_SIG_N (1U << 1)
168 #define T1_LUT_SGN_E (1U << 2)
169 #define T1_LUT_SIG_W (1U << 3)
170 #define T1_LUT_SGN_N (1U << 4)
171 #define T1_LUT_SIG_E (1U << 5)
172 #define T1_LUT_SGN_S (1U << 6)
173 #define T1_LUT_SIG_S (1U << 7)
174 /* END of flags that apply to opj_flag_t */
175 
176 /* ----------------------------------------------------------------------- */
177 
180 
184 typedef struct opj_t1 {
185 
188 
196 
202 
203  /* Thre 3 variables below are only used by the decoder */
204  /* set to TRUE in multithreaded context */
206  /* Temporary buffer to concatenate all chunks of a codebock */
208  /* Maximum size available in cblkdatabuffer */
210 } opj_t1_t;
211 
214 /* ----------------------------------------------------------------------- */
215 
225  opj_tcd_tile_t *tile,
226  opj_tcp_t *tcp,
227  const OPJ_FLOAT64 * mct_norms,
228  OPJ_UINT32 mct_numcomps);
229 
241  volatile OPJ_BOOL* pret,
242  opj_tcd_tilecomp_t* tilec,
243  opj_tccp_t* tccp,
244  opj_event_mgr_t *p_manager,
245  opj_mutex_t* p_manager_mutex,
246  OPJ_BOOL check_pterm);
247 
248 
249 
255 opj_t1_t* opj_t1_create(OPJ_BOOL isEncoder);
256 
262 void opj_t1_destroy(opj_t1_t *p_t1);
263 /* ----------------------------------------------------------------------- */
267 
268 #endif /* OPJ_T1_H */
struct opj_t1 opj_t1_t
Tier-1 coding (coding of code-block coefficients)
OPJ_BYTE * cblkdatabuffer
Definition: t1.h:207
OPJ_BOOL encoder
Definition: t1.h:201
double OPJ_FLOAT64
Definition: openjpeg.h:116
OPJ_UINT32 datasize
Definition: t1.h:199
Message handler object used for.
Definition: event.h:50
OPJ_BOOL mustuse_cblkdatabuffer
Definition: t1.h:205
Tier-1 coding (coding of code-block coefficients)
Definition: t1.h:184
Tile coder/decoder.
Definition: tcd.h:251
int OPJ_BOOL
Definition: openjpeg.h:110
OPJ_BOOL opj_t1_encode_cblks(opj_tcd_t *tcd, opj_tcd_tile_t *tile, opj_tcp_t *tcp, const OPJ_FLOAT64 *mct_norms, OPJ_UINT32 mct_numcomps)
Encode the code-blocks of a tile.
Definition: t1.c:2267
unsigned char OPJ_BYTE
Definition: openjpeg.h:117
Tile-component coding parameters.
Definition: j2k.h:175
int32_t OPJ_INT32
Definition: openjpeg.h:125
opj_flag_t * flags
Flags used by decoder and encoder.
Definition: t1.h:195
OPJ_UINT32 h
Definition: t1.h:198
OPJ_UINT32 w
Definition: t1.h:197
OPJ_UINT32 flagssize
Definition: t1.h:200
void opj_t1_decode_cblks(opj_tcd_t *tcd, volatile OPJ_BOOL *pret, opj_tcd_tilecomp_t *tilec, opj_tccp_t *tccp, opj_event_mgr_t *p_manager, opj_mutex_t *p_manager_mutex, OPJ_BOOL check_pterm)
Decode the code-blocks of a tile.
Definition: t1.c:1799
OPJ_UINT32 cblkdatabuffersize
Definition: t1.h:209
void opj_t1_destroy(opj_t1_t *p_t1)
Destroys a previously created T1 handle.
Definition: t1.c:1547
struct opj_mutex_t opj_mutex_t
Opaque type for a mutex.
Definition: thread.h:52
OPJ_UINT32 opj_flag_t
Flags for 4 consecutive rows of a column.
Definition: t1.h:179
opj_mqc_t mqc
MQC component.
Definition: t1.h:187
uint32_t OPJ_UINT32
Definition: openjpeg.h:126
OPJ_INT32 * data
Definition: t1.h:189
Tile coding parameters : this structure is used to store coding/decoding parameters common to all til...
Definition: j2k.h:241
FIXME DOC.
Definition: tcd.h:228
Tile-component structure.
Definition: tcd.h:189
opj_t1_t * opj_t1_create(OPJ_BOOL isEncoder)
Creates a new Tier 1 handle and initializes the look-up tables of the Tier-1 coder/decoder.
Definition: t1.c:1527
MQ coder.
Definition: mqc.h:74
Definition: query_parser.h:41