00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef OPJ_T1_H
00040 #define OPJ_T1_H
00041
00051
00052
00053 #define T1_NMSEDEC_BITS 7
00054
00055 #define T1_NUMCTXS_ZC 9
00056 #define T1_NUMCTXS_SC 5
00057 #define T1_NUMCTXS_MAG 3
00058 #define T1_NUMCTXS_AGG 1
00059 #define T1_NUMCTXS_UNI 1
00060
00061 #define T1_CTXNO_ZC 0
00062 #define T1_CTXNO_SC (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
00063 #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
00064 #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
00065 #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
00066 #define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
00067
00068 #define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
00069
00070 #define T1_TYPE_MQ 0
00071 #define T1_TYPE_RAW 1
00073
00074
00085
00086
00087
00088
00089
00090
00091 #define T1_SIGMA_0 (1U << 0)
00092 #define T1_SIGMA_1 (1U << 1)
00093 #define T1_SIGMA_2 (1U << 2)
00094 #define T1_SIGMA_3 (1U << 3)
00095 #define T1_SIGMA_4 (1U << 4)
00096 #define T1_SIGMA_5 (1U << 5)
00097 #define T1_SIGMA_6 (1U << 6)
00098 #define T1_SIGMA_7 (1U << 7)
00099 #define T1_SIGMA_8 (1U << 8)
00100 #define T1_SIGMA_9 (1U << 9)
00101 #define T1_SIGMA_10 (1U << 10)
00102 #define T1_SIGMA_11 (1U << 11)
00103 #define T1_SIGMA_12 (1U << 12)
00104 #define T1_SIGMA_13 (1U << 13)
00105 #define T1_SIGMA_14 (1U << 14)
00106 #define T1_SIGMA_15 (1U << 15)
00107 #define T1_SIGMA_16 (1U << 16)
00108 #define T1_SIGMA_17 (1U << 17)
00109
00110 #define T1_CHI_0 (1U << 18)
00111 #define T1_CHI_0_I 18
00112 #define T1_CHI_1 (1U << 19)
00113 #define T1_CHI_1_I 19
00114 #define T1_MU_0 (1U << 20)
00115 #define T1_PI_0 (1U << 21)
00116 #define T1_CHI_2 (1U << 22)
00117 #define T1_CHI_2_I 22
00118 #define T1_MU_1 (1U << 23)
00119 #define T1_PI_1 (1U << 24)
00120 #define T1_CHI_3 (1U << 25)
00121 #define T1_MU_2 (1U << 26)
00122 #define T1_PI_2 (1U << 27)
00123 #define T1_CHI_4 (1U << 28)
00124 #define T1_MU_3 (1U << 29)
00125 #define T1_PI_3 (1U << 30)
00126 #define T1_CHI_5 (1U << 31)
00127 #define T1_CHI_5_I 31
00128
00149 #define T1_SIGMA_NW T1_SIGMA_0
00150 #define T1_SIGMA_N T1_SIGMA_1
00151 #define T1_SIGMA_NE T1_SIGMA_2
00152 #define T1_SIGMA_W T1_SIGMA_3
00153 #define T1_SIGMA_THIS T1_SIGMA_4
00154 #define T1_SIGMA_E T1_SIGMA_5
00155 #define T1_SIGMA_SW T1_SIGMA_6
00156 #define T1_SIGMA_S T1_SIGMA_7
00157 #define T1_SIGMA_SE T1_SIGMA_8
00158 #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)
00159
00160 #define T1_CHI_THIS T1_CHI_1
00161 #define T1_CHI_THIS_I T1_CHI_1_I
00162 #define T1_MU_THIS T1_MU_0
00163 #define T1_PI_THIS T1_PI_0
00164 #define T1_CHI_S T1_CHI_2
00165
00166 #define T1_LUT_SGN_W (1U << 0)
00167 #define T1_LUT_SIG_N (1U << 1)
00168 #define T1_LUT_SGN_E (1U << 2)
00169 #define T1_LUT_SIG_W (1U << 3)
00170 #define T1_LUT_SGN_N (1U << 4)
00171 #define T1_LUT_SIG_E (1U << 5)
00172 #define T1_LUT_SGN_S (1U << 6)
00173 #define T1_LUT_SIG_S (1U << 7)
00174
00175
00176
00177
00179 typedef OPJ_UINT32 opj_flag_t;
00180
00184 typedef struct opj_t1 {
00185
00187 opj_mqc_t mqc;
00188
00189 OPJ_INT32 *data;
00195 opj_flag_t *flags;
00196
00197 OPJ_UINT32 w;
00198 OPJ_UINT32 h;
00199 OPJ_UINT32 datasize;
00200 OPJ_UINT32 flagssize;
00201 OPJ_UINT32 data_stride;
00202 OPJ_BOOL encoder;
00203
00204
00205
00206 OPJ_BOOL mustuse_cblkdatabuffer;
00207
00208 OPJ_BYTE *cblkdatabuffer;
00209
00210 OPJ_UINT32 cblkdatabuffersize;
00211 } opj_t1_t;
00212
00215
00216
00225 OPJ_BOOL opj_t1_encode_cblks(opj_t1_t *t1,
00226 opj_tcd_tile_t *tile,
00227 opj_tcp_t *tcp,
00228 const OPJ_FLOAT64 * mct_norms,
00229 OPJ_UINT32 mct_numcomps);
00230
00241 void opj_t1_decode_cblks(opj_tcd_t* tcd,
00242 volatile OPJ_BOOL* pret,
00243 opj_tcd_tilecomp_t* tilec,
00244 opj_tccp_t* tccp,
00245 opj_event_mgr_t *p_manager,
00246 opj_mutex_t* p_manager_mutex,
00247 OPJ_BOOL check_pterm);
00248
00249
00250
00256 opj_t1_t* opj_t1_create(OPJ_BOOL isEncoder);
00257
00263 void opj_t1_destroy(opj_t1_t *p_t1);
00264
00268
00269 #endif