Go to the documentation of this file.
45 #define T1_NMSEDEC_BITS 7
47 #define T1_SIG_NE 0x0001
48 #define T1_SIG_SE 0x0002
49 #define T1_SIG_SW 0x0004
50 #define T1_SIG_NW 0x0008
51 #define T1_SIG_N 0x0010
52 #define T1_SIG_E 0x0020
53 #define T1_SIG_S 0x0040
54 #define T1_SIG_W 0x0080
55 #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)
56 #define T1_SIG_PRIM (T1_SIG_N|T1_SIG_E|T1_SIG_S|T1_SIG_W)
58 #define T1_SGN_N 0x0100
59 #define T1_SGN_E 0x0200
60 #define T1_SGN_S 0x0400
61 #define T1_SGN_W 0x0800
62 #define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W)
65 #define T1_REFINE 0x2000
66 #define T1_VISIT 0x4000
68 #define T1_NUMCTXS_ZC 9
69 #define T1_NUMCTXS_SC 5
70 #define T1_NUMCTXS_MAG 3
71 #define T1_NUMCTXS_AGG 1
72 #define T1_NUMCTXS_UNI 1
75 #define T1_CTXNO_SC (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
76 #define T1_CTXNO_MAG (T1_CTXNO_SC+T1_NUMCTXS_SC)
77 #define T1_CTXNO_AGG (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
78 #define T1_CTXNO_UNI (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
79 #define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
81 #define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
111 #define MACRO_t1_flags(x,y) t1->flags[((x)*(t1->flags_stride))+(y)]
void t1_encode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp)
Encode the code-blocks of a tile.
Definition: t1.c:1399
double distotile
Definition: tcd.h:156
#define J2K_CCP_CBLKSTY_PTERM
Predictable termination.
Definition: j2k.h:52
int y1
Definition: tcd.h:131
int y0
Definition: tcd.h:94
MQ coder.
Definition: mqc.h:64
int flagssize
Definition: t1.h:107
static void t1_updateflags(flag_t *flagsp, int s, int stride)
Definition: t1.c:313
static INLINE int int_abs(int a)
Definition: int.h:79
#define opj_free(m)
Deallocates or frees a memory block.
Definition: opj_malloc.h:152
static short lut_nmsedec_ref[1<< T1_NMSEDEC_BITS]
Definition: t1_luts.h:106
#define J2K_CCP_CBLKSTY_SEGSYM
Segmentation symbols are used.
Definition: j2k.h:53
FIXME: documentation.
Definition: tcd.h:79
#define opj_malloc(size)
Allocate an uninitialized memory block.
Definition: opj_malloc.h:51
int totalpasses
Definition: tcd.h:88
static INLINE int int_max(int a, int b)
Get the maximum of two integers.
Definition: int.h:57
#define T1_CTXNO_UNI
Definition: t1.h:78
RAW encoding operations.
Definition: raw.h:46
void mqc_init_dec(opj_mqc_t *mqc, unsigned char *bp, int len)
Initialize the decoder.
Definition: mqc.c:511
FIXME: documentation.
Definition: tcd.h:47
#define T1_SIG_W
Context orientation : West direction.
Definition: t1.h:54
void mqc_bypass_init_enc(opj_mqc_t *mqc)
BYPASS mode switch, initialization operation.
Definition: mqc.c:410
int len
Definition: tcd.h:63
int len
Definition: tcd.h:51
int pw
Definition: tcd.h:132
int numbps
Definition: tcd.h:95
#define T1_CTXNO_AGG
Definition: t1.h:77
opj_tcd_pass_t * passes
Definition: tcd.h:82
static void t1_dec_sigpass_raw(opj_t1_t *t1, int bpno, int orient, int cblksty)
Decode significant pass.
Definition: t1.c:479
static void t1_decode_cblk(opj_t1_t *t1, opj_tcd_cblk_dec_t *cblk, int orient, int roishift, int cblksty)
Decode 1 code-block.
Definition: t1.c:1280
int qmfbid
discrete wavelet transform identifier
Definition: j2k.h:146
#define T1_CTXNO_ZC
Definition: t1.h:74
int numbands
Definition: tcd.h:133
opj_t1_t * t1_create(opj_common_ptr cinfo)
Create a new T1 handle and initialize the look-up tables of the Tier-1 coder/decoder.
Definition: t1.c:1370
opj_tcd_band_t bands[3]
Definition: tcd.h:134
#define J2K_CCP_CBLKSTY_LAZY
Selective arithmetic coding bypass.
Definition: j2k.h:48
#define T1_SGN_N
Definition: t1.h:58
void mqc_destroy(opj_mqc_t *mqc)
Destroy a previously created MQC handle.
Definition: mqc.c:363
#define OPJ_ARG_NOT_USED(x)
Definition: openjpeg.h:68
int roishift
Region Of Interest shift.
Definition: j2k.h:154
void mqc_erterm_enc(opj_mqc_t *mqc)
ERTERM mode switch (PTERM)
Definition: mqc.c:487
static void t1_enc_sigpass_step(opj_t1_t *t1, flag_t *flagsp, int *datap, int orient, int bpno, int one, int *nmsedec, char type, int vsc)
Encode significant pass.
Definition: t1.c:337
static void t1_dec_clnpass_step_partial(opj_t1_t *t1, flag_t *flagsp, int *datap, int orient, int oneplushalf)
Decode clean-up pass.
Definition: t1.c:819
opj_mqc_t * mqc
MQC component.
Definition: t1.h:98
void t1_encode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp)
Encode the code-blocks of a tile.
Definition: t1.c:1399
static INLINE void t1_dec_refpass_step_mqc(opj_t1_t *t1, flag_t *flagsp, int *datap, int poshalf, int neghalf)
Definition: t1.c:621
static char lut_spb[256]
Definition: t1_luts.h:57
int rate
Definition: tcd.h:61
static short t1_getnmsedec_ref(int x, int bitpos)
Definition: t1.c:305
static void t1_dec_clnpass_step_vsc(opj_t1_t *t1, flag_t *flagsp, int *datap, int orient, int oneplushalf, int partial, int vsc)
Definition: t1.c:863
static short lut_nmsedec_sig0[1<< T1_NMSEDEC_BITS]
Definition: t1_luts.h:87
int h
Definition: t1.h:105
int * data
Definition: t1.h:102
struct opj_t1 opj_t1_t
Tier-1 coding (coding of code-block coefficients)
#define T1_SIG_E
Context orientation : East direction.
Definition: t1.h:52
static void t1_dec_refpass_mqc_vsc(opj_t1_t *t1, int bpno)
Definition: t1.c:759
int raw_decode(opj_raw_t *raw)
Decode a symbol using raw-decoder.
Definition: raw.c:68
int numpasses
Definition: tcd.h:50
opj_tcd_resolution_t * resolutions
Definition: tcd.h:143
int x0
Definition: tcd.h:141
static void t1_enc_sigpass(opj_t1_t *t1, int bpno, int orient, int *nmsedec, char type, int cblksty)
Encode significant pass.
Definition: t1.c:449
int x1
Definition: tcd.h:141
void raw_destroy(opj_raw_t *raw)
Destroy a previously created RAW handle.
Definition: raw.c:50
static short lut_nmsedec_sig[1<< T1_NMSEDEC_BITS]
Definition: t1_luts.h:68
double dwt_getnorm_real(int level, int orient)
Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT.
Definition: dwt.c:473
void mqc_restart_init_enc(opj_mqc_t *mqc)
RESTART mode switch (TERMALL) reinitialisation.
Definition: mqc.c:475
int w
Definition: t1.h:104
#define opj_aligned_free(m)
Definition: opj_malloc.h:110
static void t1_dec_sigpass_mqc_vsc(opj_t1_t *t1, int bpno, int orient)
Definition: t1.c:547
#define opj_aligned_malloc(size)
Definition: opj_malloc.h:108
Tier-1 coding (coding of code-block coefficients)
Definition: t1.h:93
opj_common_ptr cinfo
codec context
Definition: t1.h:95
static void t1_enc_refpass(opj_t1_t *t1, int bpno, int *nmsedec, char type, int cblksty)
Encode refinement pass.
Definition: t1.c:664
opj_t1_t * t1_create(opj_common_ptr cinfo)
Create a new T1 handle and initialize the look-up tables of the Tier-1 coder/decoder.
Definition: t1.c:1370
int datasize
Definition: t1.h:106
static INLINE void t1_dec_sigpass_step_mqc(opj_t1_t *t1, flag_t *flagsp, int *datap, int orient, int oneplushalf)
Definition: t1.c:400
opj_tcd_cblk_enc_t * enc
Definition: tcd.h:109
int cw
Definition: tcd.h:107
FIXME: documentation.
Definition: tcd.h:105
static char t1_getspb(int f)
Definition: t1.c:293
int y0
Definition: tcd.h:131
opj_mqc_t * mqc_create(void)
Create a new MQC handle.
Definition: mqc.c:355
static char lut_ctxno_sc[256]
Definition: t1_luts.h:38
static void t1_dec_refpass_raw(opj_t1_t *t1, int bpno, int cblksty)
Decode refinement pass.
Definition: t1.c:692
FIXME: documentation.
Definition: tcd.h:60
static void t1_encode_cblk(opj_t1_t *t1, opj_tcd_cblk_enc_t *cblk, int orient, int compno, int level, int qmfbid, double stepsize, int cblksty, int numcomps, int mct, opj_tcd_tile_t *tile)
Encode 1 code-block.
Definition: t1.c:1146
FIXME: documentation.
Definition: tcd.h:130
static char t1_getctxno_sc(int f)
Definition: t1.c:283
void t1_destroy(opj_t1_t *t1)
Destroy a previously created T1 handle.
Definition: t1.c:1388
FIXME: documentation.
Definition: tcd.h:140
int numsegs
Definition: tcd.h:99
void t1_decode_cblks(opj_t1_t *t1, opj_tcd_tilecomp_t *tilec, opj_tccp_t *tccp)
Decode the code-blocks of a tile.
Definition: t1.c:1494
FIXME: documentation.
Definition: tcd.h:119
static void t1_dec_clnpass(opj_t1_t *t1, int bpno, int orient, int cblksty)
Decode clean-up pass.
Definition: t1.c:957
void mqc_reset_enc(opj_mqc_t *mqc)
RESET mode switch.
Definition: mqc.c:452
static INLINE void t1_dec_sigpass_step_mqc_vsc(opj_t1_t *t1, flag_t *flagsp, int *datap, int orient, int oneplushalf, int vsc)
Definition: t1.c:424
double dwt_getnorm(int level, int orient)
Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT.
Definition: dwt.c:401
static INLINE int fix_mul(int a, int b)
Multiply two fixed-precision rational numbers.
Definition: fix.h:56
union opj_tcd_precinct::@0 cblks
static INLINE int int_floorlog2(int a)
Get logarithm of an integer and round downwards.
Definition: int.h:107
static void t1_dec_clnpass_step(opj_t1_t *t1, flag_t *flagsp, int *datap, int orient, int oneplushalf)
Definition: t1.c:839
#define T1_TYPE_MQ
Normal coding using entropy coder.
Definition: t1.h:83
int numresolutions
Definition: tcd.h:142
int mct
multi-component transform identifier
Definition: j2k.h:176
int x0
Definition: tcd.h:83
#define T1_SIG_N
Context orientation : North direction.
Definition: t1.h:51
#define OPJ_TRUE
Definition: openjpeg.h:64
static INLINE void t1_dec_refpass_step_mqc_vsc(opj_t1_t *t1, flag_t *flagsp, int *datap, int poshalf, int neghalf, int vsc)
Definition: t1.c:642
void mqc_segmark_enc(opj_mqc_t *mqc)
SEGMARK mode switch (SEGSYM)
Definition: mqc.c:502
static short lut_nmsedec_ref0[1<< T1_NMSEDEC_BITS]
Definition: t1_luts.h:125
static void t1_dec_refpass_mqc(opj_t1_t *t1, int bpno)
Definition: t1.c:718
int x1
Definition: tcd.h:131
unsigned char * data
Definition: tcd.h:92
int mqc_decode(opj_mqc_t *const mqc)
Decode a symbol.
Definition: mqc.c:562
opj_raw_t * raw
RAW component.
Definition: t1.h:100
int x1
Definition: tcd.h:83
void mqc_setstate(opj_mqc_t *mqc, int ctxno, int msb, int prob)
Set the state of a particular context.
Definition: mqc.c:588
Definition: openjpeg.h:430
static opj_bool allocate_buffers(opj_t1_t *t1, int w, int h)
Definition: t1.c:1108
int y1
Definition: tcd.h:94
double mct_getnorm(int compno)
Get norm of the basis function used for the reversible multi-component transform.
Definition: mct.c:97
short flag_t
Definition: t1.h:88
int x0
Definition: tcd.h:94
#define T1_SGN_S
Definition: t1.h:60
int numbps
Definition: tcd.h:84
#define T1_SIG_S
Context orientation : South direction.
Definition: t1.h:53
static INLINE void t1_dec_sigpass_step_raw(opj_t1_t *t1, flag_t *flagsp, int *datap, int orient, int oneplushalf, int vsc)
Decode significant pass.
Definition: t1.c:376
static char lut_ctxno_zc[1024]
Definition: t1_luts.h:3
static INLINE void t1_dec_refpass_step_raw(opj_t1_t *t1, flag_t *flagsp, int *datap, int poshalf, int neghalf, int vsc)
Decode refinement pass.
Definition: t1.c:600
#define T1_SIG_PRIM
Definition: t1.h:56
void mqc_encode(opj_mqc_t *mqc, int d)
Encode a symbol using the MQ-coder.
Definition: mqc.c:390
#define MACRO_t1_flags(x, y)
Definition: t1.h:111
Tile coding parameters : this structure is used to store coding/decoding parameters common to all til...
Definition: j2k.h:166
opj_tccp_t * tccps
tile-component coding parameters
Definition: j2k.h:198
static void t1_enc_clnpass_step(opj_t1_t *t1, flag_t *flagsp, int *datap, int orient, int bpno, int one, int *nmsedec, int partial, int vsc)
Encode clean-up pass.
Definition: t1.c:784
#define T1_NMSEDEC_FRACBITS
Definition: t1.h:81
#define T1_SIG_OTH
Definition: t1.h:55
double mct_getnorm_real(int compno)
Get norm of the basis function used for the irreversible multi-component transform.
Definition: mct.c:188
#define T1_VISIT
Definition: t1.h:66
int opj_bool
Definition: openjpeg.h:63
unsigned char ** data
Definition: tcd.h:48
int numcomps
Definition: tcd.h:153
#define T1_CTXNO_MAG
Definition: t1.h:76
#define restrict
Definition: opj_includes.h:85
Tile-component coding parameters.
Definition: j2k.h:134
static void t1_enc_clnpass(opj_t1_t *t1, int bpno, int orient, int *nmsedec, int cblksty)
Encode clean-up pass.
Definition: t1.c:893
unsigned char * data
Definition: tcd.h:80
#define T1_SGN_W
Definition: t1.h:61
FIXME: documentation.
Definition: tcd.h:151
#define T1_SIG_SE
Context orientation : South-East direction.
Definition: t1.h:48
int y0
Definition: tcd.h:83
int dataindex
Definition: tcd.h:49
int mqc_numbytes(opj_mqc_t *mqc)
Return the number of bytes written/read since initialisation.
Definition: mqc.c:374
#define J2K_CCP_CBLKSTY_RESET
Reset context probabilities on coding pass boundaries.
Definition: j2k.h:49
int cblksty
code-block coding style
Definition: j2k.h:144
#define T1_SIG
Definition: t1.h:64
static INLINE int t1_getctxno_mag(int f)
Definition: t1.c:287
#define T1_SIG_NE
Context orientation : North-East direction.
Definition: t1.h:47
int x0
Definition: tcd.h:131
#define INLINE
Definition: opj_includes.h:75
int term
Definition: tcd.h:63
#define T1_SIG_SW
Context orientation : South-West direction.
Definition: t1.h:49
#define T1_SGN
Definition: t1.h:62
flag_t * flags
Definition: t1.h:103
int * data
Definition: tcd.h:144
static INLINE char t1_getctxno_zc(int f, int orient)
Definition: t1.c:279
opj_raw_t * raw_create(void)
Create a new RAW handle.
Definition: raw.c:45
opj_tcd_seg_t * segs
Definition: tcd.h:93
void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len)
Initialize the decoder.
Definition: raw.c:60
#define OPJ_FALSE
Definition: openjpeg.h:65
static void t1_dec_sigpass_mqc(opj_t1_t *t1, int bpno, int orient)
Definition: t1.c:505
double distortiondec
Definition: tcd.h:62
void t1_destroy(opj_t1_t *t1)
Destroy a previously created T1 handle.
Definition: t1.c:1388
void mqc_bypass_enc(opj_mqc_t *mqc, int d)
BYPASS mode switch, coding operation.
Definition: mqc.c:418
void t1_decode_cblks(opj_t1_t *t1, opj_tcd_tilecomp_t *tilec, opj_tccp_t *tccp)
Decode the code-blocks of a tile.
Definition: t1.c:1494
#define T1_SGN_E
Definition: t1.h:59
#define J2K_CCP_CBLKSTY_TERMALL
Termination on each coding pass.
Definition: j2k.h:50
#define T1_SIG_NW
Context orientation : North-West direction.
Definition: t1.h:50
opj_tcd_cblk_dec_t * dec
Definition: tcd.h:110
int y1
Definition: tcd.h:83
void mqc_resetstates(opj_mqc_t *mqc)
Reset the states of all the context of the coder/decoder (each context is set to a state where 0 and ...
Definition: mqc.c:581
static short t1_getnmsedec_sig(int x, int bitpos)
Definition: t1.c:297
int flags_stride
Definition: t1.h:108
static void t1_enc_refpass_step(opj_t1_t *t1, flag_t *flagsp, int *datap, int bpno, int one, int *nmsedec, char type, int vsc)
Encode refinement pass.
Definition: t1.c:572
int ch
Definition: tcd.h:107
opj_tcd_tilecomp_t * comps
Definition: tcd.h:154
#define T1_REFINE
Definition: t1.h:65
#define mqc_setcurctx(mqc, ctxno)
Set the current context used for coding/decoding.
Definition: mqc.h:122
static double t1_getwmsedec(int nmsedec, int compno, int level, int orient, int bpno, int qmfbid, double stepsize, int numcomps, int mct)
mod fixed_quality
Definition: t1.c:1083
#define T1_TYPE_RAW
No encoding the information is store under raw format in codestream (mode switch RAW)
Definition: t1.h:84
int x1
Definition: tcd.h:94
#define J2K_CCP_CBLKSTY_VSC
Vertically stripe causal context.
Definition: j2k.h:51
void mqc_init_enc(opj_mqc_t *mqc, unsigned char *bp)
Initialize the encoder.
Definition: mqc.c:378
void mqc_flush(opj_mqc_t *mqc)
Flush the encoder, so that all remaining data is written.
Definition: mqc.c:398
int ph
Definition: tcd.h:132
#define T1_NMSEDEC_BITS
Definition: t1.h:45