OpenJPEG 2.1.0

t1.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  * Copyright (c) 2001-2003, David Janssens
00010  * Copyright (c) 2002-2003, Yannick Verschueren
00011  * Copyright (c) 2003-2007, Francois-Olivier Devaux 
00012  * Copyright (c) 2003-2014, Antonin Descampe
00013  * Copyright (c) 2005, Herve Drolon, FreeImage Team
00014  * All rights reserved.
00015  *
00016  * Redistribution and use in source and binary forms, with or without
00017  * modification, are permitted provided that the following conditions
00018  * are met:
00019  * 1. Redistributions of source code must retain the above copyright
00020  *    notice, this list of conditions and the following disclaimer.
00021  * 2. Redistributions in binary form must reproduce the above copyright
00022  *    notice, this list of conditions and the following disclaimer in the
00023  *    documentation and/or other materials provided with the distribution.
00024  *
00025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
00026  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00028  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00029  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00030  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00031  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00033  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00034  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00035  * POSSIBILITY OF SUCH DAMAGE.
00036  */
00037 #ifndef __T1_H
00038 #define __T1_H
00039 
00049 
00050 /* ----------------------------------------------------------------------- */
00051 #define T1_NMSEDEC_BITS 7
00052 
00053 #define T1_SIG_NE 0x0001        
00054 #define T1_SIG_SE 0x0002        
00055 #define T1_SIG_SW 0x0004        
00056 #define T1_SIG_NW 0x0008        
00057 #define T1_SIG_N 0x0010         
00058 #define T1_SIG_E 0x0020         
00059 #define T1_SIG_S 0x0040         
00060 #define T1_SIG_W 0x0080         
00061 #define T1_SIG_OTH (T1_SIG_N|T1_SIG_NE|T1_SIG_E|T1_SIG_SE|T1_SIG_S|T1_SIG_SW|T1_SIG_W|T1_SIG_NW)
00062 #define T1_SIG_PRIM (T1_SIG_N|T1_SIG_E|T1_SIG_S|T1_SIG_W)
00063 
00064 #define T1_SGN_N 0x0100
00065 #define T1_SGN_E 0x0200
00066 #define T1_SGN_S 0x0400
00067 #define T1_SGN_W 0x0800
00068 #define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W)
00069 
00070 #define T1_SIG 0x1000
00071 #define T1_REFINE 0x2000
00072 #define T1_VISIT 0x4000
00073 
00074 #define T1_NUMCTXS_ZC 9
00075 #define T1_NUMCTXS_SC 5
00076 #define T1_NUMCTXS_MAG 3
00077 #define T1_NUMCTXS_AGG 1
00078 #define T1_NUMCTXS_UNI 1
00079 
00080 #define T1_CTXNO_ZC 0
00081 #define T1_CTXNO_SC (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
00082 #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
00083 #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
00084 #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
00085 #define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
00086 
00087 #define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
00088 
00089 #define T1_TYPE_MQ 0    
00090 #define T1_TYPE_RAW 1   
00092 /* ----------------------------------------------------------------------- */
00093 
00094 typedef OPJ_INT16 opj_flag_t;
00095 
00099 typedef struct opj_t1 {
00100 
00102         opj_mqc_t *mqc;
00104         opj_raw_t *raw;
00105 
00106     OPJ_INT32 *data;
00107         opj_flag_t *flags;
00108         OPJ_UINT32 w;
00109         OPJ_UINT32 h;
00110         OPJ_UINT32 datasize;
00111         OPJ_UINT32 flagssize;
00112         OPJ_UINT32 flags_stride;
00113 } opj_t1_t;
00114 
00115 #define MACRO_t1_flags(x,y) t1->flags[((x)*(t1->flags_stride))+(y)]
00116 
00119 /* ----------------------------------------------------------------------- */
00120 
00128 OPJ_BOOL opj_t1_encode_cblks(   opj_t1_t *t1,
00129                                 opj_tcd_tile_t *tile,
00130                                 opj_tcp_t *tcp,
00131                                 const OPJ_FLOAT64 * mct_norms);
00132 
00139 OPJ_BOOL opj_t1_decode_cblks(   opj_t1_t* t1,
00140                                 opj_tcd_tilecomp_t* tilec,
00141                                 opj_tccp_t* tccp);
00142 
00143 
00144 
00150 opj_t1_t* opj_t1_create(void);
00151 
00157 void opj_t1_destroy(opj_t1_t *p_t1);
00158 /* ----------------------------------------------------------------------- */
00162 
00163 #endif /* __T1_H */